How to add your own postprocessor?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
daniel_cnc
Posts: 9
Joined: Sat May 18, 2019 7:31 pm

How to add your own postprocessor?

Post by daniel_cnc »

Hello,

I tried to make a copy of the linuxcnc post processor to modify it.

I put the copy in my macro path.

linuxcnc2_post.py

But i cant select it in the list.

I also renamend linuxcnc to linuxcnc2 in the file.

OS: Ubuntu 18.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16146 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.18.4)
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by daniel_cnc on Sat Jan 25, 2020 9:11 am, edited 1 time in total.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: How to add your own postprocerssor?

Post by chrisb »

Did you restart your FreeCAD?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
daniel_cnc
Posts: 9
Joined: Sat May 18, 2019 7:31 pm

Re: How to add your own postprocerssor?

Post by daniel_cnc »

Yes, I tried several times.

I use the app Image by the way.

The scripts are shown in the Macro->Macros dialog.

But still can't select then in the list.

I tried freecad-daily and there it is not working either.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: How to add your own postprocerssor?

Post by chrisb »

You don't use it in the Macro dialog, you use it in the output tab of the job. It should occur in the list of the available post processors.

Nevertheless, it should occur in the macro selection dialog. If not, you most probably stored in some other place or your macro path points to the wrong directory.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: How to add your own postprocerssor?

Post by herbk »

Hi Chris,

Danial is using the AppImage, like me. I try to find where the postprozessor is stored at my system and find it at /tmp/.FreeCAD/Mod/Path/Pathscripts/post

Problem is, that the AppImage creates a new /tmp/.FreeCAD folder at each Start, so it`s hard to get somthing in there... We have had this a few weeks before, as i try'd to get Russels 3D OP running...
Gruß Herbert
JustinClift
Posts: 22
Joined: Tue Jan 14, 2020 12:58 pm
Location: Australia

Re: How to add your own postprocerssor?

Post by JustinClift »

One potential way forward is to extract the contents of the AppImage to a directory, so modifications can be performed.

You do this by running the AppImage from the command line, with an argument of "--appimage-extract":

Code: Select all

$ ./FreeCAD_0.19-19285-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage --appimage-extract
This should create a new directory called "squashfs-root", with FreeCAD in it.

Code: Select all

$ ls -la
total 416248
drwxr-xr-x  3 jc users       117 Jan 22 20:59 .
drwxr-xr-x 62 jc users      8192 Jan 20 11:45 ..
-rwxr-xr-x  1 jc users 426213416 Jan 18 00:38 FreeCAD_0.19-19285-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage
drwx------  3 jc users       101 Jan 22 20:37 squashfs-root

$ cd squashfs-root

$ ls -la
total 12
drwx------  3 jc users  101 Jan 22 20:37 .
drwxr-xr-x  3 jc users  188 Jan 22 20:37 ..
-rwxrwxr-x  1 jc users  658 Jan 22 20:37 AppRun
lrwxrwxrwx  1 jc users   17 Jan 22 20:37 .DirIcon -> freecad_conda.png
-rwxrwxr-x  1 jc users  250 Jan 22 20:37 freecad_conda.desktop
-rwxrwxr-x  1 jc users 3744 Jan 22 20:37 freecad_conda.png
drwx------ 23 jc users  313 Jan 22 20:37 usr
You can run FreeCAD from this directory ("./AppRun"), which will pick up any changes made inside the directory structure.

For the post files, they should be under "usr/Mod/Path/PathScripts/post":

Code: Select all

$ ls -la usr/Mod/Path/PathScripts/post
total 196
drwx------ 3 jc users  4096 Jan 22 20:43 .
drwx------ 4 jc users  4096 Jan 22 20:37 ..
-rw-rw-r-- 1 jc users 11608 Jan 22 20:37 centroid_post.py
-rw-rw-r-- 1 jc users  4277 Jan 22 20:37 comparams_post.py
-rw-rw-r-- 1 jc users  9714 Jan 22 20:37 dynapath_post.py
-rw-rw-r-- 1 jc users  4320 Jan 22 20:37 example_pre.py
-rw-rw-r-- 1 jc users 19889 Jan 22 20:37 grbl_post.py
-rw-rw-r-- 1 jc users     0 Jan 22 20:37 __init__.py
-rw-rw-r-- 1 jc users 12474 Jan 22 20:37 jtech_post.py
-rw-rw-r-- 1 jc users 14492 Jan 22 20:37 linuxcnc_post.py
-rw-rw-r-- 1 jc users 11338 Jan 22 20:37 opensbp_post.py
-rw-rw-r-- 1 jc users  8153 Jan 22 20:37 opensbp_pre.py
-rw-rw-r-- 1 jc users 24876 Jan 22 20:37 philips_post.py
drwxr-xr-x 2 jc users    38 Jan 22 20:43 __pycache__
-rw-rw-r-- 1 jc users  8134 Jan 22 20:37 rml_post.py
-rw-rw-r-- 1 jc users  3664 Jan 22 20:37 slic3r_pre.py
-rw-rw-r-- 1 jc users 14719 Jan 22 20:37 smoothie_post.py
I just tried the above, making a copy of the "linuxcnc_post.py" to "linuxcnc3_post.py", and it worked.

eg, was able to select linuxcnc3 in the Job dialog

Note that this requires running the application from the "squashfs-root" directory (eg "cd squashfs-root; ./AppRun"), rather than the original AppImage file, otherwise the changes won't be seen.
daniel_cnc
Posts: 9
Joined: Sat May 18, 2019 7:31 pm

Re: How to add your own postprocerssor?

Post by daniel_cnc »

Thank you Justin,

I wanted to avoid that.

For me it would make much more sense if this was a userconfig and not a System config.
JustinClift
Posts: 22
Joined: Tue Jan 14, 2020 12:58 pm
Location: Australia

Re: How to add your own postprocerssor?

Post by JustinClift »

No worries. :)

Do you reckon your post processor would be useful for other people?

If so, then maybe the right approach is to contribute it to FreeCAD itself, so it's included for everyone?
daniel_cnc
Posts: 9
Joined: Sat May 18, 2019 7:31 pm

Re: How to add your own postprocerssor?

Post by daniel_cnc »

It just works if you create a new Job without a Template.

Or when I have a empty PostProcessor config in the Job Config and the list on export apears.

This also works from Macro Path.

But when I want to change It on an already created Job the list is not updated.

So I would need to recreate all Jobs.
daniel_cnc
Posts: 9
Joined: Sat May 18, 2019 7:31 pm

Re: How to add your own postprocerssor?

Post by daniel_cnc »

JustinClift wrote: Wed Jan 22, 2020 6:57 pm No worries. :)

Do you reckon your post processor would be useful for other people?

If so, then maybe the right approach is to contribute it to FreeCAD itself, so it's included for everyone?
No I just want to add G4 after M3 for my Spindle to spin up.
Post Reply