点击查看详细介绍

UF_CURVE_ask_arc_data报错

otketle 7年前 2483 6

购买与咨询 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; (运行这一步时就出问题)

0

最新回复 (6)
  • yuan1478951 7年前
    1

    UF_CURVE_ask_arc_data函数是需要入口函数的UF_initialize();

  • otketle 7年前
    2

    回复:1楼
    这个有写。
    知道了原因所在,是指针问题。
    把 UF_CURVE_arc_p_t 改为 UF_CURVE_arc_t后就解决了。
    但不清楚用指针的方式为什么会出错。

  • nxopen 7年前
    3

    _p的要分配内存,一般都是将_p去掉

  • justee 7年前
    4

    UF_CURVE_arc_p_t arc_coords=0;好像不能初始化。
    还有请问大神
    把_p去掉后,UF_CURVE_ask_arc_data()这个函数也无法应用了呀

  • nxopen 7年前
    5

    函数里面直接这样写就可以啦 &UF_CURVE_arc_t

  • 狙击兴 VIP会员 7年前
    6

    //读取该圆弧的半径
    UF_CURVE_arc_t arc_coords=0;
    UF_CURVE_ask_arc_data(arc_tag45, &arc_coords);
    double arc_r=arc_coords.radius; (运行这一步时不出问题了)

请登录后发表新帖