# eryar

PipeCAD - Plant Piping Design Software.
RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
posts - 603, comments - 590, trackbacks - 0, articles - 0

Abstract. The sphere is the simplest topology shape of the BRep structure. But there are several import concept of the sphere edges, such as degenerated edge and seam edge. So construct a sphere by code, you will learn these.

1. Introduction

Figure 1.1 Sphere in Draw Test Harness

2.Make the Sphere

2.1 Make Vertex

// make the north and south poles.
aBuilder.MakeVertex(aNorthPole, aPoints[0], Precision::Confusion());
aBuilder.MakeVertex(aSouthPole, aPoints[
1], Precision::Confusion());

2.2 Make Edge

// make the seam edge with the 3D geometry curve.
aBuilder.MakeEdge(aSeamEdge, new Geom_Circle(aCircle), Precision::Confusion());

// there is no 3D geometry curve in the degenerated edge.
aBuilder.MakeEdge(aNorthEdge);
aBuilder.Degenerated(aNorthEdge, Standard_True);

// there is no 3D geometry curve in the degenerated edge.
aBuilder.MakeEdge(aSouthEdge);
aBuilder.Degenerated(aSouthEdge, Standard_True);

// set the vertex info of the seam edges.
{
TopoDS_Vertex V1
= aNorthPole;
TopoDS_Vertex V2
= aSouthPole;

V1.Reverse();

aBuilder.UpdateVertex(V1, ElCLib::Parameter(aCircle, aPoints[
0]), aSeamEdge, Precision::Confusion());

aBuilder.UpdateVertex(V2, ElCLib::Parameter(aCircle, aPoints[
1]), aSeamEdge, Precision::Confusion());

BRepTools::Update(aSeamEdge);
}

// set the vertex info of the north degenerated edge.
{
TopoDS_Vertex V1
= aNorthPole;
TopoDS_Vertex V2
= aNorthPole;

V2.Reverse();

BRepTools::Update(aNorthEdge);
}

// set the vertex info of the south degenerated edge.
{
TopoDS_Vertex V1
= aSouthPole;
TopoDS_Vertex V2
= aSouthPole;

V2.Reverse();

BRepTools::Update(aSouthEdge);
}

2.3 Make Wire

// make wire.
aBuilder.MakeWire(aWire);

// add edges to the wire.
{
TopoDS_Edge E1
= aNorthEdge;
TopoDS_Edge E2
= aSeamEdge;
TopoDS_Edge E3
= aSouthEdge;
TopoDS_Edge E4
= aSeamEdge;

E1.Reverse();
E4.Reverse();

BRepTools::Update(aWire);
}

2.4 Make Face

// make face.
aBuilder.MakeFace(aFace, new Geom_SphericalSurface(aSphere), Precision::Confusion());

// set the pcurve info between edge and face.
{
aBuilder.Range(aNorthEdge,
0.02 * M_PI);
aBuilder.UpdateEdge(aNorthEdge,
new Geom2d_Line(aLines[0]), aFace, Precision::Confusion());

aBuilder.Range(aSeamEdge,
1.5 * M_PI, 2.5 * M_PI);
aBuilder.UpdateEdge(aSeamEdge,
new Geom2d_Line(aLines[1]), new Geom2d_Line(aLines[2]), aFace, Precision::Confusion());
aBuilder.Continuity(aSeamEdge, aFace, aFace, GeomAbs_CN);

aBuilder.Range(aSouthEdge,
0.02 * M_PI);
aBuilder.UpdateEdge(aSouthEdge,
new Geom2d_Line(aLines[3]), aFace, Precision::Confusion());

BRepTools::Update(aFace);
}

Figure 2.4.1 Seam Edge Range[-PI/2, PI/2]

Figure 2.4.2 Circle in Seam Edge Range [-PI/2, PI/2]

Figure 2.4.3 Wrong Seam Edge Geometry Curve

Figure 2.4.4 Wrong Seam Edge Geometry Curve

3. Test the Sphere

Figure 3.1 Show the Sphere from file in Draw Test Harness

Figure 3.2 Spher and a Box

Figure 3.3 Sphere cut a Box

4. Conclusion

5. References

1. OpenCascade Primitives BRep - Sphere,

2. PCurve - Curve on Surface,

3. Topology and Geometry in OpenCascade-Face,