在OpenCascade中更改线型-Change Line Type in OpenCascade
关键字KeyWords:OpenCascade,Line Aspect, Line Type
在OpenCascade的显示模块中,可以设置线型、消隐方式和离散精度等属性。这些属性都是在AIS_Drawer中设置。
AIS_Drawer类就是用来管理显示属性的。可以设置如下显示属性:
- void SetLineAspect (const Handle< Prs3d_LineAspect > &anAspect)
- void SetWireAspect (const Handle< Prs3d_LineAspect > &anAspect)
- void SetDeviationCoefficient (const Standard_Real aCoefficient)
- void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
以为设置线型是用SetLineAspect,结果试了一下,不成功。查找了一下论坛,也有人有同样的问题:
http://www.opencascade.org/org/forum/thread_12589/?forum=3
又搜索了下,发现设置拓朴形状线型的函数是用:SetWireAspect,试验成功!示例程序如下所示:
Handle_AIS_Shape xAxis
=
new
AIS_Shape(BRepBuilderAPI_MakeEdge(gp_Pnt(
-
5000
,
0
,
0
), gp_Pnt(
5000
,
0
,
0
)));
Handle_Prs3d_LineAspect lineAspect = new Prs3d_LineAspect(Quantity_NOC_WHITE, Aspect_TOL_DOTDASH, 1 );
xAxis -> Attributes() -> SetWireAspect(lineAspect);
myAISContext -> Display(xAxis, false );
Handle_Prs3d_LineAspect lineAspect = new Prs3d_LineAspect(Quantity_NOC_WHITE, Aspect_TOL_DOTDASH, 1 );
xAxis -> Attributes() -> SetWireAspect(lineAspect);
myAISContext -> Display(xAxis, false );