Categories

 

G-Wizard Calculator:
Fast, Easy, Reliable Feeds and Speeds

Subscribe

Join 50,000+ CNC'ers!  Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:

  • Our Big List of over 200 CNC Tips and Techniques
  • Our Free GCode Programming Basics Course
  • And more!

 

GCode is Complicated
G-Wizard Makes it Easy

LinuxCNC Subroutines Question

0
0

I’m not sure how to add a subroutine or loops.

In the GWizard Editor, the “O” code shows it as a subroutine but when using “sub”, “endsub” ,”while”, etc. I just get a bunch of errors.

This code works fine in Axis:

o<circle> sub
  F25
  (getting the radius from the diameter value)
  (that was passed by dividing it in 1/2)
  (then storing it in a named parameter)
  #<radius> = [#3 / 2]
  G0 X[#1 - #<radius>] Y[#2]
  (debug, X = #1 Y = #2 radius = #<radius>)
  G2 X[#1 - #<radius>] Y[#2] I[#<radius>] J0
  (msg, some useful code here)
o<circle> endsub

(X center, Y center, Circle Diameter)
o<circle> call [1.5] [2.0] [3]
G0 X0 Y0
M2
  • You must to post comments
0
0

Kerry, at the moment GWE only handles subroutine and control structure syntaxes that are very similar to Fanuc Macro B.  LinuxCNC is quite different and so there’s a fair amount of work involved to set up for it.  I have it on my ToDo list, but it’ll be a little while before I get to it as some other things are higher priority.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website
Show us your humanity*

 

Do you want to be a better CNC'er?

Get Better Tool Life, Surface Finish, and Material Removal Rates.

 

Start Now, It's Free!

Home

Software

  GW Calculator

  GW Editor

  Gearotic

  Conversational

  Deals and Steals

CNC Blog

  Software

  Techniques

  Beginner

  Cool

  Projects

 

Cookbooks

     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     DIY CNC Cookbook

     CNC Dictionary

CNC Projects

Resources

     Machinist's Search

     Videos

     Online Groups

     Individuals

     Reference Data

     Books

     CNC Dictionary

     Suppliers

     Tool Brands

Workshop

     Hall of Fame

     Organization: Soon!

 

About

     Customers

     Partners

     Our History

     Privacy Policy

 
All material © 2016, CNCCookbook, Inc.