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. PHP实现上传视频的功能

    首先前台HTML表单代码如下: <html> <head> <meta http-equiv="Content-Type" content=" ...

  2. Kafka速览

    一.基本结构 三台机器组成的Kafka集群,每台机器启动一个Kafka进程,即Broker 向broker发送消息的客户端是Producer,拉取消息的客户端是Consumer Producer和Co ...

  3. leetcode-161周赛-5248-统计【优美子数组】

    题目描述: 自己的提交:超时: class Solution: def numberOfSubarrays(self, nums, k: int) -> int: dp = [0]* (len( ...

  4. Kylin-2.6.2集群部署

    1. 集群节点规划与说明 rzx1 all rzx2 query rzx3 query 说明: Kylin节点角色有三种: all: 包含query和job query: 查询节点 job: 工作节点 ...

  5. Linux 软硬链接区别

    一.“硬链接“和“软链接“ 链接的概念:链接简单说实际上是一种文件共享的方式,是 POSIX 中的概念,主流文件系统都支持链接文件. 链接的作用:可以将链接简单地理解为 Windows 中常见的快捷方 ...

  6. robotframework+selenium2library之上传本地文件

    针对将本地的文件上传到测试系统,selenium2library提供了一个关键词 choose file choose file    jquery=*[name='Filedata']+label: ...

  7. js检查判断设备

    js检查判断设备 var navigatorType = {}; var u=navigator.userAgent; navigatorType.IsIE= u.indexOf('Trident') ...

  8. (3)Redis conifg

    redis.windows-service.conf      Redis-x64-3.2.100 # Redis configuration file example # Note on units ...

  9. lamp+nginx代理+discuz+wordpress+phpmyadmin搭建

    我们以模拟实际需求的形式来复习.需求如下:1. 准备两台centos 6,其中一台机器跑mysql,另外一台机器跑apache和nginx + php2. 同时安装apache和nginx,其中ngi ...

  10. linux 创建多级目录 mkdir -p

    原文地址:http://www.dutor.net/index.php/2010/06/cmd-mkdir-p/ mkdir的-p选项允许你一次性创建多层次的目录,而不是一次只创建单独的目录.例如,我 ...