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

@sliptonic:
thanks a lor for the the script!
No time to test it until now. Unfortunately.
(Somebody can sell me days of 96 hours? I would buy a dozen. :D )
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Path Workbench Code restructuring - heads up

Post by Russ4262 »

sliptonic wrote: Sun Nov 13, 2022 4:34 pm ... 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. ...
Here is your version modified with a solution for encoded viewprovider issue. This version also removes the command-line usage. This one is designed to be run in a folder containing .FCStd files, converting each and appending the new versions with "_current" to the filename.

Thanks for the script, Sir. Work on my similar script was failing in the re-Zipping process.

Edit 2023-03-11: Deleted files in place of updated version. Originals were about 90+ downloads combined.

Cheers.

Russell

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.30769 (Git)
Build type: Release
Branch: master
Hash: 1282fdb7e8a721e9b411358d68daf8921b0bf50a
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * FC_SU
  * PathExp
  * Z_MacroStartup
Last edited by Russ4262 on Sun Mar 12, 2023 3:02 am, edited 5 times in total.
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 »

Awesome! Thanks Russ

Since the list of module maps is still incomplete, maybe we should add a dry-run option that just spits out the list of modules that don't have maps.
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Path Workbench Code restructuring - heads up

Post by Russ4262 »

And/Or have the action cancel and not create the new version, but report the missing modules that are needed for success with a message to the user suggesting they be added and the utility re-run.

Russell
User avatar
Gauthier
Posts: 123
Joined: Fri Jul 04, 2014 10:00 am
Location: Audenge, France

Re: Path Workbench Code restructuring - heads up

Post by Gauthier »

Hi @sliptonic, Hi @Russ4262,

I use the Path workbench for many years, and I can't beleave that all the precedent work desapear like this!
Many thanks for your script which try to keep our work!

In JobFixerCopy.py, I added in the maps:
objectmaps:
"PathScripts.PathPocket": "Path.Op.Pocket",
"PathScripts.PathProfileContour": "Path.Op.Profile",

viewprovidermaps:
"PathScripts.PathPocketGui": "Path.Op.Gui.Pocket",
"PathScripts.PathHelixGui":"Path.Op.Gui.Helix",
"PathScripts.PathProfileContourGui": "Path.Op.Gui.Profile",

however, I still have difficulty retrieving models with tool definitions.
Here are the error messages I get:

Code: Select all

16:35:40  Invalid type Path::PropertyTool for property UsinagePlatineMinuterie06_current#T1__Fraise_D3x20.Tool
16:35:40  Invalid type Path::PropertyTool for property UsinagePlatineMinuterie06_current#T2__Foret_D2.Tool
16:35:40  <string>(1)<class 'AttributeError'>: Module Path.Op.Profile has no class ObjectContour
16:35:41  Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
<class 'ModuleNotFoundError'>: No module named 'PathScripts.PathToolController'
16:35:41  Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
<class 'ModuleNotFoundError'>: No module named 'PathScripts.PathToolController'
16:35:41  Traceback (most recent call last):
  File "/home/gauthier/src/FreeCAD/build_20221218/Mod/Path/Path/Dressup/Gui/Tags.py", line 477, in updateData
    self.updatePositions(obj.Positions, obj.Disabled)
  File "/home/gauthier/src/FreeCAD/build_20221218/Mod/Path/Path/Dressup/Gui/Tags.py", line 467, in updatePositions
    self.obj.Proxy.pointAtBottom(self.obj, p), self.colors
  File "/home/gauthier/src/FreeCAD/build_20221218/Mod/Path/Path/Dressup/Tags.py", line 1350, in pointAtBottom
    self.setup(obj)
  File "/home/gauthier/src/FreeCAD/build_20221218/Mod/Path/Path/Dressup/Tags.py", line 1314, in setup
    self.toolRadius = float(PathDressup.toolController(obj.Base).Tool.Diameter) / 2
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Tool'
I also attached the offending test model before and after conversion...

Thanks for your help
@++;
Gauthier.

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (XFCE/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31340 (Git)
Build type: Unknown
Branch: master
Hash: 856af2a12287a2d7c0d5ab23646be43af26b14b1
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 7.1.1, OCC 7.8.0.dev
Locale: C/Default (C) [ OS: French/France (fr_FR) ]
Installed mods: 
  * fasteners 0.4.27
  * Curves 0.6.5
  * Assembly4 0.12.5
  * CurvedShapes 1.0.4
Attachments
UsinagePlatineMinuterie06_current.FCStd
(928.32 KiB) Downloaded 93 times
UsinagePlatineMinuterie06.FCStd
(430.03 KiB) Downloaded 93 times
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 »

Gauthier wrote: Tue Dec 20, 2022 3:53 pm Hi @sliptonic, Hi @Russ4262,

I use the Path workbench for many years, and I can't beleave that all the precedent work desapear like this!
Many thanks for your script which try to keep our work!
It's the flip-side of improving fast. People start to get comfortable with the tool as it is. But remember, we're not even at 1.0 yet. There's a good chance that things will break, especially in development and no implied guarantee of backward compabitility. We do our best but caveat emptor.
In JobFixerCopy.py, I added in the maps:
objectmaps:
"PathScripts.PathPocket": "Path.Op.Pocket",
"PathScripts.PathProfileContour": "Path.Op.Profile",

viewprovidermaps:
"PathScripts.PathPocketGui": "Path.Op.Gui.Pocket",
"PathScripts.PathHelixGui":"Path.Op.Gui.Helix",
"PathScripts.PathProfileContourGui": "Path.Op.Gui.Profile",
Great! Thanks.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Code restructuring - heads up

Post by chrisb »

Russ4262 wrote: Wed Nov 16, 2022 5:14 am
sliptonic wrote: Sun Nov 13, 2022 4:34 pm ... 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. ...
Here is your version modified with a solution for encoded viewprovider issue. This version also removes the command-line usage. This one is designed to be run in a folder containing .FCStd files, converting each and appending the new versions with "_current" to the filename.
There is the file from this post. I can open it in 0.20, but it crashes my FreeCAD 0.21, even if I run JobFixerCopy.py on it.

Should I create a ticket?
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: Path Workbench Code restructuring - heads up

Post by GeneFC »

chrisb wrote: Sun Jan 08, 2023 12:20 am There is the file from this post. I can open it in 0.20, but it crashes my FreeCAD 0.21, even if I run JobFixerCopy.py on it.
I went back and tried that file in several ways.

First, with an older version of FreeCAD (0.21) before the refactor. No crash, but lots of TechDraw errors.

Next, with the original referenced FCStd file and a recent version of FC. Again, no crash, but a bunch of Path errors reported.

Finally, with the repaired FCStd file and the same recent version of FC. No crash and no errors.

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.31432 (Git)
Build type: Release
Branch: master
Hash: 63a2855751d638bf27ed969dc60654bda2b54baf
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * FeedsAndSpeeds 0.5.0
  * FeedsAndSpeeds-master.zip
  * freecad.gears 1.0.0
  * Help 1.0.3
I am not sure this is related to the Path WB in any case. The subject file is completely devoid of any Path operations.

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

Re: Path Workbench Code restructuring - heads up

Post by chrisb »

GeneFC wrote: Sun Jan 08, 2023 12:46 am I am not sure this is related to the Path WB in any case. The subject file is completely devoid of any Path operations.
Indeed, sorry for the noise. I removed the whole Job in 0.20, and FreeCAD still crashes when loading the file. I have to investigate this further.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Path Workbench Code restructuring - heads up

Post by Russ4262 »

chrisb wrote: Sun Jan 08, 2023 12:20 am ... There is the file from this post. I can open it in 0.20, but it crashes my FreeCAD 0.21, even if I run JobFixerCopy.py on it. ...
I ran the JobFixerCopy.py script to the target file, then opened it with FC version provided. Only one error occurs and is on the Job - see screenshot. I recompute the Job and the error disappears. The Drilling operation has no path visible and cannot be accessed when double clicking to edit. Deleting and recreating a default Drilling op succeeds.

Russell

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.31917 (Git)
Build type: Release
Branch: master
Hash: 4639283b459f9ff9093e289908cc003db8745b82
Python 3.10.9, Qt 5.15.6, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * FC_SU
  * freecad.gears 1.0.0
  * PathExp
  * Z_MacroStartup
Attachments
Initial Job error upon loading.
Initial Job error upon loading.
Screenshot 2023-03-11 070840.png (158.03 KiB) Viewed 11578 times
Post Reply