fixes #19831 - additional code to cover projection of split curve edge
This commit is contained in:
@@ -8965,6 +8965,27 @@ void processEdge(const TopoDS_Edge& edge,
|
||||
// all we need to do is match coordinate systems
|
||||
// for some reason OCC doesn't like to project a planar B-Spline to a plane parallel to it
|
||||
if (planar && plane.Axis().Direction().IsParallel(sketchPlane.Axis().Direction(), Precision::Confusion())) {
|
||||
TopoDS_Edge projEdge = edge;
|
||||
|
||||
// We need to trim the curve in case we are projecting a B-Spline segment
|
||||
if(curve.GetType() == GeomAbs_BSplineCurve){
|
||||
double Param1 = curve.FirstParameter();
|
||||
double Param2 = curve.LastParameter();
|
||||
|
||||
if (Param1 > Param2){
|
||||
std::swap(Param1, Param2);
|
||||
}
|
||||
|
||||
// trim curve in case we are projecting a segment
|
||||
auto bsplineCurve = curve.BSpline();
|
||||
if(Param2 - Param1 > Precision::Confusion()){
|
||||
bsplineCurve->Segment(Param1, Param2);
|
||||
projEdge = BRepBuilderAPI_MakeEdge(bsplineCurve).Edge();
|
||||
}
|
||||
}
|
||||
|
||||
projShape.setShape(projEdge);
|
||||
|
||||
// We can't use gp_Pln::Distance() because we need to
|
||||
// know which side the plane is regarding the sketch
|
||||
const gp_Pnt& aP = sketchPlane.Location();
|
||||
@@ -8973,12 +8994,10 @@ void processEdge(const TopoDS_Edge& edge,
|
||||
double d = (aDir.X() * (aP.X() - aLoc.X()) +
|
||||
aDir.Y() * (aP.Y() - aLoc.Y()) +
|
||||
aDir.Z() * (aP.Z() - aLoc.Z()));
|
||||
|
||||
|
||||
gp_Trsf trsf;
|
||||
trsf.SetTranslation(gp_Vec(aDir) * d);
|
||||
projShape.setShape(edge);
|
||||
projShape.transformShape(Part::TopoShape::convert(trsf), /*copy*/false);
|
||||
|
||||
} else {
|
||||
// When planes not parallel or perpendicular, or edge is not planar
|
||||
// normal projection is working just fine
|
||||
|
||||
Reference in New Issue
Block a user