zoukankan      html  css  js  c++  java
  • NXOpen绝对座标值转为WCS座标值

    VS2010 NX8.5

    //定义函数

    Point3d WCSPointTransposeCsysPoint(Point3d origionPoint3D);//工作部件绝对坐标值转化为新坐标下点坐标值
    Point3d PointMatrixToNewPoint(Point3d origionPoint3D,Matrix3x3 matrix3X3,Point3d newPoint3D);// 点的转换

    Point3d HoleTable::WCSPointTransposeCsysPoint(Point3d origionPoint3D) //工作部件绝对坐标值转化为WCS坐标下点坐标值
    {
    try
    {
    Point3d WcsOrigin ;//WCS 原点
    NXOpen::Matrix3x3 WCSmatrix1;//WCS 矩阵
    NXOpen::Vector3d WCSxDirection;//WCS X轴
    NXOpen::Vector3d WCSyDirection;//WCS Y轴
    NXOpen::CartesianCoordinateSystem* OriginalWcsData = workPart->WCS()->CoordinateSystem();
    WcsOrigin = workPart->WCS()->Origin();//获得WCS的原点
    WCSmatrix1 = workPart->WCS()->CoordinateSystem()->Orientation()->Element();//获得WCS的矩阵
    OriginalWcsData->GetDirections(&WCSxDirection, &WCSyDirection);//获得WCS的XY轴

    Point3d tmpPoint3D;//转换
    tmpPoint3D.X = origionPoint3D.X - WcsOrigin.X;
    tmpPoint3D.Y = origionPoint3D.Y - WcsOrigin.Y;
    tmpPoint3D.Z = origionPoint3D.Z - WcsOrigin.Z;

    Point3d WCSPoint3D=PointMatrixToNewPoint(tmpPoint3D,WCSmatrix1,origionPoint3D);//点的转换

    return Point3d(WCSPoint3D);

    }
    catch(exception& ex)
    {
    //---- Enter your exception handling code here -----
    HoleTable::theUI->NXMessageBox()->Show("点的转换", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    }

    Point3d HoleTable::PointMatrixToNewPoint(Point3d origionPoint3D,Matrix3x3 matrix3X3,Point3d newPoint3D)// 点的转换
    {
    try
    {
    newPoint3D.X = matrix3X3.Xx * origionPoint3D.X + matrix3X3.Xy * origionPoint3D.Y + matrix3X3.Xz * origionPoint3D.Z;
    newPoint3D.Y = matrix3X3.Yx * origionPoint3D.X + matrix3X3.Yy * origionPoint3D.Y + matrix3X3.Yz * origionPoint3D.Z;
    newPoint3D.Z = matrix3X3.Zx * origionPoint3D.X + matrix3X3.Zy * origionPoint3D.Y + matrix3X3.Zz * origionPoint3D.Z;
    Point3d WCSPoint3D =newPoint3D;//转换后的点
    return Point3d(WCSPoint3D);
    }
    catch(exception& ex)
    {
    //---- Enter your exception handling code here -----
    HoleTable::theUI->NXMessageBox()->Show("点的转换", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    }

    怡宁塑胶模具设计
  • 相关阅读:
    selenium python 启动Chrome
    安装selenium python
    网络编程32
    动态生成验证码———MVC版
    C#之发送邮件【模板】+【封装】ZJ版
    【转】解读ASP.NET 5 & MVC6系列(1):ASP.NET 5简介
    Cache,MemCache,Application,Cookie等其它缓存汇总
    点击弹出li所在的序列号
    【转】js实现复制到剪贴板功能,兼容所有浏览器
    前端效果——持续更新。。。
  • 原文地址:https://www.cnblogs.com/hqsalanhuang/p/14673184.html
Copyright © 2011-2022 走看看