Skip to content

Commit

Permalink
[TD]fix thread line alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and davesrocketshop committed Mar 16, 2024
1 parent f98a91f commit 1411e70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/Mod/TechDraw/App/Cosmetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ void CosmeticEdge::initialize()
m_geometry->setCosmeticTag(getTagAsString());
}

// TODO: not sure that this method should be doing the inversion. CV for example
// accepts input point as is. The caller should have figured out the correct points.
TopoDS_Edge CosmeticEdge::TopoDS_EdgeFromVectors(const Base::Vector3d& pt1, const Base::Vector3d& pt2)
{
// Base::Console().Message("CE::CE(p1, p2)\n");
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/App/CosmeticVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Base::Vector3d CosmeticVertex::rotatedAndScaled(const double scale, const double

//! converts a point into its unscaled, unrotated form. If point is Gui space coordinates,
//! it should be inverted (DU::invertY) before calling this method, and the result should be
//! inverted on return.
//! inverted back on return.
Base::Vector3d CosmeticVertex::makeCanonicalPoint(DrawViewPart* dvp, Base::Vector3d point, bool unscale)
{
// Base::Console().Message("CV::makeCanonicalPoint(%s)\n", DU::formatVector(point).c_str());
Expand Down
10 changes: 3 additions & 7 deletions src/Mod/TechDraw/Gui/CommandExtensionPack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,8 +2122,8 @@ void _createThreadLines(std::vector<std::string> SubNames, TechDraw::DrawViewPar

TechDraw::GenericPtr line0 = std::static_pointer_cast<TechDraw::Generic>(geom0);
TechDraw::GenericPtr line1 = std::static_pointer_cast<TechDraw::Generic>(geom1);
// start and end points are scaled and rotated. invert the points
// so the canonicalPoint math works correctly.
// start and end points are scaled,rotated and inverted (CSRIx). We need to
// uninvert the points so the canonicalPoint math works correctly.
Base::Vector3d start0 = DU::invertY(line0->getStartPoint());
Base::Vector3d end0 = DU::invertY(line0->getEndPoint());
Base::Vector3d start1 = DU::invertY(line1->getStartPoint());
Expand All @@ -2133,11 +2133,6 @@ void _createThreadLines(std::vector<std::string> SubNames, TechDraw::DrawViewPar
start1 = CosmeticVertex::makeCanonicalPoint(objFeat, start1);
end0 = CosmeticVertex::makeCanonicalPoint(objFeat, end0);
end1 = CosmeticVertex::makeCanonicalPoint(objFeat, end1);
// put the points back into weird Qt coord system.
start0 = DU::invertY(start0);
start1 = DU::invertY(start1);
end0 = DU::invertY(end0);
end1 = DU::invertY(end1);
if (DrawUtil::circulation(start0, end0, start1)
!= DrawUtil::circulation(end0, end1, start1)) {
Base::Vector3d help1 = start1;
Expand All @@ -2148,6 +2143,7 @@ void _createThreadLines(std::vector<std::string> SubNames, TechDraw::DrawViewPar
float kernelDiam = (start1 - start0).Length();
float kernelFactor = (kernelDiam * factor - kernelDiam) / 2;
Base::Vector3d delta = (start1 - start0).Normalize() * kernelFactor;
// addCosmeticEdge(pt1, pt2) inverts the points before creating the edge
std::string line0Tag =
objFeat->addCosmeticEdge(start0 - delta, end0 - delta);
std::string line1Tag =
Expand Down

0 comments on commit 1411e70

Please sign in to comment.