I have implemented the basics of a first approach and I would like to share it with you and get some feedback.
So far I have tried to keep it simple. There is no Python interfacing yet. Just an initial approach.
The code is here:
There is a first commit with the Geometry level implementation and a second commit with an example geometry extension for the sketcher.
Of course, the extension is not fully integrated into the Sketcher yet. I did a serialisation test after adding the extension like this (dirty trial just in the middle of toggleConstruction function to see if it worked):
Code: Select all
if(!geoNew->hasExtension(SketchGeometryExtension::getClassTypeId())) {
SketchGeometryExtension *ext = new SketchGeometryExtension();
ext->id = 5;
geoNew->setExtension(ext);
}
Code: Select all
<Property name="Geometry" type="Part::PropertyGeometryList">
<GeometryList count="1">
<Geometry type="Part::GeomCircle">
<GeoExtensions count="1">
<GeoExtension type="Sketcher::SketchGeometryExtension" id="5"/>
</GeoExtensions>
<Construction value="1"/>
<Circle CenterX="-111.9" CenterY="5.8" CenterZ="0.0" NormalX="0.0" NormalY="0.0" NormalZ="1.0" AngleXU="-0.0" Radius="29.6"/>
</Geometry>
</GeometryList>
</Property>
A FC without GeoExtension support, for example:
opens the file just fine.OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15221 (Git) AppImage
Build type: Release
Branch: master
Hash: fc5b6288c6eb4fe89192f63f1fbdf4a43c0fad27
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
The nice part of all this trick is that the Geometry is used as always before, but workbenches may add extended information, even if Geometry does not know about this extended information at all.
At this point, the challenges are:
a) Python support for extensions (not my strongest point, but if this is ok I will try my best),
b) There is no support for a Python written extension (for a Python written workbench). I think this would be great, but I will have to dive into how ickby managed to make that work for normal (container/property) extensions.
Any feedback is welcome.
how bad is this? how could it be better? Am I too much off?wmayer wrote:... ping ...
Off Topic: For some reason the latest PPA crashes in my system when trying to open any file:
OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15609 (Git)
Build type: Release
Branch: master
Hash: a14af0f2bd26f980d71be80a799ee48127bc7619
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0