|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
/*********************************************************/
7 P; C0 s) x( v6 ?- K#include <stdio.h>
6 [ @6 U7 ]' w' ?" E! J#include <stdlib.h> s9 t" d' e. D( U
#include <uf.h> a7 u) y( l* W, D" V/ V% D
#include <uf_attr.h>
3 O+ ~: C- ]6 c8 J% A& R& V#include <uf_cfi.h>1 E7 W% @4 y i
#include <uf_curve.h>! R5 W* c' ?* e3 p
#include <uf_ui.h>4 ^' J) Y% ~" P( P' q
#include <uf_modl.h>
3 \) u% F! C- F. n#include <uf_disp.h>; r: X8 `' V8 R# H( ?5 H
#include <uf_obj.h>1 p0 b" o1 u" h9 B# t
#include <uf_csys.h>
/ R$ ]. E5 P1 U K/ W7 p
" h! @9 L$ n0 Q+ ^3 e# V c9 m$ n5 M8 e8 P" G: e9 }; }
/************* unload alloc mem *************************/( p2 U1 S3 E* r) {% b' A7 x4 _
/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
' s# b, F! c$ G. {: [* J
5 b. h! M& ^ i+ |static int init_proc(UF_UI_selection_p_t select,void* user_data)" a$ ]# V. p" e7 g9 [1 w
{; n. A. z2 ~& X- [8 m, s+ b
int num_triples = 1; //只选择一种类型+ T8 o! E+ G/ I+ u2 J7 i" p
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
, Y$ d! i6 E5 z/ e k; x. ] if((UF_UI_set_sel_mask(select,) f6 [( }# h' n. ?1 v/ C; E' X) z
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,$ E' l) ^* y( c+ ?$ e! K9 x
num_triples, mask_triples)) == 0)
! B) E8 x1 X3 e' |5 G( J% V {
/ R+ L" c; L9 J5 q% C return (UF_UI_SEL_SUCCESS);3 b& W: t, v! \" R8 G
}
5 o" y4 w& u# q! M6 c( ~- t else
/ _1 i" n7 n% e {- N8 y" Y* Z" M E! D" M0 N7 o5 z: G
return (UF_UI_SEL_FAILURE);% W" O8 f, l: w+ q
}1 n' Z |: V0 G: [/ g# V
}& j+ }& S2 q0 T; [: o* z
r- i( B' {: l3 O& u! ]7 {3 l
W& S9 b1 G9 n& x7 C+ r
extern void ufusr( char *param, int *reTCod, int param_len ) ) M& H% p( {. {0 Q
{
$ X" q4 i+ f- L9 u3 ? UF_initialize();
+ K; _7 D! j3 j9 l
$ X3 [, \! W8 t ' d3 A' J( l. P& d
char cue[] = "简简单单:请选择单个体";1 O) \+ r2 d9 H# ]3 v& m% l( @
char title[] = "简简单单:请选择单个体";9 S) D! w2 ?3 j+ p `6 C& n
int response=0;
! Q* K! x* h. { tag_t object;
3 r. h4 p+ v1 o int count=0;4 O7 J z; f4 K
double cursor[3];
! U/ i! _& r0 r6 Q6 G tag_t view;
$ I" D& X1 E z1 q9 v- C int i=0;$ [' k9 f \ Z( E1 s
double pt[3]={0,0,0};
8 B8 k$ | X1 v1 u0 F+ u( h8 z' v double z1[3]={0,0,1};
6 f1 t& P; P( k/ n' S: c% N UF_OBJ_translucency_t cyt=0;, s: m# G7 m" I+ I
L10:2 t& y7 r7 T/ G" b2 n2 [% }
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);# T c" M$ C' J! [3 W# `
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10* j5 ^1 K( n. m9 {
if(response==UF_UI_CANCEL) return; //如果点取消就退出
5 W; x$ n' s. w- F9 }6 d5 b- F* m0 e+ g# J
UF_DISP_set_highlight(object,0); //取消高亮显示9 J% T' x, G! S2 n; d
tag_t csys_tag;
+ W# i1 u8 E$ a" Q& P. f double min_corner [ 3 ] ;
" Y" C2 ]0 k \; ^- E. _ @ double directions [ 3 ] [ 3 ] ; ' n! R1 `3 I; ?1 C
double distances [ 3 ] ;; u7 N( P, B& ~' h1 g6 U
UF_CSYS_ask_wcs(&csys_tag);
; y. z* t( S- h/ W" u$ b r UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);* k7 @' k' b0 u# m/ m# J
! q: E) ^9 e; ] char mesg_x[256];, b; Z) V) d- w7 j. k
sprintf(mesg_x,"%f",distances[0]);
|- p! n0 U+ w3 e! C1 y( H$ W2 J& ]. j - A* z1 w4 w7 R1 l( |& o) O
char mesg_y[256];
$ U3 m# e1 T0 w# y) z4 E$ B sprintf(mesg_y,"%f",distances[1]); S5 U! F/ E+ b# l
8 f( d6 P& \# i# X. R1 s* n4 a `
char mesg_z[256];
0 @% \/ F! G: D) g ]# j sprintf(mesg_z,"%f",distances[2]);' z, v3 h% N$ ~1 Q% Q" I
; _6 C" [1 z- U: ~
char *edge[3] = {mesg_x,mesg_y,mesg_z};
3 i. b, _2 v9 M6 t! I tag_t blk_tag;6 q# F. {" F' o* I) C+ e/ M/ l
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);
+ Q+ c3 o- o* o1 v $ I: ?6 R6 I+ h2 ~4 i
UF_MODL_ask_feat_body(blk_tag,&blk_tag);) H7 L9 w# ~5 \0 C) c1 G" U" c
UF_OBJ_set_translucency(blk_tag,100); //设置透明
7 B5 t' P3 J. |% h: f2 V UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
& q# `0 j% z& f9 {8 q* n- {" C H UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型7 O- D" o5 r4 V6 a8 t3 q" b2 R \2 w
6 y0 G+ m+ y5 P: b
/* uf_list_p_t ll;
+ r2 Y+ E5 z. b0 G( A# T0 k7 ` UF_MODL_create_list(&ll);/ L# X0 B1 ?8 R# K
UF_MODL_ask_body_edges(blk_tag,&ll);
$ x/ ]1 v# ~) Q1 J9 E. b U7 Y, L int ww;
. F& i3 s) o$ l- J6 Z& y6 F UF_MODL_ask_list_count(ll,&ww);" ]2 B' z0 g1 ?
for (int i=0;i<ww;i++)) m6 s# V, d; R
{( f n: m3 V2 J
tag_t yy,curve1;
2 G+ e+ w7 z! U, I- n- K3 O9 Z' f UF_MODL_ask_list_item(ll,i,&yy);% j1 t: D* z7 y9 i b
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线9 y. `, P4 w- C5 N0 O4 o7 W( b
}*/) c" S8 M% l; I# A, v' |8 v) y
char box[256];
8 f( g9 }7 c& d sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
7 i8 G7 L) x- o; D. F2 G uc1601(box,1);* `- C) B E7 ~, f) y( o3 c9 k
- ^5 g- L1 @# }- h6 i$ y, x9 R goto L10; //透明之后继续回到选择的状态
) q" ? @: V8 B# x3 p' f
! O& I+ I8 I$ |# ~9 d: R `
/ `' W4 ^! r2 O: Y: {$ u6 [: o. g# e& l. V( p! D
$ {( j- p- N. C/ j8 a8 h; k
; m2 G, Z9 q+ F5 k UF_terminate();) D/ }7 K. ]- Q+ W- R4 `9 f- R' j5 W
return;
$ r2 Q9 o8 O7 A; q0 v}
7 I0 t+ k2 d% u7 E: x, f& S7 @2 C9 h' _/ M9 L5 g8 c
% T$ f2 ~! ^9 k, j
extern int ufusr_ask_unload()- R' H$ E, J! ~% b+ g1 K
{
7 [$ E0 Y1 x) r M, \ return UF_UNLOAD_IMMEDIATELY;, q! [2 ~4 N0 v7 u( a
}
- x" f a8 i4 F" I1 O
\1 A0 }: L! t8 [4 w# w1 u* U |
-
-
评分
-
查看全部评分
|