马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我 用 API 编了一个在草图上画圆的程序,编译成功以后,用UG执行生成的DLL文件,第一
次执行成功了,实现了在草图上画圆的功能,过了一段时间再执行就提示UG内存错误,
重启UG再执行就提示错误恢复故障了,这是什么原因啊?
以下是我的程序,这是程序的问题还是软件的问题啊,还望高手教我下怎么解决
int err, option = 2;
int ref[2] = {1,1};
int plane_dir = 1;
char sket_name[31];
tag_t object[2] = {NULL_TAG, NULL_TAG};
tag_t sket_tag, arc_tag, con_tag;
double angle[2], origin[3], radius;
double matrix[9]= {1,0,0,0,1,0,0,0,0};
UF_PART_new("d:\\block.prt",1,&sket_tag);
strcpy(sket_name, "SKET_DEMO");
err=UF_SKET_initialize_sketch(sket_name, &sket_tag);
if(sket_tag == NULL_TAG && err == 0)
{
err = UF_SKET_create_sketch(sket_name, option, matrix,
object, ref, plane_dir, &sket_tag);
}
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 = 0 * DEGRA;
//* Center of arc with respect to (0,0,0) of Absolute CSYS.
double vec[3] = {0,0,0};
//* 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 = 2.0;//* Create the arc.
UF_CURVE_create_arc(&arc_coord45,&arc_tag45); |