NX二次开发-NXOpen::WCS Class Reference
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的更多相关文章
- NX二次开发-NXOpen::CoordinateSystemCollection Class Reference
NX11+VS2013 #include <NXOpen/Section.hxx> #include <NXOpen/SectionCollection.hxx> #inclu ...
- NX二次开发-获取WCS坐标系的原点坐标和矩阵标识
函数:UF_CSYS_ask_csys_info() 函数说明:获取工作坐标系对象的标识符. 用法: #include <uf.h> #include <uf_csys.h> ...
- NX二次开发-获取WCS标识
函数:UF_CSYS_ask_wcs() 函数说明:获取工作坐标系对象的标识. 用法: 1 #include <uf.h> 2 #include <uf_csys.h> 3 e ...
- NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference
NX11+VS2013 #include <NXOpen/Section.hxx> #include <NXOpen/SectionCollection.hxx> #inclu ...
- NX二次开发-NXOPEN自动切换到工程图模块
UFUN的API里是没有切换到工程图的函数的,NXOPEN里是有方法可以用的.不过应该是不支持NX9以下的版本. NX9的不能录制出来,在UI类里有方法 NX9+VS2012 #include < ...
- NX二次开发-NXOpen获取边的端点NXOpen::Edge::GetVertices
NX9+VS2012 #include <NXOpen/Features_BlockFeatureBuilder.hxx> #include <NXOpen/Features_Fea ...
- NX二次开发-获取WCS标识UF_CSYS_ask_wcs
NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //获取WCS标识 tag_t WcsId = ...
- 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 ...
- NX二次开发-设置WCS显示UF_CSYS_set_wcs_display
NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //设置WCS显示 //1显示WCS, 0不显 ...
随机推荐
- Dart编程实例 - Dart 面向对象编程
Dart编程实例 - Dart 面向对象编程 class TestClass { void disp() { print("Hello World"); } } void main ...
- BZOJ 3159: 决战 解题报告
BZOJ 3159: 决战 1 sec 512MB 题意: 给你一颗\(n\)个点,初始点权为\(0\)的有跟树,要求支持 Increase x y w 将路径\(x\)到\(y\)所有点点权加上\( ...
- HDU 4866 Shooting 题解:主席树
这题的主要的坑点就是他给你的射击目标有重合的部分,如果你向这些重合的部分射击的话要考虑两种情况: 射击目标数量 ≥ 重合数量 : 全加上 射击目标数量 ≤ 重合数量 : 只加距离*射击目标数量 然而这 ...
- 解决spring boot中普通类中使用service为null 的方法
我使用的是springboot+mybatisplus +mysql1.创建一个SpringUtil工具类 import org.springframework.beans.BeansExceptio ...
- 7、Appium常用API
嗯,官网已经介绍的很全了.会选几个常用API后期整理. Appium常用API地址:http://appium.io/docs/cn/writing-running-appium/appium-bin ...
- UVA 356 - Square Pegs And Round Holes
题目:在一个2n*2n的网格中间画一个直径为2n-1的圆,问圆内部的格子以及和圆相交的格子个数. 思路:只要考虑1 / 4圆的点就行,用点到原点距离与半径比较,当格子左下方和右上方都在格子里时,格子在 ...
- error C1010: 在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "stdafx.h"”?
解决方案: 属性>预编译头>不使用预编译头>应用
- MySQL将查询结果写入到文件的2种方法
1.SELECT INTO OUTFIL: 这种方法不能覆盖或者追加到已经存在的文件,只能写入到新文件,并且建立文件的路径需要mysql进程用户有权限建立新文件. mysql 61571 60876 ...
- 使用VBA达到vlookup效果
Function Desc(ProdNum) Desc = Application.WorksheetFunction.VLookup(ProdNum, Range("myTable&quo ...
- D-Ubuntu中修改MySQL的默认数据集(client和server)
Ubuntu16.04,MySQL5.7 1, sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 使用vim编辑MySQL的配置文件,不同版本的MySQL配置文件 ...