Curved Shapes Workbench
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Curved Shapes Workbench
Hi all,
I would like to share my new workbench "Curved Shapes".
It contains a tool to create a 3D shape from multiple curves in the XY- XZ- and/or YZ- plane.
I have created it to make it simple for me to design model aircrafts.
Here is some documentation: https://github.com/chbergmann/CurvedShapesWorkbench
I would like to share my new workbench "Curved Shapes".
It contains a tool to create a 3D shape from multiple curves in the XY- XZ- and/or YZ- plane.
I have created it to make it simple for me to design model aircrafts.
Here is some documentation: https://github.com/chbergmann/CurvedShapesWorkbench
Re: Curved Shapes Workbench
There is one open issue:
When I save a project with a CurvedArray item to a .FCstd file, I get an error <class 'TypeError'>: Object of type FeaturePython is not JSON serializable
When I load the saved project, the objects are there, but it is not possible to edit a CurvedArray item.
Any ideas how to solve this ?
When I save a project with a CurvedArray item to a .FCstd file, I get an error <class 'TypeError'>: Object of type FeaturePython is not JSON serializable
When I load the saved project, the objects are there, but it is not possible to edit a CurvedArray item.
Any ideas how to solve this ?
Re: Curved Shapes Workbench
I didn't have a deep look, but it may come from here :
https://github.com/chbergmann/CurvedSha ... ray.py#L41
You are storing a pointer to the FeaturePython object.
That looks easier, but since it is not a standard python type, JSON is not able to save / restore it.
You can implement your own save / restore mechanism in setState() / getState().
But I think a better way is to transfer it to your custom Proxy methods :
All the special methods of a Proxy object (execute(), onChanged(), onBeforeChange(), onDocumentRestored()) get the FeaturePython object as first argument, so you can probably transfer this reference to your other custom methods, without having to save a reference in self.obj.
https://github.com/chbergmann/CurvedSha ... ray.py#L41
You are storing a pointer to the FeaturePython object.
That looks easier, but since it is not a standard python type, JSON is not able to save / restore it.
You can implement your own save / restore mechanism in setState() / getState().
But I think a better way is to transfer it to your custom Proxy methods :
All the special methods of a Proxy object (execute(), onChanged(), onBeforeChange(), onDocumentRestored()) get the FeaturePython object as first argument, so you can probably transfer this reference to your other custom methods, without having to save a reference in self.obj.
Re: Curved Shapes Workbench
Here :
execute() is one of the special methods of a FeaturePython Proxy object.
It is, for example, called on document recomputes.
FreeCAD calls it with its FeaturePython parent object as first argument.
I don't think it is a good idea to override it that way.
As it is now, your FeaturePython object only reacts to Property changes, not to external recomputes ... because only your onChanged() will call it with a property name as argument.
Code: Select all
def execute(self, prop):
It is, for example, called on document recomputes.
FreeCAD calls it with its FeaturePython parent object as first argument.
I don't think it is a good idea to override it that way.
As it is now, your FeaturePython object only reacts to Property changes, not to external recomputes ... because only your onChanged() will call it with a property name as argument.
Re: Curved Shapes Workbench
Chris_G, thanks a lot. That helped me to fix it. Saving and Loading is no possible without errors.
Re: Curved Shapes Workbench
I have created two new tools:
Curved Segment interpolates between two 2D shapes and resizes in the bounds of hullcurves:
Interpolated middle interpolates a 2D shape into the middle between two 2D curves. The base shapes can be connected to a shape with a sharp corner.
Here is the wiki page for the workbench:
https://github.com/chbergmann/CurvedShapesWorkbench
Curved Segment interpolates between two 2D shapes and resizes in the bounds of hullcurves:
Interpolated middle interpolates a 2D shape into the middle between two 2D curves. The base shapes can be connected to a shape with a sharp corner.
Here is the wiki page for the workbench:
https://github.com/chbergmann/CurvedShapesWorkbench
Re: Curved Shapes Workbench
Your workbench is not working here
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17171 (Git)
Build type: Release
Branch: master
Hash: d19470a9711ea604f3ca6c93e46afadf64d5bb87
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17171 (Git)
Build type: Release
Branch: master
Hash: d19470a9711ea604f3ca6c93e46afadf64d5bb87
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
- Attachments
-
- Capture.JPG (11.71 KiB) Viewed 15305 times
Re: Curved Shapes Workbench
oops. invalid import. I fixed it.
GlouGlou, try again please.
GlouGlou, try again please.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Curved Shapes Workbench
thank you for sharing this.