Two cylinders are fused together with BRepAlgoAPI_Fuse. The code is as follows.
// first Shape = Cylinder
gp_Pnt middlePoint = gp_Pnt(1000, 0, 1000);//1000,0,1000
gp_Dir direction = gp_Dir(0, 1, 0);
gp_Ax2 Ax2 = gp_Ax2(middlePoint, direction);
aCylinderShape1 = BRepPrimAPI_MakeCylinder(Ax2, 500,2000);
// second Shape = Cone
middlePoint = gp_Pnt(1000, 1000, 1000);
direction = gp_Dir(0, 1, 0);
Ax2 = gp_Ax2(middlePoint, direction);
//Shape2 = BRepPrimAPI_MakeCone(Ax2, 0.0635114, 0, 0.309304);
aCylinderShape2 = BRepPrimAPI_MakeCylinder(Ax2, 500,2000);
TopoDS_Shape aFuseShape = BRepAlgoAPI_Fuse(aCylinderShape1, aCylinderShape2);
After that the cylindrical wire of the first section is dumped out as follows.
Shape : 6, FORWARD
Dump of 6 TShapes
-----------------
Flags : Free, Modified, Checked, Orientable, Closed, Infinite, Convex
TShape # 1 : WIRE 0101000 04A8B6F8
-5 +3 +2 -3
TShape # 2 : EDGE 0101100 04A83684
+4 -4
Tolerance : 1e-007
same parametrisation of curves
same range on curves
- Curve 3D : 3, range : 0 6.28319
- PCurve : 6 on surface 3, range : 0 6.28319
UV Points : 0, 0 6.28319, 0
- PCurve : 7 on surface 4, range : 0 6.28319
UV Points : 500, -1.22465e-013 500, -1.22465e-013
TShape # 3 : EDGE 0101000 04A877C4
+4 -6
Tolerance : 1e-007
same parametrisation of curves
same range on curves
- Curve 3D : 2, range : 0 1000
- PCurve : 4, 5 (CN) on surface 3, range : 0 1000
UV Points : 6.28319, 0 6.28319, 1000
UV Points : 0, 0 0, 1000
TShape # 4 : VERTEX 0101101 04A83594
Tolerance : 1e-007
- Point 3D : 1000, 0, 1500
TShape # 5 : EDGE 0101100 04A84260
+6 -6
Tolerance : 1e-007
same parametrisation of curves
same range on curves
- Curve 3D : 1, range : 0 6.28319
- PCurve : 1 on surface 1, range : 0 6.28319
UV Points : 0, 0 6.28319, 0
- PCurve : 2 on surface 2, range : 0 6.28319
UV Points : 500, 0 500, 0
- PCurve : 3 on surface 3, range : 0 6.28319
UV Points : 0, 1000 6.28319, 1000
TShape # 6 : VERTEX 0101101 04A84170
Tolerance : 1e-007
- Point 3D : 1000, 1000, 1500
-------
Dump of 7 Curve2ds
-------
1 : Line
Origin :0, 0
Axis :1, 0
2 : Circle
Center :0, 0
XAxis :1, 0
YAxis :-0, 1
Radius :500
3 : Line
Origin :0, 1000
Axis :1, 0
4 : Line
Origin :6.28319, -0
Axis :0, 1
5 : Line
Origin :0, -0
Axis :0, 1
6 : Line
Origin :0, 0
Axis :1, 0
7 : Circle
Center :0, 0
XAxis :1, 0
YAxis :-0, 1
Radius :500
-------
Dump of 3 Curves
-------
1 : Circle
Center :1000, 1000, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
Radius :500
2 : Line
Origin :1000, 0, 1500
Axis :0, 1, 0
3 : Circle
Center :1000, 0, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
Radius :500
-------
Dump of 0 Polygon3Ds
-------
-------
Dump of 0 PolygonOnTriangulations
-------
-------
Dump of 4 surfaces
-------
1 : CylindricalSurface
Origin :1000, 1000, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
Radius :500
2 : Plane
Origin :1000, 1000, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
3 : CylindricalSurface
Origin :1000, 0, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
Radius :500
4 : Plane
Origin :1000, 0, 1000
Axis :0, 1, 0
XAxis :0, -0, 1
YAxis :1, 0, -0
-------
Dump of 0 Triangulations
-------
-------
Dump of 0 Locations
-------
I want to know how to output the pcurves of the wire in order. Here is the codes I am using and the output is wrong.
for(Ex.Init(W,aFace); Ex.More(); Ex.Next())
{
aEdge1 = Ex.Current();
aEdgeList.AddTail(aEdge1);
Standard_Boolean Eisreversed = (aEdge1.Orientation() == TopAbs_REVERSED);
BRep_ListIteratorOfListOfCurveRepresentation itrc((*((Handle(BRep_TEdge)*)&aEdge1.TShape()))->ChangeCurves());
while(itrc.More())
{
const Handle(BRep_CurveRepresentation)& cr = itrc.Value();
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
GC->Range(First,Last);
if (cr->IsCurveOnSurface(tSurface, loc))
{
Handle(Geom_Surface) S = GC->Surface();
L = aEdge1.Location() * GC->Location();
if (GC->IsCurveOnClosedSurface() && Eisreversed)
{
theCurve2d_2 = GC->PCurve2();
//output theCurve2d_2
break;
}
else
{
theCurve2d_1 = GC->PCurve();
//output theCurve2d_1
break;
}
}
itrc.Next();
}
}