ConicalSurface类:用来创建一个园锥表面; 构造表面得方法有:
--已知一个园锥表面,与空间一点,过此点得平行于已知园锥表面;
--已知一个园锥表面,与一个距离,创建一个平行于已知园锥表面得园锥表面; --通过四个点构造一个园锥表面; --通过一个轴与两个点; --通过两个点与两个半径; GeomAPI_IntCS类:
此类用来计算一个园弧与与一个表面得交点或相交线段; GeomFill_BSplineCurves类:
此类用来构造一个可以填充得BSpline表面,构造它可以用两个三个或四个BSpline曲线作为边界; 填充类型有三种:
enum GeomFill_FillingStyle { GeomFill_StretchStyle, GeomFill_CoonsStyle, GeomFill_CurvedStyle };
以下示例为用两个样条曲线生成一个表面:
GeomFill_FillingStyle Type =
GeomFill_StretchStyle;
GeomFill_BSplineCurves
aGeomFill1(SPL1,SPL2,Type);
Handle(Geom_BSplineSurface) aBSplineSurface1 = aGeomFill1、Surface(); GeomFill_Pipe类:
此类用来构造一个pipe,沿着一个路径sweep一个截面,这两个都就是曲线类型;一般来说,结果就是一个BSpline表面; 常见得有几种方法:
--给定一个路径与一个半径,截面就是个园,位置就是路径得第一个点, 比如:
GeomFill_Pipe
aPipe(SPL1,1);
aPipe、
Perform(); Handle(Geom_Surface) aSurface= aPipe、
Surface();
Standard_CString aSurfaceEntityTypeName=\ if (!aSurface、
IsNull())
aSurfaceEntityTypeName = aSurface->DynamicType()->Name();
--给定一个路径与一个截面。 比如:
Handle(Geom_Ellipse) E = GC_MakeEllipse( gp::XOY() ,3,1)、Value();
GeomFill_Pipe
aPipe2(SPL1,E);
aPipe2、
Perform();
Handle(Geom_Surface) aSurface2= aPipe2、Surface();
Standard_CString aSurfaceEntityTypeName2=\ if (!aSurface2、
IsNull()) {
aSurfaceEntityTypeName2 = aSurface2->DynamicType()->Name(); aSurface2->Translate(gp_Vec(5,0,0)); }
--给定一个路径与两个截面,中间截面为过度线; 示例:
Handle(Geom_TrimmedCurve) TC1
= GC_MakeSegment(gp_Pnt(1,1,1),gp_Pnt(5,5,5));
Handle(Geom_TrimmedCurve) TC2
= GC_MakeSegment(gp_Pnt(1,1,0),gp_Pnt(4,5,6));
GeomFill_Pipe
aPipe3(SPL1,TC1,TC2);
aPipe3、
Perform();
Handle(Geom_Surface) aSurface3 = aPipe3、Surface();
Standard_CString aSurfaceEntityTypeName3=\ if (!aSurface3、
IsNull())
{
aSurfaceEntityTypeName3 = aSurface3->DynamicType()->Name(); aSurface3->Translate(gp_Vec(10,0,0));
} --给定一个路径与N个截面,中间为过渡线;
一般情况下,所生结果为:NURBS,但就是,在一些特殊得情况下,可以生成平面,园柱,球,园锥等;
参数,U,沿着截面得方向,V沿着路径方向; Geom_BezierSurface类: 生成一个Bezier表面; Geom_OffsetSurface类: 用来偏移一个表面; 比如:
Standard_Real offset =
1;
Handle(Geom_OffsetSurface) GOS = new Geom_OffsetSurface(aGeomSurface, offset); Geom_SweptSurface类:
有两个派生类,分别用来生成一个回转体表面与一个延展体表面; Geom_SurfaceOfLinearExtrusion:用来描述一个线性延展表面; 它得基类就是:Geom_Surface类 比如:
Handle(Geom_BSplineCurve) aCurve =GeomAPI_PointsToBSpline(array)、Curve();
gp_Dir
aDir(1,2,3);
Handle(Geom_SurfaceOfLinearExtrusion) SOLE =new
Geom_SurfaceOfLinearExtrusion(aCurve,aDir); Handle(Geom_RectangularTrimmedSurface) aTrimmedSurface =new Geom_RectangularTrimmedSurface(SOLE,-10,10,false);
Geom_SurfaceOfRevolution类,表示一个回转体表面; 比如:
Handle(Geom_BSplineCurve) aCurve = GeomAPI_PointsToBSpline(array)、Curve();
Handle(Geom_SurfaceOfRevolution) SOR =new Geom_SurfaceOfRevolution(aCurve,gp::OX());
1:利用一个二维数组来生成曲面得方法: TColgp_Array2OfPnt array3
(1,5,1,5); array3、SetValue(1,1,gp_Pnt (-4,-4,5)); 、、、
array3、SetValue(2,1,gp_Pnt (-2,-4,4)); 、、、
Handle(Geom_BSplineSurface) aSurf2 =GeomAPI_PointsToBSplineSurface(array3)、Surface();
2:GeomAPI_ExtremaSurfaceSurface类: 计算两个表面之间得极值点; 主要方法:
(1):Quantity_Length LowerDistance() const;计算两个表面得最短距离; (2):Standard_EXPORT void LowerDistanceParameters(Quantity_Parameter& U1,Quantity_Parameter& V1,Quantity_Parameter& U2,Quantity_Parameter& V2) const; 得到第一个表面上得极值点得UV参数与第二个表面上得极值点得UV参数;
(3):void NearestPoints(gp_Pnt& P1,gp_Pnt& P2) const;得到第一个表面上得极值点与第二个表面上得极值点;
(4): Quantity_Length Distance(const Standard_Integer Index) const;得到第N个极值点得距离;
(5):Standard_Integer NbExtrema() const;极值得数目; 、、、、、、 示例:
GeomAPI_ExtremaSurfaceSurface ESS(aSurf1,aSurf2); Quantity_Length dist = ESS、LowerDistance(); gp_Pnt P1,P2;
ESS、NearestPoints(P1,P2);
gp_Pnt P3,P4;
Handle(Geom_Curve) aCurve;
Standard_Integer NbExtrema = ESS、NbExtrema(); for(Standard_Integer k=1;k<=NbExtrema;k++){
ESS、
Points(k,P3,P4);
aCurve= GC_MakeSegment(P3,P4)、Value();
DisplayCurve(aDoc,aCurve,Quantity_NOC_YELLOW3,false); }
一些OCC得基础知识,愿与各位OCC爱好者共同学习;mail:
一:关于体得类
BRepBuilderAPI_MakeVertex类 创建点;
BRepBuilderAPI_MakeEdge类 此类用来创建边; 比如,由直线生成边:
gp_Lin line(gp_Ax1(gp_Pnt(10,10,10),gp_Dir(1,0,0)));
WhiteEdge = BRepBuilderAPI_MakeEdge(line,-20,10); 下面为生成四分之一园边:
gp_Elips Elips(gp_Ax2(gp_Pnt(10,0,0),gp_Dir(1,1,1)),60,30); RedEdge = BRepBuilderAPI_MakeEdge(Elips,0,PI/2); 下面就是由曲线生成边:
Handle (Geom_BezierCurve) curve = new Geom_BezierCurve(array); BRepBuilderAPI_MakeEdge ME (curve); GreenEdge = ME;
OCC类基础



