|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
% q }" R, {3 I: N3 h#include <stdio.h>
1 @3 j3 F8 [) o- O& b/ a9 b#include <stdlib.h>
5 b: q* w. h6 o8 J- J( [#include <uf.h>7 d6 J& t. s, x$ p, O3 F5 ]
#include <uf_attr.h>
4 U* }3 a% ?' \ k# x#include <uf_cfi.h>6 U! Y% n8 J8 X9 `" u' r" [0 Q
#include <uf_curve.h>
; h6 O8 N( e' f, Z#include <uf_ui.h>
# M5 O- C3 N: F#include <uf_modl.h>
: O; C; H+ C/ y! N p4 M7 Q#include <uf_disp.h>. d$ d) O Z5 @" y" u
#include <uf_obj.h>, R" n% R. ]9 q/ y% B0 ]" x- _
#include <uf_csys.h>
7 }2 G4 ~+ s- T, ^" `. w& Q: n3 z: P. Z$ H. o% X- p; ~
0 i, M) x8 B1 v9 H5 t, Q- x
/************* unload alloc mem *************************/; X" k& U0 ]" {: \0 |3 R7 i
/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */ j" s# z* }. l# J+ c
7 {/ e9 S2 z" T: q( r) X( n
static int init_proc(UF_UI_selection_p_t select,void* user_data)
' [0 Q# S8 ]5 E, b% m% l8 ^{% K7 X* u. Q1 ~! r) e& i$ A
int num_triples = 1; //只选择一种类型
3 A! k0 r% A4 a( F/ h' f! r' k UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
+ n, P2 E! x/ ~: Z7 f' x9 v if((UF_UI_set_sel_mask(select,8 L% z7 H3 U+ A
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,+ v- ]5 x; T% H% H' ?8 r) N% m" F3 M
num_triples, mask_triples)) == 0) n1 d; I/ v; L/ N
{
3 P* D9 t/ E5 U) h3 N return (UF_UI_SEL_SUCCESS);
) N: F: N; ?4 I ? }
, f/ C+ L) F& ]3 D5 ]) w O4 B! j else8 z3 L! P# O$ C6 B
{
. f; W& @0 f( b) c return (UF_UI_SEL_FAILURE);! O& |6 h1 S; \' ?
}" ?) k* J) D! M; @
}
' A% x& b" \( }% }* w, P e. }
/ b* Q! B I( n1 j u" O0 {: n6 A, [" [& `
extern void ufusr( char *param, int *reTCod, int param_len )
/ E$ R& T! ~7 u+ B7 G4 r. h{& `) i; w5 }% H
UF_initialize();
2 v; X( z6 w; g( _; B4 D! ?. \ f* L+ H6 {! ]- j1 ]% l
4 w0 k7 o& ~3 R4 u char cue[] = "简简单单:请选择单个体";
( P8 y3 V& j7 {3 b5 r* Y) U" _$ }0 S7 M char title[] = "简简单单:请选择单个体";& G3 v/ @" W; w0 T, o$ ^' N
int response=0;& K$ a, n* a. Q/ B1 @1 m1 _- O" p
tag_t object;( f$ s. ]9 ~. I0 @0 a3 m4 x d* K: w
int count=0;- ~% |6 Q* u3 l0 p2 O$ A
double cursor[3];
; u O" l5 V$ @" ], i0 \ tag_t view;
" z1 h# y% Q1 q7 ?) n% i+ q& C int i=0;2 `6 S& `6 L8 {7 a7 x% Y/ ]
double pt[3]={0,0,0};. S; ^; v7 H3 l
double z1[3]={0,0,1};
/ f3 J! d" a7 M) _. N: \ UF_OBJ_translucency_t cyt=0;
: x) g- f: h+ _$ r$ JL10:
/ W M2 u3 |) Q( g3 Y( V2 d( K6 C UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);* Y( y* @- h. ]. v$ J
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
7 {& w3 Q- `5 I if(response==UF_UI_CANCEL) return; //如果点取消就退出
I. V$ r; K9 W0 p2 G$ N
' c! ~2 l5 M8 F& m/ @: a, ^ UF_DISP_set_highlight(object,0); //取消高亮显示
5 m, D" e) N( B& i tag_t csys_tag;
$ d0 S. p. J% l) y9 A double min_corner [ 3 ] ;
8 ~2 O# T2 B8 L double directions [ 3 ] [ 3 ] ; + b; K- c- B; D" a# J
double distances [ 3 ] ;- f& p$ ]5 F# `; d& V# }* T7 [
UF_CSYS_ask_wcs(&csys_tag);8 B# N. `; C( `; u
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
6 m% t% {( q, L' m. D C _7 L5 |" {' n
char mesg_x[256];" |# T5 p5 [/ x5 i
sprintf(mesg_x,"%f",distances[0]); y; w! a1 `5 E- W- e
8 o5 D$ P4 I; i3 s1 {& B; p+ b$ s c
char mesg_y[256];
, U: n9 x. r x) X! `) P sprintf(mesg_y,"%f",distances[1]);, K: D! L- i0 \/ B: Y( ]
/ p P; n- }# G4 V8 |; g; X
char mesg_z[256];
# T' W3 K. W9 L. M8 U) s0 S sprintf(mesg_z,"%f",distances[2]);
% T& ]- w/ f \4 K) W 2 a* D' H% [: R( ~9 T P
char *edge[3] = {mesg_x,mesg_y,mesg_z};
7 P! _' U6 ]4 I7 H3 n# w. e tag_t blk_tag;2 O6 @5 t' p9 p$ N' T8 K! W
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);& a& b& ~; l1 \+ W
9 G( J9 Q! T# D+ i
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
, G0 S. d8 g c: F& E UF_OBJ_set_translucency(blk_tag,100); //设置透明# Q5 f. X1 s3 m" U8 w
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
: V E" i% [' k/ s+ w- M3 w' G UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型- I5 p/ H& E0 l- X
% d" s" Q* Q- t/ s2 U
/* uf_list_p_t ll;
" }$ W+ k$ ^( `# _- U0 Z UF_MODL_create_list(&ll);
/ X1 k% [- ~" | UF_MODL_ask_body_edges(blk_tag,&ll);
* A: m: r! Y2 v) w# h; u" G: D& ~. D int ww;" r. g4 B% ?6 M* G
UF_MODL_ask_list_count(ll,&ww);: s7 t6 A- a* k/ D8 O+ e, g% T# A
for (int i=0;i<ww;i++)6 a2 S3 Z& G. C% ]( [+ M
{
) I1 ~3 H3 D% p2 ~6 g tag_t yy,curve1; ; D) \% C1 C4 X6 i0 v$ b4 m
UF_MODL_ask_list_item(ll,i,&yy);, Z" W3 ]5 i; i% I' J
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线: U& z$ w7 {8 F( f
}*/
2 N y3 r/ p5 U+ p K S3 |2 _9 D char box[256];
' J( E: u7 U; [, }+ m: S sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
3 U6 h8 y8 n4 v3 Z3 A uc1601(box,1);
. n/ W; P% w5 H( V5 f+ X5 p# i
8 b; b6 _2 F& D0 F1 M( Y3 @' ` goto L10; //透明之后继续回到选择的状态
+ W7 s' O. ?. S" F; j( m2 t9 w1 j3 t
. s Y& B, d, H. r- Z( ]4 R
& |- ]* U& ?9 U K( x7 c
1 k9 `: e! B( z0 E* t! W7 K5 O3 w" e# `. l
UF_terminate();
5 f0 u4 a" w' A/ T return;1 t, o6 ~6 r4 Y8 ?4 t
}
: S# s4 Q# P' H( g9 K6 m4 L& o z$ B: E1 |: K) i3 V) d2 J. U
3 J- S0 O* N# Jextern int ufusr_ask_unload()8 I! o+ x+ s9 ~6 [
{
7 ?/ d. c- P/ t, y% _1 ^) S return UF_UNLOAD_IMMEDIATELY;2 ^4 I! r K$ H" w
}8 D- C5 u1 v4 Y8 h. H" k0 w6 G
t* _# A, [. y6 ?( r: A |
-
-
评分
-
查看全部评分
|