|
UF_initialize();
struct Robot {
NXOpen::Vector3d xdir, ydir;
NXOpen::Point3d originPoint;
};
Robot robot;
PropertyList* CoordSystemRobotProps = CoordSystemRobot->GetProperties();
std::vector<NXOpen::TaggedObject*>CoordSystemRobotObjects = CoordSystemRobotProps->GetTaggedObjectVector("SelectedObjects");
NXOpen::CartesianCoordinateSystem *coord = dynamic_cast<NXOpen::CartesianCoordinateSystem *>(CoordSystemRobotObjects[0]);
coord->GetDirections(&robot.xdir, &robot.ydir);
robot.originPoint = coord->Origin();
delete CoordSystemRobotProps;
CoordSystemRobotProps = NULL;
char a[100];
sprintf(a, "机器人坐标:%.2f %.2f %.2f\nX轴方向:(%.1f, %.1f, %.1f) Y轴方向:(%.1f, %.1f, %.1f)", robot.originPoint.X, robot.originPoint.Y, robot.originPoint.Z,robot.xdir.X, robot.xdir.Y, robot.xdir.Z, robot.ydir.X, robot.ydir.Y, robot.ydir.Z);
uc1601(a, 1);
CoordSystemRobotObjects.clear();
UF_terminate();
uc1601("1", 1);
尝试过以上代码,虽然能读取坐标原点及方向向量等参数 但是读取完代码运行结束之后ug就会崩溃退出
注:使用的是ug8.0
|
|