|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
4 D6 m4 L# L9 o7 w. R' V' m3 Y#include <stdio.h>% P) z5 I7 ] c$ O0 S( Y7 u8 ~2 D
#include <stdlib.h>
$ c( ^1 u# y, x4 N: {1 N#include <uf.h>: j- ?, b! q! Y4 V. r
#include <uf_attr.h>
9 h# E, G0 y8 }& \ r6 e#include <uf_cfi.h>
6 ]2 V& e; n9 L! Q/ c; V: H1 U#include <uf_curve.h>, H; B/ ~ y3 m) }. X0 C
#include <uf_ui.h>+ X+ I1 y Z* W; U
#include <uf_modl.h>( K2 x6 |. d) d: Q; P5 P; Q' B' [" o
#include <uf_disp.h>
' i1 }: U; Q. [/ W) x' ?#include <uf_obj.h>
( E4 W5 e$ g+ P; ^$ B#include <uf_csys.h>
) N6 z7 Q0 u* ]$ s; w8 N
( p9 }5 h0 P) r- Q5 I' c& Y& a4 g8 L% K+ ~
/************* unload alloc mem *************************/4 c: r* ~: H, d( ?0 U# T
/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
, N$ p* I6 L8 Y# Y3 ?3 W6 z3 X* a8 N! d+ G2 W1 a$ q8 R
static int init_proc(UF_UI_selection_p_t select,void* user_data)/ {! c4 j: U% y2 {1 O
{* \. z' N9 o# x% K3 W8 U
int num_triples = 1; //只选择一种类型
" Y1 ^" e. b; n; p UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
4 Q9 j7 ~6 |/ I if((UF_UI_set_sel_mask(select," Z$ S1 P" D. x, f& G' V
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,' p D9 C/ h! ^9 ^. G$ _ M
num_triples, mask_triples)) == 0)
8 L! x3 Z, |2 x. z) n; E {9 T# F1 ~, w# d4 H3 k2 m* y$ p
return (UF_UI_SEL_SUCCESS);
" k- i& c9 _( G& I: K. M }
1 r9 A+ u. X0 K5 l& K' D% c else
, y! T; [; K6 K. O) J {
# Y) E. Q, r1 Q0 q j A0 B- v return (UF_UI_SEL_FAILURE);
! `2 Q$ B9 s; B- s0 q4 }1 X1 f }( y8 `, e. J, |; f- x& x
}7 K0 I" A4 ^8 j
2 q9 q# \7 ^' ]' e9 g# |. n
$ b; q I/ @1 b* W+ Jextern void ufusr( char *param, int *reTCod, int param_len )
+ ?. N7 s- X5 }3 i4 @& @7 t& s{
7 o {9 ?1 t% Y) F UF_initialize();
/ c/ o6 z. @: ]7 c0 m
! Q- N/ h! s% a" t7 @/ U : }" \! f1 E' f
char cue[] = "简简单单:请选择单个体";3 S' g& v: O, o6 w, C* f
char title[] = "简简单单:请选择单个体";
; z" K& `, F+ [, S, T N int response=0;
6 h: C: n- j/ w A% H0 o/ T tag_t object;2 T) ~8 ?2 p3 W; j
int count=0;
3 B# T6 K. ~2 w0 e! p4 H double cursor[3];
# g* z8 L0 h) N S tag_t view;
" ^$ u4 J8 A- a int i=0;$ ~4 U' w) @& Y2 l( m% v
double pt[3]={0,0,0};
0 i* G# w* d" T& u! j5 n double z1[3]={0,0,1};/ Y# y, E `# t; |# t. ^
UF_OBJ_translucency_t cyt=0;- i- n; E- v3 s3 X
L10:
7 d& B% a* f5 q/ p# w6 _, ]: ] UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);6 \) Y4 {/ H' H$ J4 u
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10! ]4 ^! S8 ~. e$ _9 r1 c
if(response==UF_UI_CANCEL) return; //如果点取消就退出
9 C; {: {3 z7 M! x9 Q! T# Y* W$ X0 o8 X' Y Z
UF_DISP_set_highlight(object,0); //取消高亮显示0 q- q( O! B( B; k+ @% l% L8 k
tag_t csys_tag; % x; [6 i; b6 B5 V4 {
double min_corner [ 3 ] ; : @8 S: }- j/ l/ u ?5 O. F
double directions [ 3 ] [ 3 ] ; ( S" ]% \! R* j$ T' G& i# L+ V0 Y
double distances [ 3 ] ; `; Z8 `$ l: I8 a- y4 P: d
UF_CSYS_ask_wcs(&csys_tag);- b) |2 @; j; f6 q) t
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
$ J' n9 @2 A2 d5 @8 X# o- U7 A! O! o9 z
char mesg_x[256];6 r0 ^) C, _9 Z! \6 D3 p
sprintf(mesg_x,"%f",distances[0]);. ^/ ]: F) c4 v) |
3 |5 P9 L1 w( }! h3 f$ ]9 z8 f0 r
char mesg_y[256];
% g* d. R# e+ i3 z( h sprintf(mesg_y,"%f",distances[1]);
+ b7 V% ^- F7 \( }7 f6 _" Y
g* D; E2 W4 }% Z6 }6 q char mesg_z[256];
7 N. z. J- a- C# B7 L sprintf(mesg_z,"%f",distances[2]);
5 Z s8 g2 _3 I! \( L 8 p' q+ \* A @) O4 j
char *edge[3] = {mesg_x,mesg_y,mesg_z};
: _ K- k/ y' t$ B$ }& ~: ~ tag_t blk_tag;
5 x/ N# R% t/ o' w UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);( L3 j- P* A' ~
: N, p& W" {8 z' [2 ?3 W
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
7 a, p* M8 o2 g/ K, s3 o; I UF_OBJ_set_translucency(blk_tag,100); //设置透明
" Z; {: ] x) P* a2 s* t) ` UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
+ [' i; N$ o# l j UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
6 g0 ]- b5 z g/ p6 g; h5 g; @1 @ [. Z, i K3 F
/* uf_list_p_t ll;# J a. s: w4 A8 _" p
UF_MODL_create_list(&ll);
4 @8 _& x O" U& V UF_MODL_ask_body_edges(blk_tag,&ll);) G$ |1 ?# t ^6 W$ J
int ww;
( _3 Z, ~! X+ m& d# b2 C* V" T UF_MODL_ask_list_count(ll,&ww);4 d$ L% a7 ~( I# k1 d7 n q; P
for (int i=0;i<ww;i++)6 ~, z; d. z& m/ R8 a6 U( W9 `
{
" h; h( l+ e; s$ @0 G/ |7 Z tag_t yy,curve1; & o4 p: T' d/ |
UF_MODL_ask_list_item(ll,i,&yy);
, R' f+ b( x. b3 H+ w2 d |; `* L I UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线8 r$ s% e1 W4 F* E8 g+ b
}*/9 F1 ?7 l6 }/ @. w; |
char box[256];
5 K! f* M/ G* f: }1 P sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
, o1 J) A* {( s$ u uc1601(box,1);: Y2 v- n- z4 C( s/ ^& i
/ @8 n1 V0 P5 g- G6 S: z# d goto L10; //透明之后继续回到选择的状态
5 y( W# P6 U) {3 `" A5 z; k: l
5 k. ~# h, U1 O! q 4 J2 a+ K; a6 {8 j* Z" P, f+ s1 s
: q5 R2 n# ^, r" I5 z- F) y' }: ^3 P E0 t, b# L6 ]
6 H$ g$ X! L3 E0 Y
UF_terminate();2 U6 K O3 ~& a8 r% u5 P' N8 \
return;. t @6 a5 C/ G5 \, ~; H
}( M* Q4 ~5 |4 }1 K) ^! F" [
- G; O5 Z% W: O( Y$ U
2 }- t4 |' O- a' {extern int ufusr_ask_unload(): t+ n3 V6 I& l" a6 w" }; p' D
{
) [/ T9 Y: M* a! t% A a return UF_UNLOAD_IMMEDIATELY;
! q# S$ |9 [/ C}' B: X9 Z: c7 }1 C
/ s/ O* e2 x# g# U9 {- V2 q3 y
|
-
-
评分
-
查看全部评分
|