做十来个网站优化,餐饮网站程序,广告设计公司实践报告,北京百度关键词优化文章目录 1、前言2、在Opencascad中显示小的坐标系3、在Opencascad中创建自定义的坐标系 1、前言
在Opencascad开发时#xff0c;在view中可以显示小的坐标系#xff0c;但是有时我们需要在建模时创建基准坐标系#xff0c;当然可以作为工件坐标系也可以作为基准坐标系。本… 文章目录 1、前言2、在Opencascad中显示小的坐标系3、在Opencascad中创建自定义的坐标系 1、前言
在Opencascad开发时在view中可以显示小的坐标系但是有时我们需要在建模时创建基准坐标系当然可以作为工件坐标系也可以作为基准坐标系。本文以一个实际的例子讲述一下自定义坐标系的创建当然我们默认是显示框架已经做好了。 2、在Opencascad中显示小的坐标系
首先看到效果如下图所示 这个是通过
Handle(V3d_View) myView; //这里需要初始化
myView-TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER);//这是显示小坐标系的代码当然可以设置这个坐标系的样式其可以设置为cube形式其代码为
myView-TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER);//这是显示小坐标系的代码//myView-TriedronErase(); 隐藏坐标系viewCube new AIS_ViewCube();myContext-Display(viewCube, Standard_True);其效果为 这里就多了一个坐标系所有打开上面代码中注释的 //myView-TriedronErase(); 隐藏坐标系即可。 如下图 完整的代码为
myView-TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER);//这是显示小坐标系的代码myView-TriedronErase(); 隐藏坐标系viewCube new AIS_ViewCube();myContext-Display(viewCube, Standard_True);但是对于我这种人来说出现这个cube反而感觉很不舒服毕竟感觉很丑所以我一般都不会用cube样式的喜欢干净整洁的。
3、在Opencascad中创建自定义的坐标系
创建自定义的坐标系需要用的类是AIS_Trihedron 其完整的代码为
//创建工件坐标系gp_Pnt origionPnt(0, 0, 0);//原点gp_Pnt xAxisPnt(1, 0, 0); gp_Vec vectorX(origionPnt, xAxisPnt); //X轴矢量gp_Dir aixX(vectorX / vectorX.Magnitude());// X轴gp_Vec vectorY vectorX.Rotated(gp_Ax1(origionPnt, gp_Dir(0, 0, 1)), M_PI_2); //获取Y轴矢量gp_Vec vectorZ vectorX.Crossed(vectorY); //Z轴矢量gp_Dir aixZ (vectorZ / vectorZ.Magnitude());//Z轴gp_Ax2 ax2 gp_Ax2(origionPnt, aixZ, aixX);Handle(Geom_Axis2Placement) TrihedronAxis new Geom_Axis2Placement(ax2);partTrihedron new AIS_Trihedron(TrihedronAxis);partTrihedron-SetTypeOfPresentation(PrsMgr_TypeOfPresentation3d::PrsMgr_TOP_AllView); //设置显示样式所有视图有效partTrihedron-SetDatumDisplayMode(Prs3d_DatumMode::Prs3d_DM_Shaded); //设置基准形状样式//设置轴向标签partTrihedron-SetLabel(Prs3d_DatumParts::Prs3d_DP_Origin, OC); partTrihedron-SetLabel(Prs3d_DatumParts::Prs3d_DP_XAxis, XC);partTrihedron-SetLabel(Prs3d_DatumParts::Prs3d_DP_YAxis, YC);partTrihedron-SetLabel(Prs3d_DatumParts::Prs3d_DP_ZAxis, ZC); //设置轴向颜色partTrihedron-SetColor(Quantity_NOC_BLUE);partTrihedron-SetXAxisColor(Quantity_NOC_RED);partTrihedron-SetYAxisColor(Quantity_NOC_GREEN);//设置轴值默认是100mm可以修改partTrihedron-SetSize(WCSVALUE);myContext-Display(partTrihedron, true);其效果为