[Part] Section Cut: also handle normal Link objects

Link objects within App::Part containers were already handled but not Link objects outside
This commit is contained in:
Uwe
2022-03-08 06:25:35 +01:00
parent 5dd531ea22
commit 068f02c4b7

View File

@@ -328,7 +328,7 @@ void SectionCut::startCutting(bool isInitial)
// those that have a solid shape
std::vector<App::DocumentObject*> ObjectsListCut;
for (it = ObjectsListVisible.begin(); it != ObjectsListVisible.end(); ++it) {
// we need all Link objects in App::Parts for example for Assembly 4
// we need all Link objects in App::Part for example for Assembly 4
if (it->getObject()->getTypeId() == Base::Type::fromName("App::Part")) {
App::Part* pcPart = static_cast<App::Part*>(it->getObject());
bool isLinkAssembly = false;
@@ -363,6 +363,13 @@ void SectionCut::startCutting(bool isInitial)
&& it->getObject()->getTypeId() != Base::Type::fromName("App::Part"))
ObjectsListCut.push_back(it->getObject());
}
// get Links that are derived from Part objects
if (it->getObject()->getTypeId() == Base::Type::fromName("App::Link")) {
App::Link* pcLink = static_cast<App::Link*>(it->getObject());
auto linkedObject = doc->getObject(pcLink->LinkedObject.getObjectName());
if (linkedObject && linkedObject->getTypeId().isDerivedFrom(Base::Type::fromName("Part::Feature")))
ObjectsListCut.push_back(it->getObject());
}
}
// sort out objects that are part of Part::Boolean, Part::MultiCommon, Part::MultiFuse,