Part: [skip ci] fixes #0004169: DatumPoint at the intersection of a DatumPlane and DatumPoint not working correctly
This commit is contained in:
@@ -33,23 +33,16 @@
|
||||
# include <gp_Ax1.hxx>
|
||||
# include <gp_Pnt.hxx>
|
||||
# include <gp_Dir.hxx>
|
||||
# include <gp_Circ.hxx>
|
||||
# include <gp_Elips.hxx>
|
||||
# include <gp_Parab.hxx>
|
||||
# include <gp_Hypr.hxx>
|
||||
# include <Geom_Line.hxx>
|
||||
# include <Geom_Circle.hxx>
|
||||
# include <Geom_Ellipse.hxx>
|
||||
# include <Geom_Hyperbola.hxx>
|
||||
# include <Geom_Parabola.hxx>
|
||||
# include <Geom_BezierCurve.hxx>
|
||||
# include <Geom_BSplineCurve.hxx>
|
||||
# include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
# include <Geom_Plane.hxx>
|
||||
# include <Geom2d_Curve.hxx>
|
||||
# include <Geom2dAPI_InterCurveCurve.hxx>
|
||||
# include <Geom2dAPI_ProjectPointOnCurve.hxx>
|
||||
# include <GeomAPI.hxx>
|
||||
# include <GeomAdaptor.hxx>
|
||||
# include <BRepAdaptor_Surface.hxx>
|
||||
# include <BRepAdaptor_Curve.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
@@ -2119,70 +2112,28 @@ gp_Pnt AttachEnginePoint::getProximityPoint(eMapMode mmode, const TopoDS_Shape&
|
||||
BRepAdaptor_Curve crv(TopoDS::Edge(edge));
|
||||
|
||||
GeomAdaptor_Curve typedcrv;
|
||||
|
||||
switch(crv.GetType()) {
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
Handle(Geom_Line) geomt = new Geom_Line(crv.Line());
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
Handle(Geom_Circle) geomt = new Geom_Circle(crv.Circle());
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Ellipse:
|
||||
{
|
||||
Handle(Geom_Ellipse) geomt = new Geom_Ellipse(crv.Ellipse());
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Hyperbola:
|
||||
{
|
||||
Handle(Geom_Hyperbola) geomt = new Geom_Hyperbola(crv.Hyperbola());
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Parabola:
|
||||
{
|
||||
Handle(Geom_Parabola) geomt = new Geom_Parabola(crv.Parabola());
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle(Geom_BezierCurve) geomt = crv.Bezier();
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(Geom_BSplineCurve) geomt = crv.BSpline();
|
||||
typedcrv.Load(geomt);
|
||||
break;
|
||||
}
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
case GeomAbs_OffsetCurve:
|
||||
#endif
|
||||
case GeomAbs_OtherCurve:
|
||||
Base::Console().Warning("AttachEnginePoint::getProximityPoint curve not supported, intersection may not work properly");
|
||||
typedcrv = crv.Curve();
|
||||
break;
|
||||
try {
|
||||
// Important note about BRepIntCurveSurface_Inter and GeomAdaptor_Curve
|
||||
//
|
||||
// A GeomAdaptor_Curve obtained directly from BRepAdaptor_Curve will lose the information
|
||||
// about Location/orientation of the edge.
|
||||
//
|
||||
// That's why GeomAdaptor::MakeCurve() is used to create a new geometry with the
|
||||
// transformation applied.
|
||||
typedcrv.Load(GeomAdaptor::MakeCurve(crv));
|
||||
}
|
||||
catch (const Standard_DomainError&) {
|
||||
Handle(Geom_Curve) curve = crv.Curve().Curve();
|
||||
if (curve.IsNull()) {
|
||||
// Can this ever happen?
|
||||
typedcrv = crv.Curve();
|
||||
}
|
||||
else {
|
||||
curve = Handle(Geom_Curve)::DownCast(curve->Copy());
|
||||
curve->Transform(crv.Trsf());
|
||||
typedcrv.Load(curve);
|
||||
}
|
||||
}
|
||||
|
||||
// Important note about BRepIntCurveSurface_Inter and GeomAdaptor_Curve
|
||||
//
|
||||
// In OCCT 7.4 (and apparently <= 7.4 too):
|
||||
//
|
||||
// A GeomAdaptor_Curve obtained directly from BRepAdaptor_Curve will not work because it won't respect the
|
||||
// Location/orientation of the underlying curve.
|
||||
//
|
||||
// This is why the code above is necessary to generate an intermediary curve handle, from which to get an
|
||||
// GeomAdaptor_Curve that will maintain the location and orientation.
|
||||
//
|
||||
// To test this apparent OCCT bug, just change in intCS.Init below typedcrv with crv.Curve().
|
||||
|
||||
BRepIntCurveSurface_Inter intCS;
|
||||
intCS.Init(face, typedcrv, Precision::Confusion());
|
||||
|
||||
Reference in New Issue
Block a user