|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() 1 L+ ^8 q# Z m X+ `0 @; D+ a
- {
( M7 a/ D: E. q - // TODO: Add your control notification handler code here/ T! g4 Z# z! q! x5 A& F1 {/ f
- char cue[] = "please select a face of body";
1 N. d9 S5 q7 U6 v0 h. s$ J1 @. b, _ K! ? - char title[] = "select face";4 @) a1 k( @1 ]) y/ K
- int response1;. z1 A' z8 u; }+ Y- Z2 B
- tag_t view,temp,temp1,point;6 ~9 C0 ~( B9 F
- double cursor[3],matrix[9];
. o6 H/ n8 Y1 B+ p - int ret=0;
, D' [. i5 M, o E# b1 d5 {
- ]5 V7 _2 a0 h/ s b" `( K( h- //UF_UI_specify_screen_position()函数的初始化参数' S2 @( A1 _1 L7 f2 c! g
- char message[] ="please specify a position"; 4 j; s: J! s/ J: Q( X
- int response2;
" p- P1 Q; z$ }$ |* i -
& G/ I, R* E) H+ @' n3 d Q4 t - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
; B+ k' n8 S6 s5 |3 b - int num_geoms;//几何体数量
7 {% d9 |& ?8 ]& G/ d' k( h - tag_t geoms_p;//几何体
7 U4 K$ S$ h% j; t - tag_t mesh_tag=NULL_TAG;
0 a6 N4 `* W& C: ]' K1 a* w: W - tag_t scenario=NULL_TAG;5 v3 J+ z! y; G
- tag_t display_part_tag;
( s$ P; X$ N0 i - tag_t proto;
- ^3 C" \# I. G7 | - //最小化当前对话框
7 d: v4 [" ^1 D" u/ Z" T- B7 A - ShowWindow(SW_HIDE);" _3 B: } \1 G$ M, P2 U5 {6 T
- int num_bodys=1;3 j7 |0 N6 I! m" `3 L* E
- tag_t body_tags=NULL_TAG;
' g( }/ Z) Z" e; r; ]! O - int num_desc_lines=1;
) I. X" M! q* Z2 B; E$ m - const char *description="";' ~' x0 x9 a* T3 a" W' [( v
- tag_t new_fem_tag;# s$ v- m5 k! f( Q
- display_part_tag=UF_PART_ask_display_part();5 ~# t, l q1 w: o& Z
- tag_t work_tag=UF_ASSEM_ask_work_part();
! E8 @2 p& g9 r9 c6 | - ' d% T8 U q% W
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;9 q: V0 ?: ^9 O3 u3 C: t3 r* D8 @* _% G
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
1 Q3 z% ]: t3 K& w% D2 C, |/ i3 w - mesh_parms.element_size=1.0;
0 l! S( S2 o' }7 | - /* mesh_parms.element_size=dDefaultElementSize; */
9 F0 ]5 Q6 j% K# a - mesh_parms.edge_maTCh_tolerance=0.508;
# J0 r3 n" G5 z - mesh_parms.format_mesh=true;
; X3 B) ?' D3 G! G ] - mesh_parms.attempt_quad_mapping=true;
# n) \5 S- p2 T - mesh_parms.split_poor_quads=true;/ k7 ]: J" j; Q& D# t' l4 B. E) c
- mesh_parms.maximum_quad_warp=5;. I( U E# {- q+ ^! l+ N
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//4 E; I7 J. c" W) I2 i: d
- mesh_parms.maximum_midnode_jacobian=5;! I2 f0 Z. F7 l7 S2 q2 I
- mesh_parms.minimum_face_angle=20;
2 [$ l. u' V6 y+ T% s @8 c% p - mesh_parms.surf_mesh_size_variation=50;8 S0 I. |% W. N, n0 q% F5 x
- num_geoms=1;
/ {# t* E- j! B& u - geoms_p=NULL_TAG;
8 i0 b5 q4 V5 ^* u- l0 E
( T* ?3 H7 \" m4 H2 |7 k8 R$ z- 6 ~, D: P# ^; ]% ?: H
& B1 H' I) k- p% z: a0 r4 M( `0 X- 2 @& @- g# _1 W1 y6 ~
- //把控制权交给UG
# V7 n- b* t+ T& ]; Z - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
9 D1 g9 y! u+ O- S7 D+ z - if (ret != UF_UI_LOCK_SET)7 Q% C+ l" q& l1 v, B& T3 \
- {( E1 W8 Q+ G+ @" O& t, j+ L
- UF_UI_set_status("Could not lock Unigraphics");* @: } S4 r+ g6 m) {
- return;8 j& }5 u: n+ @" a6 `' ]
- }+ P+ E" k5 Q& D& U
- ret = UF_UI_select_with_single_dialog(cue,title,
- g8 S9 F2 Q6 P' B* r+ d; X - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
" F+ r9 r. d6 ]% w, h7 h - &response1, &surf, cursor, &view);//调用面选择对话框
0 i a' g. z7 p7 P, R -
& J. c" S0 G% M' O: ~# T3 j - # c: d* D t& u5 Y/ I: ?
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);" f, ~8 w7 k+ V j% j _# L
- & U; z. p2 X5 N, n3 \- R. ?
- int count=0;, a" d" c+ d( t6 R3 k, S" [ I" s
-
% ]0 A5 ?& Y( p+ p! r! {( `- _ - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
9 m" r% f3 s8 C& B% u - if(!ret)$ V% x/ m- h- g; W3 ~
- {8 P' s1 I$ e9 ~$ c( Q& ]
- if (response1 == UF_UI_OBJECT_SELECTED ||1 U1 h$ v+ d7 Q# K) i3 F" r9 b
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)6 }: j2 U3 c4 @4 D' _7 v
- {
- R1 ]) ^9 `3 Y0 g( p* n6 ~4 U8 y - num_geoms=1;
$ k8 [: s* s* t0 I - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
1 P6 J* o& O Y- s' l/ P - if(error!=0)$ p' {6 ?( e, Y; D1 I; O
- AfxMessageBox("划分网格不成功");0 ~' v/ P% e( Z- {0 ^
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
/ {; V7 n& H7 H- u6 H$ t - }# B6 U) v6 c+ o9 l7 M y3 o
-
* A7 O# y4 c. h. K - 7 N( X! k/ r0 X4 Q' b( W
- 4 Y" W& l' ?: p3 ] a$ E
- } 1 @1 c8 X! D1 `
- //UF_free(geoms_p);
! }5 g5 |8 J9 p9 y' K - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);4 d: h8 a/ {) @5 x0 Z0 T
- ShowWindow(SW_NORMAL);
4 C1 U$ j/ a3 m; ^& t/ b - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,% E% J( x3 }2 y6 w$ a9 R1 R6 P
特此前来求教错在哪里了
7 ^7 ]8 O# r: G |
|