|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() 5 Y; l+ v; I# B# @+ s+ K
- {( D D5 J) p" ?+ |9 N# r/ D, s
- // TODO: Add your control notification handler code here J l& }8 M, @' W$ l/ `+ f2 o `
- char cue[] = "please select a face of body";" D1 x- ]2 ?# f( Z* \
- char title[] = "select face";
! u0 |7 \$ t6 y# P - int response1;9 ^+ O. C% W! X" L
- tag_t view,temp,temp1,point;4 S0 i+ H3 H& `; Z' s, R
- double cursor[3],matrix[9];6 T- O/ r! X2 Y9 {: F& Q$ [
- int ret=0;' m; v8 s* h- p4 {4 {: B& s1 g
- 4 y1 A; W/ _0 }) G$ h
- //UF_UI_specify_screen_position()函数的初始化参数# _- u2 T8 F5 G8 T/ e0 ^% k
- char message[] ="please specify a position";
; M* M, r9 `8 ]8 w3 f" C - int response2;; ]: j, Q( A' j1 U
-
9 H3 a2 Z# z" m. M }7 J5 b$ @ - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
1 |' F6 H' w8 a - int num_geoms;//几何体数量
' \; t7 k3 W6 y) s( a( G; W. X - tag_t geoms_p;//几何体
3 T( o/ [8 r! r0 O! \ - tag_t mesh_tag=NULL_TAG;
% N! h1 m- ]- C: C" k# F3 d - tag_t scenario=NULL_TAG;# R! u q: b( y- p5 F; f$ A
- tag_t display_part_tag;0 [2 `( s4 s0 c/ L% U& ^/ ]; V
- tag_t proto;
e" @: L# ?! f. T - //最小化当前对话框
% u% K( k9 K& K2 U - ShowWindow(SW_HIDE);
2 U7 E5 d! a, A0 I - int num_bodys=1;- {6 L$ D7 s Y T. e6 n* N
- tag_t body_tags=NULL_TAG;
8 r( [! U6 D" k% q# L - int num_desc_lines=1;8 g! D6 _( F! X# A. o* H# M1 _% ?
- const char *description="";6 g1 L& E3 K" ` f4 I% V4 r
- tag_t new_fem_tag;1 g3 o% V! v, G# q
- display_part_tag=UF_PART_ask_display_part();
1 F) L% Q a2 }1 H& H( C - tag_t work_tag=UF_ASSEM_ask_work_part();8 g4 e% ^7 O( l0 v4 }+ x
- / V& [$ M0 W! r8 C. e; H4 ~6 P% x
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
/ K( m6 U* }" C/ h% Y; [5 [; L - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
2 i+ {1 P& _; B2 o9 u - mesh_parms.element_size=1.0;
( @9 M q; A$ f; {. V) \ - /* mesh_parms.element_size=dDefaultElementSize; */
* E0 B/ ^* E* M* _7 D - mesh_parms.edge_maTCh_tolerance=0.508;
! R! D n$ t: H1 Y6 {$ w8 y' v - mesh_parms.format_mesh=true;
5 t: S) {# g$ o+ n5 [ - mesh_parms.attempt_quad_mapping=true;2 u% i/ m* m& W9 q2 U
- mesh_parms.split_poor_quads=true;2 m& L' O t8 T% d
- mesh_parms.maximum_quad_warp=5;
# y$ \- ?, W) y8 @9 J% Y& i - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//4 c- W; H1 i5 w! S2 J3 d
- mesh_parms.maximum_midnode_jacobian=5;/ ~7 B2 H- B2 k0 f& Y6 X
- mesh_parms.minimum_face_angle=20;* @5 N+ ?3 f/ T$ N2 p0 q6 q& C
- mesh_parms.surf_mesh_size_variation=50;) d8 y5 g# Q5 e8 u. K
- num_geoms=1;
( d! a0 C7 f. w2 Z - geoms_p=NULL_TAG;! ?( w% H/ [7 W" y
- : V" Q! s# h& X F7 I# Q, M
- / y* H$ s, o# J- Q, b: Y
% Q8 t# Q& Z) v; w. b" y
% c3 J1 B R. s9 U- //把控制权交给UG# a! H: n) c- J7 W9 B2 K
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
, L0 {2 p6 ]& P. A8 q. w v - if (ret != UF_UI_LOCK_SET). o) H/ o4 C/ @
- {
9 i- }; W1 A* n* C& \ - UF_UI_set_status("Could not lock Unigraphics");, S3 t8 h2 P; v* L" w
- return;
; M+ q; G7 T# c& o% S9 Q& t% q - }
4 D8 d R- e/ `( f/ X, A& P0 D - ret = UF_UI_select_with_single_dialog(cue,title,% h& p: Q( m% |" e) ^
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
5 K" W( a. m% D2 y) A - &response1, &surf, cursor, &view);//调用面选择对话框
. H4 M0 U9 i( z* T - / z: b1 O' a/ b
-
4 u- t P" M# P. H" z7 I& g - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
1 U) {% t% f Q, D" z* P - 6 p- q; |: J( o) p h" i4 J2 J
- int count=0;8 X) w9 A4 T2 V2 k* s, H9 ~
-
! y2 p% q; B |5 ?' o& P - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
" r+ h' \/ h: `! i) S - if(!ret)
5 R# l9 C2 m G" r2 r - {$ Q4 ]; l# u5 ]0 u
- if (response1 == UF_UI_OBJECT_SELECTED ||+ H) e+ b* u7 Z4 p+ E0 O
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)* ] R6 b+ P1 C# b
- {( i' a# c7 ]. t' M A# ]5 ^5 }3 ]
- num_geoms=1;2 _- t6 E! M* }/ _. L. [1 [
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);# f) W8 V, h/ B9 |, @
- if(error!=0)) z7 [, Q) Q. K7 S' m; h1 H# u
- AfxMessageBox("划分网格不成功");4 o3 T4 i/ B8 X* {: [" S
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
v8 t/ Z, z# j: |5 X - }
4 c3 V* j% w: O! V t - 6 |) j( u5 E/ L' r
-
' \- P6 e: d, Y! G - . l n$ U# U9 a/ q# Q
- } 7 p# g9 _* c- U, ]! R8 t
- //UF_free(geoms_p);* q( i W+ W" E1 M3 J7 C! {
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);& H3 H7 j2 p' K) C0 \4 F' c
- ShowWindow(SW_NORMAL);4 Q' a$ l C! a$ n J
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,3 t: y9 }* W# I! l# D' w
特此前来求教错在哪里了! I2 c9 n9 q6 l7 n6 ~) F
|
|