Add Part_RegularPolygon,

regular polygon edge in Part workbench "create primitives",

Add icons Part_Polygon and Part_Spline
This commit is contained in:
jmaustpc
2013-11-11 01:23:47 +11:00
committed by Yorik van Havre
parent 3be45a18a5
commit cb540afa2e
12 changed files with 774 additions and 47 deletions

View File

@@ -194,6 +194,7 @@ void PartExport initPart()
Part::Sphere ::init();
Part::Cylinder ::init();
Part::Prism ::init();
Part::RegularPolygon ::init();
Part::Cone ::init();
Part::Torus ::init();
Part::Helix ::init();

View File

@@ -523,6 +523,65 @@ App::DocumentObjectExecReturn *Prism::execute(void)
return App::DocumentObject::StdReturn;
}
App::PropertyIntegerConstraint::Constraints RegularPolygon::numberOfSides = {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);
}
short RegularPolygon::mustExecute() const
{
if (NumberOfSides.isTouched())
return 1;
if (Radius.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 (Height.getValue() < Precision::Confusion())
// return new App::DocumentObjectExecReturn("Height of prism too small");
try {
long nodes = NumberOfSides.getValue();
Base::Matrix4D mat;
mat.rotZ(Base::toRadians(360.0/nodes));
// create polygon
BRepBuilderAPI_MakePolygon mkPoly;
Base::Vector3d v(Radius.getValue(),0,0);
for (long i=0; i<nodes; i++) {
mkPoly.Add(gp_Pnt(v.x,v.y,v.z));
v = mat * v;
}
mkPoly.Add(gp_Pnt(v.x,v.y,v.z));
// BRepBuilderAPI_MakeFace mkFace(mkPoly.Wire());
// BRepPrimAPI_MakePrism mkPrism(mkFace.Face(), gp_Vec(0,0,Height.getValue()));
this->Shape.setValue(mkPoly.Shape());
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
return new App::DocumentObjectExecReturn(e->GetMessageString());
}
return App::DocumentObject::StdReturn;
}
PROPERTY_SOURCE(Part::Cone, Part::Primitive)
Cone::Cone(void)

View File

@@ -220,6 +220,31 @@ private:
static App::PropertyIntegerConstraint::Constraints polygonRange;
};
class PartExport RegularPolygon : public Primitive
{
PROPERTY_HEADER(Part::RegularPolygon);
public:
RegularPolygon();
App::PropertyIntegerConstraint NumberOfSides;
App::PropertyLength Radius;
App::PropertyLength Height;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the ViewProvider
const char* getViewProviderName(void) const {
return "PartGui::ViewProviderRegularPolygon";
}
//@}
private:
static App::PropertyIntegerConstraint::Constraints numberOfSides;
};
class PartExport Cone : public Primitive
{
PROPERTY_HEADER(Part::Cone);

View File

@@ -24,9 +24,8 @@
#include <Mod/Part/App/PropertyTopoShape.h>
#include "SoBrepShape.h"
#include "SoBrepFaceSet.h"
#include "SoBrepEdgeSet.h"
#include "SoBrepPointSet.h"
#include "SoFCShapeObject.h"
#include "ViewProvider.h"
#include "ViewProviderExt.h"
@@ -51,7 +50,7 @@
#include "ViewProviderTorusParametric.h"
#include "ViewProviderRuledSurface.h"
#include "ViewProviderPrism.h"
#include "ViewProviderSpline.h"
#include "ViewProviderRegularPolygon.h"
#include "DlgSettingsGeneral.h"
#include "DlgSettingsObjectColor.h"
@@ -59,6 +58,7 @@
#include "Workbench.h"
#include <Gui/Language/Translator.h>
#include "qrc_Part.cpp"
#include "Resources/icons/PartFeature.xpm"
#include "Resources/icons/PartFeatureImport.xpm"
@@ -100,52 +100,50 @@ void PartGuiExport initPartGui()
(void) Py_InitModule("PartGui", PartGui_methods); /* mod name, table ptr */
Base::Console().Log("Loading GUI of Part module... done\n");
PartGui::SoBrepFaceSet ::initClass();
PartGui::SoBrepEdgeSet ::initClass();
PartGui::SoBrepPointSet ::initClass();
PartGui::SoFCControlPoints ::initClass();
PartGui::ViewProviderPartBase ::init();
PartGui::ViewProviderPartExt ::init();
PartGui::ViewProviderPart ::init();
PartGui::ViewProviderEllipsoid ::init();
PartGui::ViewProviderPython ::init();
PartGui::ViewProviderBox ::init();
PartGui::ViewProviderPrism ::init();
PartGui::ViewProviderWedge ::init();
PartGui::ViewProviderImport ::init();
PartGui::ViewProviderCurveNet ::init();
PartGui::ViewProviderExtrusion ::init();
PartGui::ViewProvider2DObject ::init();
PartGui::ViewProvider2DObjectPython ::init();
PartGui::ViewProviderMirror ::init();
PartGui::ViewProviderFillet ::init();
PartGui::ViewProviderChamfer ::init();
PartGui::ViewProviderRevolution ::init();
PartGui::ViewProviderLoft ::init();
PartGui::ViewProviderSweep ::init();
PartGui::ViewProviderOffset ::init();
PartGui::ViewProviderThickness ::init();
PartGui::ViewProviderCustom ::init();
PartGui::ViewProviderCustomPython ::init();
PartGui::ViewProviderBoolean ::init();
PartGui::ViewProviderMultiFuse ::init();
PartGui::ViewProviderMultiCommon ::init();
PartGui::ViewProviderCompound ::init();
PartGui::ViewProviderSpline ::init();
PartGui::ViewProviderCircleParametric ::init();
PartGui::ViewProviderLineParametric ::init();
PartGui::ViewProviderPointParametric ::init();
PartGui::ViewProviderEllipseParametric ::init();
PartGui::ViewProviderHelixParametric ::init();
PartGui::ViewProviderSpiralParametric ::init();
PartGui::ViewProviderPlaneParametric ::init();
PartGui::ViewProviderSphereParametric ::init();
PartGui::SoBrepFaceSet ::initClass();
PartGui::SoBrepEdgeSet ::initClass();
PartGui::SoBrepPointSet ::initClass();
PartGui::SoFCControlPoints ::initClass();
PartGui::ViewProviderPartBase ::init();
PartGui::ViewProviderPartExt ::init();
PartGui::ViewProviderPart ::init();
PartGui::ViewProviderEllipsoid ::init();
PartGui::ViewProviderPython ::init();
PartGui::ViewProviderBox ::init();
PartGui::ViewProviderPrism ::init();
PartGui::ViewProviderRegularPolygon ::init();
PartGui::ViewProviderImport ::init();
PartGui::ViewProviderCurveNet ::init();
PartGui::ViewProviderExtrusion ::init();
PartGui::ViewProvider2DObject ::init();
PartGui::ViewProvider2DObjectPython ::init();
PartGui::ViewProviderMirror ::init();
PartGui::ViewProviderFillet ::init();
PartGui::ViewProviderChamfer ::init();
PartGui::ViewProviderRevolution ::init();
PartGui::ViewProviderLoft ::init();
PartGui::ViewProviderSweep ::init();
PartGui::ViewProviderOffset ::init();
PartGui::ViewProviderThickness ::init();
PartGui::ViewProviderCustom ::init();
PartGui::ViewProviderCustomPython ::init();
PartGui::ViewProviderBoolean ::init();
PartGui::ViewProviderMultiFuse ::init();
PartGui::ViewProviderMultiCommon ::init();
PartGui::ViewProviderCompound ::init();
PartGui::ViewProviderCircleParametric ::init();
PartGui::ViewProviderLineParametric ::init();
PartGui::ViewProviderPointParametric ::init();
PartGui::ViewProviderEllipseParametric ::init();
PartGui::ViewProviderHelixParametric ::init();
PartGui::ViewProviderPlaneParametric ::init();
PartGui::ViewProviderSphereParametric ::init();
PartGui::ViewProviderCylinderParametric ::init();
PartGui::ViewProviderConeParametric ::init();
PartGui::ViewProviderTorusParametric ::init();
PartGui::ViewProviderRuledSurface ::init();
PartGui::ViewProviderConeParametric ::init();
PartGui::ViewProviderTorusParametric ::init();
PartGui::ViewProviderRuledSurface ::init();
PartGui::Workbench ::init();
PartGui::Workbench ::init();
// instantiating the commands
CreatePartCommands();

View File

@@ -167,6 +167,8 @@ SET(PartGui_SRCS
ViewProviderConeParametric.h
ViewProviderPrism.cpp
ViewProviderPrism.h
ViewProviderRegularPolygon.cpp
ViewProviderRegularPolygon.h
ViewProviderTorusParametric.cpp
ViewProviderTorusParametric.h
ViewProviderCurveNet.cpp

View File

@@ -259,6 +259,7 @@ DlgPrimitives::DlgPrimitives(QWidget* parent)
ui.edgeY2->setMinimum(INT_MIN);
ui.edgeZ2->setMaximum(INT_MAX);
ui.edgeZ2->setMinimum(INT_MIN);
// RegularPolygon
}
/*
@@ -593,6 +594,18 @@ void DlgPrimitives::createPrimitive(const QString& placement)
.arg(ui.edgeZ2->value(),0,'f',2)
.arg(placement);
}
else if (ui.comboBox1->currentIndex() == 14) { // RegularPolygon
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.Placement=%5\n")
.arg(name)
.arg(ui.regularPolygonNumberOfSides->value())
.arg(ui.regularPolygonRadius->value(),0,'f',2)
.arg(placement);
}
// Execute the Python block
QString prim = tr("Create %1").arg(ui.comboBox1->currentText());

View File

@@ -103,6 +103,11 @@
<string>Line</string>
</property>
</item>
<item>
<property name="text">
<string>RegularPolygon</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
@@ -1853,6 +1858,79 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_regularPolygon">
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelRegularPolygonNumberOfSides">
<property name="text">
<string>Number Of Sides:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="regularPolygonNumberOfSides">
<property name="maximum">
<double>1000</double>
</property>
<property name="minimum">
<double>3</double>
</property>
<property name="value">
<double>6</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelRegularPolygonRadius">
<property name="text">
<string>Radius:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="regularPolygonRadius">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@@ -40,6 +40,8 @@
<file>icons/Part_Line_Parametric.svg</file>
<file>icons/Part_Circle_Parametric.svg</file>
<file>icons/Part_Point_Parametric.svg</file>
<file>icons/Part_Polygon_Parametric.svg</file>
<file>icons/Part_Spline_Parametric.svg</file>
<file>icons/Tree_Part_Box_Parametric.svg</file>
<file>icons/Tree_Part_Cylinder_Parametric.svg</file>
<file>icons/Tree_Part_Cone_Parametric.svg</file>

View File

@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg3052"
sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Part_Polygon_Parametric.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3054">
<linearGradient
id="linearGradient4032">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective3060" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3705"
gradientUnits="userSpaceOnUse"
cx="148.88333"
cy="81.869568"
fx="148.88333"
fy="81.869568"
r="19.467436"
gradientTransform="matrix(1.6244669,-0.05136783,0.04345521,0.9993132,-102.99033,7.7040438)" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#4bff54;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#00b800;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3206"
id="radialGradient3703"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.87904684,0.2250379,-0.41709097,2.0016728,56.73751,-127.99883)" />
<linearGradient
id="linearGradient3199">
<stop
id="stop3201"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3203"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3692"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3206">
<stop
id="stop3208"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3210"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032"
id="radialGradient4030"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.260164,-0.05136783,0.03370995,0.9993132,-43.139781,7.2044077)"
cx="148.88333"
cy="81.869568"
fx="148.88333"
fy="81.869568"
r="19.467436" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="12.375"
inkscape:cx="32"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="964"
inkscape:window-x="-2"
inkscape:window-y="-3"
inkscape:window-maximized="1"
inkscape:snap-global="false"
showguides="true"
inkscape:guide-bbox="true">
<sodipodi:guide
orientation="0,1"
position="31.959442,64.811153"
id="guide3868" />
</sodipodi:namedview>
<metadata
id="metadata3057">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:none;stroke:#0034ff;stroke-width:5.91920948;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 31.786417,6.1814916 8.0249875,18.216742 8.1047238,45.475391 30.989055,57.749753 54.192329,45.634798 l -10e-7,-27.019536 z"
id="path3791"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.5375294,0,0,0.54858724,-4.140097,24.770273)" />
<path
style="fill:none;stroke:#ff0900;stroke-width:4.43940735;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 31.286713,31.386122 53.724296,18.71563"
id="path3848"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-9"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.51667837,0,0,0.54346469,19.745674,12.029905)" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-6"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.52463285,0,0,0.51891128,-26.254894,38.850717)" />
<path
style="fill:none;stroke:#ff0900;stroke-width:4.43940735;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 8.0497535,45.571575 30.726545,57.370103"
id="path3848-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-9-1"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.52840295,0,0,0.51220806,-3.7779762,50.676798)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg3052"
sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Part_Spline_Parametric.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3054">
<linearGradient
id="linearGradient4032">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective3060" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3705"
gradientUnits="userSpaceOnUse"
cx="148.88333"
cy="81.869568"
fx="148.88333"
fy="81.869568"
r="19.467436"
gradientTransform="matrix(1.6244669,-0.05136783,0.04345521,0.9993132,-102.99033,7.7040438)" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#4bff54;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#00b800;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3206"
id="radialGradient3703"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.87904684,0.2250379,-0.41709097,2.0016728,56.73751,-127.99883)" />
<linearGradient
id="linearGradient3199">
<stop
id="stop3201"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3203"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3692"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3206">
<stop
id="stop3208"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3210"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032"
id="radialGradient4030"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.260164,-0.05136783,0.03370995,0.9993132,-43.139781,7.2044077)"
cx="148.88333"
cy="81.869568"
fx="148.88333"
fy="81.869568"
r="19.467436" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="12.359375"
inkscape:cx="32"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="964"
inkscape:window-x="-2"
inkscape:window-y="-3"
inkscape:window-maximized="1"
inkscape:snap-global="false"
showguides="true"
inkscape:guide-bbox="true">
<sodipodi:guide
orientation="0,1"
position="31.959442,64.811153"
id="guide3868" />
</sodipodi:namedview>
<metadata
id="metadata3057">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:none;stroke:#0034ff;stroke-width:5.72468805;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 8.2379722,54.347623 C 10.828679,38.993635 17.287289,19.890229 30.446901,33.514508 c 10.060552,11.3053 19.436205,7.415342 22.469392,-10.12481 0.771013,-4.334031 0.925798,-5.325441 1.730936,-13.9900744"
id="path3791"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.50207235,0,0,0.54936111,10.49718,32.701326)" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-9"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.48259672,0,0,0.54423134,22.971333,3.0108315)" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-6"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.4900265,0,0,0.51964329,-10.691288,22.412382)" />
<path
sodipodi:type="arc"
style="fill:#ff0900;fill-opacity:1;fill-rule:nonzero;stroke:#ff0900;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3078-5-9-1"
sodipodi:cx="65.622307"
sodipodi:cy="12.613435"
sodipodi:rx="7.6248417"
sodipodi:ry="7.3409381"
d="m 73.247149,12.613435 a 7.6248417,7.3409381 0 1 1 -15.249684,0 7.6248417,7.3409381 0 1 1 15.249684,0 z"
transform="matrix(0.49354792,0,0,0.51293061,-24.330871,47.217221)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -0,0 +1,68 @@
/***************************************************************************
* Copyright (c) 2013 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include <Base/Parameter.h>
#include "ViewProviderRegularPolygon.h"
using namespace PartGui;
using namespace std;
//**************************************************************************
// Construction/Destruction
PROPERTY_SOURCE(PartGui::ViewProviderRegularPolygon, PartGui::ViewProviderPart)
ViewProviderRegularPolygon::ViewProviderRegularPolygon()
{
sPixmap = "Part_Polygon_Parametric.svg";
}
ViewProviderRegularPolygon::~ViewProviderRegularPolygon()
{
}
// **********************************************************************************
std::vector<std::string> ViewProviderRegularPolygon::getDisplayModes(void) const
{
// get the modes of the father
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");
return StrList;
}

View File

@@ -0,0 +1,53 @@
/***************************************************************************
* Copyright (c) 2013 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef PARTGUI_VIEWPROVIDERREGULARPOLYGON_H
#define PARTGUI_VIEWPROVIDERREGULARPOLYGON_H
#include "ViewProvider.h"
namespace PartGui {
class PartGuiExport ViewProviderRegularPolygon : public ViewProviderPart
{
PROPERTY_HEADER(PartGui::ViewProviderRegularPolygon);
public:
/// constructor
ViewProviderRegularPolygon();
/// destructor
virtual ~ViewProviderRegularPolygon();
std::vector<std::string> getDisplayModes(void) const;
protected:
};
} // namespace PartGui
#endif // PARTGUI_VIEWPROVIDERREGULARPOLYGON_H