vvoid creatcurve(double center[3])
{
curvetags.clear();
curves.clear();
int type=list_box0->GetSelectedItems().at(0);
double length1=abs(center[0]-point[0]);
double length2=abs(center[1]-point[1]);
double length3=abs(center[2]-point[2]);
tag_t wcs;
UF_CSYS_ask_wcs(&wcs);
UF_CSYS_ask_matrix_of_object(wcs, &arc_coords.matrix_tag);
arc_coords.start_angle = 0.0;
arc_coords.end_angle = TWOPI;
arc_coords.arc_center[0] =center[0];
arc_coords.arc_center[1] = center[1];
arc_coords.arc_center[2] =center[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
if (center[0]<point[0]&¢er[1]>point[1])
{
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =center[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
}
if (center[0]>point[0]&¢er[1]>point[1])
{
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =center[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
}
if (center[0]<point[0]&¢er[1]<point[1])
{
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =center[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
}
if (center[0]>point[0]&¢er[1]<point[1])
{
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]-length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]+length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =point[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
curvetags.push_back(arc_tag1);
Curvedata.arc_coords1=arc_coords;
Curvedata.arc_tag1=arc_tag1;
curves.push_back(Curvedata);
arc_coords.arc_center[0] =point[0]-length1;
arc_coords.arc_center[1] =point[1]+length2;
arc_coords.arc_center[2] =center[2];
arc_coords.radius =tempsize[type].D;
UF_CURVE_create_arc(&arc_coords,&arc_tag1);
}
}
【UG\NX二次开发】三点创建圆弧
于 2023-11-09 16:27:31 首次发布
该代码定义了一个名为`voidcreatcurve`的函数,用于在三维空间中根据中心点和边界点创建弧形曲线,使用了`UF_CURVE_create_arc`等技术处理多个可能的弧形生成情况。
摘要由CSDN通过智能技术生成