Basic macro questions
- thet
- Offline
- New Member
- Posts: 2
- Thank you received: 0
I have some basic questions on macro usage in linuxcnc.
Is it possible to execute gcode within self defined macros (e.g. M101)? All examples I found searching the web are executing hal_cmd or other bash code. But no example showing how to let's say move the cnc mill in a rectangle shape.
I found out, that I could do such using python and import linuxcnc module and execute a mdi command. But that does only work as a single G-code line in MDI mode and not when I use that M-code within a ngc file.
Can you give me a hint how to use macros properly?
Or maybe macros aren't the best way to do that?
Ubuntu 10 LTS version
with axis 2.5
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
JT
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
- Posts: 2075
- Thank you received: 406
For details see the corresponding WIKI page.
Norbert
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
You can add macros to gmoccapy, similar to touchy's way.
A macro is nothing else than a ngc-file. You are able to execute complete CNC programs in MDI mode, by just pushing one button.
To do so, you have to add a section like so:
[MACROS]
MACRO = i_am_lost
JT
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
- Posts: 25
- Thank you received: 761
But no example showing how to let's say move the cnc mill in a rectangle shape.
Make a file called rect.ngc which contains something like
o<rect> sub
GOO X0 Y0 Z2
GO0 Z0.1
G01 Z-0.1
GO1 X90 Y90
G01 X180 Y0
G01 X90 Y-90
G01 X0 YO
G00 Z2
o<rect> endsub
Then call it in your code with
o<rect> call
regards
Please Log in or Create an account to join the conversation.
- thet
- Offline
- New Member
- Posts: 2
- Thank you received: 0
The subroutine solution (ngc o-code) worked for me.
... for now
Now I will dig a little bit deeper in python based subroutines (found some python code that looked like subs).
regards
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
- Posts: 2075
- Thank you received: 406
you are right, but you can run a complete subroutine in gmoccapy or touchy by just pressing one button.
I thought, that is what he weant's.
And I have to to also some advertising for my GUI
Norbert
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
JT
Please Log in or Create an account to join the conversation.