584,808 active members*
5,286 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2018
    Posts
    12

    Arithmetic expression is gcode?

    Can I use arithmetic expressions in gcode for CNCUSB?

    For example: G1 [Z]+0.1

    I am thinking about this as a way to position my laser cutter while still retaining the ability the adjust Z height. This would allow me to engrave along a curved surface while maintaining a consistent depth of cut. Is there a better way to do this?

  2. #2
    Join Date
    Nov 2012
    Posts
    1267

    Re: Arithmetic expression is gcode?

    One way to engrave a non-flat part is to probe the surface and adjust the G-code for the height variations. A program called AutoLeveller does just that (and does it quite well). Do you have a way to attach a probe to your machine?

  3. #3
    Join Date
    Mar 2017
    Posts
    1295

    Re: Arithmetic expression is gcode?

    TNG has very powerful arithmetic that you can use in g-code. However I don't understand how this will help you in your case.
    You can use Warp feature to engrave curved surfaces. You don't need AutoLeveller if you use Warp.

  4. #4
    Join Date
    Aug 2018
    Posts
    12

    Re: Arithmetic expression is gcode?

    I apologize for not being clearer. I am thinking specifically about engraving on non-planar surfaces as part of the creation process. Example: I made a loose change dish for my son, and I wanted to engrave scripture in the bottom as just another toolpath within a single project. Since the g-code already contains the contour information, It seems (to my simple mind) like it would be more straightforward to use mathematical expressions to keep the laser head 10 mm above the workpiece surface as the head moves along. But maybe I'm approaching it wrong...

  5. #5
    Join Date
    Nov 2012
    Posts
    1267

    Re: Arithmetic expression is gcode?

    I'm afraid what are you planning to do is way beyond "arithmetics in G-code". Imagine you are engraving a straight line across your dish - the Z would have to change constantlty as a (non-linear) function of X and Y. This math needs to be done either on the controller level (this is what the Warp feature does, I presume), or in a 3D CAM program, or in a program like Autoleveller.

  6. #6
    Join Date
    Mar 2017
    Posts
    1295

    Re: Arithmetic expression is gcode?

    Please send me dish and scripture g-code.
    I'll check if something can be one.

  7. #7
    Join Date
    Aug 2018
    Posts
    12

    Re: Arithmetic expression is gcode?

    Here is the file. I completed the initial project before I have a laser, so I used a small-diameter bit to engrave the scripture. Now that I have a laser, I would like to use it for engravings since it has a significantly higher resolution.

    Thank you for you trouble!
    Attached Files Attached Files

  8. #8
    Join Date
    Aug 2018
    Posts
    12

    Re: Arithmetic expression is gcode?

    I just realized the first file I uploaded was the dish and engraving as a single file. So here they are as separate files (in a single zip):

  9. #9
    Join Date
    Aug 2018
    Posts
    12

    Re: Arithmetic expression is gcode?

    I am embarrassed at how difficult I was making this. After some more digging, I realized I could use a combination of G49 and G42 to accomplish exactly what I wanted to do. Thanks to all who used some of their limited time on my (really simple) problem...

Similar Threads

  1. Calling a macro in an expression
    By 01isnot.01 in forum G-Code Programing
    Replies: 4
    Last Post: 01-14-2013, 08:43 AM
  2. Illegal Expression in line
    By hartan in forum Fadal
    Replies: 9
    Last Post: 02-19-2012, 02:02 PM
  3. Arithmetic Rounding Operation on a Bridgeport with DX-32
    By arauchfuss in forum Bridgeport / Hardinge Mills
    Replies: 0
    Last Post: 01-11-2010, 04:09 PM
  4. Mazak Expression
    By iNk in forum Mazak, Mitsubishi, Mazatrol
    Replies: 1
    Last Post: 01-17-2006, 05:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •