Thu, 04/07/2011 - 10:26

Forums:

I want to get normal of an edge. Can any one tell how to get. TopExp_Explorer to iterate over edges.

Also can any one tell how to get connect edges of a face. My problem is I have a pipe and I want to get the radial edge of it not the seams.Pls help.

Thu, 04/07/2011 - 16:34

To get the normal of the edge, get the Geom_Curve corresponding to the edge, then call the method D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V1) to get the first derivative.

I'm not sure how to get the edges connected to a face. However, if your pipe is a simple cylinder and all you need to do is differentiate between the edge that is the seam and the edges that are the ends of the cylinder then you can check the type of the curve that makes up the edge:

for (Ex.Init(myPipeShape,TopAbs_EDGE); Ex.More(); Ex.Next())

{

// Get the curve

Handle(Geom_Curve) curve;

double dParamStart;

double dParamEnd;

curve = BRep_Tool::Curve(TopoDS::Edge(Ex.Current()), dParamStart, dParamEnd );

// Always make sure the curve is not NULL!

// Some shapes, such as spheres, cones, and tori can have

// null curves for edges at the poles or apex.

if( !curve.IsNull() )

{

// Get the normal at the start

gp_Pnt ptStart;

gp_Vec vStart;

curve->D1( dParamStart, ptStart, vStart );

// Check the type of curve

if (curve->IsKind(STANDARD_TYPE(Geom_Circle)))

{

// This is the end of the cylinder

}

}

}

Tue, 08/30/2016 - 09:24

Hi,

you can also try the static methods of TopOpeBRepBuild_Tools class:

or:

look also in the docs.

H1

Tue, 08/30/2016 - 13:15

Hey, that's a very useful pointer...

This function used to compute normal in point which is located near the point with param UV (used for computation of normals where the normal in the point UV equal to zero). However, I think the docs on the

TopOpeBRepBuild_Tools::GetNormalInNearestPoint( const TopoDS_Face& aFace, const TopoDS_Edge& anEdge, gp_Vec& aNormal )method are pretty confusing:However, its not so clear which UV param is used here... not so informative, since the method doesnt take a UV parameter.