Welcome to Our Community

Unlock hidden features. Sign Up for Free Today!

UGS Return to Zero

Discussion in 'Control Software' started by Steve Fox, May 24, 2016.

  1. Steve Fox

    Steve Fox Veteran
    Builder

    Joined:
    Feb 22, 2015
    Messages:
    122
    Likes Received:
    16
    Does anybody know how to set return to zero without it going to Z zero before X and Y go to zero?

    What happens is, wherever the machine is, it first moves the Z axis to zero and then moves X and Y.
    If I have Z set to the top of the material, it drags the bit.
    In GRBL, it's possible to set which axis moves first, so during a HOME for instance, you can set X and Y to move before Z.

    I would like to do the same in UGS. As a workaround, I set the Z zero to .05" above the surface and change the cutting depth to compensate.

    Steve Fox
     
  2. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2013
    Messages:
    521
    Likes Received:
    250
    lol, on some advanced machines, like Haas, there are advanced Gcodes for this sort of thing.
    for GRBL, you just have to send it the correct Gcodes, so somehow we need to convince UGS to do it
    OR
    we need to put the right stuff in our post-processor the makes our Gcode.

    Let me deal with what I know well, SketchUcam.
    Normal operation for Sketchucam is tohave the top of the material as Z-zero
    you also set a 'safe height' value in the parameters, and all Z motion that is not cutting will happen at that safe height.
    So if you have vacuum hold down and no clamps, this can be 1mm above the material (if you dare), 5 or 10mm is more common.
    If you are using clamps, then this safe height should be set to clear the highest point on the clamps, ensuring that Z will always retract far enough to miss the clamps during rapids.

    great so far, but what about the end of the job?
    The default is to return to X0 Y0 Zsafeheight, like this
    Code:
    G90 G21 G49  G17
    M3 S30000
    G00 Z5.000         ; safe height
    G00 X55.657 Y50.763
    G00 Z0.500         ; rapid to near the surface
    G01 Z-6.300 F1000   ; cut down into the material
    G01 X174.057 F2000
    G01 Y139.463
    G01 X55.657
    G01 Y50.763
    G00 Z5.000       ; rapid up to safe height
    G00 X0 Y0 (home)   ; return to zero, safely
    
    Let us now consider some options we can use for the ed of the job.
    If you are using a Phlatprinter, the default will make the foam stick out the BACK of the machine
    If you set Use_Outfeed to true in the Feature Options, the foam will feed 3/4 of the safe X size out the front of the machine at the end of the job.
    Code:
    G00 Z5.000
    (Outfeed)
    G00 X150.000 Y0.000
    
    That is not useful on an OX type machine....
    So, let us put values in for
    • Use_Home_Height/Default_Home_Height
    • Use_End_Position/End PositionX/End Position Y
    Now the ending for the file will put Z at the given home height, and X,Y at the given values. I would use this for moving the gantry
    back, away from the material, so I can get my parts out easily.
    There is one snag with this in that such movement will be limited by the current safe area.
    Here I have set the end position to 300,300 and 32mm high, but my safe area is 200,200, so we get working code with warnings in it.
    Code:
    cut cut cut....
    G00 Z5.000
    (EndPosition)
    (Warning move x=300.0mm GT max of 200.0mm)
    (Warning move Y=300.0mm GT max of 200.0mm)
    G00 X200.000 Y200.000 Z32.000
    
    This is ok though, the bit will move to 32mm above the stock at the far right corner, out of our way, just as we wanted.
    To move it further away, either change the safearea, or be prepared to do some manual editing to something like this
    Code:
    G00 Z5.000
    (edited EndPosition)
    G53 G00 X400.000 Y500.000 Z0.000
    
    now the machine moves in machine co-ordinates (G53), ignoring your current X0Y0 setting, so you have to be sure you have
    the correct numbers in there. GRBL likes to find home switches at far right of the cutting area, so that is machine 0,0,0 so be very careful with these numbers.

    so, back to UGS, let me fire it up and see..... (they call me a geek cos I have an Arduino with GRBL in my office so I can work with it directly without having to forget about it until I get home)
    on the Machine Control tab, when you hit the 'return to zero' button it sends the machine to the machine co-ordinates set for G28, normally 0,0, actually outputting the Gcode
    Code:
    G21 G90 G0 Z0.0
    G90 G28 X0 Y0
    
    effectively sending Z to 0
    and X and Y to machine 0,0 AFTER Z has moved.
    This is not what we want, as you pointed out.

    so, UGS is open source, and you can grab all the code and go and find the button action for 'return to zero' and change the code, recompile, reinstall etc etc. can be done, Java is not that hard to deal with.
    OR
    you can use the 'macros' tab and set up a macro to do what you want.....
    Code:
    G90; G53 Z0; G53 X0 Y0
    
    will send it to machine 0,0,0, moving Z up first (machine Z zero should be top of Z travel)
    or we can use the g28 position and machine zero
    Code:
    G90; G53 Z0; G28 X0 Y0
    
    or some position that suites your setup, you will need to figure out the correct numbers, example:
    Code:
    G90; G0 Z100; G0 X200 Y400
    
    glossary:
    • G90 - changes movement mode to absolute, just in case your last program used relative
    • G53 forces use of machine position, otherwise all movements will use 'work position', only lasts for the current line
    • Machine position or 'machine co-ordinates' : where the machine thinks home is
    • Work position : where you used 'reset X axis' 'reset Y axis' etc to tell the machine where 0,0,0 on the stock is. By default this sets the G54 system unless you change it to G55 to G59
     
    snokid likes this.
  3. Steve Fox

    Steve Fox Veteran
    Builder

    Joined:
    Feb 22, 2015
    Messages:
    122
    Likes Received:
    16
    David,
    I don't think that modifying the JAVA code is an option right now. Since they are modifying the code daily, it would just change back after the next download.
    I guess I'll use the Macro option.
    I did go to GitHub and check the comments. Someone submitted a request two weeks ago to change the homing order, so I added a comment to it suggesting the same thing. It says the program is currently under heavy development, so maybe it will get fixed soon.

    Again, thanks for your help,
    Steve Fox
     
    David the swarfer likes this.

Share This Page

  • About Us

    The OpenBuilds Team is dedicated helping you to Dream it - Build it - Share it! Collaborate on our forums and be sure to visit the Part Store for all your Building needs!
  • Like us on Facebook

  • Support Open Source FairShare Program!

    OpenBuilds FairShare Give Back Program provide resources to Open Source projects, developers and schools around the world. Invest in your future by helping others develop theirs!

    Donate to FairShare!