Metric system bug in PathPilot
04 Sep 2016 20:06 #80030
by barsam
Metric system bug in PathPilot was created 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: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:
Although I am not sure the imeprial part will work. It all depends on the executed calculations.
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:
return 25.4 if self.g21 else 1.0
To make it work in full metric mode and occasionally execute imperial gcode files, change it as follows:
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.
The following user(s) said Thank You: nkp
Please Log in or Create an account to join the conversation.
05 Sep 2016 08:42 #80045
by cncbasher
Replied by cncbasher on topic Metric system bug in PathPilot
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 or Create an account to join the conversation.
05 Sep 2016 08:51 #80046
by barsam
Replied by barsam on topic Metric system bug in PathPilot
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.
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 or Create an account to join the conversation.
05 Sep 2016 10:53 #80047
by barsam
Replied by barsam on topic Metric system bug in PathPilot
There you go... More proper and universal.
# 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 or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19188
- Thank you received: 6432
05 Sep 2016 11:09 #80049
by tommylight
Not my thing, but i think it should be g20 where in red???
Please correct me if i am wrong.
Thank you,
Tom
Replied by tommylight on topic Metric system bug in PathPilot
There you go... More proper and universal.
# 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 or Create an account to join the conversation.
05 Sep 2016 12:38 #80051
by barsam
Replied by barsam on topic Metric system bug in PathPilot
Actually there is no variable called g20 in the self object that is why the numbers are reversed and not the if statement.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
03 Jan 2020 18:17 #153915
by porshe
Replied by porshe on topic Metric system bug in PathPilot
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.
Please Log in or Create an account to join the conversation.
04 Jan 2020 13:25 - 04 Jan 2020 13:27 #153987
by dinkata
Replied by dinkata on topic Metric system bug in PathPilot
change only this
ini ........
RS274NGC_STARTUP_CODE = G7 G18 G21 G90 G64
...
ini ........
RS274NGC_STARTUP_CODE = G7 G18 G21 G90 G64
...
Last edit: 04 Jan 2020 13:27 by dinkata.
Please Log in or Create an account to join the conversation.
04 Jan 2020 18:14 #154006
by porshe
Replied by porshe on topic Metric system bug in PathPilot
Thanks dinkata. It helped.
Please Log in or Create an account to join the conversation.
Moderators: cncbasher
Time to create page: 0.165 seconds