NX二次开发-NXOpen::CoordinateSystemCollection Class Reference
2024-10-07 18:50:45
NX11+VS2013 #include <NXOpen/Section.hxx>
#include <NXOpen/SectionCollection.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/CoordinateSystem.hxx>
#include <NXOpen/CoordinateSystemCollection.hxx>
#include <NXOpen/CartesianCoordinateSystem.hxx>
#include <NXOpen/NXMatrix.hxx>
#include <NXOpen/NXMatrixCollection.hxx>
#include <NXOpen/Xform.hxx>
#include <NXOpen/XformCollection.hxx>
#include <NXOpen/Scalar.hxx>
#include <NXOpen/ScalarCollection.hxx>
#include <NXOpen/CylindricalCoordinateSystem.hxx>
#include <NXOpen/UI.hxx>
#include <NXOpen/NXMessageBox.hxx> using namespace NXOpen;
using namespace std; NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display()); //创建一个新的笛卡尔坐标系(TRUE和FALSE,如果坐标系是临时的用TRUE,它将不会显示,也不会保存在部件中)
Point3d WcsOrigin1(100.0, 100.0, 100.0);//原点
Matrix3x3 WcsMatrix1 (, , , , , , , , );//矩阵
NXOpen::CartesianCoordinateSystem* WcsNew1 = workPart->CoordinateSystems()->CreateCoordinateSystem(WcsOrigin1, WcsMatrix1, FALSE); //创建一个新的笛卡尔坐标系
Point3d WcsOrigin2(200.0, 200.0, 200.0);//原点
Vector3d xDirection2(1.0, 0.0, 0.0);//向量
Vector3d yDirection2(0.0, 1.0, 0.0);
NXOpen::CartesianCoordinateSystem* WcsNew2 = workPart->CoordinateSystems()->CreateCoordinateSystem(WcsOrigin2, xDirection2, yDirection2); //创建一个新的笛卡尔坐标系(TRUE和FALSE,如果坐标系是临时的用TRUE,它将不会显示,也不会保存在部件中)
Point3d WcsOrigin3(300.0, 300.0, 300.0);//原点
Matrix3x3 WcsMatrix3(, , , , , , , , );//矩阵
NXOpen::NXMatrix* Matrix3 = workPart->NXMatrices()->Create(WcsMatrix3);//创建一个新的矩阵
NXOpen::CartesianCoordinateSystem* WcsNew3 = workPart->CoordinateSystems()->CreateCoordinateSystem(WcsOrigin3, Matrix3, FALSE); //创建一个新的笛卡尔坐标系
Point3d WcsOrigin4(400.0, 400.0, 400.0);//原点
Vector3d xDirection4(1.0, 0.0, 0.0);//向量
Vector3d yDirection4(0.0, 1.0, 0.0);
double Scale = ;
NXOpen::Xform* xform = workPart->Xforms()->CreateXform(WcsOrigin4, xDirection4, yDirection4, SmartObject::UpdateOptionWithinModeling, Scale);
NXOpen::CartesianCoordinateSystem* WcsNew4 = workPart->CoordinateSystems()->CreateCoordinateSystem(xform, SmartObject::UpdateOptionWithinModeling);
WcsNew4->SetVisibility(SmartObject::VisibilityOptionVisible);//设置显示坐标系 //创建一个新的圆柱坐标系
Point3d WcsOrigin5(500.0, 500.0, 500.0);//原点
Vector3d xDirection5(1.0, 0.0, 0.0);//向量
Vector3d yDirection5(0.0, 1.0, 0.0);
NXOpen::CylindricalCoordinateSystem* WcsNew5 = workPart->CoordinateSystems()->CreateCylindricalCoordinateSystem(WcsOrigin5, xDirection5, yDirection5); //创建一个新的圆柱坐标系(TRUE和FALSE,如果坐标系是临时的用TRUE,它将不会显示,也不会保存在部件中)
Point3d WcsOrigin6(600.0, 600.0, 600.0);//原点
Matrix3x3 WcsMatrix6(, , , , , , , , );//矩阵
NXOpen::NXMatrix* Matrix6 = workPart->NXMatrices()->Create(WcsMatrix6);//创建一个新的矩阵
NXOpen::CylindricalCoordinateSystem* WcsNew6 = workPart->CoordinateSystems()->CreateCylindricalCoordinateSystem(WcsOrigin6, Matrix6, FALSE); //创建一个新的圆柱坐标系
Point3d WcsOrigin7(700.0, 700.0, 700.0);//原点
Vector3d xDirection7(1.0, 0.0, 0.0);//向量
Vector3d yDirection7(0.0, 1.0, 0.0);
double Scale7 = ;
NXOpen::Xform* xform7 = workPart->Xforms()->CreateXform(WcsOrigin7, xDirection7, yDirection7, SmartObject::UpdateOptionWithinModeling, Scale7);
NXOpen::CylindricalCoordinateSystem* WcsNew7 = workPart->CoordinateSystems()->CreateCylindricalCoordinateSystem(xform7, SmartObject::UpdateOptionWithinModeling);
WcsNew7->SetVisibility(SmartObject::VisibilityOptionVisible);//设置显示坐标系 //迭代器遍历所有坐标系
vector<tag_t> AllCoordVector;//定义vector
NXOpen::CoordinateSystem* AllCoord;//定义类型
NXOpen::CoordinateSystemCollection::iterator Ite;//定义迭代器
for (Ite = workPart->CoordinateSystems()->begin(); Ite != workPart->CoordinateSystems()->end(); ++Ite)
{
AllCoord = (*Ite);
AllCoordVector.push_back(AllCoord->Tag());//获得坐标系的tag
} char msg[];
sprintf_s(msg, "坐标系数量为:%d", AllCoordVector.size());
UI::GetUI()->NXMessageBox()->Show("标题", NXMessageBox::DialogTypeWarning, msg); Caesar卢尚宇
2019年8月31日
最新文章
- linux 下压缩大批量文件
- sql 将查询结果为多行一列合并为一行一列
- POJ 2151 Check the difficulty of problems (概率DP)
- matlab figure 论文级别绘图
- 无Xaml的WPF展示
- 正则表达式获取URL参数
- 详解一名合格PHP工程师应该具备的基本知识结构
- 【c语言】求最大值
- linux版powershell安装教程(.net core版)
- hihoCoder #1094 : Lost in the City(枚举,微软苏州校招笔试 12月27日 )
- Linux指令--/etc/group文件
- CentOS7部分调优命令
- 属性集合java.util.Properties
- hello2 源码解析
- python基础入门--input标签、变量、数字类型、列表、字符串、字典、索引值、bool值、占位符格式输出
- java常见反编译工具
- 原生socket请求url获取状态码、消息报头、响应正文
- 【OpenCV】解析OpenCV中copyMakerBorder函数
- 为什么要重写hashcode方法和equals方法
- javascript之 原生document.querySelector和querySelectorAll方法
热门文章
- AcWing 215. 破译密码 (莫比乌斯反演)打卡
- leetcode上的一些动态规划
- mongo 大数据量更新注意事项
- 解决oracle v$sqlarea sql不完整
- mysql与python连接学习
- Django框架(二十五)—— Django rest_framework-路由控制与响应器
- Django框架(十六)—— cookie和session组件
- 【纯净软件】三款照片EXIF信息删除软件 Clear Exif、JPEG &; PNG Stripper、Easy Exif Delete 非专业横向对比
- 【Linux】- CentOS7安装java运行环境
- 大型项目必备IPC之其他IPC方式(二)