Code Restructuring - JobFixer Script

Good day FreeCAD users.
On 23 September 2022, mlampert posted a heads-up about a pending code restructuring. Since the 12 Oct. 2022 merger of that giant step forward for the Path workbench, users have been wanting to recover previous Path workbench projectcs that used the old code structure. To this need, sliptonic posted on 13 November 2022 a python script to assist with migrating project files created with pre-restucturing versions of FC to the newly restructured version we currently have. Since then, a few more contributions to that script have been made to improve the results and usability.

This thread is dedicated to that helpful JobFixer script, and those who would like to use it. Updated versions of the script will be attached to this original post.

The latest script is version 9, updated on 24 September 2023, and attached below.

Cheers,
Russell

EDIT 2023-07-21: Update to version 8, with 58 downloads of V7 from 19 March 2023.
EDIT 2023-09-24: Update to version 9, with 45 downloads of V8 from 21 July 2023.

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.32198 (Git)
Build type: Release
Branch: master
Hash: f51b2156f35399cab38eef1e957a59ad5a11de66
Python 3.8.16, 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

Colleagues, there is a problem with the script. When it appears - if there are pictures in the project file (Image workbench), then after applying the script, it is impossible to save any changes in the file, the following error pops up

PropertyFileIncluded::SaveDocFile(): File ‘/home/user/.cache/FreeCAD/Cache/FreeCAD_Doc_f54bd16f-ba17-4367-a9d4-ac4dea565601_91ee46_961635/кроншт.jpg’ in transient directory doesn’t exist.
цуа.jpg
At the same time in the cache, the desired picture file is there, the only problem is where this file is looking for itself FC

Morning,
Do you have a sample file with which to experiment and experience the error?

Thanks,
Russell

.

The problem is not the number of files in your mailbox, but the size of the file itself. Can you simplify it and still get the issue?

Oh. Your hypothesis is not correct. My mailbox doesn’t have, never was and never will have any restrictions - it’s mine and I have full control over it. Moreover, the question about non-existent problems of my mailbox has never been raised. But the forum engine does not allow me to post a file with FCSTD extension weighing even 1.5mb. What was reported by screenshots - in order to fix the identified script error I was asked to provide a file with an example. I agreed to provide such a file in a private message through the forum “engine” and offered the way of file transfer - by adult e-mail, not by teenager messages of the forum with its censorship. And in response, as often happens, silence. After a couple days of waiting I posted screenshots in the forum.
перевод от deepl мог исказить тональность, но сущность передал верно.

That’s just what I meant. The size limit is 1 MB I think.

:slight_smile:
Would you agree that the situation is solved simply by using adult email to forward the file to research the problem?

After all, the problem is in the file created in the “old version” and this file already contains all the problems needed for research. It can be opened, edited and saved only in the “modern” version, which destroys the possibility of research.

The argument, of course, is about nothing.

.

Not exacly as it is a limitation of “forum email system”, that has some good reasons to exist, as example it is supplied to every forum user “for free” and is taylored to simple message exchange, so someone has to pay for the host, so some “metering” is an “usual practice”.

There is in many forums a request for MWE “Minimal Working Example” to show problems, and if such a thing is not supplied, you will not receive nothing, not even a “your post lack of a MWE” as it is “their politics”, here we are less strict in enforcing rules.

For more complex things, there is another “usual practice” to post it on some cloud system were an user could download it.

To not forgot also that here, every help is made “for free” by volunteer, so probably if “helper” time is scarce (Russ4262 is one of the developers of Path WB) “time to answer” could be not so blazing fast, but considering how much you payed for service (0 whatever currency you use) probably service is worth the price.

But even this fact is often not taken in account by users, that usually want their problem solved in “no time”, we “helpers” are also users so we know that.

Regards

Carlo D.

Seems e2.FCStd produced by FC Link branch.
(Document.xml header contains ProgramVersion=“2023.131R26244 +5365 (Git)”).

Opening e2.FCStd in FreeCAD_0.20.2-2022-12-27-conda-Linux-x86_64-py310.AppImage throws

<PropertyLinks> PropertyLinks.cpp(794): Lost link to e2 TC__Ф3_175_17_4 while loading, maybe an object was not loaded correctly
<PropertyLinks> PropertyLinks.cpp(794): Lost link to e2 TC__Ф6_2 while loading, maybe an object was not loaded correctly
Enumeration index -1 is out of range, ignore it
Enumeration index -1 is out of range, ignore it

After replacing ‘Ф’ with ‘d’ everywhere within e2.FCStd messages from PropertyLinks.cpp vanished, but JobFixer v7 still can not produce correct Document.xml.
(missing <?xml version='1.0' encoding='utf-8'?> header; missing tags, but their contents are in place; some trifles else)

Removing Path Job gives correct .FCStd without and any messages in 0.20 and 0.21 versions both.

@memfis What’s about IMPORTANT: Please read first before asking for help?

using FreeCAD_0.20.2-2022-12-27-conda-Linux-x86_64-py310.AppImage i made a simple box. added a profile and a dogbone. used the recent version, 7, of jobfixer to convert the file.

$ python ./JobFixer.py -i dogbone.FCStd

Job Fixer, 2023-03-19 using Python 3.9.2
Using suffix: _current
Input file: dogbone.FCStd
Output: dogbone_current.FCStd
cleaning ObjectData
module draftobjects.clone not substituted
cleaning ViewProviderData
module PathScripts.PathDressupDogbone not substituted


opened the new file with FreeCAD_weekly-builds-33593-2023-07-16-conda-Linux-x86_64-py310.AppImage.

(1)<class ‘AttributeError’>: Module Path.Dressup.DogboneII has no class ObjectDressup
Traceback (most recent call last):
File “/tmp/.mount_FreeCAKDq04W/usr/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py”, line 139, in _import
return original_import(name, *args, **kwargs)
<class ‘ModuleNotFoundError’>: No module named ‘PathScripts.PathDressupDogbone’

Please upload the file before applying the script too.

Link Branch files are not 100% compatible with “stock FreeCAD” files, so probably it is an expected results, RealThunder has told this somewhere, probably in some post or in his documentation.

Missing “Link Branch” and “stock FreeCAD” files is not for faint of heart and FreeCAD developers could not blamed if something is not going flawlessy, not an uncommon problems when you are using forks.

Regards.

Carlo D.

my bad
i thought this thread was for reporting possible problems with the jobfixer script

Yes it is also for reporting bugs.

However, It will be better to supply a proper FC info like those below:

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: Italian/Italy (it_IT)
Installed mods: 
  * CurvedShapes 1.0.4
  * nurbs-ng
  * ScriptWB-v1
  * QuickMeasure 2022.10.28
  * freecad.gears 1.0.0
  * Assembly4 0.50.2
  * fasteners 0.4.56
  * toSketch 1.0.1
  * Curves 0.6.12
  * Help 1.0.3

obtained using instruction present in:

http://forum.freecadweb.org/viewtopic.php?f=3&t=2264


EDIT:
Even if it seems not necessary here, as the error is probably a glitch in the script, let’s see, if these informations could solve your problem:

It seems that something has gone weird:

module PathScripts.PathDressupDogbone not substituted

Maybe it is caused by these lines in GuiDocument.xml in the “_current” file around line 352:

                <Property name="Proxy" type="App::PropertyPythonObject" status="1">
                    <Python value="bnVsbA==" encoded="yes" module="PathScripts.PathDressupDogbone" class="ViewProviderDressup" />
                </Property>

It seems that this stanza in the dogbone file, around line 357:

                <Property name="Proxy" type="App::PropertyPythonObject" status="1">
                    <Python value="bnVsbA==" encoded="yes" module="PathScripts.PathDressupDogbone" class="ViewProviderDressup"/>
                </Property>

is not taken in account from the scripts as it is not present in viewprovidermaps in the V7 of JobFixer.py.

A minor glitch in usage :

    python JobFixerCopy_V5.py -h\

sliptonic What do you think?

END EDIT:


Regards

Carlo D.

EDITED POST, Sorry for any inconvenience!

Evening.
Wow, what activity of late. I’ll just jump in.

@memfis: I tried the two e2 files, as well as the basic e2 file converted with the JobFixer script, with FC version 20.2 and a recent 33613 revision. Both versions of FC threw errors when opening the three files. Put another way, I was unsuccessful at opening any of these files without errors. Therefore, to attempt to assist, I created a simple source file in FC 20.2 with an image, solid, and Path objects. I used the JobFixer script to update the file, and then opened it with my FC 33613 revision without errors. I was able to modify and save the file without errors. This leads me to believe there is more to the problem reported.
Based on user xemul’s comment,

@memfis: If the source file is based on a modified version of FC, it is possible that the file is not compatible with the JobFixer script in some capacity.



@fxkl47BF: Thanks for reporting. This issue is now fixed, as it relates to the Dogbone dressup. See original post for version 8 of the script.



@onekk: Corrected. Thanks for the notice!

@onekk: Yes. This is only part of the problem reported by user fxkl47BF above. Thanks for your feedback.

As stated above, version 8 of the script is now available in the original post of this thread.

Blessings and peace,
Russell

Hi all.

First of all, I want to thank the guys who made this script - I’ve been looking for a long time how to make old files work on version 21 (maybe it would be worth adding a link to this topic in the release description?).

Secondly, I would like to ask @Russ4262 to supplement the script with the missing mapping in

objectmaps = {
...
PathScripts.PathArray": "Path.Op.Gui.Array,
}

Thank you all :slight_smile:

ps Just tags that may help those suffering find this topic

  • freecad fcstd backward compatibility


  • freecad path workbench backward compatibility


  • freecad 21 path workbench import previous version issue

pss This mapping should be in the objectmaps section. I pasted it into the viewprovidermaps section and it didn’t work :frowning:

Hi and welcome to the forum!

You have to ping someone as so: Russ4262 (which is herewith done).

Excuse me. The tooltip did not appear for some reason. I assumed that the mention would form itself.