Hod Do I ?

Post anything you want to discuss with others about the software.

Re: Hod Do I ?

Postby beefy » Wed Oct 30, 2019 11:31 am

needleworks wrote:Thanks beefy, that is exactly what I am trying to do. As I have already homed the machine, the Z axis is at the top of it's travel, the only way the Z axis can go after that is down. All my values are correct for going to "Park 1" , the only thing I am trying to achieve is to change the order in which the axis move. For example, where it says in the Macro :-

double parkZ = 100;
double parkX = 0;
double parkY = 0;

can I simply change this order to this, where the Z axis will move last :-

double parkX = 0;
double parkY = 0;
double parkZ = 100;

I'm "almost" sure I had it running this way before but I just can't remember how I done it.


Ha ha, I can tell you've had zippo to do with programming.

No, "double parkZ = 100;" for example is a variable declaration, not a C# command, so the order of variable declaration does not affect anything.

"double" is the type of variable. "parkZ" is the variable name. " = 100" is giving the variable an initial value of 100. The semicolon terminates that C# statement.

Look at the stock standard M200 macro, and then look at this modified one I've just done. I've added a few extra comments to help you understand a little more. Note I've added a 4th variable declaration for "parkZ_finish", and to make things clearer I've renamed "parkZ" to "parkZ_start". Carefully read through the code and you may get some idea of what's happening.

If your Z home position is zero then make "parkZ_start" equal to zero. Basically, if Z is homed, nothing will happen because Z is already at that position, BUT..............imagine if you wanted to use PARK1 and you'd forgot to home. Automatically Z will travel first to zero (if that's your Z home position).

Code: Select all
// Go to Park position 1 macro

double parkZ_start = 100;
double parkX = 0;
double parkY = 0;
double parkZ_finish = 0;

if(!exec.GetLED(56)||!exec.GetLED(57)||!exec.GetLED(58)) // If machine was not homed then it is unsafe to move in machine coordinates, stop here...
{
  MessageBox.Show("The machine was not yet homed, home the machine before run to parking position!");
  exec.Stop();
  return;
}

int originalmodalmode = exec.actualmodal; // remember the modal mode

while(exec.IsMoving()){}


// FIRST MOVE COMMAND - MOVE Z TO "parkZ" position
exec.Code("G00 G53 Z"+ parkZ_start); // Move Z up first to park1 Z position
while(exec.IsMoving()){}


// SECOND MOVE COMMAND - MOVE XY TO "parkX" and "parkY" co-ordinates
exec.Code("G00 G53 X" + parkX +" Y" + parkY); // Move to XY park1 position
while(exec.IsMoving()){}


// THIRD MOVE COMMAND - MOVE Z TO FINAL POSITION
exec.Code("G00 G53 Z"+ parkZ_finish); // Move Z position desired after XY moves
while(exec.IsMoving()){}

exec.Code("G" + originalmodalmode); // Set system back to the original distance mode


If you like the thought of having the power to change stuff like this (took me just a few minutes to modify that macro), then I recommend learning a bit of C programming. Once you get the basics of that, you can move onto C# but C alone will give you a lot of understanding of what's happening in macros. Seriously it puts a real evil grin on your face when you can do that stuff.
Last edited by beefy on Wed Oct 30, 2019 11:43 am, edited 2 times in total.
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Hod Do I ?

Postby needleworks » Wed Oct 30, 2019 11:40 am

Ha ha, I can tell you've had zippo to do with programming.


No experience whatsoever mate :? I just managed to do a little in Mach3 but even that was sketchy to say the least.

Many thanks for your assistance though mate, much appreciated indeed.
needleworks
 
Posts: 39
Joined: Mon Jan 02, 2017 9:03 am

Re: Hod Do I ?

Postby needleworks » Fri Nov 01, 2019 8:33 am

Big Thanks to beefy for the help, I got a chance yesterday to use his modified macro and after adding my values I just clicked on "Park 1" and it done "exactly" what I wanted it to do :D :D :D

Once again mate, big thanks to you.
needleworks
 
Posts: 39
Joined: Mon Jan 02, 2017 9:03 am

Re: Hod Do I ?

Postby beefy » Fri Nov 01, 2019 10:54 am

Ha ha, happy to see you happy.

Would I be wrong in guessing you are an Aussie ??

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Hod Do I ?

Postby needleworks » Fri Nov 01, 2019 11:47 am

beefy wrote:Ha ha, happy to see you happy.

Would I be wrong in guessing you are an Aussie ??

Keith

Scotiish I'm afraid :)
needleworks
 
Posts: 39
Joined: Mon Jan 02, 2017 9:03 am

Re: Hod Do I ?

Postby beefy » Fri Nov 01, 2019 10:30 pm

I'm originally from Newcastle area.

I worked with you guys off Aberdeen. Yous would say that because I'm not too far from the Scottish border, I'm half OK. I'd be describes as a Scotsman with his head bashed in :lol:
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Hod Do I ?

Postby doncraig » Tue Jan 14, 2020 12:12 pm

Sorry to raise this thread again but I am having a deal of trouble with the P1 and P2 buttons. I have loaded the macro that beefy posted and the machine still does what it wants.
I have a Stepcraft 420 V1 UCCNC and UC100 controller. I am very new to all this and need a lot of help.
Whatever I put into the macro the Z axis lowers until it hits the base, I have to hit the Estop to prevent it.
I feel very frustrated that when I try a fix that seems to work for someone it never seems to work for me.
Please help.
Don W
doncraig
 
Posts: 43
Joined: Tue Jan 14, 2020 11:56 am

Re: Hod Do I ?

Postby doncraig » Tue Jan 14, 2020 7:36 pm

Hi a newbie here needing some info.
I have tried to use the macro that beefy posted but when I press the P1 (or P2) the Z axis just lowers until it jams on the base. Where have I gone wrong ??
Any help please.
Don W
doncraig
 
Posts: 43
Joined: Tue Jan 14, 2020 11:56 am

Re: Hod Do I ?

Postby doncraig » Fri Jan 24, 2020 7:56 pm

I received a fix from Rory. Thanks again.
Don W
doncraig
 
Posts: 43
Joined: Tue Jan 14, 2020 11:56 am

Re: Hod Do I ?

Postby albert2NB » Tue Mar 03, 2020 1:48 pm

Sorry to raise this thread again but I am having a deal of trouble with the P1 and P2 buttons. I have loaded the macro that beefy posted and the machine still does what it wants.
I have a Stepcraft 420 V1 UCCNC and UC100 controller. I am very new to all this and need a lot of help.
Whatever I put into the macro the Z axis lowers until it hits the base, I have to hit the Estop to prevent it.
I feel very frustrated that when I try a fix that seems to work for someone it never seems to work for me.
Please help.


I'm facing the same issues right now. Did you fix it somehow?
albert2NB
 
Posts: 3
Joined: Tue Mar 03, 2020 1:43 pm

Previous

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 12 guests