From 57d2a2fae0504a167b73d562235e04d2b373e698 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 5 Apr 2021 13:25:19 +0200 Subject: [PATCH] Part: for Prism feature use PrismExtension --- src/Mod/Part/App/PrimitiveFeature.cpp | 17 +++-------------- src/Mod/Part/App/PrimitiveFeature.h | 6 +++--- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/Mod/Part/App/PrimitiveFeature.cpp b/src/Mod/Part/App/PrimitiveFeature.cpp index e95e1bc7b404..fdb9630bd2e6 100644 --- a/src/Mod/Part/App/PrimitiveFeature.cpp +++ b/src/Mod/Part/App/PrimitiveFeature.cpp @@ -573,12 +573,9 @@ Prism::Prism(void) ADD_PROPERTY_TYPE(Polygon, (6.0), "Prism", App::Prop_None, "Number of sides in the polygon, of the prism"); ADD_PROPERTY_TYPE(Circumradius, (2.0), "Prism", App::Prop_None, "Circumradius (centre to vertex) of the polygon, of the prism"); ADD_PROPERTY_TYPE(Height, (10.0f), "Prism", App::Prop_None, "The height of the prism"); - ADD_PROPERTY_TYPE(FirstAngle, (0.0f), "Prism", App::Prop_None, "Angle in first direction"); - ADD_PROPERTY_TYPE(SecondAngle, (0.0f), "Prism", App::Prop_None, "Angle in second direction"); Polygon.setConstraints(&polygonRange); - static const App::PropertyQuantityConstraint::Constraints angleConstraint = { -89.99999, 89.99999, 1.0 }; - FirstAngle.setConstraints(&angleConstraint); - SecondAngle.setConstraints(&angleConstraint); + + PrismExtension::initExtension(this); } short Prism::mustExecute() const @@ -589,10 +586,6 @@ short Prism::mustExecute() const return 1; if (Height.isTouched()) return 1; - if (FirstAngle.isTouched()) - return 1; - if (SecondAngle.isTouched()) - return 1; return Primitive::mustExecute(); } @@ -621,11 +614,7 @@ App::DocumentObjectExecReturn *Prism::execute(void) mkPoly.Add(gp_Pnt(v.x,v.y,v.z)); BRepBuilderAPI_MakeFace mkFace(mkPoly.Wire()); // the direction vector for the prism is the height for z and the given angle - BRepPrimAPI_MakePrism mkPrism(mkFace.Face(), - gp_Vec(Height.getValue() * tan(Base::toRadians(FirstAngle.getValue())), - Height.getValue() * tan(Base::toRadians(SecondAngle.getValue())), - Height.getValue())); - this->Shape.setValue(mkPrism.Shape()); + this->Shape.setValue(makePrism(Height.getValue(), mkFace.Face())); } catch (Standard_Failure& e) { return new App::DocumentObjectExecReturn(e.GetMessageString()); diff --git a/src/Mod/Part/App/PrimitiveFeature.h b/src/Mod/Part/App/PrimitiveFeature.h index 9f8f1508022f..c32009903cf1 100644 --- a/src/Mod/Part/App/PrimitiveFeature.h +++ b/src/Mod/Part/App/PrimitiveFeature.h @@ -27,6 +27,7 @@ #include #include "PartFeature.h" #include "AttachExtension.h" +#include "PrismExtension.h" namespace Part { @@ -199,7 +200,8 @@ class PartExport Cylinder : public Primitive //@} }; -class PartExport Prism : public Primitive +class PartExport Prism : public Primitive, + public PrismExtension { PROPERTY_HEADER(Part::Prism); @@ -209,8 +211,6 @@ class PartExport Prism : public Primitive App::PropertyIntegerConstraint Polygon; App::PropertyLength Circumradius; App::PropertyLength Height; - App::PropertyAngle FirstAngle; - App::PropertyAngle SecondAngle; /** @name methods override feature */ //@{