|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
+ ?) Q5 P. o5 j9 S& `+ ]#include <stdio.h>% v% _9 e6 _5 @( V" x) j
#include <stdlib.h>
4 S+ ~7 |3 q1 P% g: @#include <uf.h> {0 W1 T x. e
#include <uf_attr.h>! n7 J' k9 b% r- g' y6 A! |* }
#include <uf_cfi.h>
# r8 P$ w4 }* s6 G+ d#include <uf_curve.h>- D( s x% o# H) f
#include <uf_ui.h>" y; s5 N l7 c+ m Z
#include <uf_modl.h>
( H5 j" v5 A. r1 ~1 z9 H5 C5 ]#include <uf_disp.h>
^- F. c4 @* A: i: z! r#include <uf_obj.h>
+ m1 G4 |6 R/ s' P) {! j# Z#include <uf_csys.h>% |- ?1 l% b& X1 K h! _3 I. `
7 s$ b2 J( ^% u
2 _4 k/ A) P! \5 e8 j' {2 ^/************* unload alloc mem *************************/9 w) [# F _9 ?: G. |
/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
4 h5 b! U' F& i k5 A$ O+ b' H, T8 b& m& S: Y
static int init_proc(UF_UI_selection_p_t select,void* user_data)
& J' s5 ]) @8 N6 ?( Y{
' G; V9 ~# K/ @7 q) a int num_triples = 1; //只选择一种类型
% _3 B2 q: C% @% O6 C- C$ Z7 V UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
, T, ?& B7 |; b if((UF_UI_set_sel_mask(select,
9 z6 ^9 M* L1 j/ A( V8 ] UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
1 k8 Y+ g3 J7 T4 F) V$ F0 N num_triples, mask_triples)) == 0). f' Q q4 D; U/ Z% b6 x( p
{
: ^4 n& \( Q0 G8 C5 R# p return (UF_UI_SEL_SUCCESS);% A. {3 N% | m" k1 Z! { e8 r
}
7 Y' m) o* A5 I0 b; |! [ else
. r/ F2 ]$ b9 ]9 a6 B: X: l2 y {
2 s7 [) G+ w8 W. \# N return (UF_UI_SEL_FAILURE);3 w7 e S3 ?$ u( d7 K
}, j7 \! t3 p4 w0 x0 L
}
8 K" O2 c0 S: {1 ?/ |+ _9 o7 A2 z7 I
2 S7 z; ^# z2 f3 C3 S. g J I
extern void ufusr( char *param, int *reTCod, int param_len )
# \/ J* L5 {) y4 h3 Z+ X{
& c' A% A5 S: ^ UF_initialize();& H8 T h7 q( _! S H
H2 Q" t0 Z+ ]' k
. G5 ~7 r- y" [- C
char cue[] = "简简单单:请选择单个体";
, Y5 l/ h- [1 j3 J+ W9 U char title[] = "简简单单:请选择单个体";
$ N$ j( K: b" p: A int response=0;
! m' Q& T& p* M tag_t object;
! T! p0 |% {0 G! V# K1 F0 P int count=0;. V/ U# G, R+ u! z& F3 T @3 N/ f
double cursor[3];
( i# Q. j( w4 ?6 I% x tag_t view;3 m1 G- l5 y# K$ p
int i=0;
" @, {: n" r; Y0 s double pt[3]={0,0,0};
( q! }5 O4 q2 O double z1[3]={0,0,1};
6 [' h' g+ t9 Y& n7 \ UF_OBJ_translucency_t cyt=0;7 B& n8 P- O* G* w6 k6 ]
L10:" V$ T* X7 d* |2 d
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);$ W [/ I+ f; l! q
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10% }4 e) t) u e3 }* t( h0 D
if(response==UF_UI_CANCEL) return; //如果点取消就退出
* l- d5 E; A# }. n7 l2 F7 |# V* D2 e$ E; A2 Y: n
UF_DISP_set_highlight(object,0); //取消高亮显示
, I: r& T6 _3 b! k6 |3 `+ Q0 o tag_t csys_tag;
# }( |9 m R9 o7 A6 F double min_corner [ 3 ] ;
/ u: S8 Q4 m- y, W double directions [ 3 ] [ 3 ] ; 7 @/ k- t9 T: n$ c- {
double distances [ 3 ] ;6 p- e/ E5 ]! A/ V6 @
UF_CSYS_ask_wcs(&csys_tag);
* e, ]4 r, |6 w( C( L% l2 Q% ~ UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
# C# H# q& E P G
D( P/ Y8 L- J+ a# J0 L. v char mesg_x[256];
, G/ x# ^8 B6 H# f9 ~( w8 [% s sprintf(mesg_x,"%f",distances[0]);1 W% `& N1 \, n6 a
! @7 R7 H4 {+ N% ]- i$ f
char mesg_y[256];2 q( o' l$ u/ H
sprintf(mesg_y,"%f",distances[1]);" l7 w: v4 P' p; V
+ C: V7 F+ t# K/ A8 Q3 |3 |2 ^
char mesg_z[256];
3 _2 ^/ t# R2 e6 h4 L0 j sprintf(mesg_z,"%f",distances[2]);
9 }. ~" n" E3 q % z4 ~8 a; Y" M) \' c
char *edge[3] = {mesg_x,mesg_y,mesg_z};
+ d9 s# [# e* t U tag_t blk_tag;
) @# R4 \/ V( R UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);! }9 ? h1 w1 J
2 p! e6 P. I e9 h: Z0 v7 r
UF_MODL_ask_feat_body(blk_tag,&blk_tag);0 }8 `. D+ ]6 {. }9 Z% B0 i2 j& q" m
UF_OBJ_set_translucency(blk_tag,100); //设置透明- ?( t3 Q/ H' y' \6 s* d
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽4 E* ^ U0 b8 a
UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
( b' \( q- v) Z& n: A1 V1 A9 A0 R( |( p9 \# C# d T3 t! g+ L
/* uf_list_p_t ll;; G! _" I# k1 I' W. G
UF_MODL_create_list(&ll);% _ H3 A+ F- @$ V- a5 R" F) n4 o
UF_MODL_ask_body_edges(blk_tag,&ll);" M4 _4 H) m8 P/ l1 c% I4 t2 L
int ww;+ S. I# J, N9 ~* Y0 g9 {
UF_MODL_ask_list_count(ll,&ww);
7 k' n. ~# d) a# U$ [ for (int i=0;i<ww;i++)8 O7 M+ d6 s& E
{
3 e# }0 a5 X8 s, O2 k1 \2 P tag_t yy,curve1;
# E! I6 c" ?6 t UF_MODL_ask_list_item(ll,i,&yy);+ m R0 Q8 v1 F C3 g0 ^5 A) @
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线: `6 D- \" x- z0 ]7 D" n
}*/
4 m" x- ~ s& D: q char box[256];, o# ~ l/ b1 B8 X& H1 \) T& O
sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);2 o) W7 H( D# z, _6 P/ n
uc1601(box,1);
$ }* X4 o) z) e8 }, O J; W5 C! t8 ~8 u0 K$ o
goto L10; //透明之后继续回到选择的状态* }# d4 H& V& [
3 O( [7 L& Q/ b$ M
7 ?3 g' w6 P) k! }1 F
, P- j. l9 ]( O- L# T6 o1 u5 p$ F- ]: |: A$ h. b: P5 g' @5 x
# P9 v5 r* O f5 ] UF_terminate();) F& U% R$ s' o0 x7 ?0 D
return;
; Y0 P! l3 n6 J/ `6 U9 a, ]}
; f& U9 g6 Z' q% G# C
3 j: b$ M4 L( Q1 e! q6 j% C7 R- o/ q3 l/ t
extern int ufusr_ask_unload()
+ a, C1 @7 o0 K( M" P4 L( m{* Z( @5 S5 x. j7 _; ?% F
return UF_UNLOAD_IMMEDIATELY;
' {* M, W. v! i2 Z/ Q! A}5 Q* y; D" u. j7 }0 V8 I2 n
3 E9 M: I9 ?2 X# v; O+ d1 _
|
-
-
评分
-
查看全部评分
|