标签:mic vector 定义 gty ons car gif err 定义函数
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());
}
}
标签:mic vector 定义 gty ons car gif err 定义函数
原文地址:https://www.cnblogs.com/hqsalanhuang/p/14673184.html