diff --git a/src/Mod/Fem/App/FemConstraint.cpp b/src/Mod/Fem/App/FemConstraint.cpp index 2fb0248ff9..60109a6053 100644 --- a/src/Mod/Fem/App/FemConstraint.cpp +++ b/src/Mod/Fem/App/FemConstraint.cpp @@ -171,6 +171,7 @@ bool Constraint::getPoints(std::vector &points, std::vectorShape.getShape(); if (toposhape.isNull()) return false; + sh = toposhape.getSubShape(SubElements[i].c_str()); if (sh.ShapeType() == TopAbs_VERTEX) { @@ -183,7 +184,8 @@ bool Constraint::getPoints(std::vector &points, std::vectorcalcDrawScaleFactor(sqrt(lx)*0.5); //OvG: setup draw scale for constraint - } else if (sh.ShapeType() == TopAbs_EDGE) { + } + else if (sh.ShapeType() == TopAbs_EDGE) { BRepAdaptor_Curve curve(TopoDS::Edge(sh)); double fp = curve.FirstParameter(); double lp = curve.LastParameter(); @@ -208,6 +210,7 @@ bool Constraint::getPoints(std::vector &points, std::vectorcalcDrawScaleFactor(); //OvG: setup draw scale for constraint } + steps = steps>CONSTRAINTSTEPLIMIT?CONSTRAINTSTEPLIMIT:steps; //OvG: Place upper limit on number of steps double step = (lp - fp) / steps; for (int i = 0; i < steps + 1; i++) { @@ -215,29 +218,69 @@ bool Constraint::getPoints(std::vector &points, std::vectorValue(ufp, vfp); + gp_Pnt p2 = hsurf->Value(ulp, vfp); + l = p1.Distance(p2); + } + + try { + isoc.Load(GeomAbs_IsoU, vlp); + lv = (l + GCPnts_AbscissaPoint::Length(isoc, Precision::Confusion()))/2.0; + } + catch (const Standard_Failure&) { + gp_Pnt p1 = hsurf->Value(ufp, vlp); + gp_Pnt p2 = hsurf->Value(ulp, vlp); + lv = (l + p1.Distance(p2))/2.0; + } + + try { + isoc.Load(GeomAbs_IsoV, ufp); + l = GCPnts_AbscissaPoint::Length(isoc, Precision::Confusion()); + } + catch (const Standard_Failure&) { + gp_Pnt p1 = hsurf->Value(ufp, vfp); + gp_Pnt p2 = hsurf->Value(ufp, vlp); + l = p1.Distance(p2); + } + + try { + isoc.Load(GeomAbs_IsoV, ulp); + lu = (l + GCPnts_AbscissaPoint::Length(isoc, Precision::Confusion()))/2.0; + } + catch (const Standard_Failure&) { + gp_Pnt p1 = hsurf->Value(ulp, vfp); + gp_Pnt p2 = hsurf->Value(ulp, vlp); + lu = (l + p1.Distance(p2))/2.0; + } + int stepsv; if (lv >= 30) //OvG: Increase 10 units distance proportionately to lv for larger objects. { @@ -255,6 +298,7 @@ bool Constraint::getPoints(std::vector &points, std::vectorcalcDrawScaleFactor(); //OvG: setup draw scale for constraint } + stepsv = stepsv>CONSTRAINTSTEPLIMIT?CONSTRAINTSTEPLIMIT:stepsv; //OvG: Place upper limit on number of steps int stepsu; if (lu >= 30) //OvG: Increase 10 units distance proportionately to lu for larger objects. @@ -273,6 +317,7 @@ bool Constraint::getPoints(std::vector &points, std::vectorcalcDrawScaleFactor(); //OvG: setup draw scale for constraint } + stepsu = stepsu>CONSTRAINTSTEPLIMIT?CONSTRAINTSTEPLIMIT:stepsu; //OvG: Place upper limit on number of steps double stepv = (vlp - vfp) / stepsv; double stepu = (ulp - ufp) / stepsu;