|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
* Q y" E. x! M) j. t- N* q#include <stdio.h>: F; o4 |* m: B" ^& k: Y5 ^8 f; `& T
#include <stdlib.h>$ {' r& O' |. P. `! a9 ^' h
#include <uf.h>
4 w, ^: O( s( p- h m8 s#include <uf_attr.h>3 M% G" w- g) h$ C* t/ A
#include <uf_cfi.h>4 [, g( J1 G4 r1 k& p- \; ?( I5 U
#include <uf_curve.h> } ^1 u! F& a' x
#include <uf_ui.h>
8 {5 @8 V- Z- | f% Z- h#include <uf_modl.h>
; c' i- {2 \! N: ?#include <uf_disp.h>
* Z/ ~5 |1 K0 J2 u& M#include <uf_obj.h>* N6 A) l( o: a! K+ r i3 x( O4 ?
#include <uf_csys.h>
& x8 O3 a z. d: J, K3 l; s5 P; n3 s) U7 x. _5 g
) A) e; p! F5 c) W" T, Y8 h
/************* unload alloc mem *************************/
" g5 \* d# {! r/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
# F' p7 b" u% P8 J4 m6 K, Q t
/ @8 T! P0 i! Q$ O k# nstatic int init_proc(UF_UI_selection_p_t select,void* user_data)# T9 j/ f% Z% @3 W% E- u
{
: }3 E3 U; }; n/ l$ F5 ]5 a- v9 O int num_triples = 1; //只选择一种类型# q, X' V% u+ \4 j8 q% b1 U
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
0 Q2 d/ G7 n# a% p) |9 u if((UF_UI_set_sel_mask(select,
) T5 A9 s( v( p; I) ^ UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
, k: Q* x. y f" b- L- R num_triples, mask_triples)) == 0)# E% c4 F H1 f4 U; E5 C3 }0 G2 \, `3 E
{5 }+ W/ j2 l5 t! S& ^ b* y
return (UF_UI_SEL_SUCCESS);
' J& p4 U( z+ _4 g- X! d }4 K# w' K6 W( h" _: _% ] S% h
else- H9 Q$ J) Q' X6 B0 t3 m" R# {' B
{
8 Z$ n5 X1 h" r j return (UF_UI_SEL_FAILURE);
' B2 R) j8 Z3 V6 K6 c# A9 W* ]1 H }
2 r c% V7 S2 H. a: T5 E}
' C% S; m- a; g9 c1 ?+ h: ^
& ?8 j- ~5 t1 E
- G9 n- ^/ \% Rextern void ufusr( char *param, int *reTCod, int param_len ) ! x/ \& |2 U2 H3 R: m2 M; t: Y8 O5 l
{
: \2 ?) A# |- V* E2 S1 [ UF_initialize();9 T, a- v; R' z, k+ \
- `4 L# C5 j* r$ f . q" V- Y, x* H. Z/ `1 w
char cue[] = "简简单单:请选择单个体";
, k. W* B6 }, U char title[] = "简简单单:请选择单个体";
! a: ^% D, c0 H7 ?+ y$ e7 @5 |+ ^ int response=0;9 C+ R9 N& e- t6 x
tag_t object;
7 L+ k. f9 V/ A3 ^ int count=0; a- C3 Z" M$ e* V) a3 P
double cursor[3];- {( I+ T# }9 l9 K. {( f
tag_t view;7 l" ?( s" p4 Y+ Y- K
int i=0;3 T- z# W4 W; l( E, P' H
double pt[3]={0,0,0};3 e6 f/ e# Y2 ?6 y( h* l, O
double z1[3]={0,0,1};! ]2 o2 d4 i, F3 w+ X& _( u) e' I
UF_OBJ_translucency_t cyt=0;
& Y8 R/ U% E; B/ {( L, k4 E, DL10:
`5 h' B" L, e i- f, V! j/ i UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);
! E1 s, l% r( `3 {6 l if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
( _* {' s2 l# S/ a' E) V6 c if(response==UF_UI_CANCEL) return; //如果点取消就退出
- H' m0 h% U; F8 U. g1 o$ J9 ^2 c" G- l) z" u
UF_DISP_set_highlight(object,0); //取消高亮显示
6 z- ?1 K5 g# Z1 i8 a! l1 b$ K$ k tag_t csys_tag;
4 k2 G7 K3 h3 Y( S4 L$ J. A double min_corner [ 3 ] ; 9 W0 G3 O. J- x
double directions [ 3 ] [ 3 ] ; 4 D: {: m, ~8 v1 }' P) z0 e
double distances [ 3 ] ;- Q/ H* V4 J- f0 V$ O# s, l) }! s7 U E
UF_CSYS_ask_wcs(&csys_tag);
8 D* K2 ]- c! g6 L7 Q UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);1 o; g1 L% y! K5 L' @/ b( ]+ r+ E8 L
) B! _* W9 r4 M% E Q! D* a* @) p
char mesg_x[256];; S! f* b% G; Y* \
sprintf(mesg_x,"%f",distances[0]);
) a, s5 f9 P! x5 [3 x5 M) e) b H E5 r2 Q/ n6 s% F/ ~' q
char mesg_y[256];
/ x# X3 T+ b7 ^# _ sprintf(mesg_y,"%f",distances[1]);/ v; ` Q O% [. l) c
# ~& e0 u5 R) K$ E char mesg_z[256];- V# H2 u# I! J# `8 I$ v" {3 x( U
sprintf(mesg_z,"%f",distances[2]);
# G* Z* W& _) [7 l & q, G5 S# o7 m, ]+ P5 h+ R# F) r; X
char *edge[3] = {mesg_x,mesg_y,mesg_z};7 y) @2 }0 l0 Y# m2 i/ ?
tag_t blk_tag;
9 r8 W; e) y, I2 y) o# a; p UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);1 Y' E$ L% { ~1 t
" r8 ]4 o5 w9 n
UF_MODL_ask_feat_body(blk_tag,&blk_tag);7 r4 n* M2 V& O5 D0 N% O, h9 e
UF_OBJ_set_translucency(blk_tag,100); //设置透明
8 z- [+ S! f% r2 c1 w UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
5 E R+ h* F$ r! u9 ? UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型4 A6 {' p. L. I
7 ?: |$ u# s- O" [: f1 I/* uf_list_p_t ll;+ p0 ^2 _/ _3 x6 \' t1 z
UF_MODL_create_list(&ll);
( l8 _0 q- J# y3 Y2 h4 U; f4 | UF_MODL_ask_body_edges(blk_tag,&ll);1 B/ m7 c: ]4 T; ^
int ww;! c. @ c& y9 K% q/ a
UF_MODL_ask_list_count(ll,&ww);& s4 \( [8 O9 }
for (int i=0;i<ww;i++)
% ^' R/ p! `! T+ w) N" t {. e5 e& O- l. d) _5 r
tag_t yy,curve1;
% e4 Z4 t) |$ ^0 w UF_MODL_ask_list_item(ll,i,&yy);
; Y/ F D, B, N+ t UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
- Z" x+ [- e) G) [% S4 k }*/5 |7 ]; K/ T8 t( H/ K, {
char box[256];
$ |. N$ Q( U( r$ M! s1 I J sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);5 t0 z: V$ Z( k% [7 \) ` T% A- Q
uc1601(box,1);
& o, i$ B0 L3 O9 x! l1 J5 \
* {: w- N' u5 `$ y( y, G goto L10; //透明之后继续回到选择的状态; }% a, K4 ^# V; f2 i- ~9 y
0 h% @: a( H" }- e8 W9 y3 x5 [
; {: k& `# E& [5 {
/ ?0 U$ ~8 m: ^! H& Y ^
9 W4 t% y1 i% w, q. |* H/ Q2 l1 _ Z' a+ `, R( X2 w J
UF_terminate();
# K1 E8 N R0 \* Y return;
) N8 j9 l! r* A' Z: v5 h}' O* y0 y1 x; F; ~3 t
; F: u0 |$ ^* V
+ [4 b) J+ g; n, ~ |2 pextern int ufusr_ask_unload()
( H# k# s8 v0 h8 x' i- ]+ T$ C{
. m8 t* H I/ p5 N2 `- Z2 t return UF_UNLOAD_IMMEDIATELY;
# o- U2 n% {; ~% ^1 w" Y& ^}
6 x( j! ]5 G' w) @" ?# G9 C5 x9 n/ Z: \
|
-
-
评分
-
查看全部评分
|