Curved Shapes Workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Curved Shapes Workbench

Post 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
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Curved Shapes Workbench

Post 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 ?
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curved Shapes Workbench

Post 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.
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curved Shapes Workbench

Post 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.
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Curved Shapes Workbench

Post by christi »

Chris_G, thanks a lot. That helped me to fix it. Saving and Loading is no possible without errors.
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Curved Shapes Workbench

Post 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
User avatar
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Curved Shapes Workbench

Post 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)
Attachments
Capture.JPG
Capture.JPG (11.71 KiB) Viewed 15071 times
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Curved Shapes Workbench

Post by christi »

oops. invalid import. I fixed it.
GlouGlou, try again please.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Curved Shapes Workbench

Post by TheMarkster »

Nice work with this.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Curved Shapes Workbench

Post by microelly2 »

thank you for sharing this.
Post Reply