|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
/ G |& y l- L* B7 i#include <stdio.h>& {0 u+ p, i7 }
#include <stdlib.h>
6 Z; e/ j4 h) V+ S {9 z#include <uf.h>
5 B, @$ J; Z" e- k8 T& F1 C#include <uf_attr.h>
. T" K* I" R: c9 G8 w3 K7 F#include <uf_cfi.h>& \% p9 l; T( C H5 J
#include <uf_curve.h>2 x$ K, V. d) M
#include <uf_ui.h>8 O) S- A4 A) `1 s: W& H
#include <uf_modl.h>
4 C. ]' a' g L4 ~1 g! R4 `7 y#include <uf_disp.h>; W* _0 v+ @: G" A, o9 h
#include <uf_obj.h>
) ~1 d( K, h1 q( b) c w#include <uf_csys.h> z, o8 d( E4 t: |" j
3 V9 J5 ]( y8 P
3 X$ b9 E& M+ c& J
/************* unload alloc mem *************************/
* o$ j1 L- Y% t9 L/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */$ C. E9 V/ X! \5 W
9 ^. a/ g7 s, s" c) M1 n, f+ x
static int init_proc(UF_UI_selection_p_t select,void* user_data)9 |7 g* {& |* C( h" \' W* y
{; R6 U" F' Z3 J* E- n6 Q, d
int num_triples = 1; //只选择一种类型/ A1 _+ r5 g ?3 J( k) \+ }! ]1 D
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
7 W. \* p& i7 @5 n: ^" Z if((UF_UI_set_sel_mask(select,
4 D" {2 s6 k, T( A/ e UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,& \ t2 B+ w) j9 w
num_triples, mask_triples)) == 0)& W1 d' L7 y: Y: ]; e! r
{' V. b5 K' s) u9 {7 Y: t; i+ g
return (UF_UI_SEL_SUCCESS);5 t: M. P1 r5 D, h8 O8 A
}, h; C. D, } Q4 M) A
else9 k7 r2 N2 c. ^4 D- f( p
{* F6 {3 ?8 g0 g# r+ P8 p% r
return (UF_UI_SEL_FAILURE);- q8 F& G* L! q9 E; g1 N
}* s8 b/ H" w1 X
}7 a5 a0 U. X7 Z: |2 t( i4 O6 `/ _
: d. f1 f" I1 n
) V& U0 \/ y) @ Xextern void ufusr( char *param, int *reTCod, int param_len )
6 G- h6 D, h# |! P8 L1 {" e" G3 r U{! \' k, j0 H# Z4 p1 }+ R
UF_initialize();2 k: v+ F# G6 E8 V, i0 W C
* U7 I6 Y `, ]7 N
0 q" {7 P# L1 i7 y( M
char cue[] = "简简单单:请选择单个体";
( l6 ?& }* I6 x char title[] = "简简单单:请选择单个体";( \$ g8 w+ w0 r& V
int response=0;( V: y4 Y' C# M5 K9 e% Q$ T: n
tag_t object;4 {% n1 _' E" l# M# v, }2 X2 y7 j; a
int count=0;' }$ X* _4 Y9 [: y: W
double cursor[3];
/ L, `- l1 b1 H2 Q tag_t view;5 r0 J! y/ c/ O7 G% z2 f
int i=0;
, x# k4 T3 Z: S double pt[3]={0,0,0}; L: P A" N- V( h; q& c1 o
double z1[3]={0,0,1};
$ }6 @' h+ ]1 V3 C( ]/ @ UF_OBJ_translucency_t cyt=0;
& c* `9 e8 T/ j1 y/ i' dL10:
0 Q4 Q( C& Y3 q- o UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);- _" b6 Z& ]& Z- p
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10 ?4 |7 H- g/ T& `% K
if(response==UF_UI_CANCEL) return; //如果点取消就退出
; u, t: x9 q& O' ^3 n; j) {) T! g3 S# E' k& G! ~! L' |# U
UF_DISP_set_highlight(object,0); //取消高亮显示
4 K6 I: D d; e7 R4 ? tag_t csys_tag;
+ n! Z! X, I; Z5 r4 J: z0 C double min_corner [ 3 ] ; , m) ?& M5 h/ l9 A6 p. J3 j( }
double directions [ 3 ] [ 3 ] ;
" v( G3 |8 D( }. d4 T double distances [ 3 ] ;
3 n5 g" Q/ m# Z8 d UF_CSYS_ask_wcs(&csys_tag);$ |; m: w6 \% ~+ q3 B$ \
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances); B) m: J" m2 r$ d8 s; x
# O7 \3 f0 Y( n& ^, _
char mesg_x[256];
9 n" O. @9 }4 ~* ?5 ]3 ]2 R sprintf(mesg_x,"%f",distances[0]);
, Z* U+ e+ e* W9 G, A
8 Z+ w" _1 S* L' M. f# { char mesg_y[256];8 s8 l: v1 Q. ?. h
sprintf(mesg_y,"%f",distances[1]);7 Q% J4 h( V. g; ^3 d+ U
* b- O1 G$ P* k- f
char mesg_z[256];: T/ B: f6 x" F" G- d
sprintf(mesg_z,"%f",distances[2]);
# B9 d1 _6 n- O. J! I9 k1 c 0 b0 M D8 L `5 Z
char *edge[3] = {mesg_x,mesg_y,mesg_z};
$ d2 c, C/ U& n. r! S, @ tag_t blk_tag;5 p/ A$ W, |3 Z% M+ \ k6 h# a5 \% l
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);/ z9 z, A6 R% s* v& F! W. [
+ g$ Y( m8 z/ o# q; E
UF_MODL_ask_feat_body(blk_tag,&blk_tag); |2 m+ S3 R" F" T$ ^: T4 i! p
UF_OBJ_set_translucency(blk_tag,100); //设置透明! E; Z8 H0 x4 \% ^2 M* P# U$ n/ J
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽9 W7 f$ k' t) f( n4 t
UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
n0 l- _1 ` H, ]/ p5 w% `. q* h1 c: a) C4 u
/* uf_list_p_t ll;. P" g+ s) U5 Z( E5 s+ M3 w! {
UF_MODL_create_list(&ll);
% c, s) V" A9 D' P3 u/ E/ K UF_MODL_ask_body_edges(blk_tag,&ll);
6 H6 n3 f8 [' J+ m int ww;
, G1 d- L% [! e& {5 o/ {% y# t N UF_MODL_ask_list_count(ll,&ww);
* Z, z& b& `/ l" S) P for (int i=0;i<ww;i++)
z9 c6 t5 i& v* P9 q {
: T: r% T$ `6 ]( K9 M( v tag_t yy,curve1; Q( G4 ]1 C" a# _5 p) P
UF_MODL_ask_list_item(ll,i,&yy);6 L. x- s& w6 `) ^" q6 I) k- m
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
' m1 m4 ]) B" E( M1 @. l }*/7 _/ z1 P8 a, S1 Q" d1 j+ T9 c
char box[256];
6 `- I7 e; Z7 @' d' s+ S; {0 z sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
) ^2 q' [, n# |3 [! I8 L uc1601(box,1);
3 Y$ C) }* a7 t# @0 y
9 I+ |- k7 }% c6 V5 S/ f goto L10; //透明之后继续回到选择的状态6 I9 C* Z8 e/ V# D
1 Z# _/ d" Q% @8 i+ N9 O2 h1 [
) {: E: O) S) d% x9 i# ]; j2 l& _9 z% A; Y& h/ E6 {1 D% l
! R- [$ ^4 T- m; p, B9 J* F) {# ~/ c
, b, s' z8 e; V- C# r% s UF_terminate();
" L/ k. |7 p. x$ {7 e/ x return;
q# Y/ W; T8 [/ V}. P' p; \, ?+ ~1 L
: A3 T3 E# X' q0 x0 L
! A" {3 X2 H3 p0 z) v" iextern int ufusr_ask_unload()
4 _: K, t5 Q! ^3 Z0 \( V) w{4 p: O7 C, A$ i3 a& `; c
return UF_UNLOAD_IMMEDIATELY;
* v4 `; R" \+ j/ M# g& S' k# B}
, E7 F7 ~0 c* Z& ~- Q. |6 G: n: l$ y9 j1 i5 |% Z5 ?( C
|
-
-
评分
-
查看全部评分
|