Step by Step guide to creating GCode for the Maslow with FreeCAD

Fails at step 6 can’t create a body it is greyed out :unamused:

Anyone here with the know how willing to update this to the latest version of FreeCAD?

Hi there, Im getting a “name ‘pythonopen’ is not defined” error when atempting to export using the maslow_post… can anyone help with this?
image

Hi there,

I’m not totally sure why, but there is code to create a function called pythonopen which is the same as the built-in open function. According to the comments, this is to avoid confusion with another open function defined elsewhere. However, I can’t see the other open function.

So, two suggestions:

  1. If you are using Python 3 then try changing line 101 in maslow.py from
    if open.__module__ == '__builtin__':
    to
    if open.__module__ == 'io':
    This will force pythonopen to be declared, but doesn’t actually do anything to explain why it is necessary.

or

  1. Unless someone can explain why that is even necessary, try changing line 219 from
    gfile = pythonopen(filename,"wb")
    to
    gfile = open(filename,"wb")

You are probably using Python 3, which is why the if statement in line 101 returns a different value, which then causes pythonopen to be undefined. However, as I said, I don’t really know why that is even necessary. Unless someone can explain it I’d remove the if statement at line 101 and 102 entirely, thus removing pythonopen completely, then modify what was line 219 as suggested above.

Hi, What OS are you running FreeCAD on and what version? A workaround -> use the linux_cnc post, using it for years without issue, but I don’t have ‘complicated’ g-code. Kind regards, Gero

Hi There

Thanks for taking a look at this

suggestion 1 and 2 both gave me this error image

I am using python 3.8.4 on windows 10.0.19041 freecad 0.18

I am using python 3.8.4 on windows 10.0.19041 freecad 0.18… have not tried the linux_cnc post does it have the mm/s to mm/min conversion issue mentioned in earlier posts?

Have not looked into that. I likely has, but I did not bother since my max feedrates on my desktop-cnc and the Maslow are limited by the software. I will look into it. If I remember correctly there is a workaround in the units setting. Let me check. Can’t look into the python issue as my results on linux are not likely to be comparable.

I’ve checked v0.18 with a simple sketch. The ‘inspect g-code’ inside FreeCAD gives 30mm/s as F30. It’s like the post-processor is ignored. Exporting the g-code however, gives a F1800, so the conversion does work on the export. Checked with both. linuxcnc_post and grbl_post, both are fine and should work with the Maslow (if you don’t have some helix-flux-compensation in your g-code. :laughing: )

Edit: The post-processor set inside your job is ignored if you select ‘none’ at export. Make sure to select at export.

Post 9 or 10, changing the units to mm/min for me, creates crazy result on linux with v.18 and v.19. Test and observe well… However my downloads are mostly bleeding-edge, so bugs to be expected.
Another workaround, if you don’t what to calculate yourself is to make use of FreeCADs built in calculator.
For example you want F800, type 800/60 and you will get close enough.
One more tip that might help: Once you have setup your tool with the speeds, right-klick on the ‘Job’ and save template. The next time you create a job you can choose that template and your tool and speeds are there.

Ok. It’s to do with the differences between Python 2 and Python 3. Since Python 2 is deprecated we should all be moving on to Python 3, however, that requires programmer effort to drag every single piece of code up to the new version.

If I have time I will have a go, but in the meantime anyone else is free to do so, since the problem is obvious and the solution is clear. :slight_smile:

I fixed that for the Maslow post-processor. Except, you won’t see that because it’s not working for you for other reasons at the moment.

1 Like

Thanks… Where can I get that? i’m not seeing it in Github.

Where can I get what?

The latest maslow.py in Walt Moorhouse’s Github has the mm/min fix. However, that script is working for you at all because it’s not been updated for Python 3.

After giving up on FreeCad .17 a over a year or more ago, I thought I would come back and kick the tires on the prerelease ver .19. I got say I am impressed a lot of work has been put into the upcoming release, I was able to follow a quick tutorial and generate g-code and check it with the built in simulator.


But one thing I noticed that might be pertinent to the thread is that the GRBL post processor has had a major rewrite from the .17 and .18 versions. Looking at the maslow_post.py that was linked here it is just over 300 lines of code. The new .pre19 version is over 550 lines of code and still contains a line to suppress Gcode commands. I suspect there have been changes as well .18 point releases.

# ***************************************************************************
# * Internal global variables
# ***************************************************************************
MOTION_COMMANDS = ['G0', 'G00', 'G1', 'G01', 'G2', 'G02', 'G3', 'G03']  # Motion gCode commands definition
RAPID_MOVES = ['G0', 'G00']                                             # Rapid moves gCode commands definition
SUPPRESS_COMMANDS = []                                      # These commands are ignored by commenting them out
COMMAND_SPACE = " "
# Global variables storing current position
1 Like

on 0.19 as well and happily cutting acrylic with my desktop cnc with the linuxcnc post-processor. Not tested on the Maslow yet.

The bug I had with impoting .svg is gone and nice curves show up now.

1 Like

Nice, I will have to check that out. Speaking of SVG I noticed the new Inkscape 1.0 has gotten some ‘CAD’ like features added to the path effects (Fillet/Chamfer, new measuring tools, etc.

1 Like

Thanks, have something to check out in the morning.

Thanks for the hint regarding a new version of inkscape.

1 Like