Merge pull request 'fix(assembly): handle non-standard datum element types in Distance joint classification' (#319) from fix/datum-plane-classification-all-hierarchies into main
Reviewed-on: #319
This commit was merged in pull request #319.
This commit is contained in:
@@ -325,21 +325,28 @@ DistanceType getDistanceType(App::DocumentObject* joint)
|
||||
auto* obj1 = getLinkedObjFromRef(joint, "Reference1");
|
||||
auto* obj2 = getLinkedObjFromRef(joint, "Reference2");
|
||||
|
||||
// Datum objects have empty element types because their sub-name ends
|
||||
// with "." and yields no Face/Edge/Vertex element. Detect them here
|
||||
// and classify before the main geometry chain, which cannot handle
|
||||
// the empty element type.
|
||||
// Datum objects referenced bare have empty element types (sub-name
|
||||
// ends with "."). PartDesign datums referenced through a body can
|
||||
// also produce non-standard element types like "Plane" (from a
|
||||
// sub-name such as "Body.DatumPlane.Plane" — Part::Datum::getSubObject
|
||||
// ignores the trailing element, but splitSubName still extracts it).
|
||||
//
|
||||
// Detect these before the main geometry chain, which only handles
|
||||
// the standard Face/Edge/Vertex element types.
|
||||
//
|
||||
// isDatumPlane/Line/Point cover all three independent hierarchies:
|
||||
// - App::Plane / App::Line / App::Point (origin datums)
|
||||
// - Part::Datum subclasses (PartDesign datums)
|
||||
// - Part::Feature with single-face shape (Part::Plane primitive, bare ref)
|
||||
const bool datumPlane1 = type1.empty() && isDatumPlane(obj1);
|
||||
const bool datumPlane2 = type2.empty() && isDatumPlane(obj2);
|
||||
const bool datumLine1 = type1.empty() && !datumPlane1 && isDatumLine(obj1);
|
||||
const bool datumLine2 = type2.empty() && !datumPlane2 && isDatumLine(obj2);
|
||||
const bool datumPoint1 = type1.empty() && !datumPlane1 && !datumLine1 && isDatumPoint(obj1);
|
||||
const bool datumPoint2 = type2.empty() && !datumPlane2 && !datumLine2 && isDatumPoint(obj2);
|
||||
auto isNonGeomElement = [](const std::string& t) {
|
||||
return t != "Face" && t != "Edge" && t != "Vertex";
|
||||
};
|
||||
const bool datumPlane1 = isNonGeomElement(type1) && isDatumPlane(obj1);
|
||||
const bool datumPlane2 = isNonGeomElement(type2) && isDatumPlane(obj2);
|
||||
const bool datumLine1 = isNonGeomElement(type1) && !datumPlane1 && isDatumLine(obj1);
|
||||
const bool datumLine2 = isNonGeomElement(type2) && !datumPlane2 && isDatumLine(obj2);
|
||||
const bool datumPoint1 = isNonGeomElement(type1) && !datumPlane1 && !datumLine1 && isDatumPoint(obj1);
|
||||
const bool datumPoint2 = isNonGeomElement(type2) && !datumPlane2 && !datumLine2 && isDatumPoint(obj2);
|
||||
const bool datum1 = datumPlane1 || datumLine1 || datumPoint1;
|
||||
const bool datum2 = datumPlane2 || datumLine2 || datumPoint2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user