UGNX二次开发源码分享:关于显示UG NX临时箭头功能
这功能其实很好用,比如选择面,自动显示面的法线等等。
static void do_ugopen_api(void)
{
double pt1 = {0.0, 0.0, 0.0};
double pt2 = {2.0, 2.0, 2.0};
double pt3 = {-2.0,-2.0,-2.0};
double vect1 = {1.0, 1.0, 1.0};
UF_DISP_conehead_attrb_s attrb;
UF_DISP_conehead(UF_DISP_ALL_ACTIVE_VIEWS,
pt1, vect1, 1);
/* Example to draw the vector with the base of its staff
anchored at the origin so that the vector appears to point
away from the origin
*/
UF_DISP_conehead(UF_DISP_ALL_ACTIVE_VIEWS,
pt2, vect1, 0);
UF_DISP_labeled_conehead(UF_DISP_ALL_ACTIVE_VIEWS,
pt3, vect1, 0, "Normal");
UF_DISP_get_conehead_attrb(&attrb);
/* Use color index three */
attrb.color = 3;
/* Update the current attribute settings */
UF_DISP_set_conehead_attrb(&attrb);
printf("\nCurrent conhead display settings:\n");
printf("\tLength of Staff: %g\n", attrb.staff_length);
printf("\tTotal Length: %g\n", attrb.total_length);
printf("\tRadius of Cone Base: %g\n", attrb.cone_radius);
printf("\tColor Index: %d\n", attrb.color);
printf("\tFont Index: %d\n", attrb.font);
printf("\tDensity Index: %d\n", attrb.density);
}
页:
[1]