|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
/*********************************************************/: G+ y5 u/ l8 V) k
#include <stdio.h>6 v* z9 U# f- h/ i9 }. h) j* s$ ]
#include <stdlib.h>
8 c! ~) `+ F' w#include <uf.h>8 _( J5 ?( H# x7 L& o6 c
#include <uf_attr.h>
0 d; @+ X! g0 X#include <uf_cfi.h>2 k$ |2 {8 c/ @' u- U6 f
#include <uf_curve.h>
4 \ t- O" I$ I0 I( L$ F#include <uf_ui.h>
( `/ q% ~( I3 L0 J& N6 \#include <uf_modl.h>
/ H# P% q1 l* n1 G8 G" H$ g d# `#include <uf_disp.h>
: v+ I2 ]& P e6 U5 L) t#include <uf_obj.h>: m8 m' t6 F5 P' u" t: }6 x( \$ B: n
#include <uf_csys.h>9 n- w% p7 g& k, w
2 E5 X0 `* o4 ~% y( @) W( l+ S7 B: J' P8 u
/************* unload alloc mem *************************/
8 w4 b: v6 Z2 C) L& K/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
" h/ a( Z5 I- c& j# g: C+ s
) c3 |7 L d% P! o) P; Lstatic int init_proc(UF_UI_selection_p_t select,void* user_data)
+ J, q, g# M1 E; w{
0 b4 K$ H; [( \# E int num_triples = 1; //只选择一种类型( x8 I0 Z- ]2 l
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};6 O) H& G& C* f1 j6 W3 j' m9 P
if((UF_UI_set_sel_mask(select,
% N' U5 r& e& H* B UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,/ f1 u3 F) |4 W5 ~* L
num_triples, mask_triples)) == 0)
4 u+ w; T) A% o5 s6 e; b) I {; l: K! P# I. _$ F
return (UF_UI_SEL_SUCCESS);
5 [* b2 |7 g ^, {' t }
9 k! m. a. t# k& b+ S: v- t" x else
$ {1 z" W, P; U3 D$ f2 A' j {3 e. u5 m6 S7 V* d* H8 G2 w
return (UF_UI_SEL_FAILURE);
7 B: R) e/ Z9 x P }
# I) o/ O" V/ ^" ~}7 B/ s, i, v/ K' U
4 o9 U! ^5 x4 Z @2 O: O
. d e2 s3 {7 _5 A" \extern void ufusr( char *param, int *reTCod, int param_len ) 7 |1 \7 Q# V& T; K& T, z. E
{" p2 d! I6 O9 x# G4 f, n
UF_initialize();
- a8 l: L2 G$ g5 ?+ S/ |- i. k& ?2 Q/ A4 Q% d& x7 I
4 Y; [& z% B- C. f) \
char cue[] = "简简单单:请选择单个体";
! H1 X# K% `9 T char title[] = "简简单单:请选择单个体";
2 }; o1 U4 G2 q: \ int response=0;' C3 j2 v! S2 ^' |6 _/ ~: N C3 K
tag_t object;' y/ S4 B) q; w, I7 `$ }! H/ w
int count=0;
/ c8 e+ L7 A1 f6 d; K double cursor[3];) O+ ~. `) m' E* q; _% D9 U
tag_t view;6 `; r8 B" s5 m' G
int i=0;5 a, I& B: p$ Q" K. {
double pt[3]={0,0,0};
, O: p# `3 v$ `9 r& X1 x6 b double z1[3]={0,0,1};3 W N9 m+ E$ }" O% t; O& p
UF_OBJ_translucency_t cyt=0;
, j: g) }* m( _! M7 n! e- }, b' gL10:
8 |' q/ R5 s: s# P/ y; W$ U/ [( v UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);+ k8 _% M+ a5 {5 N( t+ x$ [6 u
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
% b9 P: R! Y5 ^1 ? if(response==UF_UI_CANCEL) return; //如果点取消就退出/ ^. B9 n7 U: t$ s
: @' n b+ q y4 ` i
UF_DISP_set_highlight(object,0); //取消高亮显示' I- C j" F% d8 {
tag_t csys_tag; ( X; f; ^) x; E |
double min_corner [ 3 ] ; % d& ]0 H: Q/ S$ ~& Z. P
double directions [ 3 ] [ 3 ] ;
$ b2 n9 A2 ^) w double distances [ 3 ] ;
4 @0 i4 w; l3 R. O* L% s UF_CSYS_ask_wcs(&csys_tag);
3 ]/ E, G, z. K- G i2 k$ \ UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);; B& o$ s9 z7 S. ^, g
3 `, e! u+ `0 ]6 D! h0 D char mesg_x[256];* @, O4 H; ?0 L4 ~3 J9 {" U
sprintf(mesg_x,"%f",distances[0]);
# |/ g2 A! D7 ?* b/ `# i
9 e# I1 D6 w& S+ Y5 U2 t0 ~ char mesg_y[256];! l7 X6 A k' R4 I2 e
sprintf(mesg_y,"%f",distances[1]);
' V/ r1 | p5 g' d
9 J; T1 h' ~3 i- j char mesg_z[256];! E8 l! u1 H6 B4 c. b, n
sprintf(mesg_z,"%f",distances[2]);
8 r# ^" z5 A8 D2 `8 a V
5 Q/ e$ P6 {, W, ]2 F; S char *edge[3] = {mesg_x,mesg_y,mesg_z};
4 n- r+ m9 W' v" n; K+ c: o tag_t blk_tag;
; D- k: s6 F0 T/ k$ D$ g UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);
% q7 }* k+ R% Z# f2 b- ` & x- A4 @, {! Y8 L; B
UF_MODL_ask_feat_body(blk_tag,&blk_tag); F* j& z" F/ W! F! F( K0 I
UF_OBJ_set_translucency(blk_tag,100); //设置透明 t' t# k8 a" O+ {" a9 w' {+ M
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
" W* ^5 ~& R" g" _0 ] UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
# r* Q7 |4 T$ d; n6 v# v4 `) ^. p, Y2 A0 A- ?
/* uf_list_p_t ll;
" k7 V# s8 s7 g! u( ?+ [# O2 b UF_MODL_create_list(&ll);
$ G9 l! \" t! \% N UF_MODL_ask_body_edges(blk_tag,&ll);
F. J6 N& y9 [% t int ww;5 L% \ M+ w' }% q# C
UF_MODL_ask_list_count(ll,&ww);
" h3 l' I! y- G1 ?4 \ for (int i=0;i<ww;i++)
0 s! {6 A( |' [3 E {
5 y& S& L: O! [ U. \# W tag_t yy,curve1;
9 t1 ^* O% Q* i# y$ p ] UF_MODL_ask_list_item(ll,i,&yy);# C. d( A) h& y4 Y* @+ e
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
5 k; O5 ]0 w; N( \: j: L6 l2 k+ W }*/
$ g+ Y8 l% |, n& l4 o- ]) P char box[256];
+ Z8 d( S8 \, ^: J9 T0 \" V sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);) M( E8 ?' T$ o; [
uc1601(box,1);
( J2 V- a( s9 k9 B3 n E! E% K
2 j% K4 J: L. | goto L10; //透明之后继续回到选择的状态
4 q' y. Q7 b/ Q. o
+ c5 } `1 N2 h2 e # a2 w) K* k+ f! e! S
+ d/ Q' z& f. x8 z4 `. W# r+ ^
1 `; P& m s- u' g9 r2 b
' A9 H: g% P, y( k, B3 E4 t
UF_terminate();
3 N7 v9 B4 E9 X% U% y$ l" X* f0 D return;
* W: U) R4 G& u- j j}$ y- Q; o) D3 u( R& v7 {8 E
5 o u5 f8 ?# }; g8 A0 s2 Z" ]. _: x& j% f1 O+ U
extern int ufusr_ask_unload()
1 F: [& p d/ @9 O1 M& Z4 D{
2 ^1 s) M. S, H2 i3 s# Y return UF_UNLOAD_IMMEDIATELY;
2 E1 }5 k# A2 ?; d9 o! t}
8 {1 {: K' @! |9 X+ B
& g' @# L; }4 w! ` _& S& p2 m |
-
-
评分
-
查看全部评分
|