change postprocessor

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
strahlensauger
Posts: 33
Joined: Thu Dec 16, 2021 8:13 pm

change postprocessor

Post by strahlensauger »

Hello,
I would like to change some rules of the linuxcnc postprocessor.
I am using an appimage of freecad. Is it possible to access the postprocessor in an appimage?
The freecad coming with the distribution throws a lot of errors when I load a file and behaves different
from the appimage, so I can't use it and have to stick to the appimage.
Help is appreciated.
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: change postprocessor

Post by chrisb »

Moved from Path forum.

As I am a friend of showing people how to help themselves:
Go to the wiki. Enter "AppImage" with a capital "I" in the search field. Hit enter.

Wasn't too hard, was it?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: change postprocessor

Post by chrisb »

You should have told us more about your system, e.g. by showing your full FreeCAD infos. In case you have a Ubuntu based system, then for your use case the non AppImage ppa version may be even more interesting:

(- remove your currently installed version (no need to remove the AppImage))
- go again to the wiki
- type in the search field "Insta" and you are already offered "Install on Linux", because L comes before M (for Mac) and W (for Windows)
- at the right end of the Ubuntu section click the Expand link
- You find a description for the "Development PPA (Daily)"

If you use this you have direct access to the files of the FreeCAD install.

In case you want to change only the postprocessor, you can also create your own, See Path Postprocessor Customization.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
strahlensauger
Posts: 33
Joined: Thu Dec 16, 2021 8:13 pm

Re: change postprocessor

Post by strahlensauger »

Thanks for your quick answer, I will check that out,
just for clarification to my prior post:
I didn't want you to have you to read too much, in that I was probably unclear, (and I read the wiki)...
OK long version,
I installed a gcode subprogram for automatic tool change on my linucnc mill. After a tool change command M6Tn
the linuxcnc postprocessor puts a G43 command, which it should not for that program to work. So I want to change that behavior.
In the linuxcnc Forum I found out that I have to remove
writeBlock(gMotionModal.format(0), gFormat.format(43), zOutput.format(initialPosition.z), hFormat.format(lengthOffset));
from the linuxcnc.cps"-post-processor:

As you recommended to look in the wiki it says
Included Postprocessors are saved in the FreeCAD.Mod.Path.Pathscripts.Post by default:
I dont understand - is that a directory, it looks more like a Python module or sth...
If I look into .FreeCAD/Mod/ there is no Path directory,
here I'm stuck.


Secondary I tried to clarify that I have to use an appimage.
On the mill omputer I run Debian and the freecad version provided with Debian 10 is version 0.18 but I need version 0.19.
On my production machine I run arch and the arch freecad is different from the appimage. On start after loading a freecad file it shows

13:16:16 Traceback (most recent call last):
File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 139, in attach
self.axs = coin.SoType.fromName('SoAxisCrossKit').createInstance()
File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set

The appimage runs fine.


My system:
OS: Arch Linux (xmonad)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24366 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0f9259c)
Hash: 0f9259cda103ae1824ac16c68ac9b4a0d54b05fc
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: German/Germany (de_DE)


and the arch freecad:
OS: Arch Linux (xmonad)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: makepkg
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.10.1
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: German/Germany (de_DE)
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: change postprocessor

Post by chrisb »

strahlensauger wrote: Sat Jan 22, 2022 11:43 am Included Postprocessors are saved in the FreeCAD.Mod.Path.Pathscripts.Post by default:
I dont understand - is that a directory, it looks more like a Python module or sth...
It is a directory with postprocessors. These are indeed written in Python. Look for linuxcnc_post.py.
If I look into .FreeCAD/Mod/ there is no Path directory,
That's your personal FreeCAD addon and macro directory. place your own post in there.

For usng Path workbench, we recommend FreeCAD 0.20.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: change postprocessor

Post by GeneFC »

strahlensauger wrote: Sat Jan 22, 2022 11:43 am As you recommended to look in the wiki it says
Included Postprocessors are saved in the FreeCAD.Mod.Path.Pathscripts.Post by default:
I dont understand - is that a directory, it looks more like a Python module or sth...
If I look into .FreeCAD/Mod/ there is no Path directory,
here I'm stuck.
Replace the dots with slashes.

FreeCAD/Mod/Path/Pathscripts/Post

Not sure why the wiki was written with dots.

Gene
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: change postprocessor

Post by chrisb »

Good find Gene! I hadn't thought of that, because I had originally written the postprocessor customisation page and thought it was still in the state where I left it quite some time ago.
strahlensauger wrote: Sat Jan 22, 2022 11:43 am the wiki it says
Included Postprocessors are saved in the FreeCAD.Mod.Path.Pathscripts.Post by default:
However, I could not find that dot notation. Can you give a link so we can fix it?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
strahlensauger
Posts: 33
Joined: Thu Dec 16, 2021 8:13 pm

Re: change postprocessor

Post by strahlensauger »

https://wiki.freecadweb.org/Path_Post


Look under Options. it is written in bold.
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: change postprocessor

Post by chrisb »

I have corrected the wiki.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
strahlensauger
Posts: 33
Joined: Thu Dec 16, 2021 8:13 pm

Re: change postprocessor

Post by strahlensauger »

Hello,
now that I have some spare time I'm trying to modify the postprocessor linuxcnc.
I use the newest appimage and if I try to save the modified postprocessor to

/tmp/.mount_FreeCACN68za/usr/Mod/Path/PathScripts/post/linuxcnc_post.py

it won't save. (Due to permissions...I know)
I just wonder, if it is possible to put the postprocessor file in a different locoation e.g
.config/FreeCAD/Mod/Path/PathScripts/post/linuxcnc_post.py
and only change the path to the postprocessor in FreeCAD somewhere (I dont know where)
to use the postprocessor in future updates without changing it all the time.
advice is appreciated...
Post Reply