PartDesign: move common properties to FeatureSketchBased and add some source documentation

This commit is contained in:
jrheinlaender 2012-10-23 13:20:59 +02:00 committed by logari81
parent b472ac77a0
commit 8de40bc3a2
9 changed files with 49 additions and 26 deletions

View File

@ -56,8 +56,6 @@ Groove::Groove()
ADD_PROPERTY_TYPE(Axis,(Base::Vector3f(0.0f,1.0f,0.0f)),"Groove", App::Prop_ReadOnly, "Axis");
ADD_PROPERTY_TYPE(Angle,(360.0),"Groove", App::Prop_None, "Angle");
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Groove",(App::PropertyType)(App::Prop_None),"Reference axis of Groove");
ADD_PROPERTY_TYPE(Midplane,(0),"Groove", App::Prop_None, "Mid plane");
ADD_PROPERTY_TYPE(Reversed, (0),"Groove", App::Prop_None, "Reversed");
}
short Groove::mustExecute() const
@ -66,9 +64,7 @@ short Groove::mustExecute() const
ReferenceAxis.isTouched() ||
Axis.isTouched() ||
Base.isTouched() ||
Angle.isTouched() ||
Midplane.isTouched() ||
Reversed.isTouched())
Angle.isTouched())
return 1;
return Subtractive::mustExecute();
}

View File

@ -40,8 +40,6 @@ public:
App::PropertyVector Base;
App::PropertyVector Axis;
App::PropertyAngle Angle;
App::PropertyBool Midplane;
App::PropertyBool Reversed;
/** if this property is set to a valid link, both Axis and Base properties
* are calculated according to the linked line
@ -50,7 +48,13 @@ public:
/** @name methods override feature */
//@{
/// recalculate the feature
/** Recalculate the feature
* Revolves the Sketch around the given Axis (with basepoint Base)
* The angle of the revolution is given by Angle.
* If Midplane is true, then the revolution will extend for half of Angle on both sides of the sketch plane.
* If Reversed is true then the direction of revolution will be reversed.
* The created material will be cut out of the sketch support
*/
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider

View File

@ -59,8 +59,6 @@ Pad::Pad()
ADD_PROPERTY(Type,((long)0));
Type.setEnums(TypeEnums);
ADD_PROPERTY(Length,(100.0));
ADD_PROPERTY(Reversed,(0));
ADD_PROPERTY(Midplane,(0));
ADD_PROPERTY(Length2,(100.0));
ADD_PROPERTY(FaceName,(""));
}
@ -69,8 +67,6 @@ short Pad::mustExecute() const
{
if (Placement.isTouched() ||
Length.isTouched() ||
Midplane.isTouched() ||
Reversed.isTouched() ||
Length2.isTouched() ||
FaceName.isTouched())
return 1;

View File

@ -40,15 +40,24 @@ public:
App::PropertyEnumeration Type;
App::PropertyLength Length;
//App::PropertyEnumeration Side;
App::PropertyBool Reversed;
App::PropertyBool Midplane;
App::PropertyLength Length2;
App::PropertyString FaceName;
/** @name methods override feature */
//@{
/// recalculate the feature
/** Recalculate the feature
* Extrudes the Sketch in the direction of the sketch face normal
* If Type is "Length" then Length gives the extrusion length, the direction will be away from the support
* If Type is "UpToLast" then the extrusion will stop at the last face of the support
* that is cut by a line through the centre of gravite of the sketch
* If Type is "UpToFirst" then extrusion will stop at the first face of the support
* If Type is "UpToFace" then the extrusion will stop at FaceName in the support
* If Type is "TwoLengths" then the extrusion will extend Length in the direction away from the support
* and Length2 in the opposite direction
* If Midplane is true, then the extrusion will extend for half of the length on both sides of the sketch plane
* If Reversed is true then the direction of revolution will be reversed.
* The created material will be fused with the sketch support (if there is one)
*/
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider

View File

@ -43,7 +43,16 @@ public:
/** @name methods override feature */
//@{
/// recalculate the feature
/** Recalculate the feature
* Extrudes the Sketch in the direction of the sketch face normal
* If Type is "Length" then Length gives the extrusion length, the direction will be into the support
* If Type is "ThroughAll" then the extrusion length will be infinite
* If Type is "UpToFirst" then extrusion will stop at the first face of the support that is cut
* by a line through the centre of gravite of the sketch
* If Type is "UpToFace" then the extrusion will stop at FaceName in the support
* If Midplane is true, then the extrusion will extend for half of the length on both sides of the sketch plane
* The created material will be cut out of the sketch support
*/
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider

View File

@ -56,8 +56,6 @@ Revolution::Revolution()
ADD_PROPERTY_TYPE(Axis,(Base::Vector3f(0.0f,1.0f,0.0f)),"Revolution", App::Prop_ReadOnly, "Axis");
ADD_PROPERTY_TYPE(Angle,(360.0),"Revolution", App::Prop_None, "Angle");
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Revolution",(App::Prop_None),"Reference axis of revolution");
ADD_PROPERTY_TYPE(Midplane,(0),"Revolution", App::Prop_None, "Mid plane");
ADD_PROPERTY_TYPE(Reversed, (0),"Revolution", App::Prop_None, "Reversed");
}
short Revolution::mustExecute() const
@ -66,9 +64,7 @@ short Revolution::mustExecute() const
ReferenceAxis.isTouched() ||
Axis.isTouched() ||
Base.isTouched() ||
Angle.isTouched() ||
Midplane.isTouched() ||
Reversed.isTouched())
Angle.isTouched())
return 1;
return Additive::mustExecute();
}

View File

@ -40,8 +40,6 @@ public:
App::PropertyVector Base;
App::PropertyVector Axis;
App::PropertyAngle Angle;
App::PropertyBool Midplane;
App::PropertyBool Reversed;
/** if this property is set to a valid link, both Axis and Base properties
* are calculated according to the linked line
@ -50,7 +48,13 @@ public:
/** @name methods override feature */
//@{
/// recalculate the feature
/** Recalculate the feature
* Revolves the Sketch around the given Axis (with basepoint Base)
* The angle of the revolution is given by Angle.
* If Midplane is true, then the revolution will extend for half of Angle on both sides of the sketch plane.
* If Reversed is true then the direction of revolution will be reversed.
* The created material will be fused with the sketch support (if there is one)
*/
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider

View File

@ -75,11 +75,15 @@ PROPERTY_SOURCE(PartDesign::SketchBased, PartDesign::Feature)
SketchBased::SketchBased()
{
ADD_PROPERTY(Sketch,(0));
ADD_PROPERTY_TYPE(Midplane,(0),"SketchBased", App::Prop_None, "Extrude symmetric to sketch face");
ADD_PROPERTY_TYPE(Reversed, (0),"SketchBased", App::Prop_None, "Reverse extrusion direction");
}
short SketchBased::mustExecute() const
{
if (Sketch.isTouched())
if (Sketch.isTouched() ||
Midplane.isTouched() ||
Reversed.isTouched())
return 1;
return 0; // PartDesign::Feature::mustExecute();
}

View File

@ -40,7 +40,12 @@ class PartDesignExport SketchBased : public PartDesign::Feature
public:
SketchBased();
/// Common properties for all sketch based features
App::PropertyLink Sketch;
/// Reverse extrusion direction
App::PropertyBool Reversed;
/// Make extrusion symmetric to sketch plane
App::PropertyBool Midplane;
short mustExecute() const;