QtPlasmaC Qtvcp Python Traceback on Run From Line after M67

More
20 Dec 2022 01:59 - 20 Dec 2022 02:02 #259921 by caretech
Issue: "Run From Line" works fine unless trying to run from a line AFTER a g-code line that looks like this:

(slow down to 60% for a small hole)
m67 e3 q60.0


LinuxCNC 2.10.0~pre0
Running on MX Linux 21
Using qtplasmac
Debs built from code pulled roughly 2 weeks ago; I don't have the exact Git rev number handy.
Gcode generated by Sheetcam TNG Development 7.1.28 (I see 7.1.29 is now available)

The full traceback:
Traceback (most recent call last):
    File "/usr/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py",
line 1714, in run_clicked
    data = RFL.run_from_line_get(self.lastLoadedProgram,
self.startLine)
    File "/usr/lib/python3/dist-packages/plasmac/run_from_line.py", line
158, in run_from_line_get
    pc = int(codes['a3'].split('m67e3q')[1])
ValueError: invalid literal for int() with base 10: '60.0'


Sometimes typing something out helps you to see the obvious that you missed while looking at it the first time. Seems to me the complaint is that an int is expected, but a float (60.0) is received? Is this a Sheetcam post processor issue, or something that could be tweaked in LinuxCNC code to accept ints or floats? Perhaps I'm way off base here. I dabble in python but sure don't write code every day or anything.

I'm not in my shop now or I would experiment with removing the .0 and see if I can Run from Line successfully then...
Last edit: 20 Dec 2022 02:02 by caretech.

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

More
20 Dec 2022 03:30 #259924 by caretech
So I went out to my shop and experimented some more. If I'd not be so rusty with coding I'd have noticed the quotes around '60.0' meaning it's a string... anyhow, so I decided to modify the code to first convert the string to a float, then convert the float to int, and now my Run From Line works as expected in the file that was giving me problems! The (very slightly) modified line is below:
# Line 158 of /usr/lib/python3/dist-packages/plasmac/run_from_line.py
    pc = int(float(codes['a3'].split('m67e3q')[1]))

I'm not experienced enough to know if this is an acceptable fix or if it's a cringeworthy hack.

An interesting observation I made also (probably no news to qtplasmac gurus) is that nowhere in my original gcode file is a line found containing "m67 e3 q60.0". It appears that QtPlasmac runs some logic that replaces certain lines with directions of its own when a file is loaded. The closest I can find in the actual file output from Sheetcam is the following:
 M67 E3 Q65

And from that, the file loading process in qtplasmac creates the offending line, m67 e3 q60.0

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

More
20 Dec 2022 04:05 #259930 by phillc54
Thanks for finding this bug.
A float is valid for an analog pin so the int is incorrect.
linuxcnc.org/docs/devel/html/man/man9/mo...9.html#MOTION%20PINS

The following concerns me though, is it actually changing the value?

The closest I can find in the actual file output from Sheetcam is the following:

M67 E3 Q65

And from that, the file loading process in qtplasmac creates the offending line, m67 e3 q60.0


There is a filter program named qtplasmac_gcode that the gcode file is run through when loaded.

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

More
20 Dec 2022 11:50 #259948 by snowgoer540
I made a quick program to test this out, and neither the original load nor the Run From Line load change M67E3Q65 in any way except it makes it all lowercase... m67e3q65.

Can you post the G-Code file you are working with?  And also, can you tell us what line you are attempting to RFL on, etc?  That would probably help narrow down what is going on (other than the string to int conversion). :)

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

More
20 Dec 2022 12:27 #259951 by caretech
Thanks for the responses, and sure, I will attach the file that gave me trouble.

At Line 274 of this file, you will see M67 E3 Q65. But a view of the code in QtPlasmac looks different, the line numbers don't match and there's the line with the 60.0 float described above. In this picture you'll observe the "m67e3q65" line at 278, and line 279 isn't found in the gcode file. Trying Run From Line for any line greater than 279 resulted in the Python traceback.



Gcode file attached in the exact form I ran it, below.

Attachment not found



PS. The qtplasmac version is visible in the picture, v1.233.249
Attachments:

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

More
20 Dec 2022 12:29 #259952 by caretech
Trying again with the ngc file...

 

File Attachment:

File Name: Driftwood1...2-20.ngc
File Size:144 KB


 
Attachments:

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

More
20 Dec 2022 14:54 - 20 Dec 2022 14:55 #259958 by snowgoer540
The extra lines are because at line 14 you have:
#<holes>      = 2 


Which turns the automatic hole processing on.  

linuxcnc.org/docs/devel/html/plasma/qtpl...html#qt_hole-cutting

The string to int is a bug, thank you for reporting it :) 
Last edit: 20 Dec 2022 14:55 by snowgoer540.
The following user(s) said Thank You: caretech

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

More
20 Dec 2022 15:41 #259961 by snowgoer540
A fix has been pushed for the string to float conversion.  As soon as the buildbot does its thing, you should be good to go.
The following user(s) said Thank You: caretech

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

More
20 Dec 2022 15:54 - 20 Dec 2022 15:59 #259963 by caretech
Thanks, Greg! I see your commit and can easily edit the code on my machine to match. (I'll probably do a git pull on my build VM and build some new debs to take out to my machine too so I have all the latest fixes and goodies; who can resist?)

Back to the topic of hole cutting, do I have a situation where that is being doubly processed? In other words, since Sheetcam is writing the % of slowdown into the gcode (m67e3q65) in addition to adding the #<holes> = 2 line, is qtplasmac told twice to perform hole cutting rules? Not sure if I am making sense. In other words, a situation where qtplasmac is told to figure out where the little holes are by itself and apply hole cutting rules automatically, but on top of that there are feed reduction directives manually written into the gcode by the post processor for each small hole...

Maybe none of this matters and qtplasmac will replace / over-ride sheetcam's m67 lines. Just wondering.

Joel
Last edit: 20 Dec 2022 15:59 by caretech. Reason: few small readability tweaks

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

More
20 Dec 2022 16:06 #259964 by snowgoer540
No problem!  You could also just set your machine up as a run in place build, and then you only have to do git pull and make in the src directory to get the new goodies, no need to build the debs, etc.  But to each their own :)

It seems that way to me.  I don't use the stock sheetcam post processor, in favor of the one Phill wrote years ago (not broken, so I havent fixed it).  I dont know what setting in the sheetcam post/cut parameters makes it output the automatic hole stuff.  

But it does seem like you are using cut rules in addition to whatever setting turns on the #<holes> output on the post.  

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

Moderators: snowgoer540
Time to create page: 0.151 seconds
Powered by Kunena Forum