OpenCasCade(八) 拓扑几何

1.1.1      拓扑几何描述

1.1.2                                                       
OCBRepPrimAPI_MakePrim

(1)    功能说明:swept(拉伸)

(2)    构造函数

OCBRepPrimAPI_MakePrism(OCTopoDS_Shape S, OCgp_Vec V, bool Copy, bool Canonize);

OCBRepPrimAPI_MakePrism(OCTopoDS_Shape S, OCgp_Dir D, bool Inf, bool Copy, bool Canonize);

(3)    参数说明

OCTopoDS_Shape:扫掠拓扑对象

OCgp_Vec:扫掠的方向及大小(向量)

OCgp_Dir:扫掠的方向及大小(单位向量)

Copy:默认值为FALSE; 若为TRUE,则得用扫掠对象副本进行扫掠

Canonize:默认值为TRUE;

Inf:默认值为TRUE; if Inf is false the prism is semi-infinite (in the direction D).

(4)    实例

例1:拓扑点扫掠成边

OCTopoDS_Vertex V1 =

new OCBRepBuilderAPI_MakeVertex(new OCgp_Pnt(-200, -200, 0)).Vertex();

              OCTopoDS_Shape S1 =

new OCBRepPrimAPI_MakePrism(V1, new OCgp_Vec(0, 0, 100), false, false).Shape();

 

例2:拓扑边扫掠成面

OCTopoDS_Edge E =

            new OCBRepBuilderAPI_MakeEdge(new OCgp_Pnt(-150, -150, 0),

new OCgp_Pnt(-50, -50, 0)).Edge();

            OCTopoDS_Shape S2 =

new OCBRepPrimAPI_MakePrism(E, new OCgp_Vec(0, 0, 100), false, false).Shape();

例3:拓扑边框扫掠成体

OCTopoDS_Edge E1,E2,E3;

            OCTopoDS_Wire W = new OCBRepBuilderAPI_MakeWire(E1, E2, E3).Wire();

            OCTopoDS_Shape S3 =

   
new OCBRepPrimAPI_MakePrism(W, new OCgp_Vec(0, 0, 100), false, false).Shape();

 

 

 

1.1.3      OCBRepPrimAPI_MakeRevol

(1)    功能说明:旋转面

(2)    构造函数

public OCBRepPrimAPI_MakeRevol(OCTopoDS_Shape S, OCgp_Ax1 A, bool Copy);

public OCBRepPrimAPI_MakeRevol(OCTopoDS_Shape S, OCgp_Ax1 A, double D, bool Copy);

(3)    参数说明

OCTopoDS_Shape:要进行旋转的拓扑对象

OCgp_Ax1:用某一坐标方向的直线作为旋转轴

Copy:是否用要旋转对象的副本来进行操作,默认值为FALSE;

D:旋转的角度;

 

(4)    实例

例1:拓扑点形成圆弧

OCTopoDS_Vertex V1;

             OCgp_Ax1 axe = new OCgp_Ax1(new OCgp_Pnt(-170, -170, 0), new OCgp_Dir(0, 0, 1));

             OCGeom_Axis1Placement Gax1 = new OCGeom_Axis1Placement(axe);

             OCAIS_Axis ax1 = new OCAIS_Axis(Gax1);

             OCTopoDS_Shape S1 = new OCBRepPrimAPI_MakeRevol(V1, axe, false).Shape();

例2:拓扑边形成柱面

OCTopoDS_Edge E;

            OCAIS_Shape ais3 = new OCAIS_Shape(E);

            OCgp_Ax1 axe = new OCgp_Ax1(new OCgp_Pnt(-100, -100, 0), new OCgp_Dir(0, 0, 1));

            OCGeom_Axis1Placement Gax2 = new OCGeom_Axis1Placement(axe);

            OCAIS_Axis ax2 = new OCAIS_Axis(Gax2);

            OCTopoDS_Shape S2 = new OCBRepPrimAPI_MakeRevol(E, axe, false).Shape();

 

例3:拓扑线框形成环体

OCTopoDS_Edge E1, E2, E3;

            OCTopoDS_Wire W = new OCBRepBuilderAPI_MakeWire(E1, E2, E3).Wire();

            OCgp_Ax1 axe = new OCgp_Ax1(new OCgp_Pnt(0, 0, 30), new OCgp_Dir(0, 1, 0));

            OCGeom_Axis1Placement Gax3 = new OCGeom_Axis1Placement(axe);

            OCAIS_Axis ax3 = new OCAIS_Axis(Gax3);

            OCTopoDS_Shape S3 =

new OCBRepPrimAPI_MakeRevol(W, axe, 210 * PI / 180, false).Shape();

 

 

 

1.1.4      OCBRepOffsetAPI_MakePipe

(1)    功能说明:pipe管道

该类建立一个基础Shape(call profile)沿一个线框(call spine--脊骨)扫掠。

Profile不能包含solids;

该类提供如下功能处理:

    定义管道的构造,实现构造算法且可查看结果。

注意:该类实现管道的构造仅针对G1连续的spine。

      如果是线框应用管道后,变成曲面;如果是面应用管道后,变成体;

(2)    构造函数

public OCBRepOffsetAPI_MakePipe(OCTopoDS_Wire Spine, OCTopoDS_Shape Profile);

(3)    参数说明

Spine:管道的轨迹线;

Profile:沿轨迹线进行扫掠的拓扑SHAPE;

(4)    实例

例1:一个圆面,沿一个曲线(线框)进行扫掠,形成一个SOLID

OCTopoDS_Wire W ;          

            OCgp_Circ c =

new OCgp_Circ(new OCgp_Ax2(new OCgp_Pnt(0, 0, 0), new OCgp_Dir(0, 1, 0)), 10);

            OCTopoDS_Edge Ec = new OCBRepBuilderAPI_MakeEdge(c).Edge();

            OCTopoDS_Wire Wc = new OCBRepBuilderAPI_MakeWire(Ec).Wire();          

            OCTopoDS_Face F = new OCBRepBuilderAPI_MakeFace(Wc, true).Face();

            OCTopoDS_Shape S = new OCBRepOffsetAPI_MakePipe(W, F).Shape();

 

 

 

1.1.5      OCBRepOffsetAPI_ThruSections

(1)    功能说明:

Initializes an algorithm for building a shell or a solid passing through a set of sections;

(2)    构造函数

public OCBRepOffsetAPI_ThruSections(bool isSolid, bool ruled, double pres3d)

(3)    参数说明

isSolid:默认值为FALSE;若为真,则表示算法需要建立一个SOLID,否则,表示,需要建立一个SHELL;

ruled:默认值为FALSE; 是否规则

ruled=true: if the faces generated betweenthe edges of two consecutive wires are ruled surfaces;

ruled=false: if they are smoothed out by approximation

pres3d:defines the precision criterion used by the   approximation algorithm。默认值为:1.0e-6

(4)    实例

例1:通过四个SECTION形成一个SOLID;

OCgp_Circ c1b =

new OCgp_Circ(new OCgp_Ax2(new OCgp_Pnt(100, 0, -100), new OCgp_Dir(0, 0, 1)), 40);

            OCTopoDS_Edge E1b = new OCBRepBuilderAPI_MakeEdge(c1b).Edge();

            OCTopoDS_Wire W1b = new OCBRepBuilderAPI_MakeWire(E1b).Wire();

           

            OCgp_Circ c2b =

new OCgp_Circ(new OCgp_Ax2(new OCgp_Pnt(210, 0, -0), new OCgp_Dir(0, 0, 1)), 40);

            OCTopoDS_Edge E2b = new OCBRepBuilderAPI_MakeEdge(c2b).Edge();

            OCTopoDS_Wire W2b = new OCBRepBuilderAPI_MakeWire(E2b).Wire();

          

            OCgp_Circ c3b =

new OCgp_Circ(new OCgp_Ax2(new OCgp_Pnt(275, 0, 100), new OCgp_Dir(0, 0, 1)), 40);

            OCTopoDS_Edge E3b = new OCBRepBuilderAPI_MakeEdge(c3b).Edge();

            OCTopoDS_Wire W3b = new OCBRepBuilderAPI_MakeWire(E3b).Wire();

          

            OCgp_Circ c4b =

new OCgp_Circ(new OCgp_Ax2(new OCgp_Pnt(200, 0, 200), new OCgp_Dir(0, 0, 1)), 40);

            OCTopoDS_Edge E4b = new OCBRepBuilderAPI_MakeEdge(c4b).Edge();

            OCTopoDS_Wire W4b = new OCBRepBuilderAPI_MakeWire(E4b).Wire();

          

            OCBRepOffsetAPI_ThruSections generatorb =

 new OCBRepOffsetAPI_ThruSections(true, false, 1.0e-06);

            generatorb.AddWire(W1b);

            generatorb.AddWire(W2b);

            generatorb.AddWire(W3b);

            generatorb.AddWire(W4b);

            generatorb.Build();

            OCTopoDS_Shape S2 = generatorb.Shape();

 

 

 

1.1.6      BRepOffsetAPI_MakePipeShell

说明:

该类提供了一个框架,沿着脊柱的导线构建一个shell或者solid。

构造solid,初始线框必须闭合的。

主要通过两种方法进行定义:

一、截面

二、定义扫掠方式

posted @ 2011-12-13 10:56  folotus  阅读(4270)  评论(0编辑  收藏  举报