Page 1 of 15

Curved Shapes Workbench

Posted: Tue Jun 11, 2019 6:17 pm
by christi
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.

Image

Here is some documentation: https://github.com/chbergmann/CurvedShapesWorkbench

Re: Curved Shapes Workbench

Posted: Tue Jun 11, 2019 6:21 pm
by christi
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 ?

Re: Curved Shapes Workbench

Posted: Tue Jun 11, 2019 8:07 pm
by Chris_G
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.

Re: Curved Shapes Workbench

Posted: Tue Jun 11, 2019 9:11 pm
by Chris_G
Here :

Code: Select all

def execute(self, prop):
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.

Re: Curved Shapes Workbench

Posted: Fri Jun 14, 2019 8:19 pm
by christi
Chris_G, thanks a lot. That helped me to fix it. Saving and Loading is no possible without errors.

Re: Curved Shapes Workbench

Posted: Sun Jun 30, 2019 8:06 am
by christi
I have created two new tools:

Curved Segment interpolates between two 2D shapes and resizes in the bounds of hullcurves:
Image
Image

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.
Image
Image

Here is the wiki page for the workbench:
https://github.com/chbergmann/CurvedShapesWorkbench

Re: Curved Shapes Workbench

Posted: Mon Jul 01, 2019 6:30 pm
by Vincent B
Your workbench is not working here :roll:

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)

Re: Curved Shapes Workbench

Posted: Mon Jul 01, 2019 7:32 pm
by christi
oops. invalid import. I fixed it.
GlouGlou, try again please.

Re: Curved Shapes Workbench

Posted: Thu Jul 04, 2019 4:38 am
by TheMarkster
Nice work with this.

Re: Curved Shapes Workbench

Posted: Thu Jul 04, 2019 6:12 am
by microelly2
thank you for sharing this.