|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() $ w1 m8 d. W, g$ B) Y: h
- {& N2 x- o& x2 T; M) Q
- // TODO: Add your control notification handler code here
( c' G( r" j6 u P- y - char cue[] = "please select a face of body";
5 z4 z, j W/ s, y# n9 I - char title[] = "select face";+ P! y P6 Y9 V, l; ~
- int response1;# z6 F$ n I6 ^; V) h' T4 t
- tag_t view,temp,temp1,point;) Y" i6 I9 W G
- double cursor[3],matrix[9];9 R* O: c+ ?& j
- int ret=0;
% ^: T0 V5 j7 p% ~" e& l2 w
( h9 ]7 L3 c7 G- //UF_UI_specify_screen_position()函数的初始化参数, E+ N6 n3 u+ \: W6 G2 i
- char message[] ="please specify a position";
- x0 }* F9 a" `9 l - int response2;, v% j3 _7 c0 @" f* B0 o: m
- 1 J1 y @' d9 h
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;& d0 h/ V0 A9 a3 b# A$ l
- int num_geoms;//几何体数量9 q1 r8 t: f0 \' Y1 A
- tag_t geoms_p;//几何体
& `# o# _2 k3 w+ s$ d7 V - tag_t mesh_tag=NULL_TAG;
1 U* S; Q$ e5 E, x) D6 T - tag_t scenario=NULL_TAG;
9 M2 v- v# l4 o4 @* p. u3 l - tag_t display_part_tag;" h2 T3 i$ r: S" h) u
- tag_t proto;
1 U' o& J+ A* f) @/ c8 J6 ?8 S( h - //最小化当前对话框
, b. Y2 v5 z8 W% e' S3 m' q - ShowWindow(SW_HIDE);! _% j, j+ ]& }
- int num_bodys=1;+ u4 I; A( l, n+ L* `, g9 ~1 Z
- tag_t body_tags=NULL_TAG;
+ q5 m7 u3 j1 @. @' }& m9 a% d* r - int num_desc_lines=1;# c5 A: [2 k+ b4 L; h, F
- const char *description="";
& T- s* z5 ?+ x. ~4 J - tag_t new_fem_tag;
1 I( A# i. a/ C* b" u - display_part_tag=UF_PART_ask_display_part();0 |: l# Y, H O' V2 ^- n0 Q, N
- tag_t work_tag=UF_ASSEM_ask_work_part();. ?4 ?* y7 r8 o
; x- F# y8 q( ?# n, b- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
* l2 V* s R1 }- g& b9 i6 h7 a% C - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;6 B, p' O/ o# V1 E$ o8 m9 f
- mesh_parms.element_size=1.0;" q9 \- z) b1 ^/ a0 {
- /* mesh_parms.element_size=dDefaultElementSize; */ & e+ Y2 J6 k8 M: H3 N$ A+ a
- mesh_parms.edge_maTCh_tolerance=0.508;3 _ H. G! y' N5 q( M" O Y- }
- mesh_parms.format_mesh=true;
0 e6 l5 E: u& j9 y q1 Y+ n - mesh_parms.attempt_quad_mapping=true;2 f9 p7 H- f! S+ A/ h
- mesh_parms.split_poor_quads=true;
6 S: h5 n8 q9 ~2 X9 Q - mesh_parms.maximum_quad_warp=5;4 y9 r2 m9 R( N$ R/ N3 Z' Y2 U
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//$ p: W" I" \2 a8 K' X2 V {
- mesh_parms.maximum_midnode_jacobian=5;
5 j! }* J8 Z& q2 u! e - mesh_parms.minimum_face_angle=20;
' i' {0 y0 b! J( x+ L - mesh_parms.surf_mesh_size_variation=50; f8 S+ G, y6 q8 Y- G
- num_geoms=1;
3 {4 |3 V6 v$ _5 ]4 ] - geoms_p=NULL_TAG;
+ y* g N+ ^3 E; S" c - 9 P* f# M3 M4 P( h
s/ @8 k- v- ^& j; ]* e3 l O) o
8 `3 s) I; L; d8 l$ e; }; P9 _7 t- 0 D9 I k9 J# W. A
- //把控制权交给UG
( b. }& {; L+ r& O) ]; ~ - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
# e8 q6 I# A1 n! s6 ~7 z5 w - if (ret != UF_UI_LOCK_SET)
9 w: I. t7 u8 Z" s7 w9 Q& p - {% p- r8 i. a- t
- UF_UI_set_status("Could not lock Unigraphics");
6 A9 j& ]) Q. U" H - return;$ m6 i" X0 c: b m6 H4 v. ]3 O/ r% {
- }6 L8 o4 {; ^) v( {" W0 p1 p
- ret = UF_UI_select_with_single_dialog(cue,title,0 q, U1 z3 p: h/ H1 M- Q% {0 s4 a
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,* H% r' @" r7 g6 L/ p7 H# K
- &response1, &surf, cursor, &view);//调用面选择对话框5 x4 H2 D7 u7 J" o# v
- % B2 a7 `, N9 i: m( r- W; d+ F* a
- ) b2 w" h2 e) u X! ]" A2 j( X
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);: ]" `5 g: o4 |1 A3 F, k
7 o9 o) Z8 P& o" u, A2 W+ P( X- int count=0;
$ d( t, {" ]8 E0 i4 b. |/ M -
& ~8 N1 Q5 ?! H - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); 5 r2 o8 w# o' x$ w2 S/ ]
- if(!ret)
7 J Q4 o# A2 |7 C e1 R - {4 B& L: C# f- Q# }, y0 q& y
- if (response1 == UF_UI_OBJECT_SELECTED ||
" \* [% d( k# Q+ G - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)' m b+ m. z" g h+ i/ m
- {
" v: k) _( |, ~/ E - num_geoms=1;
4 B# _: c& c% d- X9 v - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
0 x$ Y" }6 ?0 p7 u b, Z4 j% K - if(error!=0)
) q& w3 a: d0 v* R. R* q* ` - AfxMessageBox("划分网格不成功");1 V4 x2 m; o8 ]! h
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
! k% ^! l o) B0 c& C - }
# M# ?( L# w7 X; S' l3 L -
: s% e1 l) V5 m6 B! ] - # @% e* S% n! @5 @+ ^/ P, q
-
" |6 m" ^# s0 x8 l* w1 o* S - }
7 k3 ~' A9 o, x$ D/ O - //UF_free(geoms_p);9 u3 [# q2 E5 V' ~$ Z+ V5 Q( x: o
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);* I9 s3 L/ q7 T7 i: p. _
- ShowWindow(SW_NORMAL);2 M+ n& S$ {1 ~& b
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,; p3 l7 n0 W$ q
特此前来求教错在哪里了# U& a+ g. L! B" W
|
|