|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/' M3 {" I) Q- s2 D
#include <stdio.h>
$ J" I3 f3 {6 g#include <stdlib.h>
6 w5 V$ _& k4 V) S#include <uf.h>
. @1 {, `2 T6 ?. X7 e K# p2 a#include <uf_attr.h>
8 e/ b( u3 G: k; X0 ^9 T#include <uf_cfi.h>
0 M2 ~4 ]% b0 B( W$ g' N#include <uf_curve.h>
9 v* [: U ]2 g9 D. V }, }, k#include <uf_ui.h>
0 g4 N2 D. v: f! Q# K, e4 z#include <uf_modl.h>( _( I* q" k' h* o" R5 I
#include <uf_disp.h>
5 }9 _0 U- J0 Z I4 X+ O#include <uf_obj.h>- A( I! Q: D! d I" Q
#include <uf_csys.h>2 a2 ]' r; B# I) Z3 O
/ R1 d+ {: p$ |% Y
3 M8 m. o% I0 [/************* unload alloc mem *************************/
: r, A1 I7 O6 y- E/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */% e9 c; n/ f5 U9 Z* _5 O% q# f
) ]# N7 j9 j& P. D
static int init_proc(UF_UI_selection_p_t select,void* user_data)
7 q8 ^4 V: \* e( R* P9 k{ d% H; t( B, B0 B1 s
int num_triples = 1; //只选择一种类型( F) Q- j6 Y4 ]* s! i, ^
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
4 b1 d* o$ @! S4 t( i if((UF_UI_set_sel_mask(select,. I: A" y, D+ M" X' r$ O: v B
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,$ o, ~$ Z+ n8 s1 ~
num_triples, mask_triples)) == 0)
9 k% |# [! w2 y$ Z+ D) N: b7 T0 P {5 I8 ]% s& Q0 B# U
return (UF_UI_SEL_SUCCESS);' C' q1 k" H% }* l) \5 }) G
}( i5 ^" f/ b1 s0 y5 q
else+ o: y4 m2 @1 u9 x8 V
{" T8 G+ F* ]! P n/ C
return (UF_UI_SEL_FAILURE);
& y4 A8 y! s1 v6 U; U( L8 ~ }1 ]( y, T! Z% {3 W
}8 C, D+ h+ X) ]" Q- [ f" M$ c0 \, P
5 g9 t9 R9 u/ o( \$ |# g
, _4 W3 D& \+ n0 a* Bextern void ufusr( char *param, int *reTCod, int param_len ) 0 o; }! O/ H/ _( f) q
{& ~- S# `! m$ v7 H& K
UF_initialize();" T, Y4 o& Z1 j' c: G, V# I4 b
" X% u2 W I! X: k3 E# R# D/ Z% S 3 Y) v/ n7 u3 s' a
char cue[] = "简简单单:请选择单个体";
# x; P% b3 V# @; s* m char title[] = "简简单单:请选择单个体";* v) @) \5 g: y* O
int response=0;
! I6 ^9 |" a3 L+ h1 k: @' f& l tag_t object;
E. p- G! M/ D9 I( K+ O int count=0;8 \' B# j& p$ G! H5 m+ g, q$ A9 S3 Y
double cursor[3];" \, k' q' L8 [' O
tag_t view;! s8 }; h" U: p0 X. J/ Y
int i=0;% O" K3 h7 [) c2 E+ l/ h. h
double pt[3]={0,0,0};' N- s: i6 E+ L" Q4 y {) C
double z1[3]={0,0,1};
6 t E* O5 P, v, l) A6 {8 { UF_OBJ_translucency_t cyt=0;
2 S- f: I1 U( U& `) Z4 rL10:! Z4 J- R1 Q% u$ u
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);7 @+ s- [2 b% i9 u8 F5 o' K
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L100 T7 i8 R n+ K3 I
if(response==UF_UI_CANCEL) return; //如果点取消就退出
' Z) z! \" d8 h% S; O6 M% S9 W
. B& F3 G- o* O7 S; D7 b' q7 d UF_DISP_set_highlight(object,0); //取消高亮显示
# u; D' k z2 _$ F tag_t csys_tag; , L, P: a. T% F0 A: s" m1 f
double min_corner [ 3 ] ; / {4 u4 k7 L3 E" Z9 D4 O
double directions [ 3 ] [ 3 ] ; $ G( F; r8 @& {' }
double distances [ 3 ] ;
7 D3 M" v4 j% e UF_CSYS_ask_wcs(&csys_tag);( S2 _7 _% u; S* z( w7 {: s1 l6 \! }
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
' P5 Z1 G, b2 {! L: U
+ n0 i$ c' x4 l2 _5 ]. c char mesg_x[256];
& s( H8 t9 r9 F) D. i# \" Z, E' K& u sprintf(mesg_x,"%f",distances[0]);, _! J6 M& _* E! P
2 O- `# T! ~/ ?9 V6 q
char mesg_y[256];
9 F8 X9 J# c/ X sprintf(mesg_y,"%f",distances[1]);4 Q% l% C5 X/ `$ W; O; I
8 A" |' x/ a( t
char mesg_z[256];
' {1 b# K, z+ C3 Z sprintf(mesg_z,"%f",distances[2]);
2 u9 I3 y6 {7 J6 M
' @! E j5 ^# O$ P& z- \; C char *edge[3] = {mesg_x,mesg_y,mesg_z};! V7 o. ~% S" Y/ q% Q5 t# f G) Y
tag_t blk_tag;) X/ D1 K3 ^$ p$ M m1 e
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);' ?5 v1 a* G: O. u4 Q3 r9 w
, @% }' S2 D. z& Q6 X- y
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
, q: k4 Z! p9 r" S) }; s# r UF_OBJ_set_translucency(blk_tag,100); //设置透明3 t7 \& p7 j; Y! r3 o" I& f8 x
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
' E& L4 R( a; X5 H6 J UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
$ S2 V' e, a* A) o6 i% e7 B
, G9 H# b/ J" d7 p" b/* uf_list_p_t ll;
. U' \# a0 T7 U" R( N" n2 A UF_MODL_create_list(&ll);! D) {; `8 w6 a: K" J
UF_MODL_ask_body_edges(blk_tag,&ll);% D- g( [& e' m% Z) N2 X2 v: B
int ww;
9 ?$ W4 o7 |! l# ~; x f UF_MODL_ask_list_count(ll,&ww);# v# W c) x' V" P+ k8 s
for (int i=0;i<ww;i++)2 O# z5 ?4 y7 p$ `
{7 J6 N9 O2 Y$ i; ]1 U* Z6 u
tag_t yy,curve1;
% p9 J# g+ Q/ t E# g; A& u UF_MODL_ask_list_item(ll,i,&yy);0 n! W9 ~+ V# U
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线. l: K" H2 M% ?
}*/
# R- [; Z- q5 K char box[256];
; J$ O( ^+ i8 U! v) B sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);0 _2 X* V3 w& |3 p/ p: o
uc1601(box,1);4 Y# p# K4 i" P/ E1 J
( `8 v( }/ m6 f. l7 S
goto L10; //透明之后继续回到选择的状态
% `8 q7 {7 h( f% Q. n- j X
! }; H& H! L) P) t ) b. B0 B( Y! M, m
( f( u: }1 i0 S$ Q
+ G6 T% P4 s0 B9 `! O9 v: @
, Y9 T: \$ ?" u) ^
UF_terminate();
N3 S* [3 A! J9 N9 c6 b return;
) \* I* H' I9 I6 V}
$ o* w# I1 E4 O6 H3 P: G, y1 w6 M; F5 _
$ A3 c i$ w. @4 F; ^# xextern int ufusr_ask_unload()
5 b3 z8 {$ ^' U N* {6 n r4 x4 K{1 o f" z ], m9 N
return UF_UNLOAD_IMMEDIATELY;
; t& A) r7 W4 Q* ^2 i2 u4 F}
7 l# m6 J0 |/ Z9 {8 ?0 j
0 j8 f7 V, Z7 \) Y/ i% z; f: k1 g |
-
-
评分
-
查看全部评分
|