GeomAPI_ExtremaCurveSurface anExtrema(aCurve, aPlane);
double aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aShape));
if (anExtrema.NbExtrema() > 0 &&
+ !anExtrema.Extrema().IsParallel() &&
anExtrema.LowerDistance() < aTolerance) {
// distance is lower than tolerance => tangent case
gp_Pnt aPntC, aPntS;
std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
- return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
+ if (aNorm.get() && aNorm->isInitialized() && anOrigin.get() && anOrigin->isInitialized())
+ return std::shared_ptr<GeomAPI_Ax3>(
+ new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
+
+ return std::shared_ptr<GeomAPI_Ax3>();
}
bool SketchPlugin_Sketch::customAction(const std::string& theActionId)
std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(NORM_ID()));
- if (!anOrigin || !aNorm)
- return std::shared_ptr<GeomAPI_Pln>();
+ if (anOrigin.get() && aNorm.get() && anOrigin->isInitialized() && aNorm->isInitialized())
+ return std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
- return std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
+ return std::shared_ptr<GeomAPI_Pln>();
}
/// Returns currently defined plane as an object of Ax3