Defeaturing
Posted: Fri Jun 29, 2018 3:02 pm
Hi,
I am giving a try at implementing OCC Defeaturing.
My first test works on TopoShapeSolidPyImp : https://github.com/tomate44/FreeCAD/commits/defeaturing
However, I suppose TopoShapeSolid is not the right place to add this feature, since this algo is supposed to work on Solids, Compsolids, and "compounds of solids". It is probably wrong to duplicate the same code in 3 places.
How and where should I move it ?
This is currently only for python (...PyImp).
If the feature was to be added in the Part Gui, it must be first added in App/TopoShape.cpp, right ?
One thing slightly annoying is that I cannot call the python method directly on a shape :
I have to call it on a copy of the shape :
Below, a test solid (left) and the results of 3 defeaturing :
I am giving a try at implementing OCC Defeaturing.
My first test works on TopoShapeSolidPyImp : https://github.com/tomate44/FreeCAD/commits/defeaturing
However, I suppose TopoShapeSolid is not the right place to add this feature, since this algo is supposed to work on Solids, Compsolids, and "compounds of solids". It is probably wrong to duplicate the same code in 3 places.
How and where should I move it ?
This is currently only for python (...PyImp).
If the feature was to be added in the Part Gui, it must be first added in App/TopoShape.cpp, right ?
One thing slightly annoying is that I cannot call the python method directly on a shape :
Code: Select all
obj.Shape.removeFaces([6,7,9])
>>> ReferenceError: This object is immutable, you can not set any attribute or call a non const method
Code: Select all
obj1.Shape.copy().removeFaces([6,7,9])
<Solid object at 0x55a990c314f0>
Below, a test solid (left) and the results of 3 defeaturing :
Code: Select all
Part.show(sh.removeFaces([6]))
Part.show(sh.removeFaces([7,8,14]))
Part.show(sh.removeFaces([10,11,12,13,15]))