Skip to content

Commit

Permalink
Add over/under Tolerance to Dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and yorikvanhavre committed Oct 2, 2018
1 parent 1d3f3ab commit d2c2b35
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 99 deletions.
14 changes: 14 additions & 0 deletions src/Mod/TechDraw/App/DrawViewDimension.cpp
Expand Up @@ -102,6 +102,8 @@ DrawViewDimension::DrawViewDimension(void)
ADD_PROPERTY(Type,((long)0));
MeasureType.setEnums(MeasureTypeEnums);
ADD_PROPERTY(MeasureType, ((long)1)); //Projected (or True) measurement
ADD_PROPERTY_TYPE(OverTolerance ,(0.0),"",App::Prop_None,"+ Tolerance value");
ADD_PROPERTY_TYPE(UnderTolerance ,(0.0),"",App::Prop_None,"- Tolerance value");


//hide the properties the user can't edit in the property editor
Expand Down Expand Up @@ -847,6 +849,18 @@ bool DrawViewDimension::has3DReferences(void) const
return (References3D.getSize() > 0);
}

bool DrawViewDimension::hasTolerance(void) const
{
bool result = true;
double overTol = OverTolerance.getValue();
double underTol = UnderTolerance.getValue();
if (DrawUtil::fpCompare(overTol,0.0) &&
DrawUtil::fpCompare(underTol,0.0) ) {
result = false;
}
return result;
}

bool DrawViewDimension::showUnits() const
{
bool result = false;
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/TechDraw/App/DrawViewDimension.h
Expand Up @@ -99,10 +99,13 @@ class TechDrawExport DrawViewDimension : public TechDraw::DrawView
App::PropertyEnumeration Type; //DistanceX,DistanceY,Diameter, etc
App::PropertyString FormatSpec;
App::PropertyBool Arbitrary;
App::PropertyFloat OverTolerance;
App::PropertyFloat UnderTolerance;

short mustExecute() const;
bool has2DReferences(void) const;
bool has3DReferences(void) const;
bool hasTolerance(void) const;

/** @name methods override Feature */
//@{
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/MDIViewPage.cpp
Expand Up @@ -1073,7 +1073,7 @@ void MDIViewPage::setTreeToSceneSelect(void)

QGIDatumLabel *dimLabel = dynamic_cast<QGIDatumLabel*>(*it);
if(dimLabel) {
QGraphicsItem*dimParent = dimLabel->parentItem();
QGraphicsItem*dimParent = dimLabel->QGraphicsItem::parentItem();
if(!dimParent)
continue;

Expand Down

0 comments on commit d2c2b35

Please sign in to comment.