Skip to content

Commit

Permalink
[TD]Section Line position
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Nov 27, 2019
1 parent 54d9e04 commit acc7686
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/Mod/TechDraw/App/DrawViewPart.cpp
Expand Up @@ -328,6 +328,7 @@ GeometryObject* DrawViewPart::makeGeometryForShape(TopoDS_Shape shape)
//center shape on origin
TopoDS_Shape centeredShape = TechDraw::moveShape(shape,
centroid * -1.0);
m_saveCentroid = centroid;
m_saveShape = centeredShape;

TopoDS_Shape scaledShape = TechDraw::scaleShape(centeredShape,
Expand Down Expand Up @@ -792,12 +793,10 @@ gp_Ax2 DrawViewPart::getViewAxis(const Base::Vector3d& pt,
}

//TODO: make saveShape a property
Base::Vector3d DrawViewPart::getCentroid(void) const

Base::Vector3d DrawViewPart::getOriginalCentroid(void) const
{
Base::Vector3d stdOrg(0.0,0.0,0.0);
Base::Vector3d centroid = TechDraw::findCentroidVec(m_saveShape,
getProjectionCS(stdOrg));
return centroid;
return m_saveCentroid;
}

std::vector<DrawViewSection*> DrawViewPart::getSectionRefs(void) const
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/TechDraw/App/DrawViewPart.h
Expand Up @@ -155,7 +155,7 @@ class TechDrawExport DrawViewPart : public DrawView
const bool flip=true) const;
virtual gp_Ax2 getProjectionCS(Base::Vector3d pt) const;
virtual Base::Vector3d getXDirection(void) const; //don't use XDirection.getValue()
virtual Base::Vector3d getCentroid(void) const;
virtual Base::Vector3d getOriginalCentroid(void) const;
virtual Base::Vector3d getLegacyX(const Base::Vector3d& pt,
const Base::Vector3d& axis,
const bool flip = true) const;
Expand Down Expand Up @@ -247,6 +247,7 @@ class TechDrawExport DrawViewPart : public DrawView
bool m_handleFaces;

TopoDS_Shape m_saveShape; //TODO: make this a Property. Part::TopoShapeProperty??
Base::Vector3d m_saveCentroid; //centroid before centering shape in origin

private:
bool nowUnsetting;
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/TechDraw/Gui/QGIViewPart.cpp
Expand Up @@ -781,9 +781,9 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b

//dvp is centered on centroid looking along dvp direction
//dvs is centered on SO looking along section normal
//need to subtract SO from centroid to get displacement
//dvp view origin is 000 + centroid
Base::Vector3d org = viewSection->SectionOrigin.getValue();
Base::Vector3d cent = viewPart->getCentroid();
Base::Vector3d cent = viewPart->getOriginalCentroid();
Base::Vector3d adjOrg = org - cent;
double scale = viewPart->getScale();

Expand All @@ -794,7 +794,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
displace.ProjectToLine(pAdjOrg, arrowDir);
Base::Vector3d offset = pAdjOrg + displace;

// makeMark(0.0, 0.0);
// makeMark(0.0, 0.0); //red

sectionLine->setPos(Rez::guiX(offset.x),Rez::guiX(offset.y));
double sectionSpan;
Expand Down

0 comments on commit acc7686

Please sign in to comment.