[PD] Pad/Pocket: sort out common code
- sort out a constraint used by Pad and Pocket - also unify Length2 parameter naming
This commit is contained in:
@@ -61,6 +61,7 @@ PROPERTY_SOURCE(PartDesign::FeatureExtrude, PartDesign::ProfileBased)
|
||||
|
||||
FeatureExtrude::FeatureExtrude()
|
||||
{
|
||||
signedLengthConstraint = { -DBL_MAX, DBL_MAX, 1.0 };
|
||||
}
|
||||
|
||||
short FeatureExtrude::mustExecute() const
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
App::PropertyLength Offset;
|
||||
App::PropertyLinkSub ReferenceAxis;
|
||||
|
||||
App::PropertyQuantityConstraint::Constraints signedLengthConstraint;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
short mustExecute() const;
|
||||
|
||||
@@ -66,15 +66,14 @@ Pad::Pad()
|
||||
|
||||
ADD_PROPERTY_TYPE(Type, (0L), "Pad", App::Prop_None, "Pad type");
|
||||
Type.setEnums(TypeEnums);
|
||||
ADD_PROPERTY_TYPE(Length, (100.0), "Pad", App::Prop_None,"Pad length");
|
||||
ADD_PROPERTY_TYPE(Length2, (100.0), "Pad", App::Prop_None,"Second Pad length");
|
||||
ADD_PROPERTY_TYPE(Length, (100.0), "Pad", App::Prop_None, "Pad length");
|
||||
ADD_PROPERTY_TYPE(Length2, (100.0), "Pad", App::Prop_None, "Pad length in 2nd direction");
|
||||
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pad", App::Prop_None, "Use custom vector for pad direction");
|
||||
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pad", App::Prop_None, "Pad direction vector");
|
||||
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pad", App::Prop_None, "Reference axis of direction");
|
||||
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pad", App::Prop_None, "Measure pad length along the sketch normal direction");
|
||||
ADD_PROPERTY_TYPE(UpToFace, (0), "Pad", App::Prop_None, "Face where pad will end");
|
||||
ADD_PROPERTY_TYPE(Offset, (0.0), "Pad", App::Prop_None, "Offset from face in which pad will end");
|
||||
static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0};
|
||||
Offset.setConstraints(&signedLengthConstraint);
|
||||
|
||||
// Remove the constraints and keep the type to allow to accept negative values
|
||||
|
||||
@@ -63,18 +63,17 @@ Pocket::Pocket()
|
||||
{
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
|
||||
ADD_PROPERTY_TYPE(Type,((long)0),"Pocket",App::Prop_None,"Pocket type");
|
||||
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");
|
||||
ADD_PROPERTY_TYPE(Length2,(100.0),"Pocket",App::Prop_None,"P");
|
||||
ADD_PROPERTY_TYPE(Length, (100.0), "Pocket", App::Prop_None, "Pocket length");
|
||||
ADD_PROPERTY_TYPE(Length2, (100.0), "Pocket", App::Prop_None, "Pocket length in 2nd direction");
|
||||
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pocket", App::Prop_None, "Use custom vector for pocket direction");
|
||||
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pocket", App::Prop_None, "Pocket direction vector");
|
||||
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pocket", App::Prop_None, "Reference axis of direction");
|
||||
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pocket", App::Prop_None, "Measure pocket length along the sketch normal direction");
|
||||
ADD_PROPERTY_TYPE(UpToFace,(0),"Pocket",App::Prop_None,"Face where pocket will end");
|
||||
ADD_PROPERTY_TYPE(Offset,(0.0),"Pocket",App::Prop_None,"Offset from face in which pocket will end");
|
||||
static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0};
|
||||
Offset.setConstraints ( &signedLengthConstraint );
|
||||
ADD_PROPERTY_TYPE(UpToFace, (0), "Pocket", App::Prop_None, "Face where pocket will end");
|
||||
ADD_PROPERTY_TYPE(Offset, (0.0), "Pocket", App::Prop_None, "Offset from face in which pocket will end");
|
||||
Offset.setConstraints(&signedLengthConstraint);
|
||||
|
||||
// Remove the constraints and keep the type to allow to accept negative values
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=3&t=52075&p=448410#p447636
|
||||
|
||||
Reference in New Issue
Block a user