选择面设置方位坐标


void twb_xd_set_properties::setbearing_in_face( tag_t face )
{
  try
  {
    //获取面的法向矢量-------------------------------------------------------------------------------------------------------
    int type = 0;//返回面的类型
    double point [ 3 ] ={};//返回面上面的点
    double dir [ 3 ] ={};//返回面的法向
    double box [ 6 ];//返回面的X.Y轴
    double radius;//如果是圆柱返回面的半径
    double rad_data;
    int norm_dir;//返回面的方向,1=正向,-1=反向
    UF_MODL_ask_face_data( face, &type, point, dir, box, &radius, &rad_data, &norm_dir);

    //返回一个指定Z轴,返回任意X、Y轴的坐标3X3矩阵---------------------------------------------------------------------------
    double mtx [ 9 ] ;
    UF_MTX3_initialize_z(dir,mtx);

    //设置方位坐标---------------------------------------------------------------------------------------------------------------
    //X轴
    Vector3d new_X;
    new_X.X = mtx[0];
    new_X.Y = mtx[1];
    new_X.Z = mtx[2];

    //Y轴
    Vector3d new_Y;
    new_Y.X = mtx[3];
    new_Y.Y = mtx[4];
    new_Y.Z = mtx[5];

    //原点
    Point3d new_Origin;
    new_Origin.X = point[0];
    new_Origin.Y = point[1];
    new_Origin.Z = point[2];

    //设置方位
    manip0->SetOrigin( new_Origin );//设置方位原点
    manip0->SetXAxis(new_X);//设置方位X轴
    manip0->SetYAxis(new_Y);//设置方位Y轴

  }
  catch(exception& ex)
  {
    //---- Enter your exception handling code here -----
    twb_xd_set_properties::theUI->NXMessageBox()->Show("设置方位", NXOpen::NXMessageBox::DialogTypeError, ex.what());
  }
}

选择面设置方位坐标

上一篇:Python访问MongoDB数据库


下一篇:Redis 持久化和集群