NX11+VS2013

 #include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/WCS.hxx>
#include <NXOpen/CartesianCoordinateSystem.hxx>
#include <NXOpen/CoordinateSystem.hxx>
#include <NXOpen/CoordinateSystemCollection.hxx>
using namespace NXOpen; NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());

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

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

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

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

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

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

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

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

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

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

 //获得WCS的可见性
bool WcsVis = workPart->WCS()->Visibility(); 2019年8月17日
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. 62. File类常用方法

    为了怕混淆,先说明一些下面要出现的名词意思:例如:D:\\新建文件夹 (2)\\a.txt 和  D:\\新建文件夹 (2)\\aaaa D:\\新建文件夹 (2)   父路径    a.txt    ...

  2. 【leetcode】667. Beautiful Arrangement II

    题目如下: Given two integers n and k, you need to construct a list which contains ndifferent positive in ...

  3. magento 多域名多店

    在magento1.4中请参考官网 :http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-dom ...

  4. RMQ区间求最值

    RMQ用于区间快速查找最值,适用于期间数值无更改的情况.其预处理的复杂度为O(nlogn),查询的时间复杂度为O(1),对比于线段树的预处理O(nlogn),查询O(logn)来说,在某些情况下有着其 ...

  5. linux环境下安装PHP的OpenSSL扩展

    先安装依赖包:yum install openssl openssl-devel 进入PHP安装包里的OpenSSL文件夹,根据个人的安装包位置不同,此处是 cd /home/local/php.5. ...

  6. elementUI拿到当前表格行的数据的另一种写法

    背景: 这里是通过点击“修改”按钮后才拿到当前行的数据,不是点击当前行任意位置拿到数据,所以不能用 @row-click 方法 改用点击的时候直接拿到这个表里面的这一条数据 1.绑定事件 <te ...

  7. 20165239 2018——2019Exp8 Web基础

    Exp8 Web基础 基础问题回答 (1)什么是表单 •表单在网页中主要负责数据采集功能. •一个表单有三个基本组成部分: ◦表单标签,这里面包含了处理表单数据所用CGI程序的URL以及数据提交到服务 ...

  8. wampServer2.2 You don't have permission to access /phpmyadmin/ on this server.

    You don't have permission to access /phpmyadmin/ on this server. 打开 然后

  9. 4. Python数据类型之数字、字符串、列表

    开发过程中,我们需要处理文本.图形.音频.视频.网页等各种各样的数据,不同的数据,需要定义不同的数据类型.在Python中,能够直接处理的数据类型主要有以下几种:数字.字符串.列表.元组.字典.集合等 ...

  10. 【转】Linux系统抓包命令tcpdump使用实例

    tcpdump是linux命令行下常用的的一个抓包工具,记录一下平时常用的方式,测试机器系统是ubuntu 12.04. tcpdump的命令格式tcpdump的参数众多,通过man tcpdump可 ...