linuxcnc.command().mdi() vs .program_open()
- scsmith1451
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 55
- Thank you received: 2
19 Oct 2025 23:17 #336731
by scsmith1451
linuxcnc.command().mdi() vs .program_open() was created by scsmith1451
Can anyone tell me the difference(s) between calling an ngc routine with .mdi("o<myfunction> call") and .program_open("myfunction.ngc")?
Please Log in or Create an account to join the conversation.
- Aciera
-
- Offline
- Administrator
-
Less
More
- Posts: 4536
- Thank you received: 2017
20 Oct 2025 10:31 #336740
by Aciera
Replied by Aciera on topic linuxcnc.command().mdi() vs .program_open()
A file containing a subroutine callable with .mdi("o<myfunction> call") is different from a program file that can be opened using .program_open("myfunction.ngc")
Please Log in or Create an account to join the conversation.
- JT
-
- Away
- Administrator
-
Less
More
- Posts: 1029
- Thank you received: 530
20 Oct 2025 16:14 #336753
by JT
Replied by JT on topic linuxcnc.command().mdi() vs .program_open()
mdi(string) send an MDI command. Maximum 254 chars
MDI executes the command
program_open(string) open an NGC file
Open loads a file into memory but does not run the file.
JT
MDI executes the command
program_open(string) open an NGC file
Open loads a file into memory but does not run the file.
JT
The following user(s) said Thank You: scsmith1451
Please Log in or Create an account to join the conversation.
- scsmith1451
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 55
- Thank you received: 2
21 Oct 2025 17:50 #336842
by scsmith1451
Replied by scsmith1451 on topic linuxcnc.command().mdi() vs .program_open()
Follow-on:
I'm working on a python program to check the levelness of my table.
I have several o<word> functions that are currently attached to buttons on the gmoccapy vcp, one to set zero_z, one to make the measurement and one to reset the spindle back to zero_z preparatory to the next measurement. All work as expected.
The python program is an attempt to automate the process measuring the four corners and the center of the table, then record the values into a spreadsheet. The hope is that overtime I can create run charts for each point to evaluate accuracy and precision.
Currently, the application moves to the Z height and sets zero_z calling the first .ngc function as expected. Next it moves the spindle to the first corner and calls the measurement.ngc. The spindle is lowered to the touch plate, but fails to move up and back down for the final measurement. It appears as though the function is failing to execute all of the commands before returning to the application complaining that the spindle failed to reach the touch plate.
I'm wondering if calling an o<word> function is limited to executing just one command when called by c.mdi("o<word>")?
Perhaps o<word> commands need to be processed with c.program_open. However, your previous response indicates that the code would be loaded but, not executed. 1) How do I get the file to execute after opening it, 2) Will loading a program preempt the execution of the running python program?
Any hints to get around this SNAFU?
Regards,
I'm working on a python program to check the levelness of my table.
I have several o<word> functions that are currently attached to buttons on the gmoccapy vcp, one to set zero_z, one to make the measurement and one to reset the spindle back to zero_z preparatory to the next measurement. All work as expected.
The python program is an attempt to automate the process measuring the four corners and the center of the table, then record the values into a spreadsheet. The hope is that overtime I can create run charts for each point to evaluate accuracy and precision.
Currently, the application moves to the Z height and sets zero_z calling the first .ngc function as expected. Next it moves the spindle to the first corner and calls the measurement.ngc. The spindle is lowered to the touch plate, but fails to move up and back down for the final measurement. It appears as though the function is failing to execute all of the commands before returning to the application complaining that the spindle failed to reach the touch plate.
I'm wondering if calling an o<word> function is limited to executing just one command when called by c.mdi("o<word>")?
Perhaps o<word> commands need to be processed with c.program_open. However, your previous response indicates that the code would be loaded but, not executed. 1) How do I get the file to execute after opening it, 2) Will loading a program preempt the execution of the running python program?
Any hints to get around this SNAFU?
Regards,
Please Log in or Create an account to join the conversation.
- JT
-
- Away
- Administrator
-
Less
More
- Posts: 1029
- Thank you received: 530
21 Oct 2025 20:47 #336851
by JT
Replied by JT on topic linuxcnc.command().mdi() vs .program_open()
auto(int[, int]) run, step, pause or resume a program.
This is how I open then run a program in Flex GUI
github.com/jethornton/flexgui/blob/maste...exgui/actions.py#L13
github.com/jethornton/flexgui/blob/maste...xgui/actions.py#L296
assuming you're using a probe you can store the probe results in a file.
JT
This is how I open then run a program in Flex GUI
github.com/jethornton/flexgui/blob/maste...exgui/actions.py#L13
github.com/jethornton/flexgui/blob/maste...xgui/actions.py#L296
assuming you're using a probe you can store the probe results in a file.
JT
Please Log in or Create an account to join the conversation.
Time to create page: 0.078 seconds