|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
/*********************************************************/ B- b& R4 v* t7 n5 X
#include <stdio.h>
- j. k. u) K# o% [, `( x6 `8 g6 ]#include <stdlib.h>
5 h! u# I! u. [; Z( ?" t#include <uf.h>
+ I2 n+ A& c- f) d#include <uf_attr.h>9 d- ^' s8 `6 e$ @4 A4 a
#include <uf_cfi.h>- F( J* {$ t* L5 R+ V. u& w# ?
#include <uf_curve.h>
7 P1 e. f3 |9 e( {7 z' N#include <uf_ui.h>
& X& b3 ]5 p/ ^4 E. f2 j#include <uf_modl.h>5 K3 e2 t* z$ [* q
#include <uf_disp.h>
0 W* Q1 A# [3 n/ d! v2 e# B#include <uf_obj.h>
3 [6 d7 f6 {, x1 ?6 Q$ F#include <uf_csys.h>
- }. I. b6 Y5 `/ n0 Y- `' f- S
4 Y5 C, A8 b% S) \# r$ K5 @8 w( f3 a) r9 ?0 P7 s. U) r
/************* unload alloc mem *************************/
6 K- x: p5 O" X. {& O/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
! a) l( d, g* l+ j9 H1 X+ G0 ]9 d0 L/ x6 x1 P% x" j" i Y5 J2 [" R
static int init_proc(UF_UI_selection_p_t select,void* user_data)
# y* j! m) U% p, _2 w/ Q# y' N{1 E/ _; I& r/ G" t1 T B2 ~5 _
int num_triples = 1; //只选择一种类型
2 A) C2 |, Z, \2 k6 x UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
0 G. U9 _) X1 m _ if((UF_UI_set_sel_mask(select,
7 v- W( p! X7 F; @8 t7 w UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
$ y# j9 m8 ^" W# R8 I num_triples, mask_triples)) == 0)# q8 @$ w( M9 S' A: b4 n
{
# F# Y2 {, p/ }6 }" d' Z8 s return (UF_UI_SEL_SUCCESS);
$ N, l2 m& Z7 S5 L; _) W% E9 x }* T6 X, K6 U4 l" \( |5 B' i) u
else
$ ^4 k1 U) m2 R {
) H6 }- e" V% q+ `" l return (UF_UI_SEL_FAILURE);
5 `6 L4 _8 X2 q4 l2 c i: g }
) A5 r5 s' ~9 b& q8 C' }" `8 V, k}# r* e% V, Z7 l9 ]5 X- s
2 C6 ?; }1 t5 k8 U9 L- `' c
7 ~6 a6 N* l: M+ O8 e- l9 M: g. n
extern void ufusr( char *param, int *reTCod, int param_len ) , I' b# }2 ?" U+ Y" x& C# J/ n
{
( _1 x* h P4 l UF_initialize();
9 l7 p; l/ f0 c0 x5 E5 d5 m4 N. |! d3 i) Q/ X! O X
) E* x& T, g0 N- K, Y) o& y0 a
char cue[] = "简简单单:请选择单个体";0 y& [& G" x8 `( I/ ]$ y
char title[] = "简简单单:请选择单个体";
0 G( m$ [+ I8 Y' \5 T9 @( X* [ int response=0;2 l' l; i3 m, [7 n3 F2 J
tag_t object;5 F! v: }% P" y$ |3 K
int count=0;
9 V' P/ A- y3 I6 ?( N9 p+ Q( ^& ` double cursor[3];
+ F* [5 f' M/ t9 ^. k' g+ |1 R# ~ tag_t view;) t/ E9 T! K9 Y% a; ~( \9 o
int i=0;3 H+ M5 V0 b5 P$ H3 I
double pt[3]={0,0,0};2 y7 e, V$ F) [! w/ e
double z1[3]={0,0,1};
* w$ k" ?) p; m5 P1 Z+ G UF_OBJ_translucency_t cyt=0;$ p% l+ x1 r# h7 l# h4 J2 a
L10:2 m" A2 x. T) j: J" l) ~
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);
|6 D2 T4 n; T+ C if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
/ R2 ? z3 i2 t" Y7 F' B+ e if(response==UF_UI_CANCEL) return; //如果点取消就退出
0 s0 ]" v7 C' F# D- W9 C6 _! n! _
$ v; R) ~) w& |1 v2 a9 e5 K2 P: d UF_DISP_set_highlight(object,0); //取消高亮显示$ k4 x8 e+ S* N7 D
tag_t csys_tag; " e! Z, q! ?- s" e# r4 o
double min_corner [ 3 ] ;
; A1 ^0 Y/ N1 R+ w# V; E5 R double directions [ 3 ] [ 3 ] ;
1 n" a6 Y% B; E) F* w+ R0 b1 W& L; l double distances [ 3 ] ;
" {# B% u, f, w- m* v @& l" S UF_CSYS_ask_wcs(&csys_tag);& n& D, }7 g5 J: g, ?
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
6 ]4 [: s5 Y4 \6 B: M8 \2 [
! I% ?" m0 q h( K- @. c1 o* Q char mesg_x[256];
7 M1 T# i& U! f: B) v! W9 e sprintf(mesg_x,"%f",distances[0]);
K, E" B) B! O. v/ O7 g 8 W+ N7 k5 m' y
char mesg_y[256];# ~& I/ V* B9 A6 T+ k" q
sprintf(mesg_y,"%f",distances[1]);
4 u5 U8 e% B" C$ p' S
$ j9 Q3 ~. j, u3 [8 B7 E; _ char mesg_z[256];# ?4 ~. v( l7 E a W+ f
sprintf(mesg_z,"%f",distances[2]);
+ E4 D0 _' i, e+ C* k
% z% L! A" e8 g6 D z9 q$ ?* d char *edge[3] = {mesg_x,mesg_y,mesg_z};! k$ K1 u% f& p4 W7 J& r* Z' B$ D& z
tag_t blk_tag;
1 c" M3 `/ [2 C3 |+ ?8 C UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);- D+ ^; U/ H4 U/ `, e: F! C' \
- W* L: x) Z! _& v' g1 A
UF_MODL_ask_feat_body(blk_tag,&blk_tag);; S% t' ~* K! u8 w; A! L$ B
UF_OBJ_set_translucency(blk_tag,100); //设置透明: ^( @, J8 p( T0 V! v/ f( x
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
+ f, w% v! Y0 E( X' T2 V- ~ UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
, Y% M$ @' K, K- R Y d7 ?
5 j5 ?$ W! I+ u: R* a T4 T" L; y. K+ }# h- K/* uf_list_p_t ll;
: @4 |, b8 E/ ~( p" V! w C UF_MODL_create_list(&ll);
2 ?& K+ S5 p5 b+ W5 S5 Z3 t0 @ UF_MODL_ask_body_edges(blk_tag,&ll);
d8 P R5 e) c' H" n int ww;3 C- R' A6 x) B9 C& k& p
UF_MODL_ask_list_count(ll,&ww);
, y! J, z) V- e& F4 x; C: x' B for (int i=0;i<ww;i++)
: a+ l! T6 u6 i9 u# u2 b2 W {5 S* L' o7 V* s) f
tag_t yy,curve1;
' U) m; s+ p! l: ~ s+ ^ UF_MODL_ask_list_item(ll,i,&yy);
: P8 a( Z! r9 {# g! ~ UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线: V- B9 u) k8 s2 B% M$ L0 |
}*/- N5 I) ~3 O' _
char box[256];
; k; ]) X, Q% m4 d sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
3 @- s7 H' T! i% i8 Q uc1601(box,1);
; n- U2 {/ o% i) [! t
; N/ ]+ @% i- \ R, @0 r goto L10; //透明之后继续回到选择的状态5 y% a' G6 [; i4 ?4 o4 T
& W4 w: O$ V! s9 s8 J$ }
3 G1 @4 r- t/ D# W
1 J9 y0 |5 s9 a. w5 V7 F! U% Q! D4 j# i$ S$ Z5 i3 Z1 u9 l
! I4 b! Z3 ]( ~" h9 [% a0 T UF_terminate();
b. s t1 d. N& N% g* ?8 w return;# ]) p# r @& y$ h1 f- X4 w4 T# o
}$ m+ Q: B/ @4 B( }& h% ^7 ~# |
- W4 A& M) t7 P! `
# y6 u3 C; N8 kextern int ufusr_ask_unload(). \$ ^0 P! N) `! ]# O+ V1 a
{# }6 W# F: @5 I& @: a" r
return UF_UNLOAD_IMMEDIATELY;
& r0 d" G7 b u" L& q}
% p N+ o& c7 P' r7 U. J0 `) r3 v, j: F8 I
|
-
-
评分
-
查看全部评分
|