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日

最新文章

  1. linux 下压缩大批量文件
  2. sql 将查询结果为多行一列合并为一行一列
  3. POJ 2151 Check the difficulty of problems (概率DP)
  4. matlab figure 论文级别绘图
  5. 无Xaml的WPF展示
  6. 正则表达式获取URL参数
  7. 详解一名合格PHP工程师应该具备的基本知识结构
  8. 【c语言】求最大值
  9. linux版powershell安装教程(.net core版)
  10. hihoCoder #1094 : Lost in the City(枚举,微软苏州校招笔试 12月27日 )
  11. Linux指令--/etc/group文件
  12. CentOS7部分调优命令
  13. 属性集合java.util.Properties
  14. hello2 源码解析
  15. python基础入门--input标签、变量、数字类型、列表、字符串、字典、索引值、bool值、占位符格式输出
  16. java常见反编译工具
  17. 原生socket请求url获取状态码、消息报头、响应正文
  18. 【OpenCV】解析OpenCV中copyMakerBorder函数
  19. 为什么要重写hashcode方法和equals方法
  20. javascript之 原生document.querySelector和querySelectorAll方法

热门文章

  1. AcWing 215. 破译密码 (莫比乌斯反演)打卡
  2. leetcode上的一些动态规划
  3. mongo 大数据量更新注意事项
  4. 解决oracle v$sqlarea sql不完整
  5. mysql与python连接学习
  6. Django框架(二十五)—— Django rest_framework-路由控制与响应器
  7. Django框架(十六)—— cookie和session组件
  8. 【纯净软件】三款照片EXIF信息删除软件 Clear Exif、JPEG &amp; PNG Stripper、Easy Exif Delete 非专业横向对比
  9. 【Linux】- CentOS7安装java运行环境
  10. 大型项目必备IPC之其他IPC方式(二)