|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
/*********************************************************/
$ j& U$ M3 x2 }9 p#include <stdio.h>
9 s% J% r H( ?& [, l9 I, G9 E#include <stdlib.h>
/ @! {5 P( M( X" i% M* q#include <uf.h>+ L( g% w% `% ^( a2 l
#include <uf_attr.h>$ A7 B3 w3 g5 V1 v
#include <uf_cfi.h>
b4 I u* ^. U% v, B8 y#include <uf_curve.h>3 w: ]; ]; O4 Q" m. C8 y4 T/ @
#include <uf_ui.h>
' ?( @% E+ t: C% ?$ q' M#include <uf_modl.h>6 e# c' i- z2 i6 Y) X
#include <uf_disp.h>
' S% a: S: t+ w' _9 G8 F" t p#include <uf_obj.h>
1 R3 ]! s" W) O, @/ y0 R) z( z#include <uf_csys.h>
3 s) o2 o" D3 L; n9 p6 m+ w$ d/ _% @
$ V7 h8 K: N' o2 i1 |; `
/************* unload alloc mem *************************/
' t- T7 k. Q$ S/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */% m( E2 R7 \8 w* u- L& w9 x
' ~: N+ E6 H# M7 rstatic int init_proc(UF_UI_selection_p_t select,void* user_data)* p) y1 F* _) B( y' V
{
/ x0 j/ N+ Q B" ?8 _& M4 d int num_triples = 1; //只选择一种类型
) F" V6 d* b; l9 G( R UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};; h& L0 _) j, H" H, I8 w% o
if((UF_UI_set_sel_mask(select,
3 \# Z' d' j) r' P# n% a1 u1 K# [ UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
5 F) d Q5 C( W/ _ num_triples, mask_triples)) == 0)
% u" m! i( G, y* F8 A% s {( _: V6 I. t; ]7 x0 P1 {; p
return (UF_UI_SEL_SUCCESS);
+ K* Y% D% D+ X/ f- a% B }
6 L3 _( [, {) v5 ^' N0 P! n7 o else( U) v q! C. w0 l, A9 Y
{/ E# v6 O% o1 N9 x
return (UF_UI_SEL_FAILURE);. \( m! G. |0 P7 r
}3 @/ Z1 ^& W4 X6 [8 |; i4 Y
}
- [5 k# m& C8 U- y( m' e { z% [
l: W" Z- b) X/ }* u: {6 }; O' U5 \* W" ~: P/ ~
extern void ufusr( char *param, int *reTCod, int param_len )
3 D6 T/ L* N2 h" Y1 V{6 I0 s9 S% E' ?
UF_initialize();: M3 K% ?# C: c9 g3 K* R4 B: g' D
4 c* E3 q' G; L% n. m
# H5 C }1 e: m* B; z0 w6 ~- s, k0 H
char cue[] = "简简单单:请选择单个体";
# w$ M( B4 Y* y4 u6 M/ K char title[] = "简简单单:请选择单个体";
) b- G9 n4 Q u& E. m int response=0;; P5 ~- M- n+ A! n, [; N e' h: `
tag_t object;' d" ^# V' ~+ U2 n; a: Q( C" T
int count=0;
* `4 s% Z- D4 P double cursor[3];
8 i0 a! `% J( K7 l tag_t view;- d7 z. F, |9 G9 S
int i=0;$ U/ I( T- F( h8 S1 p3 x# n2 J
double pt[3]={0,0,0};# M. C7 D0 D9 }6 S
double z1[3]={0,0,1};
( s" S, M: N# g$ W9 F UF_OBJ_translucency_t cyt=0;& @6 o- G) }* X) p
L10:
7 K8 z& ?8 T8 W+ Q' l% [ UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);
! t5 d( s+ q+ \" l3 o j' Q5 V if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
8 a: z4 V. Y; ]6 h6 L if(response==UF_UI_CANCEL) return; //如果点取消就退出
# W7 M. Y$ `5 }: C$ _# p% K3 @) U& V- U$ d- z; W
UF_DISP_set_highlight(object,0); //取消高亮显示0 W/ n- _% H- J6 N9 D
tag_t csys_tag;
/ d& R6 [3 o& {/ ]3 A& ~; M double min_corner [ 3 ] ;
+ H K* P, m! S/ B. L8 g& a; ^4 T: N# B double directions [ 3 ] [ 3 ] ;
1 l t0 c; T6 i. z4 W/ z/ G0 a+ E+ z double distances [ 3 ] ;
% W! U5 H/ X+ z6 x2 A5 H UF_CSYS_ask_wcs(&csys_tag);9 ^8 P! Z/ j/ Z% o e$ C0 l
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);, b6 `" g U7 U+ t3 [4 D
/ U& H+ D) T& Y. U# s
char mesg_x[256];; {* O1 T. _, h' ?) N
sprintf(mesg_x,"%f",distances[0]);+ l. |5 t, n* ~& [ w
% t+ X) v. P3 o2 a; e! [ char mesg_y[256];) x, Q* X2 F6 ^; B8 Y5 m
sprintf(mesg_y,"%f",distances[1]);' V% o& N. g1 G
5 W- w- N) B% I: o
char mesg_z[256];" G$ u7 g- O# c. w s0 J( a" @
sprintf(mesg_z,"%f",distances[2]);
# I9 v9 Z) b! X( }3 ^7 `
+ [2 R! C. Y h char *edge[3] = {mesg_x,mesg_y,mesg_z};
3 f& k" r0 M, f* f5 `* N tag_t blk_tag;
8 x" ]& |- V: d9 P: a' ~ UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);/ W2 ]2 i. H. J' c! u8 `7 c3 g
$ ]$ A0 C: z8 k4 y6 a* X UF_MODL_ask_feat_body(blk_tag,&blk_tag);" _* j( ? z" ~+ p9 c' x# s/ Q
UF_OBJ_set_translucency(blk_tag,100); //设置透明
* W6 A, }5 p' w% ? UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
3 y2 F3 E8 y2 F' v/ N UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型) r. U7 m0 P6 y" M H8 J' _
- [ |* f" `1 Q4 a/ |
/* uf_list_p_t ll;, i; o$ {/ g7 B. r0 Q) L6 [
UF_MODL_create_list(&ll);
* {0 s+ ~! O: r; _ UF_MODL_ask_body_edges(blk_tag,&ll);" Y: D/ L: {( n7 [4 v
int ww;; q( U0 U+ f6 [: B: R
UF_MODL_ask_list_count(ll,&ww);
! `* f& l! w$ I+ u& K) k for (int i=0;i<ww;i++)
5 Z8 L. J& l& q- d1 S. o# K: Y {# ]) |5 s( Y0 {. s5 u+ e! t! z
tag_t yy,curve1; 9 o9 C2 F& f2 A0 ?* J8 B& a
UF_MODL_ask_list_item(ll,i,&yy);8 d& c+ i4 r( K- I
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
( e$ _4 t# O6 q# e# _: Y" t }*/; v. I8 V/ ~: b+ r3 T( {9 d; y& z
char box[256];
; o+ t) ^% j2 M1 a sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);, m( ]) p% n8 K8 @- j4 P* Z: J
uc1601(box,1);. [5 `3 ^, K( b9 j
7 F# @) p0 P# t/ V
goto L10; //透明之后继续回到选择的状态
: @4 } K: B- Q. \6 d0 }% {8 [
% h: O, U* s- Z; n, D! A" D4 Y
3 G ^1 w7 A% ?# i& g$ Q8 p' R
$ P& k3 C8 }& |4 L
8 H% p5 k3 W2 S0 a' n UF_terminate();# o Q3 m( I; x9 e R
return;/ _9 k5 t( l; G( k1 f, ]! T" l
}! u3 n# @8 s- K, Z2 k
# q7 ]7 v" i W1 m3 ^ t/ c- ]
: J: B8 s. R- }5 Nextern int ufusr_ask_unload()4 O+ Z6 H# U9 W7 u1 q! u9 U
{5 w1 q! `; D# X
return UF_UNLOAD_IMMEDIATELY;
: k/ @1 h, I. j+ z2 B0 B}, F P% J$ y* y1 T! x
/ n8 Y) R- _9 ^# y( K, G |
-
-
评分
-
查看全部评分
|