# How to split and merge a face outer wire?

Hi All,

I would like to split and merge outer wire of the surface.

E.g. when we will have surface with square outer wire,
after the splitting we will have square outer wire,
but with 5 edges.
For merging this will be opposite process. From 5 edges to 4.

Would you help me how to solve this two problems?

Best regards,

Please, be more specific. When you say "outer wire of the surface" i understand TopoDS_Wire, can you tell me what is strange with the number of edges?

Hi Erki,

Yes, I want to break TopoDS_Wire (outer contour of TopoDS_Face) on given position. So the wire will contains n+1 edges after the break. The result of the operation will be the same TopoDS_Face, but with one more vertex (one more edge) on its outer contour.
The second operation what I want is opposite: when the outer wire contains two edges of e. g. one line, I want to join them.
I hope it's clear now.

Best regards,

If i don't missunderstand, you want to split an edge firstly into several segments. There are some ways to do that.
One is intersecting that edge with another one or surface( Geom2dAPI_InterCurveCurve, GeomAPI_IntCS)...Than obtain a point(s), divide the edge by BRepBuilderAPI_MakeEdge(anEdge, P1, P2).

An other way, for example, Dividing the edge into segments by calculating a parameter on the edge (BRepBuilderAPI_MakeEdge(anEdge, u1, u2) ) or moving a distance from a point on that edge ( GCPnts_AbscissaPoint ( Curve,
Abscissa, U) ).

When joining curves, if the edge is lineer there should be no problem, connect the far vertexes of the edge.
If the edge is not lineer, use can use GeomConvert::ConcatG1( TColGeom_Array1OfBSplineCurve& ArrayOfCurves,const TColStd_Array1OfReal& ArrayOfToler,Handle(ArrayOfConcatenated,ClosedG1Flag,ClosedTolerance)....

I hope this will be helpfull..

Best Regards,
Erki.

Hi Erki,

I am not sure, that you understand my question. I will try to describe it in another words:

- we have rectangular TopoDS_Face
- wire around is rectangle (outer wire - TopoDS_Wire) => 4 edges
- wire around contains edges - TopoDS_Edges with 3d and p-curve geometry

What I want:
- I want to have the same TopoDS_Face but with one edge split in one point,
which I know before spliting.

Concretely:
Let's have square face, parallel with XY plane, with left-bottom vertex in [0,0,0].
Side of square is 100. I want to split one edge of this face in [50, 0, 0].
So, resulting TopoDS_Face will have the same geometry, but when I will explore
its outer wire, I will obtain edges:
[0, 0, 0] - [50, 0, 0]
[50, 0, 0] - [100, 0, 0]
[100, 0, 0] - [100, 100, 0]
[100, 100, 0] - [0, 100, 0]
[0, 100, 0] - [0, 0, 0]

Best regards,