linuxcnc.command().mdi() vs .program_open()

More
1 year 1 week ago #336731 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 to join the conversation.

More
1 year 1 week ago #336740 by Aciera
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 to join the conversation.

More
1 year 1 week ago #336753 by JT
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

Please Log in to join the conversation.

More
1 year 1 week ago #336842 by scsmith1451
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,

Please Log in to join the conversation.

More
1 year 1 week ago #336851 by JT
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

Please Log in to join the conversation.

More
1 year 1 week ago #336878 by andypugh
Why not just write a simple G-code program to probe your 5 points and log the data to file?
Code:
(probeopen proberesults.txt) G53 G0 Z 100 G53 G0 X0 Y0 G38.2 Z0 G53 G0 Z100 G53 G0 X0 Y1000 G38.2 Z0 G53 G0 Z100 G53 G0 X1000 Y1000 G38.2 Z0 G53 G0 Z100 G53 G0 X1000 Y0 G38.2 Z0 G53 G0 Z100 G53 G0 X500 Y500 G38.2 Z0 G53 G0 Z100 (probeclose) M2

Please Log in to join the conversation.

More
1 year 1 week ago #336967 by scsmith1451
My effort is to learn g-code subtleties that are new to me as well as to improve my python coding abilities.  Consequently, I trying to fully automate the measurement process. To that end, I decided that I could combine both Andypugh and JT's approaches to first capture the data with a g-code script then process it with python.

As I studied o-code subroutine examples I attempted to use an internal subroutine with Andypugh's suggestion for a more elegant approach. I've attached my code for your inspection. 

When I load the code into LCNC this warning is raised:

 Near line 40 of ./check_level.ngc "Bad character '>' used". 

I'm lost as it appears that the code follows the examples in the documentation. Please help me understand the issue.

Kind regards

Please Log in to join the conversation.

More
1 year 1 week ago #337032 by rodw
A long time since I played with this. I think you should use [ ] symbols. But check the docs

Please Log in to join the conversation.

More
1 year 1 week ago #337039 by scsmith1451
Thanks rodw.

Turns out that the error was misreporting the line number. When I parameterized the subroutine I inadvertently left a stray > on line 33.

Please Log in to join the conversation.

More
1 year 6 days ago #337138 by scsmith1451
You folks have been awesome helping a retired guy get into LinuxCNC. Thank you for your patience as I get my machine working properly.

One lase issue.

The .ngc probe code is working flawlessly, however, the (probeopen filename.txt) is not opening a file and therefore not capturing the measurements. what might be the problem and how do I resolve it?

Kind regards

Please Log in to join the conversation.

Time to create page: 0.105 seconds
Powered by Kunena Forum