|
//错误代码从这里开始,
void TT_CREATE_CenterLine_TOOL::dosthCLASS_cb()
{
UF_initialize();
std::vector<TaggedObject *>theselectCLASSPros=selectionCLASS->GetProperties()->GetTaggedObjectVector("SelectedObjects");
tag_t classTAG=selectionCLASS->Tag();
if (enumCLASS->GetProperties()->GetEnum("Value")==0)
{
if (enumFACE->GetProperties()->GetEnum("Value")==0)
{
tag_t classTAG=theselectCLASSPros[0]->Tag();
double bounding_Box[6];
UF_MODL_ask_bounding_box( theselectCLASSPros[0]->Tag(), bounding_Box);
double x = (bounding_Box[3] + bounding_Box[0])/2;
double y = (bounding_Box[4] + bounding_Box[1])/2;
double z = (bounding_Box[5] + bounding_Box[2])/2;
double uv_min_max[4];
UF_MODL_ask_face_uv_minmax(classTAG, uv_min_max);
double parameter[2];
/* double ref_pnt[3]={x,y,z};
double face_pnt[3];
UF_MODL_ask_face_parm(classTAG,ref_pnt,parameter,face_pnt); */
double point1[3];
double U1[3];
double V1[3];
double U2[3];
double V2[3];
double unit_norm[3];
double radii[2];
UF_MODL_ask_face_props (classTAG,parameter,point1,U1,V1,U2,V2,unit_norm,radii);
UF_CURVE_line_t Line_coords1[2];
Line_coords1[0].start_point[0] =x+(U2[0]+U1[0])/2;
Line_coords1[0].start_point[1] =y+(U2[1]+U1[1])/2;
Line_coords1[0].start_point[2] =z+(U2[2]+U1[2])/2;
Line_coords1[0].end_point[0] =x-(U2[0]+U1[0])/2;
Line_coords1[0].end_point[1] =y-(U2[1]+U1[1])/2;
Line_coords1[0].end_point[2] =z-(U2[2]+U1[2])/2;
Line_coords1[1].start_point[0] =x+(V2[0]+V1[0])/2;
Line_coords1[1].start_point[1] =y+(V2[1]+V1[1])/2;
Line_coords1[1].start_point[2] =z+(V2[2]+V1[2])/2;
Line_coords1[1].end_point[0] = x-(V2[0]+V1[0])/2;
Line_coords1[1].end_point[1] = y-(V2[1]+V1[1])/2;
Line_coords1[1].end_point[2] =z-(V2[2]+V1[2])/2;
tag_t Line1[2];
UF_CURVE_create_line(&Line_coords1[0], &Line1[0]);
UF_CURVE_create_line(&Line_coords1[1], &Line1[1]);
这个做出来太长了,中心和线是对的,哪里出错了
另一个用等参数做的,找不到Tag,只有tag**,代码是对的,找不到TAG来改线型
tag_t classTAG=theselectCLASSPros[0]->Tag();
int face_type = 0;
UF_MODL_ask_face_type(classTAG,&face_type);
//分析曲面的u,v参数最大值和最小值
double uv_min_max[4];
UF_MODL_ask_face_uv_minmax(classTAG, uv_min_max);
//在面上创建等参数曲线
int uv_flag[2];
uv_flag[0]=1;
uv_flag[1]=2;
double parameter[2];
parameter[0] = (uv_min_max[1] + uv_min_max[0])/2;
parameter[1] = (uv_min_max[3] + uv_min_max[2])/2;
double dist_tol = 0.01;
tag_t* isocurve_id[2];
int isocurve_cnt = 0;
if (enumFACE->GetProperties()->GetEnum("Value")==1)
{
UF_MODL_create_isocurve(classTAG, uv_flag[0], parameter[0], dist_tol, &isocurve_id[0], &isocurve_cnt);
UF_MODL_create_isocurve(classTAG, uv_flag[1], parameter[1], dist_tol, &isocurve_id[1], &isocurve_cnt);
}
else if (enumFACE->GetProperties()->GetEnum("Value")==2)
{
UF_MODL_create_isocurve(classTAG, uv_flag[0], parameter[0], dist_tol, &isocurve_id[0], &isocurve_cnt);
}
else
{
UF_MODL_create_isocurve(classTAG, uv_flag[1], parameter[1], dist_tol, &isocurve_id[1], &isocurve_cnt);
}
}
|
|