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!
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 »

Kunda1 wrote: Tue Oct 18, 2022 1:10 pm
mlampert wrote: Tue Oct 18, 2022 1:16 am As mentioned earlier, the refactor breaks all existing Jobs. You'll have to delete all Jobs, their operations and associated objects and create the anew.
Please post link to the previous mention of this. TIA!
First post in this topic
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Path Workbench Code restructuring - heads up

Post by Kunda1 »

sliptonic wrote: Tue Oct 18, 2022 1:43 pm First post in this topic
Duh! thanks
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
Giulio Buccini
Posts: 541
Joined: Fri Aug 26, 2016 9:07 pm
Location: Munich - Gemany

Re: Path Workbench Code restructuring - heads up

Post by Giulio Buccini »

All my jobs are going to be broken after this changes (I'm using build 30377).
This is insane!
I applied a lot of tweaks and adjustments to produce that jobs. I absolutely do not want to make all of the jobs again from scratch.

Usually, after a first run on the CNC-machine then I return to home and I make all of the necessary adjustments.
An offset reduced to avoid that screw fixing the stock...
A geometric extension 0.5 mm larger or narrower to avoid creating deburr problems...
A certain speed because I got best results with a DLC-bit instead of Steel one...
...and so on.

Now I should remember all of those stuff???
This is not possible.

There is any possibility to get a script for linux converting the old FCstd files in new FCstd files compatible with the new arrangement of the three?
This would be vital for me.
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: Path Workbench Code restructuring - heads up

Post by jescombe »

Giulio Buccini wrote: Fri Nov 11, 2022 5:31 pm All my jobs are going to be broken after this changes (I'm using build 30377).
This is insane!
While I agree a migration script would be great, you could also just keep a stable 20.x AppImage for working with older files..?
Giulio Buccini
Posts: 541
Joined: Fri Aug 26, 2016 9:07 pm
Location: Munich - Gemany

Re: Path Workbench Code restructuring - heads up

Post by Giulio Buccini »

I think your is the most practicable solution: two Freecad applications on my PC.

- build 30377 for my old projects,
- build >30377 for the new ones.

Anyway, I want to cry... may I? :cry:

From what build this "fantastic change" was introduced?
Maybe I can download something more recent than build 30377, while maintaining the backward job-compatibility?
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 »

Giulio Buccini wrote: Fri Nov 11, 2022 5:50 pm Maybe I can download something more recent than build 30377, while maintaining the backward job-compatibility?
At this time there are not that many changes in the main code of FreeCAD. Going from 30377 to 305xx, for example, is probably not worth it unless there were some very specific improvements for your needs.

In any case there is no easy way to download older versions.

I keep both an old FC version (30454) and the latest FC version. I create new Jobs with the new version and reopen old Jobs with the old version. I do not believe there is any other reasonable method.

Here is a cry for you :cry: :cry: :cry: :cry: :cry:

Gene
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 »

This isn't a complete solution but it's something. Maybe someone smarter than me can improve it.

Attached file JobFixer.py is a standalone python script.

execute it like this

Code: Select all

JobFixer.py -i <inputfilename> -o <outputfilename.FCStd>
This will attempt to fix the jobs and write the result to outpufilename.FCStd.

How it works
At the beginning of the file are two dictionaries. These are used to map the old module names to the new reorganized modules. The script works directly on the GuiDocument.xml file and the Document.xml file inside the FreeCAD project. It basically does a simple substitution -- look up the old name, and stick in the new name.
It will output in the console the name of any module that it doesn't find a match for. Non-Path objects are normal. If you find Path related objects listed, those need to be added to the map and the process restarted.

Caveats:
1) The substitution maps may be incomplete or wrong.
2) The viewproviders for operations don't work. Double clicking on the operation won't bring up the task panel. You can still modify the operation through the property pane and it appears to work.
3) It's very experimental. Make sure to back up your original files.

Even with the broken viewproviders, it might be useful to add new operations and copy the properties to rebuild your documents.

Discussion of ViewProvider limitations:

The script works by searching the XML for a Property whose name is 'Proxy'. Then searching for the "module" attrib and replacing it.

In the old scheme, the operations had a viewprovider whose module is "PathScripts.PathOpGui". This is a base class. The viewprovider is actually provided through PathScripts.PathSlotGui, for instance. Simply substituting in the new string, "Path.Op.Gui.Base" doesn't work. It still tries to find the viewprovider in the PathScripts.PathOpGui, presumably because that's encoded in the pickled object.

I don't see a way around this. Like I said, maybe someone smarter than me does.
Attachments
JobFixer.py
(5.01 KiB) Downloaded 113 times
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Path Workbench Code restructuring - heads up

Post by Roy_043 »

Maybe this is useful?:
Scripted_objects_migration
chrisb
Veteran
Posts: 53939
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Code restructuring - heads up

Post by chrisb »

sliptonic wrote: Sun Nov 13, 2022 4:34 pm Attached file JobFixer.py is a standalone python script.
I very much appreciate this approach of not supporting every old version in FreeCAD but rather to migrate old projects to a new format!

Thanks!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
memfis
Posts: 586
Joined: Tue Nov 15, 2016 7:58 pm

Re: Path Workbench Code restructuring - heads up

Post by memfis »

I kept the "old" version. I can put it online for download.
Attachments
Снимок экрана от 2022-11-15 11-28-06.jpg
Снимок экрана от 2022-11-15 11-28-06.jpg (127.93 KiB) Viewed 15157 times
Post Reply