return false;
DataPtr aData = data();
+ std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(sketch());
std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = SketcherPrs_Tools::getFeaturePoint(
- aData, SketchPlugin_Constraint::ENTITY_A());
+ aData, SketchPlugin_Constraint::ENTITY_A(), aPlane);
std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = SketcherPrs_Tools::getFeaturePoint(
- aData, SketchPlugin_Constraint::ENTITY_B());
+ aData, SketchPlugin_Constraint::ENTITY_B(), aPlane);
std::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
std::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
if (!anAIS) {
anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane());
}
+ std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
+ SKETCH_DIMENSION_COLOR);
+ anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
return anAIS;
}
// Recalculate a shift of flyout point in terms of local coordinates
std::shared_ptr<GeomAPI_XY> aDir(new GeomAPI_XY(theDeltaX, theDeltaY));
+ std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(sketch());
std::shared_ptr<GeomDataAPI_Point2D> aPointA = SketcherPrs_Tools::getFeaturePoint(
- data(), SketchPlugin_Constraint::ENTITY_A());
+ data(), SketchPlugin_Constraint::ENTITY_A(), aPlane);
std::shared_ptr<GeomDataAPI_Point2D> aPointB = SketcherPrs_Tools::getFeaturePoint(
- data(), SketchPlugin_Constraint::ENTITY_B());
+ data(), SketchPlugin_Constraint::ENTITY_B(), aPlane);
std::shared_ptr<GeomAPI_XY> aStartPnt;
std::shared_ptr<GeomAPI_XY> aEndPnt;
myFlyoutUpdate = false;
}
-double SketchPlugin_ConstraintDistance::calculateCurrentDistance() const
+double SketchPlugin_ConstraintDistance::calculateCurrentDistance()
{
double aDistance = -1.;
std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(sketch());
std::shared_ptr<GeomDataAPI_Point2D> aPointA =
- SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
+ SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A(), aPlane);
std::shared_ptr<GeomDataAPI_Point2D> aPointB =
- SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
+ SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B(), aPlane);
if (aPointA.get() && aPointB.get()) { // both points
aDistance = aPointA->pnt()->distance(aPointB->pnt());
attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
std::shared_ptr<GeomAPI_Pnt2d> aFlyoutPnt = aFlyoutAttr->pnt();
+ std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(sketch());
std::shared_ptr<GeomDataAPI_Point2D> aPointA = SketcherPrs_Tools::getFeaturePoint(
- data(), SketchPlugin_Constraint::ENTITY_A());
+ data(), SketchPlugin_Constraint::ENTITY_A(), aPlane);
std::shared_ptr<GeomDataAPI_Point2D> aPointB = SketcherPrs_Tools::getFeaturePoint(
- data(), SketchPlugin_Constraint::ENTITY_B());
+ data(), SketchPlugin_Constraint::ENTITY_B(), aPlane);
std::shared_ptr<GeomAPI_XY> aStartPnt;
std::shared_ptr<GeomAPI_XY> aEndPnt;
} else
return;
+ if (aEndPnt->distance(aStartPnt) < tolerance)
+ return;
+
std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
std::shared_ptr<GeomAPI_XY> aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt);
}
}
-bool SketchPlugin_ConstraintDistance::customisePresentation(ResultPtr theResult,
- AISObjectPtr thePrs,
- std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
-{
- bool isCustomized = false;
- std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
- SKETCH_DIMENSION_COLOR);
- isCustomized = thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
-
- return isCustomized;
-}
-