[TD]protect against stretch factor == 0

This commit is contained in:
wandererfan
2024-01-19 19:32:29 -05:00
committed by WandererFan
parent c15e1d3295
commit e5ae85e8fd
2 changed files with 12 additions and 1 deletions

View File

@@ -125,6 +125,13 @@ const char* DrawViewSection::SectionDirEnums[] =
const char* DrawViewSection::CutSurfaceEnums[] = {"Hide", "Color", "SvgHatch", "PatHatch", nullptr};
constexpr double stretchMinimum{EWTOLERANCE};
constexpr double stretchMaximum{std::numeric_limits<double>::max()};
constexpr double stretchStep{0.1};
App::PropertyFloatConstraint::Constraints DrawViewSection::stretchRange = {
stretchMinimum, stretchMaximum, stretchStep};
//===========================================================================
// DrawViewSection
//===========================================================================
@@ -230,6 +237,7 @@ DrawViewSection::DrawViewSection()
ADD_PROPERTY_TYPE(SectionLineStretch, (1.0), agroup, App::Prop_None,
"Adjusts the length of the section line. 1.0 is normal length. 1.1 would be 10% longer, 0.9 would be 10% shorter.");
SectionLineStretch.setConstraints(&stretchRange);
getParameters();

View File

@@ -104,7 +104,7 @@ public:
App::PropertyBool TrimAfterCut;//new v021
App::PropertyBool UsePreviousCut; // new v022
App::PropertyFloat SectionLineStretch; // new v022
App::PropertyFloatConstraint SectionLineStretch; // new v022
bool isReallyInBox(const Base::Vector3d v, const Base::BoundBox3d bb) const;
@@ -205,6 +205,9 @@ protected:
bool m_waitingForCut;
TopoDS_Shape m_cuttingTool;
double m_shapeSize;
static App::PropertyFloatConstraint::Constraints stretchRange;
};
using DrawViewSectionPython = App::FeaturePythonT<DrawViewSection>;