For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Edge on Face/surface

Anonymous's picture

How can we create an Edge on a Face or a surface, linking 2 existing Vertices, with criterion such as for example being the shortest Edge as possible?


Guillen Antonio's picture

TopoDS_Face Face =TopoDS::Face(XX); Handle (Geom_Surface) Surface = BRep_Tool::Surface (Face);

TopoDS_Vertex VFrom = TopoDS::Vertex (YY);

TopoDS_Vertex VTo = TopoDS::Vertex (ZZ); gp_Pnt PFrom = BRep_Tool::Pnt(VFrom); gp_Pnt PTo = BRep_Tool::Pnt(VTo); TopoDS_Edge Result; BRep_Builder Builder; Builder.MakeEdge (Result); Handle (Geom2d_Curve) OriginalCurve = Handle (Geom2d_Curve)::DownCast(aGeometryForTheEdge);

Handle (Geom2d_Curve) Curve = Handle (Geom2d_Curve)::DownCast(OriginalCurve->Copy());

Handle (Geom2d_Curve) Curve1 = Handle (Geom2d_Curve)::DownCast(Curve->Transformed (TheTransformation));

Builder.UpdateEdge (Result, Curve1, Face, BRepBuilderAPI::Precision()); VFrom.Orientation (TopAbs_FORWARD); VTo.Orientation (TopAbs_REVERSED); Builder.Add(Result, VFrom); Builder.Add(Result, VTo);

Builder.Range (Result, Face, Curve1->FirstParameter(), Curve1->LastParameter()); Standard_Boolean Curve3dIsBuilt; Curve3dIsBuilt = BRepLib::BuildCurve3d(Result);

return Result;