|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() 7 L) y9 w. z3 I' l( S
- {6 W1 G+ g' Z( t, N7 J& R; ~$ `$ z5 C6 j
- // TODO: Add your control notification handler code here
( z/ f6 `2 Z. s9 N, @: Q; w - char cue[] = "please select a face of body";, m7 q8 R0 o) p7 b
- char title[] = "select face";
\5 X& P5 g9 n% J2 b- C - int response1;
o$ W" V# F8 j# X2 e' X - tag_t view,temp,temp1,point;& Q- P: Y$ F% k, Y
- double cursor[3],matrix[9];; n' J& K' U3 x1 o
- int ret=0;, A$ ?$ s; c( N; N* m
+ u: [$ a' G% i- //UF_UI_specify_screen_position()函数的初始化参数3 F; V n% a! J
- char message[] ="please specify a position";
9 {4 a! k7 I1 D0 ^' d) f - int response2;! U$ B. y) `/ c1 C% I5 }
- ' r$ e' t! W; v U
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;; Y* R3 c, K' F+ p- p+ B0 S
- int num_geoms;//几何体数量
& G6 l: {% T, v1 f% K5 p - tag_t geoms_p;//几何体 v9 W+ F9 P C; d
- tag_t mesh_tag=NULL_TAG;+ {2 r5 y7 P! ? f. g
- tag_t scenario=NULL_TAG;
5 N+ A# t' k8 u. j7 [4 z - tag_t display_part_tag;
8 l: }5 g3 c) z3 [& _: R& g - tag_t proto;
+ t( B' n S5 E! i7 J - //最小化当前对话框
/ t, B3 p) a- v$ O" T - ShowWindow(SW_HIDE);& q A$ j4 \) Y e$ N
- int num_bodys=1;
8 i! I' [: X4 m# P6 u g3 J$ g1 w$ ` - tag_t body_tags=NULL_TAG;
! B$ N D W( i8 V |# } - int num_desc_lines=1;% l2 O! k$ f! @# Y
- const char *description="";
' w' e/ q0 P$ ?( X$ f% E - tag_t new_fem_tag;
% ~2 `% |0 Z# E' w - display_part_tag=UF_PART_ask_display_part();' {* }+ r: \2 {, A& P+ t+ H- \+ |; P
- tag_t work_tag=UF_ASSEM_ask_work_part();8 N; e; a( Q+ o4 n/ _
- 8 C+ e2 W5 ` @
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
' ^7 F5 M, v) M% b - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
. t) B4 U% U& C# D5 l - mesh_parms.element_size=1.0;: s# H5 d8 j' o
- /* mesh_parms.element_size=dDefaultElementSize; */ 1 B* g% v- n, g. b% a
- mesh_parms.edge_maTCh_tolerance=0.508;
. }( E/ V: y# |# N# ^" L) C - mesh_parms.format_mesh=true;
p! {1 n8 {1 H; O - mesh_parms.attempt_quad_mapping=true;( c9 K% @/ E) _/ I% \7 k( M
- mesh_parms.split_poor_quads=true;4 w& Q D+ w3 t! d
- mesh_parms.maximum_quad_warp=5;% P1 ~* z/ ]( a: E
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
+ F! C- j) l4 S% l! } - mesh_parms.maximum_midnode_jacobian=5;
) _+ }+ r1 n( D( G! p& f6 K9 { - mesh_parms.minimum_face_angle=20;
" h" G$ b1 Z" F) E) x* Q- k1 r( D) ]8 K - mesh_parms.surf_mesh_size_variation=50;% d; q) g4 y/ a
- num_geoms=1;4 _9 X4 ^9 j( X- P& [8 ^' k% G
- geoms_p=NULL_TAG;
( o7 A# _+ Q' h; A0 f( s0 D4 Q: [ - ; @* P, t( v9 c; u$ S
4 h5 I" m( W _+ x% {: m
/ H+ x9 R% l) b5 J- & B- `8 S* y- n7 C
- //把控制权交给UG
% L7 _) X, q/ d1 _1 j: } - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
! x$ B e( B! a. F - if (ret != UF_UI_LOCK_SET)# |9 G4 c- w6 j
- {
; w/ Q+ p6 S% w! l5 \- f( r% F - UF_UI_set_status("Could not lock Unigraphics");
" `3 e; E4 l# T" j0 @' Z) q7 h - return;
}1 e; |$ U9 o, n8 q - }
# c5 \, W& Z0 A2 V0 X - ret = UF_UI_select_with_single_dialog(cue,title,
5 ~9 S3 t4 S* g. L# b6 ~! k - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
% V: B V- s- J0 B& o - &response1, &surf, cursor, &view);//调用面选择对话框
! G8 v! r% F; x9 ^ - ! j d# f/ U( v& f9 U# j
- 4 e$ d( i4 ]; h1 E
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);' `6 @* M1 V# q" q4 ?9 X
- 2 w0 W+ G* i+ h
- int count=0;
8 z2 Y& V% `+ f3 D -
" G3 G, B* M/ Q! k: Q - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); 2 g6 U1 _ J, A' M/ G7 D
- if(!ret)
* R8 R6 V3 T# v3 e$ W% m - {
( }% m; M" [8 p3 r - if (response1 == UF_UI_OBJECT_SELECTED ||
# ^+ M2 M! L" N9 b* E9 r: D" M - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)6 q0 ?5 m* T+ Y$ A5 @1 p$ U
- {- k* H p9 j1 n8 g1 @/ R; S9 ~; I9 H( T
- num_geoms=1;
, L; u# ?4 b" _: C2 z - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);- u# U0 D3 `' \, B. P
- if(error!=0)
$ A! G) n" S& [4 A - AfxMessageBox("划分网格不成功");
/ A! i. o9 l' s+ T - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
8 u2 q; C# B( A/ x3 z# U% V9 w - }$ o1 o+ N# N+ ~1 A, x" D
-
6 z: S1 A: @2 t8 ~2 ^) G! I -
d0 @5 J. j9 b8 g q -
& R; _5 Y4 f% W! Y4 J R - }
' l [8 w8 x1 R0 ? - //UF_free(geoms_p);/ A6 v, H+ f; B/ f1 m1 S- K: G7 J
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);$ p7 C; u0 q' v! u" n
- ShowWindow(SW_NORMAL);
8 A7 q) C+ h& @5 } - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
9 n O% a) q' W i4 o5 ^特此前来求教错在哪里了& q1 i7 W3 E5 ~! W7 a; [
|
|