diff --git a/src/Mod/PartDesign/App/BodyPyImp.cpp b/src/Mod/PartDesign/App/BodyPyImp.cpp index b5cd2780a4..83169f54ab 100644 --- a/src/Mod/PartDesign/App/BodyPyImp.cpp +++ b/src/Mod/PartDesign/App/BodyPyImp.cpp @@ -23,7 +23,10 @@ #include "PreCompiled.h" +#ifndef _PreComp_ #include +#endif + #include "Mod/Part/App/Part2DObject.h" #include "Mod/PartDesign/App/Body.h" diff --git a/src/Mod/PartDesign/App/DatumPoint.cpp b/src/Mod/PartDesign/App/DatumPoint.cpp index 5a65f09a64..034df15066 100644 --- a/src/Mod/PartDesign/App/DatumPoint.cpp +++ b/src/Mod/PartDesign/App/DatumPoint.cpp @@ -55,9 +55,10 @@ # include # include # include +# include #endif // TODO Cleanup headers (2015-09-04, Fat-Zer) -#include + #include "DatumPoint.h" #include "DatumLine.h" #include "DatumPlane.h" @@ -78,7 +79,7 @@ using namespace Attacher; PROPERTY_SOURCE(PartDesign::Point, Part::Datum) Point::Point() -{ +{ this->setAttacher(new AttachEnginePoint); this->makeShape(); } diff --git a/src/Mod/PartDesign/App/FeatureDressUp.cpp b/src/Mod/PartDesign/App/FeatureDressUp.cpp index 3b39144c36..b658318d27 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.cpp +++ b/src/Mod/PartDesign/App/FeatureDressUp.cpp @@ -23,17 +23,18 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#endif - - -#include "FeatureDressUp.h" -#include #include #include #include #include #include #include +#endif + + +#include "FeatureDressUp.h" +#include + using namespace PartDesign; diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index d960554eb2..1155a5f4e0 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -49,9 +49,10 @@ # include # include # include +# include #endif -#include + #include #include #include @@ -451,42 +452,42 @@ Hole::Hole() ADD_PROPERTY_TYPE(ThreadType, ((long)0), "Hole", App::Prop_None, "Thread type"); ThreadType.setEnums(ThreadTypeEnums); - + ADD_PROPERTY_TYPE(ThreadSize, ((long)0), "Hole", App::Prop_None, "Thread size"); ThreadSize.setEnums(ThreadSize_None_Enums); - + ADD_PROPERTY_TYPE(ThreadClass, ((long)0), "Hole", App::Prop_None, "Thread class"); ThreadClass.setEnums(ThreadClass_None_Enums); - + ADD_PROPERTY_TYPE(ThreadFit, ((long)0), "Hole", App::Prop_None, "Thread fit"); ThreadFit.setEnums(ThreadFitEnums); - + ADD_PROPERTY_TYPE(Diameter, (6.0), "Hole", App::Prop_None, "Diameter"); - + ADD_PROPERTY_TYPE(ThreadDirection, ((long)0), "Hole", App::Prop_None, "Thread direction"); ThreadDirection.setEnums(ThreadDirectionEnums); - + ADD_PROPERTY_TYPE(HoleCutType, ((long)0), "Hole", App::Prop_None, "Head cut type"); HoleCutType.setEnums(HoleCutType_None_Enums); - + ADD_PROPERTY_TYPE(HoleCutDiameter, (0.0), "Hole", App::Prop_None, "Head cut diameter"); - + ADD_PROPERTY_TYPE(HoleCutDepth, (0.0), "Hole", App::Prop_None, "Head cut deth"); - + ADD_PROPERTY_TYPE(HoleCutCountersinkAngle, (90.0), "Hole", App::Prop_None, "Head cut countersink angle"); - + ADD_PROPERTY_TYPE(DepthType, ((long)0), "Hole", App::Prop_None, "Type"); DepthType.setEnums(DepthTypeEnums); ADD_PROPERTY_TYPE(Depth, (25.0), "Hole", App::Prop_None, "Length"); - + ADD_PROPERTY_TYPE(DrillPoint, ((long)1), "Hole", App::Prop_None, "Drill point type"); DrillPoint.setEnums(DrillPointEnums); - + ADD_PROPERTY_TYPE(DrillPointAngle, (118.0), "Hole", App::Prop_None, "Drill point angle"); - + ADD_PROPERTY_TYPE(Tapered, ((bool)false),"Hole", App::Prop_None, "Tapered"); - + ADD_PROPERTY_TYPE(TaperedAngle, (90.0), "Hole", App::Prop_None, "Tapered angle"); } @@ -548,7 +549,7 @@ void Hole::updateDiameterParam() if (Threaded.getValue()) { if (std::string(ThreadType.getValueAsString()) != "None") { double h = pitch * sqrt(3) / 2; - + // Basic profile for ISO and UTS threads ThreadPitch.setValue(pitch); ThreadAngle.setValue(60); @@ -559,7 +560,7 @@ void Hole::updateDiameterParam() if (ModelActualThread.getValue()) { pitch = ThreadPitch.getValue(); } - + /* Use thread tap diameter, normall D - pitch */ diameter = diameter - pitch; } @@ -724,13 +725,13 @@ void Hole::onChanged(const App::Property *prop) HoleCutCountersinkAngle.setValue(90.0); else if (type == "UNC" || type == "UNF" || type == "UNEF") HoleCutCountersinkAngle.setValue(82.0); - + // Signal changes to these ProfileBased::onChanged(&ThreadSize); ProfileBased::onChanged(&ThreadClass); ProfileBased::onChanged(&HoleCutType); ProfileBased::onChanged(&Threaded); - + bool v = (type != "None") || !Threaded.getValue() || !ModelActualThread.getValue(); ThreadPitch.setReadOnly(v); ThreadAngle.setReadOnly(v); @@ -765,7 +766,7 @@ void Hole::onChanged(const App::Property *prop) bool v =(!ModelActualThread.getValue()) || (Threaded.isReadOnly()) || (std::string(ThreadType.getValueAsString()) != "None"); - + ThreadPitch.setReadOnly(v); ThreadAngle.setReadOnly(v); ThreadCutOffInner.setReadOnly(v); @@ -858,13 +859,13 @@ static void computeIntersection(gp_Pnt pa1, gp_Pnt pa2, gp_Pnt pb1, gp_Pnt pb2, double f = 1 / ( ( vx1 * - vy2 ) - ( -vx2 * vy1 ) ); double t1 = -vy2 * f * ( x2 - x1 ) + vx2 * f * ( y2 - y1 ); - -#ifdef _DEBUG + +#ifdef _DEBUG double t2 = -vy1 * f * ( x2 - x1 ) + vx1 * f * ( y2 - y1 ); assert( ( x1 + t1 * vx1 ) - ( x2 + t2 * vx2 ) < 1e-6 ); assert( ( y1 + t1 * vy1 ) - ( y2 + t2 * vy2 ) < 1e-6 ); -#endif +#endif x = x1 + t1 * vx1; y = y1 + t1 * vy1; @@ -1133,7 +1134,7 @@ App::DocumentObjectExecReturn *Hole::execute(void) } mkWire.Add( BRepBuilderAPI_MakeEdge(lastPoint, firstPoint) ); - + TopoDS_Wire wire = mkWire.Wire(); TopoDS_Face face = BRepBuilderAPI_MakeFace(wire); @@ -1160,48 +1161,48 @@ App::DocumentObjectExecReturn *Hole::execute(void) BRepBuilderAPI_MakeWire mkThreadWire; double z = 0; double d_min = Diameter.getValue() + ThreadCutOffInner.getValue(); - double d_maj = Diameter.getValue() - ThreadCutOffInner.getValue(); + double d_maj = Diameter.getValue() - ThreadCutOffInner.getValue(); int i = 0; firstPoint = toPnt(xDir * d_min); - + mkThreadWire.Add(BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), firstPoint)); while (z < length) { double z1 = i * ThreadPitch.getValue() + ThreadPitch.getValue() * 0.1; double z2 = i * ThreadPitch.getValue() + ThreadPitch.getValue() * 0.45; double z3 = i * ThreadPitch.getValue() + ThreadPitch.getValue() * 0.55; double z4 = i * ThreadPitch.getValue() + ThreadPitch.getValue() * 0.9; - + gp_Pnt p2 = toPnt(xDir * d_min - zDir * z1); gp_Pnt p3 = toPnt(xDir * d_maj - zDir * z2); gp_Pnt p4 = toPnt(xDir * d_maj - zDir * z3); gp_Pnt p5 = toPnt(xDir * d_min - zDir * z4); - + mkThreadWire.Add(BRepBuilderAPI_MakeEdge(firstPoint, p2)); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p2, p3)); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p3, p4)); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p4, p5)); firstPoint = p5; - + ++i; z += ThreadPitch.getValue(); } mkThreadWire.Add(BRepBuilderAPI_MakeEdge(firstPoint, toPnt(-z * zDir))); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(toPnt(-z * zDir), gp_Pnt(0, 0, 0))); - + TopoDS_Wire threadWire = mkThreadWire.Wire(); - + TopoDS_Face threadFace = BRepBuilderAPI_MakeFace(threadWire); - + //TopoDS_Wire helix = TopoShape::makeHelix(ThreadPitch.getValue(), ThreadPitch.getValue(), Diameter.getValue()); - + double angle = Base::toRadians(360.0); BRepPrimAPI_MakeRevol RevolMaker2(threadFace, gp_Ax1(gp_Pnt(0,0,0), zDir), angle); - + //TopoDS_Shape protoHole; if (RevolMaker2.IsDone()) { protoHole = RevolMaker2.Shape(); - + if (protoHole.IsNull()) return new App::DocumentObjectExecReturn("Hole: Resulting shape is empty"); } diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index 020c85c842..01ea877458 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -28,13 +28,13 @@ # include # include # include -#include -#include -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include +# include #endif #include @@ -68,20 +68,20 @@ short Loft::mustExecute() const return 1; if (Closed.isTouched()) return 1; - + return ProfileBased::mustExecute(); } App::DocumentObjectExecReturn *Loft::execute(void) { - + std::vector wires; try { wires = getProfileWires(); } catch (const Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); } - + TopoDS_Shape sketchshape = getVerifiedFace(); if (sketchshape.IsNull()) return new App::DocumentObjectExecReturn("Loft: Creating a face from sketch failed"); @@ -93,27 +93,27 @@ App::DocumentObjectExecReturn *Loft::execute(void) } catch (const Base::Exception&) { base = TopoDS_Shape(); } - + try { //setup the location this->positionByPrevious(); TopLoc_Location invObjLoc = this->getLocation().Inverted(); if(!base.IsNull()) base.Move(invObjLoc); - + //build up multisections auto multisections = Sections.getValues(); if(multisections.empty()) return new App::DocumentObjectExecReturn("Loft: At least one section is needed"); - + std::vector> wiresections; for(TopoDS_Wire& wire : wires) wiresections.push_back(std::vector(1, wire)); - + for(App::DocumentObject* obj : multisections) { if(!obj->isDerivedFrom(Part::Feature::getClassTypeId())) return new App::DocumentObjectExecReturn("Loft: All sections need to be part features"); - + TopExp_Explorer ex; size_t i=0; for (ex.Init(static_cast(obj)->Shape.getValue(), TopAbs_WIRE); ex.More(); ex.Next(), ++i) { @@ -123,13 +123,13 @@ App::DocumentObjectExecReturn *Loft::execute(void) } if(i shells; for(std::vector& wires : wiresections) { - + BRepOffsetAPI_ThruSections mkTS(false, Ruled.getValue(), Precision::Confusion()); for(TopoDS_Wire& wire : wires) { @@ -140,35 +140,35 @@ App::DocumentObjectExecReturn *Loft::execute(void) mkTS.Build(); if (!mkTS.IsDone()) return new App::DocumentObjectExecReturn("Loft could not be built"); - + //build the shell use simulate to get the top and bottom wires in an easy way shells.push_back(mkTS.Shape()); } - + //build the top and bottom face, sew the shell and build the final solid TopoDS_Shape front = getVerifiedFace(); front.Move(invObjLoc); std::vector backwires; for(std::vector& wires : wiresections) backwires.push_back(wires.back()); - + TopoDS_Shape back = Part::FaceMakerCheese::makeFace(backwires); - + BRepBuilderAPI_Sewing sewer; sewer.SetTolerance(Precision::Confusion()); sewer.Add(front); sewer.Add(back); for(TopoDS_Shape& s : shells) - sewer.Add(s); - + sewer.Add(s); + sewer.Perform(); - + //build the solid BRepBuilderAPI_MakeSolid mkSolid; mkSolid.Add(TopoDS::Shell(sewer.SewedShape())); if(!mkSolid.IsDone()) return new App::DocumentObjectExecReturn("Loft: Result is not a solid"); - + TopoDS_Shape result = mkSolid.Shape(); BRepClass3d_SolidClassifier SC(result); SC.PerformInfinitePoint(Precision::Confusion()); @@ -177,14 +177,14 @@ App::DocumentObjectExecReturn *Loft::execute(void) } AddSubShape.setValue(result); - + if(base.IsNull()) { Shape.setValue(getSolid(result)); return App::DocumentObject::StdReturn; } - + if(getAddSubType() == FeatureAddSub::Additive) { - + BRepAlgoAPI_Fuse mkFuse(base, result); if (!mkFuse.IsDone()) return new App::DocumentObjectExecReturn("Loft: Adding the loft failed"); @@ -197,12 +197,12 @@ App::DocumentObjectExecReturn *Loft::execute(void) if (solidCount > 1) { return new App::DocumentObjectExecReturn("Loft: Result has multiple solids. This is not supported at this time."); } - + boolOp = refineShapeIfActive(boolOp); Shape.setValue(getSolid(boolOp)); } else if(getAddSubType() == FeatureAddSub::Subtractive) { - + BRepAlgoAPI_Cut mkCut(base, result); if (!mkCut.IsDone()) return new App::DocumentObjectExecReturn("Loft: Subtracting the loft failed"); @@ -215,11 +215,11 @@ App::DocumentObjectExecReturn *Loft::execute(void) if (solidCount > 1) { return new App::DocumentObjectExecReturn("Loft: Result has multiple solids. This is not supported at this time."); } - + boolOp = refineShapeIfActive(boolOp); Shape.setValue(getSolid(boolOp)); } - + return App::DocumentObject::StdReturn; } catch (Standard_Failure& e) { diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index d298b4c584..6d282c4c34 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -41,21 +41,21 @@ # include # include # include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #endif #include @@ -80,7 +80,7 @@ const char* Pipe::TransformEnums[] = {"Constant", "Multisection", "Linear", "S-s PROPERTY_SOURCE(PartDesign::Pipe, PartDesign::ProfileBased) Pipe::Pipe() -{ +{ ADD_PROPERTY_TYPE(Sections,(0),"Sweep",App::Prop_None,"List of sections"); Sections.setSize(0); ADD_PROPERTY_TYPE(Spine,(0),"Sweep",App::Prop_None,"Path to sweep along"); @@ -118,13 +118,13 @@ App::DocumentObjectExecReturn *Pipe::execute(void) } catch (const Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); } - + TopoDS_Shape sketchshape = getVerifiedFace(); if (sketchshape.IsNull()) return new App::DocumentObjectExecReturn("Pipe: No valid sketch or face as first section"); else { - //TODO: currently we only allow planar faces. the reason for this is that with other faces in front, we could - //not use the current simulate approach and build the start and end face from the wires. As the shell + //TODO: currently we only allow planar faces. the reason for this is that with other faces in front, we could + //not use the current simulate approach and build the start and end face from the wires. As the shell //begins always at the spine and not the profile, the sketchshape cannot be used directly as front face. //We would need a method to translate the front shape to match the shell starting position somehow... TopoDS_Face face = TopoDS::Face(sketchshape); @@ -140,14 +140,14 @@ App::DocumentObjectExecReturn *Pipe::execute(void) } catch (const Base::Exception&) { base = TopoDS_Shape(); } - + try { //setup the location this->positionByPrevious(); TopLoc_Location invObjLoc = this->getLocation().Inverted(); if(!base.IsNull()) base.Move(invObjLoc); - + //build the paths App::DocumentObject* spine = Spine.getValue(); if (!(spine && spine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))) @@ -180,17 +180,17 @@ App::DocumentObjectExecReturn *Pipe::execute(void) wiresections.push_back(std::vector(1, wire)); //maybe we need a sacling law Handle(Law_Function) scalinglaw; - + //see if we shall use multiple sections if(Transformation.getValue() == 1) { - + //TODO: we need to order the sections to prevent occ from crahsing, as makepieshell connects - //the sections in the order of adding - + //the sections in the order of adding + for(App::DocumentObject* obj : multisections) { if(!obj->isDerivedFrom(Part::Feature::getClassTypeId())) return new App::DocumentObjectExecReturn("All sections need to be part features"); - + TopExp_Explorer ex; size_t i=0; for (ex.Init(static_cast(obj)->Shape.getValue(), TopAbs_WIRE); ex.More(); ex.Next()) { @@ -209,30 +209,30 @@ App::DocumentObjectExecReturn *Pipe::execute(void) else if(Transformation.getValue() == 2) { if(ScalingData.getValues().size()<1) return new App::DocumentObjectExecReturn("No valid data given for linear scaling mode"); - + Handle(Law_Linear) lin = new Law_Linear(); lin->Set(0,1,1,ScalingData[0].x); - + scalinglaw = lin; } else if(Transformation.getValue() == 3) { if(ScalingData.getValues().size()<1) return new App::DocumentObjectExecReturn("No valid data given for S-shape scaling mode"); - + Handle(Law_S) s = new Law_S(); s->Set(0,1,ScalingData[0].y, 1, ScalingData[0].x, ScalingData[0].z); - + scalinglaw = s; }*/ - + //build all shells std::vector shells; std::vector frontwires, backwires; for(std::vector& wires : wiresections) { - + BRepOffsetAPI_MakePipeShell mkPS(TopoDS::Wire(path)); setupAlgorithm(mkPS, auxpath); - + if(!scalinglaw) { for(TopoDS_Wire& wire : wires) { wire.Move(invObjLoc); @@ -250,7 +250,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void) return new App::DocumentObjectExecReturn("Pipe could not be built"); shells.push_back(mkPS.Shape()); - + if (!mkPS.Shape().Closed()) { // shell is not closed - use simulate to get the end wires TopTools_ListOfShape sim; @@ -313,7 +313,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void) // lets check if the result is a solid if (boolOp.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); - + int solidCount = countSolids(boolOp); if (solidCount > 1) { return new App::DocumentObjectExecReturn("Pipe: Result has multiple solids. This is not supported at this time."); @@ -332,7 +332,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void) // lets check if the result is a solid if (boolOp.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); - + int solidCount = countSolids(boolOp); if (solidCount > 1) { return new App::DocumentObjectExecReturn("Pipe: Result has multiple solids. This is not supported at this time."); @@ -385,7 +385,7 @@ void Pipe::setupAlgorithm(BRepOffsetAPI_MakePipeShell& mkPipeShell, TopoDS_Shape mkPipeShell.SetMode(gp_Dir(bVec.x,bVec.y,bVec.z)); break; } - + if(auxiliary) { mkPipeShell.SetMode(TopoDS::Wire(auxshape), AuxilleryCurvelinear.getValue()); //mkPipeShell.SetMode(TopoDS::Wire(auxshape), AuxilleryCurvelinear.getValue(), BRepFill_ContactOnBorder); @@ -404,7 +404,7 @@ void Pipe::getContiniusEdges(Part::TopoShape /*TopShape*/, std::vector< std::str Base::Console().Message("Initial edges:\n"); for(int i=0; i #endif -#include #include #include #include @@ -63,7 +62,7 @@ PROPERTY_SOURCE(PartDesign::Pocket, PartDesign::ProfileBased) Pocket::Pocket() { addSubType = FeatureAddSub::Subtractive; - + ADD_PROPERTY_TYPE(Type,((long)0),"Pocket",App::Prop_None,"Pocket type"); Type.setEnums(TypeEnums); ADD_PROPERTY_TYPE(Length,(100.0),"Pocket",App::Prop_None,"Pocket length"); @@ -126,7 +125,7 @@ App::DocumentObjectExecReturn *Pocket::execute(void) } // get the Sketch plane - Base::Placement SketchPos = obj->Placement.getValue(); + Base::Placement SketchPos = obj->Placement.getValue(); Base::Vector3d SketchVector = getProfileNormal(); // turn around for pockets diff --git a/src/Mod/PartDesign/App/FeaturePrimitive.cpp b/src/Mod/PartDesign/App/FeaturePrimitive.cpp index becf04b02f..a881928d62 100644 --- a/src/Mod/PartDesign/App/FeaturePrimitive.cpp +++ b/src/Mod/PartDesign/App/FeaturePrimitive.cpp @@ -23,6 +23,21 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #endif @@ -36,22 +51,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - 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(); } diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 425d4cf149..baaa7363af 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -61,14 +61,13 @@ # include # include # include +# include +# include +# include +# include +# include #endif -#include -#include -#include -#include -#include - #include #include #include @@ -181,7 +180,7 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const { err = "No profile linked"; } else { if (result->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) { - + auto wires = getProfileWires(); return Part::FaceMakerCheese::makeFace(wires); } @@ -189,13 +188,13 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const { if(Profile.getSubValues().empty()) err = "Linked object has no subshape specified"; else { - + const Part::TopoShape& shape = Profile.getValue()->Shape.getShape(); TopoDS_Shape sub = shape.getSubShape(Profile.getSubValues()[0].c_str()); - if(sub.ShapeType() == TopAbs_FACE) + if(sub.ShapeType() == TopAbs_FACE) return TopoDS::Face(sub); else if(sub.ShapeType() == TopAbs_WIRE) { - + auto wire = TopoDS::Wire(sub); if(!wire.Closed()) err = "Linked wire is not closed"; @@ -203,13 +202,13 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const { BRepBuilderAPI_MakeFace mk(wire); mk.Build(); return TopoDS::Face(mk.Shape()); - } + } } - else + else err = "Linked Subshape cannot be used"; } } - else + else err = "Linked object is neither Sketch, Part2DObject or Part::Feature"; } @@ -226,17 +225,17 @@ std::vector ProfileBased::getProfileWires() const { if(!Profile.getValue() || !Profile.getValue()->isDerivedFrom(Part::Feature::getClassTypeId())) throw Base::TypeError("No valid profile linked"); - + TopoDS_Shape shape; if(Profile.getValue()->isDerivedFrom(Part::Part2DObject::getClassTypeId())) shape = Profile.getValue()->Shape.getValue(); else { - if(Profile.getSubValues().empty()) + if(Profile.getSubValues().empty()) throw Base::ValueError("No valid subelement linked in Part::Feature"); shape = Profile.getValue()->Shape.getShape().getSubShape(Profile.getSubValues().front().c_str()); } - + if (shape.IsNull()) throw Base::ValueError("Linked shape object is empty"); @@ -323,7 +322,7 @@ Part::Feature *ProfileBased::getBaseObject(bool silent) const if(!obj) return nullptr; - + if (!obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) return obj; @@ -1041,13 +1040,13 @@ Base::Vector3d ProfileBased::getProfileNormal() const { Base::Vector3d SketchVector(0,0,1); auto obj = getVerifiedObject(true); - if(!obj) + if(!obj) return SketchVector; // get the Sketch plane if(obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { Base::Placement SketchPos = obj->Placement.getValue(); - Base::Rotation SketchOrientation = SketchPos.getRotation(); + Base::Rotation SketchOrientation = SketchPos.getRotation(); SketchOrientation.multVec(SketchVector,SketchVector); } else { @@ -1068,13 +1067,13 @@ Base::Vector3d ProfileBased::getProfileNormal() const { } } } - + return SketchVector; } void ProfileBased::Restore(Base::XMLReader& reader) { - + reader.readElement("Properties"); int Cnt = reader.getAttributeAsInteger("Count"); @@ -1090,14 +1089,14 @@ void ProfileBased::Restore(Base::XMLReader& reader) { try { //check if we load the old sketch property if(!prop && (strcmp("Sketch", PropName) == 0) && (strcmp("App::PropertyLink", TypeName) == 0)) { - + std::vector vec; // read my element reader.readElement("Link"); // get the value of my attribute std::string name = reader.getAttribute("value"); - if (name != "") { + if (name != "") { App::Document* document = getDocument(); DocumentObject* object = document ? document->getObject(name.c_str()) : 0; Profile.setValue(object, vec); diff --git a/src/Mod/PartDesign/App/FeatureThickness.cpp b/src/Mod/PartDesign/App/FeatureThickness.cpp index 37fea77712..6ce73a7f8a 100644 --- a/src/Mod/PartDesign/App/FeatureThickness.cpp +++ b/src/Mod/PartDesign/App/FeatureThickness.cpp @@ -23,13 +23,13 @@ #include "PreCompiled.h" #ifndef _PreComp_ - +# include +# include #endif #include "FeatureThickness.h" #include -#include -#include + using namespace PartDesign; diff --git a/src/Mod/PartDesign/App/PreCompiled.h b/src/Mod/PartDesign/App/PreCompiled.h index 1810f1474f..47354e19d1 100644 --- a/src/Mod/PartDesign/App/PreCompiled.h +++ b/src/Mod/PartDesign/App/PreCompiled.h @@ -57,26 +57,61 @@ #include #include +#include + +# include + +// QT +#include +#include + // OpenCasCade ===================================================================================== #include // Apart from the Part OpenCascadeAll, I need: # include -# include -# include + +# include +# include +# include +# include +# include # include +# include +# include +# include +# include # include # include +# include +# include # include -# include -# include -# include -# include -# include +# include # include # include +# include +# include +# include +# include +# include +# include +# include + +# include +# include +# include + # include +# include +# include +# include +# include + +#if OCC_VERSION_HEX >= 0x060800 +# include +#endif + #include diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index a5fb4482f3..b428083c1b 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -23,10 +23,10 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include -#include -#include -#include +# include +# include +# include +# include #endif #include "ShapeBinder.h"