|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/. f e* k( H1 S
#include <stdio.h>7 ]& H( Y: I2 I" m: h* q
#include <stdlib.h>
: t p5 d; y' l8 j! u0 |( L#include <uf.h>9 n0 J1 M+ a& V! w
#include <uf_attr.h>" ~' O0 ]$ Z3 \* u, K+ o
#include <uf_cfi.h>
# D" _& C9 `4 p; d; }#include <uf_curve.h>- z+ |# [/ s/ C0 J" R
#include <uf_ui.h>) m2 e6 V) u) h" W0 u0 C
#include <uf_modl.h>" F2 N7 ]' v% A" n, N; u# J7 o
#include <uf_disp.h>
" @$ E0 s2 Q4 \( S# \* |#include <uf_obj.h>+ g$ b# F1 r* F. z' ]9 S
#include <uf_csys.h>- \4 k" J/ R- J4 [& F8 P" i
& J0 s" G, ?1 v+ R( Q4 |+ B* o# u7 m) o
/************* unload alloc mem *************************/
* [9 k0 W4 n7 \4 ]/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
% u9 p# w" X- G/ z# S& k2 E _$ N8 T; t! x$ s$ o M
static int init_proc(UF_UI_selection_p_t select,void* user_data)
8 I2 S8 Z+ z# m4 c{' R: X6 c1 V8 J! T+ ~
int num_triples = 1; //只选择一种类型* m6 ?0 c, ^2 }* E
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
* X* i8 L- B5 ]. a2 X if((UF_UI_set_sel_mask(select,$ Z: ~# {! n3 m) n! v
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,9 q6 a0 z5 Z- i
num_triples, mask_triples)) == 0)
2 i# e& E" Q, D: t1 U5 O {) \* ?& N9 W. H( N4 ]6 {
return (UF_UI_SEL_SUCCESS);7 L/ ]7 l* J4 H) [$ ~& T4 z
}
& c d5 s# v& m+ A; T else" U" V( P# c- W* r* o+ @) P
{
3 }+ ?% E7 l- A3 D7 b return (UF_UI_SEL_FAILURE);; h8 O) x& ?1 Q3 Q
}
4 u% P5 m! o: i: k- `" ~5 a}' U! L2 i& u. r4 ]# E: z
7 J9 [4 d% v: y& U; A4 P, l2 E/ w) \
1 `$ f& y& |2 [( ]' sextern void ufusr( char *param, int *reTCod, int param_len )
: m6 O2 f# k. _, h8 p{% b7 `( F+ a- } c1 Y8 U
UF_initialize();
( u0 U. k/ n, Y% H' H7 q* ]3 f: y$ \6 B& Y
w, K' J9 i3 P! Y* J
char cue[] = "简简单单:请选择单个体";
$ ^, O2 V3 c" i4 N: a3 C! | char title[] = "简简单单:请选择单个体";
& V5 L9 u6 N' Q( }7 N- V' ] int response=0;
6 C7 \7 s+ D: T1 F tag_t object;" ^0 x( G) l2 X# z
int count=0;
5 n( g% j4 `" e m+ e double cursor[3];
7 ?- A& M: c% V3 H C% ~ tag_t view;
4 s) w4 a! g' U/ o0 c" x5 [3 y5 v int i=0;
! E/ w% c/ Y2 z( O. u$ u; ] double pt[3]={0,0,0};
+ ^ Q' @4 o! F5 p' j" |9 u% F double z1[3]={0,0,1};
" }" h1 @/ q+ ]5 I( c UF_OBJ_translucency_t cyt=0; F# n/ V( i" u8 a; d
L10:! W9 y' |( J6 K3 W
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);. M$ a: u0 b1 R" Y
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
8 L) V3 q9 G/ t( O5 I7 \) L if(response==UF_UI_CANCEL) return; //如果点取消就退出8 E/ I6 u+ p4 o9 ]- |4 J; `% z
6 ]( |- g0 ~! v% d
UF_DISP_set_highlight(object,0); //取消高亮显示
6 k1 I2 Z3 T( \; ~$ _ | tag_t csys_tag; ; u0 A3 O- |& A% d7 }$ r' q3 v
double min_corner [ 3 ] ; 0 l5 E# A4 d) ]
double directions [ 3 ] [ 3 ] ; ! T q- M; ^8 r1 c$ n0 t
double distances [ 3 ] ;" t9 C. @9 ]+ _( d
UF_CSYS_ask_wcs(&csys_tag);4 g* \- D4 S0 N; ^5 _ |# I" W
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);4 D% N1 I4 s( _$ y7 K* V
6 \; g8 ~. o! a7 F) u char mesg_x[256];
# ], A/ A$ F3 F$ q, X0 y2 x sprintf(mesg_x,"%f",distances[0]);2 Q/ X- @7 _* d6 P n$ Z; N
9 ~ c2 l7 Z$ K0 L5 E% K- _1 |6 B9 ?
char mesg_y[256];
. \/ G. Q* }! j6 U) ~ sprintf(mesg_y,"%f",distances[1]);& q8 z4 P4 t, s0 Y8 e
* t; B! Y' H* }5 ~, g0 g
char mesg_z[256];2 V, E- ~9 X, F. Y0 P/ ~3 e
sprintf(mesg_z,"%f",distances[2]);
5 L& |0 |& R$ D% |# [) h, |% o7 ]* Y 3 r# {5 Z7 b: w8 x' h5 c+ r
char *edge[3] = {mesg_x,mesg_y,mesg_z};9 Z8 ^/ h. Z/ N+ j8 d
tag_t blk_tag;4 _: n+ |0 n- e$ ?7 a
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);
, g: c. V k0 F. r) c& F0 w0 { H5 h& Y: L! G& o' {
UF_MODL_ask_feat_body(blk_tag,&blk_tag);6 R. o, ^6 B) X: d6 R6 X
UF_OBJ_set_translucency(blk_tag,100); //设置透明
' G1 H) E1 o. d* _- ] UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽" N1 M5 j/ @; ?0 A) R
UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型( Y% h9 u3 ?/ m! _# o; a
" E0 T" E4 A1 v" R u5 r/* uf_list_p_t ll;
9 o9 P/ {; p3 a8 O( V" e UF_MODL_create_list(&ll);
3 G( P0 k' p. u9 O3 A% J# c% w UF_MODL_ask_body_edges(blk_tag,&ll);
( ?! X2 a+ S) V5 y int ww;
3 B/ D$ V& R& A8 F \& _' U- c UF_MODL_ask_list_count(ll,&ww);
, S. U+ h9 B5 d, _+ C% P# T* e for (int i=0;i<ww;i++)
! R( Q6 g4 N& C/ m4 o {
/ e0 Q5 t. C7 i/ u tag_t yy,curve1; * P8 a7 J1 h8 K* b
UF_MODL_ask_list_item(ll,i,&yy);
8 W8 ]* N* M- i& p$ t9 k UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线$ X" L1 c W! F/ D& }6 ~
}*/# ?2 A& A- [# z0 R" h
char box[256];
2 a A! j/ }$ R sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);7 }7 Y/ Q1 W9 x2 u: w1 s9 v- J
uc1601(box,1);+ h+ u5 R$ q/ ?1 v
" O2 D C" z1 u A goto L10; //透明之后继续回到选择的状态+ C) a* _5 g4 F9 |6 T) z
* E& Z. P# N7 o; I
' Z$ U! z6 ^1 B7 j; {0 Z
& Q% p# e8 S) s" G' T* p/ E/ z* c& y0 E7 `
8 u. U; U# M" x T$ U0 g
UF_terminate();
7 i, S2 x7 g5 }5 c return;8 _2 v( h$ ?. Y l2 a
}( I c4 H. b7 y
/ P8 w7 h$ S4 f e6 p' A; k1 G5 \% H6 k$ z, u* Q2 G
extern int ufusr_ask_unload()
; {+ t/ M0 D- L" q( n2 s" g{8 p+ k- p3 e" g7 K
return UF_UNLOAD_IMMEDIATELY;
) S. v0 ? T1 w+ D/ ^4 k- s}
" i2 s0 x( W8 B8 c
# t5 J% t8 h: Z' U |
-
-
评分
-
查看全部评分
|