Path Workbench Code restructuring - heads up

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!
Post Reply
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Path Workbench Code restructuring - heads up

Post by mlampert »

For a while we've been struggling with an ever growing python module incorporating all of Path in a flat structure. This makes it hard for newcomers to "get into" the code base and figure out how this is supposed to work. It also makes it quite easy to introduce cyclic dependencies in the modules which then cause problems later on. We've restructured the entire code base into sub modules and pulled all elements of the Path code into a single namespace in PR-7440.

Why would any none developer care?

Due to how FreeCAD stores its objects in the ".FCStd" file the data file is inherently tied to the implementation. If the implementation changes and FreeCAD can't find the class which was used to create an element before it got saved then FreeCAD cannot process that data. In other words, once the change is merged it will break all existing Path files.

This is also the reason why we have to make this change now, before version 1.0 is released. With version 1.0 backwards compatibility becomes a priority and a cleanup like this will become much more complicated.

ToolBit's are not affected by this change. Any created and existing ToolBit files will still work after the merge.

Mod edit: The proposed PR: issue #7440
Last edited by Kunda1 on Sun Sep 04, 2022 9:09 pm, edited 2 times in total.
Reason: tweaked title + added gh issue to OP
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Code restructuring - heads up

Post by Kunda1 »

My hot take: ambitious but this makes sense for a pre-1.0 release. If I may, can you consider to also put issue #6835 on your radar as well ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Path Workbench Code restructuring - heads up

Post by sliptonic »

Yep, this is going to break a lot of stuff, make a lot of people mad, and affect both users and other developers.
Let's do it!!

onekk wrote: pinged by pinger macro
GeneFC wrote: pinged by pinger macro
chrisb wrote: pinged by pinger macro
and any other power users. If you're able to build from the PR, please do so and start keeping notes so we can write a migration guide or other instructions to users. Migration pain is going to affect us for a long time so we should probably get good at answering it.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Path Workbench Code restructuring - heads up

Post by onekk »

sliptonic wrote: Mon Sep 05, 2022 2:39 pm
onekk wrote: pinged by pinger macro
Sadly I can't build from PR, So I will wait when changes are incorporated in the "conda install" I use for "0.21.dev"

Let's see how this affects, my test code and some of my other code around.

Thanks for the information, I will eventually made or correct some code I've posted (I have to find the relevant topics, as I've not noted them down).

Best Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Path Workbench Code restructuring - heads up

Post by GeneFC »

sliptonic wrote: Mon Sep 05, 2022 2:39 pm Yep, this is going to break a lot of stuff, make a lot of people mad, and affect both users and other developers.
Let's do it!!
GeneFC wrote: pinged by pinger macro
I am on Windows, so building from a PR is not trivial, but I will try.

I can say already, "Let's do it!!"

If stuff breaks for me I will fix it.

Gene
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Code restructuring - heads up

Post by mlampert »

Kunda1 wrote: Sun Sep 04, 2022 9:07 pm My hot take: ambitious but this makes sense for a pre-1.0 release. If I may, can you consider to also put issue #6835 on your radar as well ?
I had started to take those out, but then ppl have added it back in - for a developer it's really handy to change a single line and turn on/off internal debugging. I'll keep in mind though if I come across a better pattern.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Path Workbench Code restructuring - heads up

Post by onekk »

PR is not integrated yet in development version?

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Path Workbench Code restructuring - heads up

Post by GeneFC »

As pointed out above the change is rather dramatic. No sense in adding to master until it is quite thoroughly debugged at the PR level.

I have taken a first look. In general it seems to work pretty well for new Path WB jobs, but completely fails to handle existing jobs. They are not even recognized. I do not know if that can be fixed in any way or if some sort of converter might be possible, but that is why the testing period on the PR exists.

Gene
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Path Workbench Code restructuring - heads up

Post by onekk »

GeneFC wrote: Tue Sep 06, 2022 1:16 pm As pointed out above the change is rather dramatic. No sense in adding to master until it is quite thoroughly debugged at the PR level.
...
Ok thanks.

I don't know how to do this "test at PR level" and for now it is only an informative questions, as I can't compile FC with my limited power (Intel i3-2100) machine.

I was thinking that it will be as easy as making a git pull and a recompile, but in this case the PR has to be merged in "main branch".

Probably I'm lacking ability to make a goo use of GitHub in complex projects.

There is maybe a dedicated "branch"?

Could you kindly explain me "how to do eventually" such thing, to keep note maybe in future when I could afford a more powerful machine.?

TIA and Regards.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Code restructuring - heads up

Post by chrisb »

sliptonic wrote: Mon Sep 05, 2022 2:39 pm
chrisb wrote: pinged by pinger macro
Until now Path workbench was written in Python. Is this still so? Then I could replace the whole Mod/Path directory to get the new stuff?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply