Configuration File & Tool Library on FreeCAD

Hello,
In the download section of the Snapmaker site, it’s said that the configuration file and the tool library are compatible with FreeCAD but it seems that I can’t import neither the .tool and I don’t really know where to import the .nc file.

Is there someone that have succeed doing that in FreeCAD ?

Thanks,

Ludo

1 Like

@ITmaze, i know you have been experimenting with FreeCAD, have you imported these configuration settings. or do you have any other guidance to give Ludo?

I have not, but I’ll have a look.

1 Like

Disclaimer: I’ve not yet tried this.

I’ve had a look at the file[2] supplied by SnapMaker[1]. It’s a zip file that contains a readme and two “.tools” files. These two files are also zip files. They contain a file called tools.json which you should be able to import[3][4].

  1. https://www.snapmaker.com/download/snapmaker1

  2. https://s3-us-west-2.amazonaws.com/snapmaker.com/download/snapmaker-fusion360-configuration-20200519.zip

  3. https://forum.freecadweb.org/viewtopic.php?p=192578

  4. https://wiki.freecadweb.org/Path_ToolLibraryEdit

Again, I’ve not yet tried this.

3 Likes

Haven’t tried it myself yet (sticking to Fusion for now). but did you download the files from the website or from the github page? That also has a manual on how it should be used:

the zip file on the website (https://snapmaker.com/product/snapmaker-2/downloads) is for fusion, but on the github page (also linked) there are also some for other software, like freecad.

It’s not exactly clear to me which is the last version but I would try the github version with associated Readme/manual: https://github.com/Snapmaker/snapmaker_cnc_post_process/tree/master/assets/snapmaker-freecad-configuration

1 Like

Hi, I’ve been completely offline for the past 2 days, thanks for the replys, I’ll try with these files but .json and .py looks good…
I’ll try the whole thing when my machine will be here… Normally shipped in November !
Thanks again…

Will follow much more the github page !

Hey guys
good evening everyone,

I tinkered around with the postprocessor for a few (slightly frustrating) weeks now and could finally get FreeCAD motivated to hand me over a G-code, which is already converted by the processor provided by Snapmaker.

For testing purposes, I compiled two easy workjobs each for the outlines of a few simple shapes: 1x FreeCAD, 1x Luban. They seem to match very roughly, but there are some significant differences. [My interpretation of Snapmakers G-code dialect may be partially wrong due to a sufficient documentation.]

I have noticed the following:

  • The commands occurring in every initial sequence of Luban-generated G-code are different.

– Luban uses G90 (set absolute positioning) followed by some G0 (rapid linear movements) to positioning the tool near the work origin. Afterwards it’s turning the spindle with a predefined turning speed, set by a value for power in percentage between 50 and 100. [The values for the feedrate are a bit odd and far from rapid, but won’t affect the practicability]

– The postprocessed FreeCAD G-code spares the setting for the positioning mode. The following approach to the work origin affects only the Z axis. There is an additional G21, which i couldn’t find in Snaps dialect (neither in the few sentences documentation, nor through the controllers command line). The following M3 sets the Power value with a variable named S instead of P. I tried that command seperatly in the controllers command line and it turned the spindle as well. Hard for me to estimate, if that matters or what this difference might affect also.

  • The needed movements of the tool is generated way different. Luban only uses linear movements (G0 / G1), even to display curved shapes in an approximation. FreeCADs code includes some G2 in addition, with values which meanings i couldn’t guess yet. The few lines doc published on github states, G2 and G3 are arc moves, which should be converted to linear ones for the Snap. Because.

  • Luban generates G-code which sets the work origin as reference level. Thus, the dip into the workpiece is translates by negative values on the Z axis. The FreeCAD postprocessor instead sets the bottom of the workpeace as reference level. A 0.5 mm dip into a 10mm workpiece for example is compiled at Z9.50 instead of Z-0.50. As the result, the FreeCAD G-code makes the Snapmaker milling in the air above my workpeace, exactly the thickness of my workpeace away from the intended place. I didn’t find a setting to change that yet. A possible workaround could be constructing the model in FreeCAD “in reverse”, but I didn’t try that yet according to the needed changes in my workflow.

  • I didn’t analyze the footer yet.

I’ll had a deeper look into the provided postprocessor afterwards. It seems, the Snapmaker one is a modified copy of the linuxcnc postprocessor originally provided with FreeCAD.

  • There is the python specific header found first. As long as I don’t find a need to import any additional librarys, I won’t touch that part.
  • There are some parts, which are simply hardcoded as Preamble / Header / Footer / and so on. These simply hand over their payload to the G-code file line by line and are therefore the parts, where necessary adjustments are easy to do.
  • But there are the more important parts, where functions change structure and syntax from the generated fictional G-code FreeCAD generates to the dialect understood by Snapmakers controller. Sadly, this might be the part, where the difference in the reference level is originated.

As I’m not able to switch to Fusion360 and as long as Luban is just capable of milling simple pictures into flat surfaces, I fear, I have to customize the postprocessor until I get any satisfying output. But my spare time is limited and I don’t speak python fluently enough for easy results: Anyone interested and willing to help? :upside_down_face:

2 Likes

By the way, I tried to gather and list all G and M commands I could find in the “documentation” on github and the controllers command line. Anyone interested in participating may raise a hand.

1 Like

Great write up, thanks!

Check out the Marlin gcode docs - it will answer all of your questions except M3 lol

M3, Snapmaker has a custom added P parameter, for Percentage, from 0-100. S is 0-255, by convention. The M3 command behaves different between laser and CNC so be careful - in laser mode the S parameter is ignored, you must use P. Also, Snapmaker has not enabled EVERY command listed - many are disabled, subroutines, for instance, as well as bezier curves.

As far as the air-cnc goes - just double check your coordinates before starting. If needed, issue a G92 Z0 to set the Z height to 0, from the terminal.

If the workpiece is in place you won’t be able to do that from the touchscreen. Alternatively, you could edit the gcode adding a G92 Z0 immediately before it starts moving, but that kinda stinks. Maybe you can add a custom bit of gcode in FreeCad as it exports? or change the reference surface? Sorry, not familiar with it for generating gcode.

As far as customizing the postprocessor - sure, I’ll give it a go. I’ve read through it before and it seemed straightforward. Maybe PM me and we’ll do something. If you already have a Github started that would be a great place to collaborate.

1 Like

I haven’t really look into the gcode itself for now, but I defenetely will.
.json & .py files permite me to create the jobs and a .cnc file, I’ve imported one in Luban at the moment and it seems to be able to make a great work… Still waiting for my machine… Sooner and sooner… Following your researches Chriss ! :wink:

Thanks for the link to the marlin docs - I’m not yet into that but will work on it :upside_down_face:

For the work origin:
As you mentioned, after placing the workpeace, i simply just can’t move the tool to a virtual work origin beneath the workpiece due to physical restrictions… :crazy_face: Altering the G-code will surely do the trick. But I’m lazy - too lazy to adapt most of the lines in a complex workscript. Especially when there is a chance to get it done by altering the postprocessor once… :innocent:

Yeah, I finally got a satisfying result (still with a little bit of manually postpostprocessing the gcode). :slightly_smiling_face:

I adapted the following christmas decoration, recalculated them in freecad and milled the two pieces into 12mm multiplex

The edges are not as precise as I wanted them to be due to possibly blunt router knifes.
I finetuned the edges and oiled the surfaces afterwards.

5 Likes

Hi All,

Hoping someone can help. I’ve managed to do some cnc work on my snapmaker with Fusion360, but I don’'t like to have to rely on a “free” version of commercial software. So I’d love to swith to FreeCAD (which I’ve already used with success to model for a 3D print.

I’ve managed to get the snapmaker post-processor to show up in FreeCAD.
But now I’m stuck at importing the snapmaker tool library. The Library provided by snapmaker is in .json format, but FreeCAD (0.19) seems to only like it’s own .fctb format.

Am I missing something? Has FreeCAD changed file-formats? I’ve done a search of various websites and forums, but can’t seem to find any answers. Help? :wink:

Thanks!
JJ

In FreeCAD 19, select Edit->Preferences->Path->Tool and check “Use Legacy Tools”, hit OK and restart FreeCAD. I was then able to import the JSON file provided in the assets-20210120\assets\snapmaker-freecad-configuration\Snapmaker-2.0-CNC-Tools.json file

3 Likes

Hi friends,

I have also tried using FreeCAD and Snapmaker, but ran into similar problems that were described before (I guess there was no update to the software that has improved the situation):

  1. Also for me the Spindle moves above the workpiece, similar to the issue described above. If this can be solved by changing the G-Code file manually I would be really very happy if one of you could post an example how to do this (I am not very familiar with G-Code [yet]).

  2. The work area preview is completely off. I was trying to cut a simple, circle (9cm diameter into Multiplex wood). The preview only showed one quarter of the circle, but not the complete one.

Any further suggestions to improve the FreeCAD/Snapmaker Combination in the meantime?

Thank you all,
H.

Did you ever manage to load FreeCAd and Snapmaker? The Readme is “a little light on” to say the least as to how you load the config to get the 2 to talk. If you dont mind how did you achieve this?