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. delphi和C# 保存exe文件到数据库

    Delphi: procedure TForm1.Button1Click(Sender: TObject); var strSQL, sfilename: string; MStream: TMem ...

  2. 数据结构(c语言版,严蔚敏)第2章线性表

    弟2章线性表

  3. 【LeetCode 16】最接近的三数之和

    题目链接 [题解] 上一道题那个算法求三个数的和为0的时候,其实就是一个不断在逼近本题中x=0的情况. 那么就套用上面那道题的做法. 在逼近的时候,取个差值的最小值就好了. [代码] class So ...

  4. flutter 使用keyboard_actions 关闭ios键盘

    项目中登录 输入账号密码 弹出的键盘 关闭不了,从而 引来一些问题, 1,第一次关闭 项目是在 最外层包裹一层,点击的时候进行关闭, return Scaffold( resizeToAvoidBot ...

  5. php开发面试题---Linux常用命令大全

    php开发面试题---Linux常用命令大全 一.总结 一句话总结: ls 查看目录中的文件 cd .. 返回上一级目录 cat 查看文件内容 touch 新建文件或修改时间 1.linux 系统信息 ...

  6. JSON.toJSONString()null值转“”

    public static void main(String[] s) { CybWmsCommoditiesVo cybWmsCommoditiesVo = new CybWmsCommoditie ...

  7. centos7下的nfs配置

    NFS是Network File System的缩写,即网络文件系统.客户端通过挂载的方式将NFS服务器端共享的数据目录挂载到本地目录下. nfs为什么需要RPC?因为NFS支持的功能很多,不同功能会 ...

  8. Java高级进阶:自定义ClassLoader

    假如我们的类不在classpath下,而我们又想读取一个自定义的目录下的class,如果做呢? 读取自定义目录的类 示例读取c:/test/com/test.jdk/Key.class这个类. pac ...

  9. Unity中调用Windows窗口句柄以及根据需求设置并且解决扩展屏窗体显示错乱/位置错误的Bug

    问题背景: 现在在搞PC端应用开发,我们开发中需要调用系统的窗口以及需要最大化最小化,缩放窗口拖拽窗口,以及设置窗口位置,去边框等功能 解决根据: 使用user32.dll解决 具体功能: Unity ...

  10. VisualStuido中将C#脚本封装打包DLL并调用

    DLL (Dynamic Link Library)---动态链接库 首先了解下使用DLL的优势,程序运行时不用加载所有代码,只有运行到引用时,才从DLL库中取出.并且使用DLL文件还可以减小程序体积 ...