wmayer wrote: ↑Tue Nov 29, 2022 8:00 pm
Code: Select all
void createBooleanFragments()
{
try {
App::Document* doc = ...
App::DocumentObject* obj = tryCreateBooleanFragments(doc);
setObjectLinks(obj);
}
catch (Py::Exception& e) {
e.clear();
// TODO: Report Py exception...
}
}
I can't get this to work. After I used
Code: Select all
App::DocumentObject* obj = tryCreateBooleanFragments(doc);
I get a new oject in the tree view but it is not a valid BooleanFragments object. It does not have the correct icon and one cannot toggle its visibility.
When I recompute the object, I get an error that a BooleanFragments must have at least 2 objects.
OK, so I tried to
- first call
Code: Select all
App::DocumentObject* obj = tryCreateBooleanFragments(doc);
- then adding 2 objects using
Code: Select all
App::PropertyLinkList* CutLinkList =
dynamic_cast<App::PropertyLinkList*>(CutCompound->getPropertyByName("Objects")))
and then calling this on several objects:
Code: Select all
CutLinkList->set1Value(count, newObject);
This fills me correctly the Objects list of the BooleanFragments object. However, the added objects are in the tree view not added to the BooleanFragments object. Also when I get the BoundingBox of the Shape of the BooleanFragments object, I see that it does not have the size if the added objects.
I also tried to
1. create the BooleanFragments object
2. calling
Code: Select all
CutLinkList->setValue(ObjectsListLinks);
to set directly a vector of App::DocumentObjects.
Unfortunately the result is the same than by adding several single DocumentObjects.
So I must do something wrong. I mean when I create a BooleanFragments object via Python, e.g. using this code:
Code: Select all
boolfrag = SplitFeatures.makeBooleanFragments(name='BooleanFragments')
boolfrag.Objects = [upper_tube, force_point]
I get a valid BooleanFragments object and the Objects are in the TreeView part of it.
Do you have an idea what I am doing wrong?