Part has the option of creating a Multi Union/Fusion of sub Parts.
Is an equivalent available with a user defined App::FeaturePython object? Or could such a equivalent be implemented
I would like to create a hierarchi of user defined objects which do not have graphics parts but do allow users to set a lot of
parameters that related to the FreeCAD drawing / 3D Object being created.
Thanks
App::FeaturePython equivalent toPart:: Multi Union/Fuse
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: App::FeaturePython equivalent toPart:: Multi Union/Fuse
Okay I tried to use Groups, but seems you cannot add a sub group i.e. Add a group to a group as I get the following error
Code is
Code: Select all
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/freecad/Mod/GDML/importGDML.py", line 79, in open
processGDML(filename)
File "/usr/lib/freecad/Mod/GDML/importGDML.py", line 557, in processGDML
processElements()
File "/usr/lib/freecad/Mod/GDML/importGDML.py", line 518, in processElements
elementObjGrp = elementsGrp.newObject("App:DocumentObjectGroup",name)
<class 'Base.FreeCADError'>: Cannot create object of type 'App:DocumentObjectGroup'
Code: Select all
def processElements() :
elementsGrp = doc.addObject("App::DocumentObjectGroup","Elements")
for element in materials.findall('element') :
name = element.get('name')
elementObjGrp = elementsGrp.newObject("App:DocumentObjectGroup",name)
for fraction in element.findall('fraction') :
n = fraction.get('n')
ref = fraction.get('ref')
fractObj = elementObjGrp.newObject("App::FeaturePython",ref)
GGMLfraction(fractObj,ref,n)
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: App::FeaturePython equivalent toPart:: Multi Union/Fuse
BooleanFragments tool is essentially the same as Part Union, except it does a different operation. And it's implemented in python. You can use it as a starting point.
https://github.com/FreeCAD/FreeCAD/blob ... res.py#L69
https://github.com/FreeCAD/FreeCAD/blob ... res.py#L69