Units for feedrate

Here's the place for discussion related to CAM/CNC and the development of the Path module.
herbk
Posts: 354
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Units for feedrate

Postby herbk » Thu Feb 09, 2017 5:28 pm

Hi sliptonic,
we are mostly talking about the shown units in metric system, not about changing from metric to imperial system.

speed3.jpg
speed3.jpg (167.79 KiB) Viewed 300 times

if i set a speed for axis (the green circled) Freecad exports this to the gcode as "F290".
Freecad shows mm/s (the red circed) as unit, but Linuxcnc and Mach3 (and i think some more) machine software are interpretting "F290" with "work with speed 290 mm/min".
For that, the shown unit in the red circle should change to mm/min if a postprozessor for e machine is selcted which interprets the F comand in mm/min.
Gruß Herbert
sliptonic
Posts: 621
Joined: Tue Oct 25, 2011 10:46 pm

Re: Units for feedrate

Postby sliptonic » Thu Feb 09, 2017 6:41 pm

herbk wrote:Hi sliptonic,
we are mostly talking about the shown units in metric system, not about changing from metric to imperial system.

speed3.jpg
if i set a speed for axis (the green circled) Freecad exports this to the gcode as "F290".
Freecad shows mm/s (the red circed) as unit, but Linuxcnc and Mach3 (and i think some more) machine software are interpretting "F290" with "work with speed 290 mm/min".
For that, the shown unit in the red circle should change to mm/min if a postprozessor for e machine is selcted which interprets the F comand in mm/min.


I understand but the proposed solution takes us backwards, I think.

The value that the user is inputting is a velocity and FreeCAD is capable of understanding it as that. If you type in '290 in/min' it will instantly be converted to mm/second and stored in the Path Command that way, which is exactly what I think it should do. It should NOT be storing '290' without a unit and it should NOT be storing '290 in/min'. Like all units in FreeCAD, it should be converting to base units internally and storing that.

Now that velocity is correctly represented internally, the question is how to get it out in the desired format. The post processor should have a property to represent the desired format. If you want something other than mm/sec, it can convert it at that time as I showed.

This won't solve the display problem, but that's not a Path issue. The problem is that the FreeCAD unit schema doesn't allow you to set user preference for velocity or time. There are some workarounds possible and it might be trivial to add an additional schema.
herbk
Posts: 354
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Units for feedrate

Postby herbk » Thu Feb 09, 2017 7:28 pm

Hi sliptonic,
This won't solve the display problem, but that's not a Path issue
absolutly not, and with all you say i agree.
The Problem is the interpretation of linuxcnc, and other machine softeware, which are working with the otherwise unusual unit mm/min and a big count of users which are the accustomed with it... ;)
Gruß Herbert
sliptonic
Posts: 621
Joined: Tue Oct 25, 2011 10:46 pm

Re: Units for feedrate

Postby sliptonic » Thu Feb 09, 2017 7:42 pm

herbk wrote:Hi sliptonic,
This won't solve the display problem, but that's not a Path issue
absolutly not, and with all you say i agree.
The Problem is the interpretation of linuxcnc, and other machine softeware, which are working with the otherwise unusual unit mm/min and a big count of users which are the accustomed with it... ;)


No, that's not the problem. The issue is that the post-processors are not using the F parameter as a velocity and converting it to a format that the user desires. They're just assuming that the F parameter is in the user-desired units.

I've attached a modified linuxcnc_post.py. This isn't perfect because of floating point math. If I enter 25 in/min, It outputs 'F24.99' but it works otherwise.


It just adds this to the beginning

Code: Select all

from FreeCAD import Units
UNIT_FORMAT = 'in/min'



and replace a couple lines around 242-254 like this:

Code: Select all

            # Now add the remaining parameters in order
            for param in params:
                if param in c.Parameters:
                    if param == 'F':
                        if c.Name not in ["G0", "G00"]: #linuxcnc doesn't use rapid speeds
                            speed = Units.Quantity(c.Parameters['F'], FreeCAD.Units.Velocity)
                            outstring.append(
                                param + format(float(speed.getValueAs(UNIT_FORMAT)), '.2f') )
                    elif param == 'T':
                        outstring.append(param + str(c.Parameters['T']))
                    else:
                        outstring.append(
                            param + format(c.Parameters[param], '.4f'))
Attachments
linuxcnc_post.py
(9.88 KiB) Downloaded 7 times
herbk
Posts: 354
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Units for feedrate

Postby herbk » Thu Feb 09, 2017 10:04 pm

if i replace the file with the attached, the toolcontroller isn't a part of job as it is with the original file. For that it seams, that all changes i make have no effect.
Gruß Herbert
sliptonic
Posts: 621
Joined: Tue Oct 25, 2011 10:46 pm

Re: Units for feedrate

Postby sliptonic » Thu Feb 09, 2017 10:33 pm

herbk wrote:if i replace the file with the attached, the toolcontroller isn't a part of job as it is with the original file. For that it seams, that all changes i make have no effect.


This makes no sense. The change to the postprocessor won't have any affect on the job creation.

I just retried here and the toolcontroller was created as part of the job like normal.
I then entered '25 in/min' in the horizontal speed of the TC.
And post processed.
Output was generated with F24.99

edit. FYI, there's something strange about the inputbox box that it doesn't want me to type 'in/min' very easily. I can get it done, but it's fussy.
When I hit enter though, it converts to "10.5833 mm/s" as expected.
herbk
Posts: 354
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Units for feedrate

Postby herbk » Fri Feb 10, 2017 10:02 pm

Hi sliptonic,
This makes no sense. The change to the postprocessor won't have any affect on the job creation.
I try'd again, but it's the same: after replacing the orig. file with that from link above i got this tree and can't select a tool.
lincnc.png
lincnc.png (32.09 KiB) Viewed 240 times
Gruß Herbert
chrisb
Posts: 1859
Joined: Tue Mar 17, 2015 9:14 am

Re: Units for feedrate

Postby chrisb » Mon Feb 13, 2017 9:59 pm

Is it possible that you have a dialog open in the second tab "Aufgaben". That would explain the behaviour which you describe.
herbk
Posts: 354
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Units for feedrate

Postby herbk » Tue Feb 14, 2017 7:18 am

Good morning Chris,
i didn't check that, i just made it like usual: create a job, add a tool.
After doing that 2 steps i have the order of job and TC like shown on the pic.
Now i'm back to the original linuccnc_post.py and it works like it should.
Gruß Herbert