From df390b0c88bd73d3de398089ae4c3cf97fce1f71 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 13 Jul 2025 12:00:10 -0400 Subject: [PATCH] [TD]property type changes --- src/Mod/TechDraw/App/DrawViewDetail.cpp | 6 ++--- src/Mod/TechDraw/App/DrawViewDetail.h | 4 ++-- src/Mod/TechDraw/App/DrawViewPart.cpp | 8 +++---- src/Mod/TechDraw/App/DrawViewPart.h | 4 ++-- src/Mod/TechDraw/App/DrawViewSection.cpp | 30 +++++++++++++----------- src/Mod/TechDraw/App/DrawViewSection.h | 6 ++--- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index 3a9d0a67e3..811ad1731c 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -482,8 +482,8 @@ bool DrawViewDetail::debugDetail() const void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) { if (prop == &AnchorPoint) { - // AnchorPoint was PropertyVector but is now PropertyPosition - App::PropertyVector tmp; + // AnchorPoint was PropertyVector, then briefly PropertyPosition, now back to PropertyVector + App::PropertyPosition tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); tmp.Restore(reader); @@ -494,7 +494,7 @@ void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const ch } if (prop == &Radius) { - // Radius was PropertyFloat but is now PropertyLength + // Radius was PropertyFloat, then briefly PropertyLength, now back to PropertyFloat App::PropertyLength tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); diff --git a/src/Mod/TechDraw/App/DrawViewDetail.h b/src/Mod/TechDraw/App/DrawViewDetail.h index 8c79e85344..0f9cbfef3b 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.h +++ b/src/Mod/TechDraw/App/DrawViewDetail.h @@ -57,8 +57,8 @@ public: ~DrawViewDetail() override; App::PropertyLink BaseView; - App::PropertyPosition AnchorPoint; - App::PropertyLength Radius; + App::PropertyVector AnchorPoint; + App::PropertyFloat Radius; App::PropertyString Reference; App::PropertyBool ShowMatting; diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 1b866a095b..3ab0f9fdbc 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -1516,8 +1516,8 @@ void DrawViewPart::resetReferenceVerts() void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) { if (prop == &Direction) { - // Direction was PropertyVector but is now PropertyDirection - App::PropertyVector tmp; + // Direction was PropertyVector, then briefly PropertyDirection, now back to PropertyVector + App::PropertyDirection tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); tmp.Restore(reader); @@ -1528,8 +1528,8 @@ void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char } if (prop == &XDirection) { - // XDirection was PropertyFloat but is now PropertyLength - App::PropertyVector tmp; + // XDirection was PropertyVector, then briefly PropertyDirection, now back to PropertyVector + App::PropertyDirection tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); tmp.Restore(reader); diff --git a/src/Mod/TechDraw/App/DrawViewPart.h b/src/Mod/TechDraw/App/DrawViewPart.h index c4a971781d..83936c70eb 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.h +++ b/src/Mod/TechDraw/App/DrawViewPart.h @@ -115,8 +115,8 @@ public: App::PropertyLinkList Source; App::PropertyXLinkList XSource; - App::PropertyDirection Direction; // the projection direction - App::PropertyDirection XDirection; + App::PropertyVector Direction; // the projection direction. where you are looking from. + App::PropertyVector XDirection; App::PropertyBool Perspective; App::PropertyDistance Focus; diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index c7404766db..231ce6fa22 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -164,7 +164,7 @@ DrawViewSection::DrawViewSection() "2D View source for this Section"); BaseView.setScope(App::LinkScope::Global); - // default of (0, -1, 0) matches 'Front' direction in DVP + // default of (0, -1, 0) matches default 'Front' direction in DVP ADD_PROPERTY_TYPE(SectionNormal, (0, -1, 0), sgroup, @@ -182,6 +182,8 @@ DrawViewSection::DrawViewSection() sgroup, App::Prop_None, "Orientation of this Section in the Base View"); + SectionDirection.setStatus(App::Property::Hidden, true); + SectionDirection.setStatus(App::Property::ReadOnly, true); // properties related to the cut operation ADD_PROPERTY_TYPE(FuseBeforeCut, @@ -259,8 +261,6 @@ DrawViewSection::DrawViewSection() Direction.setStatus(App::Property::ReadOnly, true); Direction.setValue(SectionNormal.getValue()); - SectionDirection.setStatus(App::Property::Hidden, true); - SectionDirection.setStatus(App::Property::ReadOnly, true); } DrawViewSection::~DrawViewSection() @@ -299,8 +299,7 @@ void DrawViewSection::onChanged(const App::Property* prop) return; } - if (prop == &SectionNormal || - prop == &XDirection) { + if (prop == &SectionNormal) { Direction.setValue(SectionNormal.getValue()); return; } @@ -568,7 +567,7 @@ void DrawViewSection::makeSectionCut(const TopoDS_Shape& baseShape) //! position, scale and rotate shape for buildGeometryObject //! save the cut shape for further processing -TopoDS_Shape DrawViewSection::prepareShape(const TopoDS_Shape& rawShape, double shapeSize) +TopoDS_Shape DrawViewSection::prepareShape(const TopoDS_Shape& uncenteredCutShape, double shapeSize) { (void)shapeSize;// shapeSize is not used in this base class, but is // interesting for derived classes @@ -578,11 +577,11 @@ TopoDS_Shape DrawViewSection::prepareShape(const TopoDS_Shape& rawShape, double Base::Vector3d origin(0.0, 0.0, 0.0); m_projectionCS = getProjectionCS(origin); gp_Pnt inputCenter; - inputCenter = ShapeUtils::findCentroid(rawShape, m_projectionCS); + inputCenter = ShapeUtils::findCentroid(uncenteredCutShape, m_projectionCS); Base::Vector3d centroid(inputCenter.X(), inputCenter.Y(), inputCenter.Z()); - m_cutShapeRaw = rawShape; - preparedShape = ShapeUtils::moveShape(rawShape, centroid * -1.0); + m_cutShapeRaw = uncenteredCutShape; + preparedShape = ShapeUtils::moveShape(uncenteredCutShape, centroid * -1.0); m_cutShape = preparedShape; m_saveCentroid = centroid; @@ -1067,7 +1066,7 @@ void DrawViewSection::setCSFromBase(const Base::Vector3d& localUnit) Base::Vector3d vXDir(newSectionCS.XDirection().X(), newSectionCS.XDirection().Y(), newSectionCS.XDirection().Z()); - XDirection.setValue(vXDir);// XDir is for projection + XDirection.setValue(vXDir); } // reset the section CS based on an XY vector in current section CS @@ -1230,9 +1229,11 @@ void DrawViewSection::setupObject() void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) { + DrawViewPart::handleChangedPropertyType(reader, TypeName, prop); + if (prop == &SectionOrigin) { - // SectionOrigin was PropertyVector but is now PropertyPosition - App::PropertyVector tmp; + // SectionOrigin was PropertyVector then briefly PropertyPosition, now back to PropertyVector + App::PropertyPosition tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); tmp.Restore(reader); @@ -1243,13 +1244,14 @@ void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const c } if (prop == &SectionNormal) { - // Radius was PropertyVector but is now PropertyDirection - App::PropertyVector tmp; + // Radius was PropertyVector, then briefly PropertyDirection, then PropertyVector + App::PropertyDirection tmp; if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { tmp.setContainer(this); tmp.Restore(reader); auto tmpValue = tmp.getValue(); SectionNormal.setValue(tmpValue); + Direction.setValue(tmpValue); } return; } diff --git a/src/Mod/TechDraw/App/DrawViewSection.h b/src/Mod/TechDraw/App/DrawViewSection.h index 5d85978511..d2d8ef05df 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.h +++ b/src/Mod/TechDraw/App/DrawViewSection.h @@ -87,8 +87,8 @@ public: //NOLINTBEGIN App::PropertyLink BaseView; - App::PropertyDirection SectionNormal; - App::PropertyPosition SectionOrigin; + App::PropertyVector SectionNormal; + App::PropertyVector SectionOrigin; App::PropertyString SectionSymbol; @@ -196,7 +196,7 @@ protected: bool trimAfterCut() const; TopoDS_Shape m_cutShape; // centered, scaled, rotated result of cut - TopoDS_Shape m_cutShapeRaw; // raw result of cut w/o center/scale/rotate + TopoDS_Shape m_cutShapeRaw; // copy of input to prepare shape void onDocumentRestored() override; void setupObject() override;