When a sublink is preselected look at the status bar:
- Snip macro screenshot-beddb8.png (53.75 KiB) Viewed 1580 times
It shows Edge9 even though this sublink object only has one edge, which would be Edge1. Then when the sublink's topo shape is acquired and TopoShape::getSubShape('Edge9') is called on it, then I think that is where it fails because this topo shape has no edge 9.
https://github.com/FreeCAD/FreeCAD/blob ... p.cpp#L303
Code: Select all
bool ok = true;
if (selobjs.size() == 1) {
selection = selobjs[0].getAsPropertyLinkSubString();
const std::vector<std::string>& subnames = selobjs[0].getSubNames();
docobj = selobjs[0].getObject();
spineObject = selobjs[0].getFeatName();
spineLabel = docobj->Label.getValue();
topoShape = Part::Feature::getTopoShape(docobj);
if (!topoShape.isNull()) {
for (std::vector<std::string>::const_iterator it = subnames.begin(); it != subnames.end(); ++it) {
subShapes.push_back(topoShape.getSubShape(subnames[0].c_str())); //<<<--- fails here --->>>
}
for (std::vector<Part::TopoShape>::iterator it = subShapes.begin(); it != subShapes.end(); ++it) {
TopoDS_Shape dsShape = (*it).getShape();
if (dsShape.IsNull() || dsShape.ShapeType() != TopAbs_EDGE) { //only edge selection allowed
ok = false;
}
}
} else { //could be not a part::feature or app:link to non-part::feature or app::part without a visible part::feature
ok = false;
}
} else { //not just one object selected
ok = false;
}
It looks like sublinks are going to be problematic where the property type is PropertyLinkSub or PropertyLinkSubList. We might just have to document this as a limitation.
I stated above that the Sweep object works if we create it with a different spine, and then edit the property to point to the sublink. This is true to an extent, but only where the entire sublink object is used or if we use Edge1 for sublinks that only have 1 edge.