Metric system bug in PathPilot

More
10 years 1 month ago #80030 by barsam
I think I have discovered a bug that is messing all the DRO's in case the LINEAR_UNIT is set to mm at the [TRAJ] section of the ini file.
There is a line in the tormach_mill_ui.py file that assumes that everything in your ini file is in imperial format and that occasionally you will be using metric gcode by the mean of G21.
Of course anyone can claim that this is not a bug since PathPilot is meant for Tormach machines, which in fact are setup in imperial units.
Nevertheless, I report it here in case anyone, like me, is strangling to find out what is wrong with the DRO’s.
In line 1898 of the python file there is this line:
Code:
return 25.4 if self.g21 else 1.0
Which works fine if you have your ini file and linear units set to imperial.
To make it work in full metric mode and occasionally execute imperial gcode files, change it as follows:
Code:
return 1 if self.g21 else 25.4

Although I am not sure the imeprial part will work. It all depends on the executed calculations.

Please Log in to join the conversation.

More
10 years 1 month ago #80045 by cncbasher
Thanks for Posting , i had seen this , and quite rightly it presumes the machine and it's setup ini is Imperial , and therfore setup as such for users with machines built using metric ballscrews and measurments etc and a metric ini , your modification should help . although rather than return 1 , i would return 1.0 just in case .

Please Log in to join the conversation.

More
10 years 1 month ago #80046 by barsam
You are right about the 1 to 1.0, I totally missed it.
In fact, as a developer, I consider the approach totally unacceptable, as the correct way to do it is to read the ini file and do the changes accordingly. But I was too lazy to do it and I needed a quick fix to go on with my setup.

Please Log in to join the conversation.

More
10 years 1 month ago #80047 by barsam
There you go... More proper and universal.
Code:
# callbacks def get_linear_scale(self): """Return the scale factor for all linear axes based on current G20/G21 mode""" self.units = self.inifile.find('TRAJ', 'LINEAR_UNITS') if self.units == 'in': return 25.4 if self.g21 else 1.0 else: return 1.0 if self.g21 else 25.4

Please Log in to join the conversation.

More
10 years 1 month ago #80049 by tommylight

barsam wrote: There you go... More proper and universal.

Code:
# callbacks def get_linear_scale(self): """Return the scale factor for all linear axes based on current G20/G21 mode""" self.units = self.inifile.find('TRAJ', 'LINEAR_UNITS') if self.units == 'in': return 25.4 if self.g21 else 1.0 [color=#ff0000]<========g20 ?[/color] else: return 1.0 if self.g21 else 25.4


Not my thing, but i think it should be g20 where in red???
Please correct me if i am wrong.
Thank you,
Tom

Please Log in to join the conversation.

More
10 years 1 month ago #80051 by barsam
Actually there is no variable called g20 in the self object that is why the numbers are reversed and not the if statement.

Please Log in to join the conversation.

More
6 years 9 months ago #153915 by porshe
Maybe someone came across this. The DRO is displayed incorrectly. Before pressing the reset, everything is displayed correctly G21 and dimensions in mm. After the reset itself it goes to G21 and displays inches. This is only in the lathe configuration. In the configurations, the milling cutter works fine.

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
6 years 9 months ago #153987 by dinkata
change only this
ini ........
RS274NGC_STARTUP_CODE = G7 G18 G21 G90 G64
...

Please Log in to join the conversation.

More
6 years 9 months ago #154006 by porshe
Thanks dinkata. It helped.

Please Log in to join the conversation.

Time to create page: 0.096 seconds
Powered by Kunena Forum