|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
$ f% Z/ i# a b" \5 h - {' a' c+ h! n% O( ~2 t
- // TODO: Add your control notification handler code here# j8 V7 l9 c5 t3 T
- char cue[] = "please select a face of body";
8 D# W4 l6 k& C Z1 Q; @8 P - char title[] = "select face";
% j8 ~# U+ b [6 r. B- F4 Y2 b6 m - int response1;5 ]3 `* d2 Q. n$ L1 n, T0 t8 [
- tag_t view,temp,temp1,point;8 V! C& i: O6 W9 W
- double cursor[3],matrix[9];& A$ {7 s# n4 }% L+ b8 ?2 B
- int ret=0;, I" {1 J- g$ l( Q
) M$ E4 x$ T6 g0 a9 i6 H8 K$ j- //UF_UI_specify_screen_position()函数的初始化参数
) ^, a. h( n6 V. z5 A2 e5 T - char message[] ="please specify a position"; 4 c* g; l1 g% e& O% N5 a
- int response2;
& O& \ w4 U; P. Z( {* b - 1 j+ e# L! |3 I/ K- g9 @
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;
7 R$ C. Q u/ S5 I - int num_geoms;//几何体数量$ I9 b1 W2 x2 B4 ^8 D8 b
- tag_t geoms_p;//几何体* L4 J. ?) i4 C m
- tag_t mesh_tag=NULL_TAG;
* c6 M: }& S/ i$ q" c4 R N - tag_t scenario=NULL_TAG;5 j c0 r$ t7 w& o2 ?+ i8 v
- tag_t display_part_tag;
# w+ U) `% `3 k3 c1 e - tag_t proto;. T' G/ |* ]3 M: R2 v
- //最小化当前对话框
d2 A, n; G7 j' r - ShowWindow(SW_HIDE);+ q* c: u3 ~" u/ B& |. n, X$ x
- int num_bodys=1;: D: F- Q5 _# h& V* I) D: Z0 m8 C
- tag_t body_tags=NULL_TAG;
: t$ |/ k! n ]0 R3 ]. u* ]' h - int num_desc_lines=1;" Q$ l: p, b6 u3 Q3 a
- const char *description="";
0 n3 V1 R# s2 g - tag_t new_fem_tag;
" [: [& V" k" @& q1 R \8 m& {* d. b - display_part_tag=UF_PART_ask_display_part();& _! H5 @1 R' z: f9 n
- tag_t work_tag=UF_ASSEM_ask_work_part();
7 G. D% L+ u4 ? S - . {& [( Q8 u6 `% q3 C
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;" z1 ~+ g/ P- `( Q! w" E8 Z, T
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;5 c$ b, y g7 i* r4 x
- mesh_parms.element_size=1.0;
/ `% M* y# K: ] - /* mesh_parms.element_size=dDefaultElementSize; */
]1 k5 O2 P+ J1 s% F - mesh_parms.edge_maTCh_tolerance=0.508;' s- }% ~9 N* E2 b
- mesh_parms.format_mesh=true;3 I9 `. Z3 K" b& _
- mesh_parms.attempt_quad_mapping=true;- ]5 `4 T# t5 Y G
- mesh_parms.split_poor_quads=true;
4 T0 w* ?8 D5 a, g7 g d9 O - mesh_parms.maximum_quad_warp=5;* ]4 D s" u" ^9 F3 ?
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;/// }. P; B7 O" j+ A
- mesh_parms.maximum_midnode_jacobian=5;2 g. K) @% a# S4 t) m
- mesh_parms.minimum_face_angle=20;& X- ?7 o4 J2 L7 E! G* ?. w
- mesh_parms.surf_mesh_size_variation=50;
+ u* j/ u; w0 C8 O% P - num_geoms=1;
* X2 p! l b; K) v - geoms_p=NULL_TAG;0 I) R; O) L! R( M; K' g
- % P6 `/ h1 ]2 z2 d- r B
- * ?: N. f4 `$ i/ `/ a5 D: A7 D+ e
$ O% N9 I6 z0 n8 y/ u- ' ~+ v6 |1 {* r5 M% A- f
- //把控制权交给UG8 S. X Q0 x# X4 \, B
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);: Z) y+ P4 r b/ D9 l
- if (ret != UF_UI_LOCK_SET)+ J5 Z' e; L+ g# ~4 L c, M
- {
5 |; p; V: U4 f - UF_UI_set_status("Could not lock Unigraphics");0 M' X0 C/ U3 P2 Z; y, \1 V3 R
- return;" l ]% K) E% S1 L
- }: u7 `/ L# n; ]$ V
- ret = UF_UI_select_with_single_dialog(cue,title,1 g( b, c7 v" t& \0 I3 L; ^3 I
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
: ?" A) i+ _' V0 W* q% i w - &response1, &surf, cursor, &view);//调用面选择对话框( F# k3 B" T Z! _6 H$ B
-
$ |) h$ X5 G3 T" z- c4 I% } - & Q- y% [/ u' o4 c* o ?
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
' x# ^7 Y2 _$ i! \! n; O
6 ?+ H+ i3 L; Q) f" v2 i+ e X- int count=0;( q- a4 Y; N. ?2 P% ^! ~ k
-
9 N5 r9 \1 R2 t! P, L. p - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); x" i, a! m0 |$ [6 H
- if(!ret)6 o, f/ p) H* K' H+ V+ q$ d
- {
. }! \" P B1 h. J% V+ a+ x2 ~ - if (response1 == UF_UI_OBJECT_SELECTED ||
2 |; k/ |- T* z8 t2 @# L1 S - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)0 h' z; w3 s9 f. a1 X6 p
- {. f: U8 z: a# `! V8 @
- num_geoms=1;# g+ N S" m6 Y/ ]" u1 ]
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
1 @8 ^' a$ d+ N) q - if(error!=0)
" B5 b# a8 v7 U - AfxMessageBox("划分网格不成功");
2 o$ r/ _2 g6 u' ^+ I/ B - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");; w5 T& z- A. b. M# g4 N
- }, G- P: }! F( R7 m
- 8 h& u- }% W7 R! b
- 1 d8 h. `7 p8 K7 z3 K: `
-
' |/ F# p+ L& w3 G" T; V - } + N0 f7 o" _3 p- y, @
- //UF_free(geoms_p);
4 T) X. V' u& Z$ R/ q - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);# P" Z) B/ B9 I: ~+ T4 @6 O
- ShowWindow(SW_NORMAL);
$ D4 I( G, Y: s0 Q - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
# h. }* T+ i. M4 Z+ B& d) v# |' C特此前来求教错在哪里了$ d- g& S0 u* |8 ~* i
|
|