|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() * X- W$ z% l7 [! C& P1 ]: j6 z
- {% y0 }. C! \( w, n- |
- // TODO: Add your control notification handler code here
' I5 L$ V3 @0 R% n1 }+ D - char cue[] = "please select a face of body";
, [ C& u" g8 A+ q* f - char title[] = "select face";
1 _$ l2 H; x% @) l! N+ c - int response1;- c& y$ n: ?1 \2 t
- tag_t view,temp,temp1,point;# j! `1 A3 H" e! k F7 j
- double cursor[3],matrix[9];: k7 C. e+ X# X# i/ P
- int ret=0;
2 i: h1 [# g+ o. n - 3 o/ ^& O+ K h4 w
- //UF_UI_specify_screen_position()函数的初始化参数
8 r, H; h2 s& ]% k- i - char message[] ="please specify a position"; & A* L" m7 s) T- H$ V
- int response2;
: L! s7 t9 j! d: ?# E - " r0 \& |* X; Z4 n3 x$ Q
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;3 Q n ]% \4 q! A
- int num_geoms;//几何体数量
l6 z& x4 s# t; i& B% @ - tag_t geoms_p;//几何体6 P5 |# x. v' v# S+ r
- tag_t mesh_tag=NULL_TAG;
: R" A0 W4 V4 I! ]8 t& g M# n6 N2 R - tag_t scenario=NULL_TAG;4 N) O6 M4 N/ D4 o
- tag_t display_part_tag;
8 x% G7 j& d# ^: ^" ^5 R* G! w) v - tag_t proto;" j+ j! R. n: g# k& I7 e
- //最小化当前对话框) T. y4 J/ l0 c9 K
- ShowWindow(SW_HIDE);7 p5 ?2 V) A8 P$ a$ A6 o6 t% j G! N
- int num_bodys=1;
; I1 p+ w, B0 n! y' `* B+ w2 {2 } - tag_t body_tags=NULL_TAG;
, h' @4 C( |. a: _ - int num_desc_lines=1;: b2 T5 p) @4 j5 b, P7 ^+ h
- const char *description="";% R; H' @; ~: W3 p3 A3 a/ _4 d
- tag_t new_fem_tag;
6 b2 [" y& Q- D8 T) {& S4 { - display_part_tag=UF_PART_ask_display_part();8 m/ r7 j9 ]9 W9 v2 Y, P. x
- tag_t work_tag=UF_ASSEM_ask_work_part();) F4 D3 X7 x+ Q8 p9 k
0 c; N! Z) n4 m- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;! W( k; R B* N$ y" d9 f0 u
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4; ]% w p% ~, y M9 ?4 [1 [3 ^" k
- mesh_parms.element_size=1.0;
3 h& O+ |( D; M" t. b! r - /* mesh_parms.element_size=dDefaultElementSize; */
2 E1 J/ ^& D. J* y% ]( n" C2 l8 v - mesh_parms.edge_maTCh_tolerance=0.508;/ C2 Y: G+ s. N( {$ u# j+ f- a
- mesh_parms.format_mesh=true;+ M! d$ W) f& [" ~& m! S, T
- mesh_parms.attempt_quad_mapping=true;
1 |4 O3 v' e6 ^7 Q |0 ^1 } - mesh_parms.split_poor_quads=true;
! c( j k( \: I3 F& ]6 T - mesh_parms.maximum_quad_warp=5;
8 s7 W/ p" y* b4 t! v/ e - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//4 s) M4 ^- |& a, T$ z; L
- mesh_parms.maximum_midnode_jacobian=5;
8 e3 m: O' P. ~# y - mesh_parms.minimum_face_angle=20;6 P; D/ H8 x$ K# l8 |
- mesh_parms.surf_mesh_size_variation=50;
* @/ I. n4 ?/ Z0 }4 t5 S - num_geoms=1;9 m1 p. n# H4 } Q1 N
- geoms_p=NULL_TAG;# K4 T+ B( Z2 O& H# ]
- * H: \! r2 l3 `1 a; U
$ c5 ^, R B9 c. V$ A' w. _
. `* @9 i+ D: S! _8 a
, P+ Y1 U) D; Q5 l* G- //把控制权交给UG8 t5 }+ T) ^5 G* v
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);) F$ I) j" M1 f( X% P: {& Y' y, S
- if (ret != UF_UI_LOCK_SET)
, b, q5 ]4 y# X9 z - {
3 H) C7 L% Q9 G - UF_UI_set_status("Could not lock Unigraphics");
* i3 J1 V9 ]1 [* ` - return;
5 P0 T1 F! o( w# D& R/ f1 M - } V# m, M$ H! _) E2 O% b
- ret = UF_UI_select_with_single_dialog(cue,title,
5 G, v( l+ l5 I" ]' b* r - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,, _3 q9 |7 B8 O5 t1 e) b
- &response1, &surf, cursor, &view);//调用面选择对话框
& ]; _. |" D2 Q. s% O; i! i6 E -
8 a- Y3 |5 @7 T; y7 F3 L -
3 c- ~! J1 i+ p6 R8 q - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);7 v# r; e: j% g- O! z- A. M$ }
* P) ^9 e, Z3 \. v$ M- int count=0;8 E% F$ W: }/ A' m; }
-
# L$ Z) L- V" w" O+ B; [( B+ { - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
# n) Z9 c2 Q' n# U% l! B! {$ T - if(!ret); d8 `+ {% ]/ X/ u" M, v3 ?
- {8 ^ W Z9 Z% a, I0 A7 k, D
- if (response1 == UF_UI_OBJECT_SELECTED ||
9 H7 C% _# T7 K! m; u - response1 == UF_UI_OBJECT_SELECTED_BY_NAME). _/ b j" [# Z$ L- D ^5 \; d% k( n
- {
3 M' Z- Y/ h7 c0 O3 ^; r- R- d - num_geoms=1;
6 c0 `0 Y5 w% _& l$ F X. Z7 I, D7 f - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);, _8 @& p, M, ?2 G, t9 |$ E
- if(error!=0)& t3 \- {# U7 e) w0 Q9 B& c
- AfxMessageBox("划分网格不成功");
% l/ d, c+ w" h* j9 U - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");1 n: U d! @5 X; G5 x4 ~: N
- }
; Y) h3 r p2 p) [6 r/ k6 J' A& ^+ H - 2 C- W. Z$ c, j3 O2 @8 V- v
-
# d1 ^% s4 R D - * \! `. s) [1 T; _7 o
- }
4 w, f5 g: _' e: l - //UF_free(geoms_p);
, ?7 ~. i: ^5 {4 d; `* l% e A - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
: w" T% J9 B" E; i9 j) Q - ShowWindow(SW_NORMAL);
9 I- v( m+ {# q9 G/ L B$ [ - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
1 x, a* s1 ^- F7 Y; ?2 X. f* l0 A) ^特此前来求教错在哪里了6 v7 j1 e# ^" A0 H" n$ V8 O3 x
|
|