Morning.
I added the reference in both ‘objectmaps’ and ‘viewprovidermaps’ because the reference should appear in both sections. I recommend a refactoring for the Array.py file since it contains both the object class and the viewprovider class, but this recommendation is extraneous to this thread.
The Pocket/PocketShape redirection should be corrected. The error appeared to be that both were being mapped to Pocket (3D Pocket).
Thanks for suggesting the addition and corrections. I will replace V8 with V9 in the original post [OP] of this thread.
To Whomever:
The pinging feature is not pinging me, so anyone using it with my username is doing so in vain. Perhaps there is a forum setting I would have to enable in my account settings.
First in cleanupBase64String function. An error occurs in the function when the string contains null instead of a string.
After line 107 we need replace null with None.
if not string.startswith("{") or not string.endswith("}"):
# print(f"original string: {string}")
return base64_string
string = string.replace("null", "None")
dictStr = eval(string)
The second point is this: the tool stores the path to the figure and a description of the parameters of the tool itself. In my file there is an indication of the old version. I think this should be corrected automatically (but maybe I’m wrong).
In case you agree I prepared a fix (of mediocre quality, but it works )
Function cleanupDoc, approximately line 180
# Eif
# Etry
# Efor
# It is for ToolBit (example C:/Program Files/FreeCAD 0.20/Mod\Path\Tools\Shape\endmill.fcstd)
res = child.findall("./Properties/Property[@name='BitShape']/String")
for r in res:
try:
valuestring = r.attrib["value"]
except:
pass
else:
if "/freecad 0.20/mod" in valuestring.lower():
r.attrib["value"] = valuestring.replace("/FreeCAD 0.20/Mod", "/FreeCAD 0.21/Mod")
# Eif
# Etry
# Efor
# It is for ToolBit (example C:/Program Files/FreeCAD 0.20/Mod/Path/Tools/Bit/5mm_Drill.fctb)
res = child.findall("./Properties/Property[@name='File']/String")
for r in res:
try:
valuestring = r.attrib["value"]
except:
pass
else:
if "/freecad 0.20/mod" in valuestring.lower():
r.attrib["value"] = valuestring.replace("/FreeCAD 0.20/Mod", "/FreeCAD 0.21/Mod")
# Eif
# Etry
# Efor
# Efor
newXML = ET.tostring(root)
return newXML
I understand that this method of indicating corrections is not very clear, so I am attaching the resulting file.
I installed python version 3.
Then open the folder that contains the file that needs to be corrected.
Press the Shift key together with the right mouse button and select Open Command Prompt.
And run the script
python "C:\Users\YOUR USER HERE\Downloads\JobFixer_V9\JobFixer.py" -d ".\" --s "_fixed"