1. NX11+VS2013
  2.  
  3. #include <NXOpen/Part.hxx>
  4. #include <NXOpen/PartCollection.hxx>
  5. #include <NXOpen/Session.hxx>
  6. #include <NXOpen/WCS.hxx>
  7. #include <NXOpen/CartesianCoordinateSystem.hxx>
  8. #include <NXOpen/CoordinateSystem.hxx>
  9. #include <NXOpen/CoordinateSystemCollection.hxx>
  10. using namespace NXOpen;
  11.  
  12. NXOpen::Session *theSession = NXOpen::Session::GetSession();
  13. NXOpen::Part *workPart(theSession->Parts()->Work());
  14. NXOpen::Part *displayPart(theSession->Parts()->Display());

  1. //获取WCS相关信息
  2. NXOpen::CartesianCoordinateSystem* WcsData = workPart->WCS()->CoordinateSystem();
  3.  
  4. //获得WCS的向量方向
  5. NXOpen::Vector3d xDirection;
  6. NXOpen::Vector3d yDirection;
  7. WcsData->GetDirections(&xDirection, &yDirection);

  1. //获得WCS的原点坐标
  2. Point3d WcsOrigin = workPart->WCS()->Origin();

  1. //围绕指定的轴旋转WCS
  2. double Angle = 45.0;
  3. workPart->WCS()->Rotate(NXOpen::WCS::AxisXAxis, Angle);

  1. //在工作部件中创建一个新的笛卡尔坐标系,即使WCS属于显示部件
  2. NXOpen::CartesianCoordinateSystem* WcsNew = workPart->WCS()->Save();

  1. //将WCS的坐标系更改为一个新的坐标系
  2. //返回值是旧的坐标系。将WCS移动到新的坐标系位置后,将显示旧坐标系。
  3. NXOpen::Point3d origin1 = { 150.0, 0.0, 0.0 };
  4. NXOpen::Vector3d xDirection1 = { 1.0, 0.0, 0.0 };
  5. NXOpen::Vector3d yDirection1 = { 0.0, 1.0, 0.0 };
  6. NXOpen::CartesianCoordinateSystem *newCs = workPart->CoordinateSystems()->CreateCoordinateSystem(origin1, xDirection1, yDirection1);
  7. NXOpen::CartesianCoordinateSystem* WcsOld = workPart->WCS()->SetCoordinateSystem(newCs);

  1. //在新的坐标系中创建一个WCS
  2. //返回值是WCS的旧坐标系
  3. NXOpen::Point3d origin2 = { 150.0, 0.0, 0.0 };
  4. NXOpen::Vector3d xDirection2 = { 1.0, 0.0, 0.0 };
  5. NXOpen::Vector3d yDirection2 = { 0.0, 1.0, 0.0 };
  6. NXOpen::CartesianCoordinateSystem *newCs1 = workPart->CoordinateSystems()->CreateCoordinateSystem(origin2, xDirection2, yDirection2);
  7. NXOpen::CartesianCoordinateSystem* WcsOld1 = workPart->WCS()->SetCoordinateSystemCartesianAtCsys(newCs1);

  1. //设置WCS原点
  2. Point3d WcsOri = { 100.0, 100.0, 100.0 };
  3. workPart->WCS()->SetOrigin(WcsOri);

  1. //设置WCS的原点和方向矩阵
  2. Point3d WcsOri1 = { 100.0, 100.0, 100.0 };
  3. Matrix3x3 matrix = { , , , , , , , , };
  4. workPart->WCS()->SetOriginAndMatrix(WcsOri1, matrix);

  1. //设置WCS的可见性
  2. workPart->WCS()->SetVisibility(false);

  1. //得到WCS的tag
  2. tag_t WcsTag = workPart->WCS()->Tag();

  1. //获得WCS的可见性
  2. bool WcsVis = workPart->WCS()->Visibility();
  3.  
  4. 2019817
    Caesar卢尚宇

NX二次开发-NXOpen::WCS Class Reference的更多相关文章

  1. NX二次开发-NXOpen::CoordinateSystemCollection Class Reference

    NX11+VS2013 #include <NXOpen/Section.hxx> #include <NXOpen/SectionCollection.hxx> #inclu ...

  2. NX二次开发-获取WCS坐标系的原点坐标和矩阵标识

    函数:UF_CSYS_ask_csys_info() 函数说明:获取工作坐标系对象的标识符. 用法: #include <uf.h> #include <uf_csys.h> ...

  3. NX二次开发-获取WCS标识

    函数:UF_CSYS_ask_wcs() 函数说明:获取工作坐标系对象的标识. 用法: 1 #include <uf.h> 2 #include <uf_csys.h> 3 e ...

  4. NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference

    NX11+VS2013 #include <NXOpen/Section.hxx> #include <NXOpen/SectionCollection.hxx> #inclu ...

  5. NX二次开发-NXOPEN自动切换到工程图模块

    UFUN的API里是没有切换到工程图的函数的,NXOPEN里是有方法可以用的.不过应该是不支持NX9以下的版本. NX9的不能录制出来,在UI类里有方法 NX9+VS2012 #include < ...

  6. NX二次开发-NXOpen获取边的端点NXOpen::Edge::GetVertices

    NX9+VS2012 #include <NXOpen/Features_BlockFeatureBuilder.hxx> #include <NXOpen/Features_Fea ...

  7. NX二次开发-获取WCS标识UF_CSYS_ask_wcs

    NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //获取WCS标识 tag_t WcsId = ...

  8. NX二次开发-设置WCS位置UF_CSYS_set_wcs

    NX9+VS2012 UF_initialize(); //输入X向量Y向量输出一个3*3矩阵 ] = {0.0, 0.0, 1.0}; ] = {0.0, 1.0, 0.0}; ]; UF_MTX3 ...

  9. NX二次开发-设置WCS显示UF_CSYS_set_wcs_display

    NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //设置WCS显示 //1显示WCS, 0不显 ...

随机推荐

  1. mysql查找字段空、不为空的方法总结

    1.不为空 Select * From table_name Where id<>'' Select * From table_name Where id!='' 2.为空 Select ...

  2. Ansible自动化部署K8S集群

    Ansible自动化部署K8S集群 1.1 Ansible介绍 Ansible是一种IT自动化工具.它可以配置系统,部署软件以及协调更高级的IT任务,例如持续部署,滚动更新.Ansible适用于管理企 ...

  3. leetcode-160周赛-5240-串联字符串的最大长度

    题目描述: 自己的提交:O(2**n∗n∗m),m 为字符串长度 class Solution: def maxLength(self, arr: List[str]) -> int: from ...

  4. ArrayList,LinkedList,Vector集合的认识

    最近在温习Java集合部分,花了三天时间读完了ArrayList与LinkedList以及Vector部分的源码.之前都是停留在简单使用ArrayList的API,读完源码看完不少文章后总算是对原理方 ...

  5. JCF——List

    ArrayList LinkedList Vector

  6. 出现Warning: date(): It is not safe to rely on the system's timezone settings的解决办法

    在没有配置,尤其是新安装的PHP中使用date函数时,会报这个错误: Warning: date(): It is not safe to rely on the system's timezone ...

  7. fiddler抓包工具详解

    转自:http://www.cnblogs.com/yyhh/p/5140852.html Fiddler 抓包工具总结   阅读目录 1. Fiddler 抓包简介 1). 字段说明 2). Sta ...

  8. error C3861: “L”: 找不到标识符

    提示错误的语句:::CLSIDFromProgID(L("Shell.Application"), &clsid); 解决办法: 出现上面的错误是因为语法错误了,去掉字符串 ...

  9. SQL生成 C# Model

    本文转自: https://www.cnblogs.com/jhli/p/11552105.html declare @TableName sysname = 'T_FakeOrderList' de ...

  10. cd 命令行进入目标文件夹

    当我在默认路径中使用cd命令时,如果我要进入D:\mytext 文件夹,那么直接使用cd D:\mytext 是不行的 正确的使用是先使用d:进入D盘,然后再进入mytext文件夹