Skip to content

Commit

Permalink
[Sketcher] Refactor SketchObject::join() (expected trivial)
Browse files Browse the repository at this point in the history
No tests are added since this commit only adjusts if-then statements.
  • Loading branch information
AjinkyaDahale committed Jan 16, 2025
1 parent 5a40725 commit 5c52353
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/Mod/Sketcher/App/SketchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4449,11 +4449,9 @@ int SketchObject::join(int geoId1, Sketcher::PointPos posId1, int geoId2, Sketch

// end knots can have a multiplicity of (degree + 1)
if (bsp1->getDegree() < newMults.back()) {
newMults.back() = bsp1->getDegree();
if (makeC1Continuous) {
newMults.back() = bsp1->getDegree()-1;
}
else {
newMults.back() = bsp1->getDegree();
newMults.back() -= 1;
}
}

Expand All @@ -4471,24 +4469,22 @@ int SketchObject::join(int geoId1, Sketcher::PointPos posId1, int geoId2, Sketch
THROWM(ValueError, "Failed to create joined curve.");
return -1;
}
else {
exposeInternalGeometry(newGeoId);
setConstruction(newGeoId, GeometryFacade::getConstruction(geo1));

// TODO: transfer constraints on the non-connected ends
auto otherPosId1 = (Sketcher::PointPos::start == posId1) ? Sketcher::PointPos::end
: Sketcher::PointPos::start;
auto otherPosId2 = (Sketcher::PointPos::start == posId2) ? Sketcher::PointPos::end
: Sketcher::PointPos::start;
exposeInternalGeometry(newGeoId);
setConstruction(newGeoId, GeometryFacade::getConstruction(geo1));

transferConstraints(geoId1, otherPosId1, newGeoId, PointPos::start, true);
transferConstraints(geoId2, otherPosId2, newGeoId, PointPos::end, true);
// TODO: transfer constraints on the non-connected ends
auto otherPosId1 = (Sketcher::PointPos::start == posId1) ? Sketcher::PointPos::end
: Sketcher::PointPos::start;
auto otherPosId2 = (Sketcher::PointPos::start == posId2) ? Sketcher::PointPos::end
: Sketcher::PointPos::start;

delGeometries({geoId1, geoId2});
return 0;
}
transferConstraints(geoId1, otherPosId1, newGeoId, PointPos::start, true);
transferConstraints(geoId2, otherPosId2, newGeoId, PointPos::end, true);

return -1;
delGeometries({geoId1, geoId2});

return 0;
}

bool SketchObject::isExternalAllowed(App::Document* pDoc, App::DocumentObject* pObj,
Expand Down

0 comments on commit 5c52353

Please sign in to comment.