fix property names for Part RegularPolygon and Prism
Prism properties: - Polygon, Circumradius and Height RegularPolygon : - Polygon and Circumradius DraftTools updated to reflect the change in property names
This commit is contained in:
parent
bcb7d02c05
commit
41adfdaf87
|
@ -471,8 +471,8 @@ PROPERTY_SOURCE(Part::Prism, Part::Primitive)
|
|||
|
||||
Prism::Prism(void)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Polygon,(6.0),"Prism",App::Prop_None,"The polygon of the prism");
|
||||
ADD_PROPERTY_TYPE(Length,(2.0),"Prism",App::Prop_None,"The edge length of the prism");
|
||||
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");
|
||||
Polygon.setConstraints(&polygonRange);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ short Prism::mustExecute() const
|
|||
{
|
||||
if (Polygon.isTouched())
|
||||
return 1;
|
||||
if (Length.isTouched())
|
||||
if (Circumradius.isTouched())
|
||||
return 1;
|
||||
if (Height.isTouched())
|
||||
return 1;
|
||||
|
@ -492,11 +492,11 @@ App::DocumentObjectExecReturn *Prism::execute(void)
|
|||
{
|
||||
// Build a prism
|
||||
if (Polygon.getValue() < 3)
|
||||
return new App::DocumentObjectExecReturn("Polygon of prism is invalid");
|
||||
if (Length.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Radius of prism too small");
|
||||
return new App::DocumentObjectExecReturn("Polygon of prism is invalid, must have 3 or more sides");
|
||||
if (Circumradius.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Circumradius of the polygon, of the prism, is too small");
|
||||
if (Height.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Height of prism too small");
|
||||
return new App::DocumentObjectExecReturn("Height of prism is too small");
|
||||
try {
|
||||
long nodes = Polygon.getValue();
|
||||
|
||||
|
@ -505,7 +505,7 @@ App::DocumentObjectExecReturn *Prism::execute(void)
|
|||
|
||||
// create polygon
|
||||
BRepBuilderAPI_MakePolygon mkPoly;
|
||||
Base::Vector3d v(Length.getValue(),0,0);
|
||||
Base::Vector3d v(Circumradius.getValue(),0,0);
|
||||
for (long i=0; i<nodes; i++) {
|
||||
mkPoly.Add(gp_Pnt(v.x,v.y,v.z));
|
||||
v = mat * v;
|
||||
|
@ -523,46 +523,43 @@ App::DocumentObjectExecReturn *Prism::execute(void)
|
|||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
App::PropertyIntegerConstraint::Constraints RegularPolygon::numberOfSides = {3,INT_MAX,1};
|
||||
App::PropertyIntegerConstraint::Constraints RegularPolygon::polygon = {3,INT_MAX,1};
|
||||
|
||||
PROPERTY_SOURCE(Part::RegularPolygon, Part::Primitive)
|
||||
|
||||
RegularPolygon::RegularPolygon(void)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(NumberOfSides,(6.0),"RegularPolygon",App::Prop_None,"The number of sides of the regular polygon");
|
||||
ADD_PROPERTY_TYPE(Radius,(2.0),"RegularPolygon",App::Prop_None,"The inscribed radius of the regular polygon");
|
||||
// ADD_PROPERTY_TYPE(Height,(10.0f),"RegularPolygon",App::Prop_None,"The height of the regular polygon");
|
||||
NumberOfSides.setConstraints(&numberOfSides);
|
||||
ADD_PROPERTY_TYPE(Polygon,(6.0),"RegularPolygon",App::Prop_None,"Number of sides in the regular polygon");
|
||||
ADD_PROPERTY_TYPE(Circumradius,(2.0),"RegularPolygon",App::Prop_None,"Circumradius (centre to vertex) of the polygon");
|
||||
Polygon.setConstraints(&polygon);
|
||||
}
|
||||
|
||||
short RegularPolygon::mustExecute() const
|
||||
{
|
||||
if (NumberOfSides.isTouched())
|
||||
if (Polygon.isTouched())
|
||||
return 1;
|
||||
if (Radius.isTouched())
|
||||
if (Circumradius.isTouched())
|
||||
return 1;
|
||||
// if (Height.isTouched())
|
||||
// return 1;
|
||||
return Primitive::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *RegularPolygon::execute(void)
|
||||
{
|
||||
// Build a regular polygon
|
||||
if (NumberOfSides.getValue() < 3)
|
||||
return new App::DocumentObjectExecReturn("Less than the minimum 3 sides is invalid");
|
||||
if (Radius.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Radius of prism too small");
|
||||
if (Polygon.getValue() < 3)
|
||||
return new App::DocumentObjectExecReturn("the polygon is invalid, must have 3 or more sides");
|
||||
if (Circumradius.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Circumradius of the polygon is too small");
|
||||
|
||||
try {
|
||||
long nodes = NumberOfSides.getValue();
|
||||
long nodes = Polygon.getValue();
|
||||
|
||||
Base::Matrix4D mat;
|
||||
mat.rotZ(Base::toRadians(360.0/nodes));
|
||||
|
||||
// create polygon
|
||||
BRepBuilderAPI_MakePolygon mkPoly;
|
||||
Base::Vector3d v(Radius.getValue(),0,0);
|
||||
Base::Vector3d v(Circumradius.getValue(),0,0);
|
||||
for (long i=0; i<nodes; i++) {
|
||||
mkPoly.Add(gp_Pnt(v.x,v.y,v.z));
|
||||
v = mat * v;
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
Prism();
|
||||
|
||||
App::PropertyIntegerConstraint Polygon;
|
||||
App::PropertyLength Length;
|
||||
App::PropertyLength Circumradius;
|
||||
App::PropertyLength Height;
|
||||
|
||||
/** @name methods override feature */
|
||||
|
@ -227,8 +227,8 @@ class PartExport RegularPolygon : public Primitive
|
|||
public:
|
||||
RegularPolygon();
|
||||
|
||||
App::PropertyIntegerConstraint NumberOfSides;
|
||||
App::PropertyLength Radius;
|
||||
App::PropertyIntegerConstraint Polygon;
|
||||
App::PropertyLength Circumradius;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
|
@ -241,7 +241,7 @@ public:
|
|||
}
|
||||
//@}
|
||||
private:
|
||||
static App::PropertyIntegerConstraint::Constraints numberOfSides;
|
||||
static App::PropertyIntegerConstraint::Constraints polygon;
|
||||
};
|
||||
|
||||
class PartExport Cone : public Primitive
|
||||
|
|
|
@ -460,12 +460,12 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
|||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Prism\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Polygon=%2\n"
|
||||
"App.ActiveDocument.%1.Length=%3\n"
|
||||
"App.ActiveDocument.%1.Circumradius=%3\n"
|
||||
"App.ActiveDocument.%1.Height=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.prismPolygon->value())
|
||||
.arg(ui.prismLength->value(),0,'f',2)
|
||||
.arg(ui.prismCircumradius->value(),0,'f',2)
|
||||
.arg(ui.prismHeight->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
|
@ -598,12 +598,12 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
|||
name = QString::fromAscii(doc->getUniqueObjectName("RegularPolygon").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::RegularPolygon\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.NumberOfSides=%2\n"
|
||||
"App.ActiveDocument.%1.Radius=%3\n"
|
||||
"App.ActiveDocument.%1.Polygon=%2\n"
|
||||
"App.ActiveDocument.%1.Circumradius=%3\n"
|
||||
"App.ActiveDocument.%1.Placement=%4\n")
|
||||
.arg(name)
|
||||
.arg(ui.regularPolygonNumberOfSides->value())
|
||||
.arg(ui.regularPolygonRadius->value(),0,'f',2)
|
||||
.arg(ui.regularPolygonPolygon->value())
|
||||
.arg(ui.regularPolygonCircumradius->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
|
||||
|
|
|
@ -1003,14 +1003,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPrismLength">
|
||||
<widget class="QLabel" name="labelPrismCircumradius">
|
||||
<property name="text">
|
||||
<string>Length:</string>
|
||||
<string>Circumradius:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="prismLength">
|
||||
<widget class="QDoubleSpinBox" name="prismCircumradius">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
|
@ -1875,14 +1875,14 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelRegularPolygonNumberOfSides">
|
||||
<widget class="QLabel" name="labelRegularPolygonPolygon">
|
||||
<property name="text">
|
||||
<string>Number Of Sides:</string>
|
||||
<string>Polygon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="regularPolygonNumberOfSides">
|
||||
<widget class="QSpinBox" name="regularPolygonPolygon">
|
||||
<property name="maximum">
|
||||
<double>1000</double>
|
||||
</property>
|
||||
|
@ -1895,14 +1895,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelRegularPolygonRadius">
|
||||
<widget class="QLabel" name="labelRegularPolygonCircumradius">
|
||||
<property name="text">
|
||||
<string>Radius:</string>
|
||||
<string>Circumradius:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="regularPolygonRadius">
|
||||
<widget class="QDoubleSpinBox" name="regularPolygonCircumradius">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
|
|
|
@ -59,8 +59,6 @@ std::vector<std::string> ViewProviderRegularPolygon::getDisplayModes(void) const
|
|||
std::vector<std::string> StrList;
|
||||
|
||||
// add your own modes
|
||||
// StrList.push_back("Flat Lines");
|
||||
// StrList.push_back("Shaded");
|
||||
StrList.push_back("Wireframe");
|
||||
StrList.push_back("Points");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user