How to make M1** execute Gcode

More
4 years 2 months ago - 4 years 2 months ago #248927 by rodw
Replied by rodw on topic How to make M1** execute Gcode
I have not played with it at all but Python 3.10 which is shipped with Debian Bookworm where Linuxcnc can be installed using:
sudo apt install linuxcnc-uspace
Now includes a case statement:

Code:
http_code = "418" match http_code: case "200": print("OK") do_something_good() case "404": print("Not Found") do_something_bad() case "418": print("I'm a teapot") make_coffee() case _: print("Code not found")
Ref:  towardsdatascience.com/switch-case-state...-python-d0caf7b2bfd3

Its enought to make me want to adopt Bookworm as my new best friend.
Last edit: 4 years 2 months ago by rodw.
The following user(s) said Thank You: my1987toyota

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #249004 by tjtr33
Replied by tjtr33 on topic How to make M1** execute Gcode
Hi,
I dont knopw if this will help
but I use M1xx to move
Theres a comp i use
and it changes modes from auto to Pause
and the motion destination is set by a seperate Mcode
My effort is for EDM
Yours is PickAnPlace
But the use of MoveWhilePaused is similar
Mine uses a single axis but can be modified
Yours would like have motion with some waypoints
that is, move UPtoClearHeight then XYtoPartWanted then DownToGrabPart then XYtoOverDest then DownToPartDestHeight
All this could be done using machine coordinates

This idea does NOT use Gcode, just destination positions
This code does NOT use PID Accell/Decell
This idea ends at same position where it began
That allows the mode reversal back to Auto without any jerk.
I attach the comp code and the hal wiring as png's
hth tomp

edit 07aug2022
in python script use
import sys, subprocess

then build your command string
  like  cmdstr = "halcmd setp testEtab.0.mypin"
and add the value to be set
  like cmdstr = cmdstr + str(myval)
then have the system exec the cmdstr
  like
    subprocess.call(cmdstr, shell=True)

loop that recipe thru all the pins to be set

hth tomp

watch in action


  subprocess.call(strg5, shell=True)
...
 
Attachments:
Last edit: 4 years 2 months ago by tjtr33. Reason: example code & video link added
The following user(s) said Thank You: my1987toyota

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago #249043 by Todd Zuercher
Replied by Todd Zuercher on topic How to make M1** execute Gcode
Another option might be to an O-sub program call instead of an M1xx code.
The following user(s) said Thank You: my1987toyota

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago #249567 by my1987toyota
Replied by my1987toyota on topic How to make M1** execute Gcode
 So far my end result became switching to a M201 code using python see the link if you want to see how it works.
[url] forum.linuxcnc.org/pnp/46568-using-m201-...nd-using-it-s-values [/url]
 

Please Log in or Create an account to join the conversation.

Time to create page: 0.151 seconds
Powered by Kunena Forum