PartDesign: 3rdParty to PCH

This commit is contained in:
Abdullah Tahiri
2019-05-01 17:20:46 +02:00
committed by abdullahtahiriyo
parent 216926233f
commit 7b0a501c0a
12 changed files with 238 additions and 200 deletions

View File

@@ -23,6 +23,21 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRepPrimAPI_MakeBox.hxx>
# include <BRepBuilderAPI_GTransform.hxx>
# include <BRepAlgoAPI_Fuse.hxx>
# include <BRepAlgoAPI_Cut.hxx>
# include <BRepBuilderAPI_Transform.hxx>
# include <BRepPrimAPI_MakeCylinder.hxx>
# include <BRepPrimAPI_MakeSphere.hxx>
# include <BRepPrimAPI_MakeCone.hxx>
# include <BRepPrimAPI_MakeTorus.hxx>
# include <BRepPrimAPI_MakePrism.hxx>
# include <BRepBuilderAPI_MakePolygon.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <BRepBuilderAPI_MakeSolid.hxx>
# include <QObject>
# include <math.h>
#endif
@@ -36,22 +51,6 @@
#include <App/Application.h>
#include <App/FeaturePythonPyImp.h>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepBuilderAPI_GTransform.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeTorus.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeSolid.hxx>
#include <QObject>
#include <math.h>
using namespace PartDesign;
namespace PartDesign {
@@ -74,7 +73,7 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
try {
//transform the primitive in the correct coordinance
FeatureAddSub::execute();
//if we have no base we just add the standard primitive shape
TopoDS_Shape base;
try{
@@ -86,17 +85,17 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
//as we use this for preview we can add it even if useless for subtractive
AddSubShape.setValue(primitiveShape);
if(getAddSubType() == FeatureAddSub::Additive)
Shape.setValue(getSolid(primitiveShape));
else
return new App::DocumentObjectExecReturn("Cannot subtract primitive feature without base feature");
else
return new App::DocumentObjectExecReturn("Cannot subtract primitive feature without base feature");
return App::DocumentObject::StdReturn;
}
if(getAddSubType() == FeatureAddSub::Additive) {
BRepAlgoAPI_Fuse mkFuse(base, primitiveShape);
if (!mkFuse.IsDone())
return new App::DocumentObjectExecReturn("Adding the primitive failed");
@@ -116,7 +115,7 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
AddSubShape.setValue(primitiveShape);
}
else if(getAddSubType() == FeatureAddSub::Subtractive) {
BRepAlgoAPI_Cut mkCut(base, primitiveShape);
if (!mkCut.IsDone())
return new App::DocumentObjectExecReturn("Subtracting the primitive failed");
@@ -130,13 +129,13 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
if (solidCount > 1) {
return new App::DocumentObjectExecReturn("Subtractive: Result has multiple solids. This is not supported at this time.");
}
boolOp = refineShapeIfActive(boolOp);
Shape.setValue(getSolid(boolOp));
AddSubShape.setValue(primitiveShape);
}
}
catch (Standard_Failure& e) {
@@ -178,7 +177,7 @@ Box::Box()
Length.setConstraints(&quantityRange);
Width.setConstraints(&quantityRange);
Height.setConstraints(&quantityRange);
primitiveType = FeaturePrimitive::Box;
}
@@ -214,7 +213,7 @@ short int Box::mustExecute() const
Height.isTouched() ||
Width.isTouched() )
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -232,7 +231,7 @@ Cylinder::Cylinder()
Angle.setConstraints(&angleRangeU);
Radius.setConstraints(&quantityRange);
Height.setConstraints(&quantityRange);
primitiveType = FeaturePrimitive::Cylinder;
}
@@ -247,7 +246,7 @@ App::DocumentObjectExecReturn* Cylinder::execute(void)
BRepPrimAPI_MakeCylinder mkCylr(Radius.getValue(),
Height.getValue(),
Angle.getValue()/180.0f*M_PI);
return FeaturePrimitive::execute(mkCylr.Shape());
}
catch (Standard_Failure& e) {
@@ -264,7 +263,7 @@ short int Cylinder::mustExecute() const
Height.isTouched() ||
Angle.isTouched() )
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -284,7 +283,7 @@ Sphere::Sphere()
Angle2.setConstraints(&angleRangeV);
ADD_PROPERTY_TYPE(Angle3,(360.0f),"Sphere",App::Prop_None,"The angle of the sphere");
Angle3.setConstraints(&angleRangeU);
primitiveType = FeaturePrimitive::Sphere;
}
@@ -315,7 +314,7 @@ short int Sphere::mustExecute() const
Angle2.isTouched() ||
Angle3.isTouched())
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -335,7 +334,7 @@ Cone::Cone()
Radius1.setConstraints(&quantityRange);
Radius2.setConstraints(&quantityRange);
Height.setConstraints(&quantityRange);
primitiveType = FeaturePrimitive::Cone;
}
@@ -353,7 +352,7 @@ App::DocumentObjectExecReturn* Cone::execute(void)
Radius2.getValue(),
Height.getValue(),
Angle.getValue()/180.0f*M_PI);
return FeaturePrimitive::execute(mkCone.Shape());
}
catch (Standard_Failure& e) {
@@ -396,7 +395,7 @@ Ellipsoid::Ellipsoid()
Angle2.setConstraints(&angleRangeV);
ADD_PROPERTY_TYPE(Angle3,(360.0f),"Ellipsoid",App::Prop_None,"The angle of the ellipsoid");
Angle3.setConstraints(&angleRangeU);
primitiveType = FeaturePrimitive::Ellipsoid;
}
@@ -413,7 +412,7 @@ App::DocumentObjectExecReturn* Ellipsoid::execute(void)
gp_Dir dir(0.0,0.0,1.0);
gp_Ax2 ax2(pnt,dir);
BRepPrimAPI_MakeSphere mkSphere(ax2,
Radius2.getValue(),
Radius2.getValue(),
Angle1.getValue()/180.0f*M_PI,
Angle2.getValue()/180.0f*M_PI,
Angle3.getValue()/180.0f*M_PI);
@@ -460,7 +459,7 @@ short int Ellipsoid::mustExecute() const
return 1;
if (Angle3.isTouched())
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -482,7 +481,7 @@ Torus::Torus()
Angle2.setConstraints(&torusRangeV);
ADD_PROPERTY_TYPE(Angle3,(360.0),"Torus",App::Prop_None,"The angle of the torus");
Angle3.setConstraints(&angleRangeU);
primitiveType = FeaturePrimitive::Torus;
}
@@ -521,7 +520,7 @@ short int Torus::mustExecute() const
return 1;
if (Angle3.isTouched())
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -536,7 +535,7 @@ Prism::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");
primitiveType = FeaturePrimitive::Prism;
}
@@ -583,7 +582,7 @@ short int Prism::mustExecute() const
return 1;
if (Height.isTouched())
return 1;
return FeaturePrimitive::mustExecute();
}
@@ -605,7 +604,7 @@ Wedge::Wedge()
ADD_PROPERTY_TYPE(Zmax,(10.0f),"Wedge",App::Prop_None,"Zmax of the wedge");
ADD_PROPERTY_TYPE(X2max,(8.0f),"Wedge",App::Prop_None,"X2max of the wedge");
ADD_PROPERTY_TYPE(Z2max,(8.0f),"Wedge",App::Prop_None,"Z2max of the wedge");
primitiveType = FeaturePrimitive::Wedge;
}
@@ -675,7 +674,7 @@ short int Wedge::mustExecute() const
X2max.isTouched() ||
Z2max.isTouched())
return 1;
return FeaturePrimitive::mustExecute();
}