How to create a new GeoFeature?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

How to create a new GeoFeature?

Post by ezzieyguywuf »

Browsing the TopoShape.h and PartFeature.h, as well as the GeoFeature.h and ComplexGeoData.h headers, it seems that in order to create a new GeoFeature that can be used in FreeCAD, I must:
  • Sub-class GeoFeature (like PartFeature does) and implement the virtual functions transformPlacement, getPropertyOfGeometry and getPyObject
  • Sub-class ComplexGeoData (like TopoShape does) to use in a PropertyComplexGeoData
  • Sub-Class PropertyComplexGeoData (like PropertyPartShape does) to encapsulate the ComplexGeoData from step 2
  • Finally, tie it all together -> my GeoFeature::getPropertyOfGeometry must return my PropertyComplexGeoData which must manage/hold my ComplexGeoData
That all seems pretty straightforward. My question, though, is am I missing anything? For example, I noticed that both GeoFeature and ComplexGeoData have transform methods. Which ones are the important ones? I seem to recall reading something somewhere about one placement/transform method being obsolete in favour of another, and I'm not sure if that was in regards to this ComplexGeoXXX stuff or not.

Any help would be appreciated! My end goal is to essentially duplicate what the Part workbench does: provide a mechanism that takes OpenCasCade geometry information and presents it in such a way that FreeCAD (my way of Coin3D) can display it. As this is an educational venture, rather than simply copy what TopoShape has done I aim to understand the underlying code structure and design patterns.
Post Reply