+ 0000452: in "Part" added create "vertex" to the create primitives dialgue gui

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5049 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2011-10-21 15:50:10 +00:00
parent 87ca80eb7f
commit b005a7cf0b
5 changed files with 170 additions and 15 deletions

View File

@@ -33,6 +33,7 @@
# include <BRepPrim_Wedge.hxx>
# include <BRepBuilderAPI_MakeEdge.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <BRepBuilderAPI_MakeVertex.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
# include <BRepBuilderAPI_GTransform.hxx>
# include <gp_Circ.hxx>
@@ -49,7 +50,9 @@
# include <Handle_Geom2d_TrimmedCurve.hxx>
# include <Precision.hxx>
# include <Standard_Real.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Solid.hxx>
# include <TopoDS_Vertex.hxx>
#endif
@@ -106,6 +109,58 @@ void Primitive::onChanged(const App::Property* prop)
Part::Feature::onChanged(prop);
}
PROPERTY_SOURCE(Part::Vertex, Part::Primitive)
Vertex::Vertex()
{
ADD_PROPERTY(X,(0.0f));
ADD_PROPERTY(Y,(0.0f));
ADD_PROPERTY(Z,(0.0f));
}
Vertex::~Vertex()
{
}
short Vertex::mustExecute() const
{
if (X.isTouched() ||
Y.isTouched() ||
Z.isTouched())
return 1;
return Part::Feature::mustExecute();
}
App::DocumentObjectExecReturn *Vertex::execute(void)
{
gp_Pnt point;
point.SetX(this->X.getValue());
point.SetY(this->Y.getValue());
point.SetZ(this->Z.getValue());
BRepBuilderAPI_MakeVertex MakeVertex(point);
const TopoDS_Vertex& vertex = MakeVertex.Vertex();
this->Shape.setValue(vertex);
return App::DocumentObject::StdReturn;
}
void Vertex::onChanged(const App::Property* prop)
{
if (!isRestoring()) {
if (prop == &X || prop == &Y || prop == &Z){
try {
App::DocumentObjectExecReturn *ret = recompute();
delete ret;
}
catch (...) {
}
}
}
Part::Feature::onChanged(prop);
}
PROPERTY_SOURCE(Part::Plane, Part::Primitive)
Plane::Plane()