chbergmann / CurvedShapesWorkbench

FreeCAD Workbench for creating 3D shapes from 2D curves
GNU Lesser General Public License v3.0
58 stars 10 forks source link

Fix __getstate__/__setstate__ methods for FreeCAD >= 0.22 #22

Closed andir closed 7 months ago

andir commented 9 months ago

As of https://github.com/FreeCAD/FreeCAD/commit/83d4080fe8 FreeCAD (for compatibility with Python 3.11) has renamed the methods to loads and dumps. Using this workbench with the latest FreeCAD main branch surfaced this issue as I wasn't able to save my documents again.

I found the change https://github.com/fra589/CurvesWB/commit/3374dbb83ea2a09787819b1e153a5697f5e19ea7 in the CurvesWB and adopted it for this WB.

Since others might run into the issue with an eager need to save the document, this is how I temporary fixed the issue via the Python console from within FreeCAD:

import CurvedShapes.CurvedArray CurvedArray.CurvedArrayViewProvider.loads = lambda self, state: None CurvedArray.CurvedArrayViewProvider.dumps = lambda self: None

(Adjust to match whatever object you have in your document)