购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
这个问题纠结了好几天了:
我用开发文档的例子创建了一个圆弧,然后用UF_CURVE_ask_arc_data来读取圆弧的半径,生成dll文件时没有问题,可在NX里运行时报错,不知道哪里不对。
代码如下:
//创建一个圆弧(来自开发文档里的代码)
tag_t arc_tag45;
UF_CURVE_arc_t arc_coord45;
double mat45[9];
/* Use X-axis for rotation. */
double rot_axis[3] = {1.0,0.0,0.0};
/* Use 45 degrees as rotation angle */
double angle45 = 45 * DEGRA;
/* Center of arc with respect to (0,0,0) of Absolute CSYS. */
double vec[3] = {3.0,-2.0,1.5};
/* Create 45 degree orientation matrix. */
UF_MTX3_rotate_about_axis(rot_axis,angle45,mat45);
/* Obtain mapped coordinates. */
UF_MTX3_vec_multiply(vec,mat45,arc_coord45.arc_center);
/* Fill out the data structure for the arc */
UF_CSYS_create_matrix(mat45,&arc_coord45.matrix_tag);
arc_coord45.start_angle = 0.0;
arc_coord45.end_angle = 360.0 * DEGRA;
arc_coord45.radius = 9.0;/* Create the arc. */
UF_CURVE_create_arc(&arc_coord45,&arc_tag45);
//读取该圆弧的半径
UF_CURVE_arc_p_t arc_coords=0;
UF_CURVE_ask_arc_data(arc_tag45,arc_coords);
double arc_r=arc_coords->radius; (运行这一步时就出问题)