Mon, 07/16/2012 - 15:25

In some edges, the orientation of the first vertex is reverse which is like to be in the following example, where vertex -4 appears in the first position, and +11 appears in the second position.

TShape # 2 : EDGE 0101000 04A7430C

-4 +11

Tolerance : 1e-007

same parametrisation of curves

same range on curves

- Curve 3D : 4, range : 0 1000

- PCurve : 5 on surface 1, range : 0 1000

UV Points : 0, 0 0, -1000

I don't know whether there are some differences between the two representations like (-4, +11), and (+11, -4) in the above example.

If there are some differences, then my second problem is how to get the two vertices of an edge in their appearance indices. In the above example, I want to get (-4, +11), not

(+11, -4). I have obtained (+11, -4) by using TopExp::FirstVertex and TopExp::LastVertex. My codes are like this:

FirstV = TopExp::FirstVertex(aEdge1);

LastV = TopExp::LastVertex(aEdge1);

Mon, 07/16/2012 - 16:29

I still don't understand the difference between the two representations like (-4, +11), and (+11, -4). But now I can obtain (-4, +11), and the codes like this:

TopExp_Explorer exVertex;

exVertex.Init(aEdge1.Oriented (TopAbs_FORWARD), TopAbs_VERTEX);

if(exVertex.More())

{

FirstV = TopoDS::Vertex(exVertex.Current());

}

exVertex.Next();

if(exVertex.More())

{

LastV = TopoDS::Vertex(exVertex.Current());

}

Mon, 07/16/2012 - 16:45

It seems that it doesn't matter for making a face with the two types of edges represented like (-4, +11) or (+11, -4).

Mon, 07/16/2012 - 17:45

I'm not completely following: what API call do you use to get the -4, +11 George?

Thanks,

-jelle

Mon, 07/16/2012 - 18:10

Dear Feng,

Have you solved you problems! I have multiple disconnected edges! My aim was to create a wire from this disconnected edges. Now I connected them together using the following code, but still have the orientation problem. Here i have a big problem to use the vertex of edges for further calculation. The orientation of edges are different. How i could make them the same orientation,

Handle(TopTools_HSequenceOfShape) Edges = new TopTools_HSequenceOfShape()for (TopExp_Explorer Ex(shapeCommon,TopAbs_EDGE); Ex.More(); Ex.Next()) //TopoDS_Shape shape common consists //disconnected edges!

Edges->Append(TopoDS::Edge(Ex.Current()));

// Generate wires from the edges and determined the nature of the underlying Handle(TopTools_HSequenceOfShape) Wires = new TopTools_HSequenceOfShape();

ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Edges,1.5*minEdgeLengthGreaterIgesRes,Standard_False,Wires); //Wonderful tool?

for(int w=1; w<=Wires->Length();w++)

{ //For each wire

TopoDS_Wire Wire = TopoDS::Wire(Wires->Value(w));

if(Wire.Closed())

qDebug()<<" Wire %ld is Closed\n"<Value(w))); aWireExp.More(); aWireExp.Next())

{ //For each edge in wire. Note that BRepTools_WireExplorer returns edges in order!

TopoDS_Edge aEdge = TopoDS::Edge(aWireExp.Current());

//Analysis of Edge

Standard_Real First, Last;

Handle(Geom_Curve) curve = BRep_Tool::Curve(aEdge,First,Last); //Extract the curve from the edge

GeomAdaptor_Curve aAdaptedCurve(curve);

GeomAbs_CurveType curveType = aAdaptedCurve.GetType();

gp_Pnt pnt1, pnt2;

aAdaptedCurve.D0(First,pnt1);

aAdaptedCurve.D0(Last,pnt2);

int nPoles = 2;

if (curveType == GeomAbs_BezierCurve || curveType == GeomAbs_BSplineCurve)

nPoles = aAdaptedCurve.NbPoles();

qDebug()<<" "<

Mon, 07/16/2012 - 19:56

Dear Milky,

If there is no ciclular curve in your edges, then ShapeFix_Wire should work perfectly. When there is a circle in the edges, ShapeFix_Wire can not calculate the edge's orientation, since the start and end point of a circle is the same. You can find how to use ShapeFix_Wire in another post:

http://www.opencascade.org/org/forum/thread_22936/?forum=3

Thanks for attention my question.

Tue, 07/17/2012 - 12:51

Thank You Very Much for your suggestion!

With your suggestion, I could

-Ordered the edges

-make connected edges

It works fine! But still the orientation is different, some of the edges are FORWARD and some are REVERSE

after using ShapeFix_Wire it self.

I checked orientation after casting edges to curve, that may cause the problem?

Thank your for your information!

Game

Tue, 07/17/2012 - 13:59

It is normal that some of the edges are FORWARD and some are REVERSE. You can visit http://opencascade.blogspot.com/, where a series of posts named Topology and Geometry has introduced why an edge is Forward or Reverse.

Tue, 07/17/2012 - 14:18

Hallo Feng,

Yaa, you are right, i read about orientation before as well, and it is described in documentation as well, but i couldn't find any function to make them the same! All REVERSE or All FORWARD. So that i can change the Edges to curves, for my further analysis in LOOP! In which the orientation is very important!

Do you have any idea how to make them same orientation (preferably FORWARD)?

Thank you Feng, for your help

Game

Tue, 07/17/2012 - 15:03

Can you give me an exmaple to explain why it is important making all the edges orientated Forward?

I think you can make all the edges to be oriented Forward by regenerating the edges oriented Reverse. The following paragrah comes from Topology and Geometry.

Forward edge orientation means that its logical direction matches direction of its curve(s). Reversed orientation means that logical direction is opposite to curve's direction.

So you should regenerat all the underlying curves making them reversed relative to their current orientation for edges oriented reverse. Steps are as follows.

1) for each edge oriented reverse

2) obtaine the underlying curve

3) reverse the curve

4) generate an edge with the reveresed curve

5) end of the for cycle

6) Adding all the edges oriented forward and the generated edges to a wire

7) Reorder the wire with ShapeFix_Wire.

It is a little complex and I don't think it is necessary to do so in most cases.

Tue, 07/17/2012 - 15:39

I normally got disconnected edges from intersection of two surfaces! I need to use this edges to generate more points for numerical calculation. Say i have edge1(1,5) and edge2(10,5). I want to make them the same orientation, like edge1(1,5) and edge2(5,10). So that, i could generate more points between the two end points using GCPnts_UniformAbscissa. say to generate (1,2,3,4,......10). Then to use this data for some other numerical calculation using for LOOP.

If the orientation is not same, i will get (1,2,3,4,5,10,9,8,7,6) which very difficult for my numerical calculation.

So, i need some kind of function, which could reverse curve/edge orientation if different? I searched a lot but not successful yet?

How I can change/reverse the orientation? Hope you got my problem now!

Thank you for the help really!

Tue, 07/17/2012 - 15:24

If all the curves of edges are lines, maybe it will be simple. For all the edges oriented reverse, switch the two parameters passed to GC_MakeSegment to generated a reversed curve, and use RepBuilderAPI_MakeEdge to generated a new edge, and replace the old edge with the new edge to reorder the wire.

Tue, 07/17/2012 - 15:40

I normally got disconnected edges from intersection of two surfaces! I need to use this edges to generate more points for numerical calculation. Say i have edge1(1,5) and edge2(10,5). I want to make them the same orientation, like edge1(1,5) and edge2(5,10). So that, i could generate more points between the two end points using GCPnts_UniformAbscissa. say to generate (1,2,3,4,......10). Then to use this data for some other numerical calculation using for LOOP.

If the orientation is not same, i will get (1,2,3,4,5,10,9,8,7,6) which very difficult for my numerical calculation.

So, i need some kind of function, which could reverse curve/edge orientation if different? I searched a lot but not successful yet?

How I can change/reverse the orientation? Hope you got my problem now!

Thank you for the help really!

Tue, 07/17/2012 - 15:45

It is not a line, it is the intersection of NURB surface and plane!

Is there a function probabily like

if(edge.orientation()==0)

{

change orientation

}

else

{

continue

}

I don't know if there is?

regards!

Tue, 07/17/2012 - 19:26

Thank you very much Feng!

I solved my problem using GCPnts_QuasiUniformAbscissa regardless of edge orientation, and i also found that edge orientation can be changed using

if(aEdge.Orientation() ==TopAbs_REVERSED) {

aEdge.Orientation(TopAbs_FORWARD);

} else

{

aEdge.Orientation(TopAbs_FORWARD);

}

But this doesn't invert the result,

Thank you for your help

Game