|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
& p2 e, D# @8 l7 a3 ? - {" W$ D* V+ L3 O5 d
- // TODO: Add your control notification handler code here. W- N% l5 N+ x4 k5 k
- char cue[] = "please select a face of body";
- u! E0 p! s' t* j: r) o0 X - char title[] = "select face";
5 l# f$ s. q6 f( `2 {3 z - int response1;2 z# a6 I. w; S, J9 W
- tag_t view,temp,temp1,point;% ^) `1 E/ J+ q/ O; y! X
- double cursor[3],matrix[9];, E$ D v0 P$ `: l- z- u" Q
- int ret=0;6 _$ E' K1 S9 B' ?
- 3 X, N, _/ b" n5 M% I
- //UF_UI_specify_screen_position()函数的初始化参数
( |) U( T2 k3 h$ Q L4 x! y - char message[] ="please specify a position"; A( f" U8 P' z. K
- int response2;" A. E) l6 Y0 H) `% G6 s
-
* C/ D, T" l; Y9 H7 u1 p - UF_SF_UGs_2d_mesh_parms_t mesh_parms;9 D. \" d0 }" k6 c* I- g0 E
- int num_geoms;//几何体数量
% k2 Q# \6 l2 k# a+ W3 E - tag_t geoms_p;//几何体, ^' D2 U0 G5 ]. B; |9 ^0 b
- tag_t mesh_tag=NULL_TAG;
5 l% j; j g# n n, q7 ^: C! H J - tag_t scenario=NULL_TAG;
! l. f8 D* f. }) M3 S - tag_t display_part_tag;
' h; r( P) Y" Y4 e - tag_t proto;
M4 d0 p/ p& v5 A0 B1 x3 | - //最小化当前对话框# G: I2 @9 R) s1 B
- ShowWindow(SW_HIDE);" {: ]% o7 I- W Y8 ]
- int num_bodys=1;5 l, R) t1 L: ~1 U, X8 M
- tag_t body_tags=NULL_TAG;
! `: h( f4 n+ X - int num_desc_lines=1;8 Y9 i. S, [& w5 K6 R: b; i; _
- const char *description="";
" y0 K; f2 w! N1 i/ n4 N - tag_t new_fem_tag;8 x( {- ~# G/ J' k! }0 x
- display_part_tag=UF_PART_ask_display_part();# g% I/ k5 i9 m0 F3 Z# {
- tag_t work_tag=UF_ASSEM_ask_work_part();
/ s7 c* m" v& q* N E0 c, ?
6 z/ M G) f, p; x- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;0 ~& A) m+ P& c5 F. u8 s
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
, t# f. F0 S& u \( R - mesh_parms.element_size=1.0;
U5 [, S) g' E: D: C! L+ V - /* mesh_parms.element_size=dDefaultElementSize; */ 0 Z' [' w* h5 e' p$ B* Z6 U/ E2 C
- mesh_parms.edge_maTCh_tolerance=0.508;# q; Z- {7 Z- f! ]* U
- mesh_parms.format_mesh=true;
' x# T% n) O; R - mesh_parms.attempt_quad_mapping=true;& C! T" D& F8 |. [
- mesh_parms.split_poor_quads=true;) U5 W% v- S- U/ ?
- mesh_parms.maximum_quad_warp=5;2 s; ]% |& b2 t) e, O+ h
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//0 u/ G3 t: b W
- mesh_parms.maximum_midnode_jacobian=5;! p7 e. G, c" }1 }- L3 y+ i
- mesh_parms.minimum_face_angle=20;
1 A- x- @0 r& h; J1 W - mesh_parms.surf_mesh_size_variation=50;
/ P- z/ }+ h: p! f5 q - num_geoms=1;
$ `) h' J% ]3 a; `$ ] - geoms_p=NULL_TAG;, l0 M* L. G+ n3 O5 z7 k6 }
+ J. R3 ]5 W/ r' e
$ I I9 t. @1 R4 }' E1 }
$ d* S/ H# M1 C) o1 p3 D
0 `1 {- K4 J: L6 R+ E: Q- //把控制权交给UG& e( a' H R$ {" \: j
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
, `1 {( |, t( m( L* g$ Y3 N. b7 L6 B9 [ - if (ret != UF_UI_LOCK_SET)
0 Y9 \* \' S" `7 b - {. j+ ?8 C. L& G+ E! ^ r
- UF_UI_set_status("Could not lock Unigraphics");* A( j. X+ z& X5 n6 n
- return;3 L F1 @7 k5 H1 ]6 p4 H9 L, t
- }
, g, z9 m' b6 r+ e: P( h - ret = UF_UI_select_with_single_dialog(cue,title,6 F% e( f' }" ~
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,- E A* f+ M2 h0 _3 G
- &response1, &surf, cursor, &view);//调用面选择对话框
$ t7 K$ q0 k9 K; U - - C. p8 b) [) H1 D
-
- r$ I0 w4 \" ` l - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
' C+ C- K' R% f - 9 m9 w6 \4 {7 {5 Y# L" V; i2 s
- int count=0;" g0 B- S8 C5 u0 |
- ' X! n/ N9 U7 d
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
# U. t( o* C5 \! S D* L) {% q - if(!ret)
# l; v! d0 b5 | - {
% D4 v; T/ g- L) W3 K- c& K2 H; I/ a - if (response1 == UF_UI_OBJECT_SELECTED ||
3 U2 ]( N( p% Y" ~$ S M1 Y - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
2 F. C) T7 t2 D - {
( O9 e: s8 L$ [" [# d - num_geoms=1;" A- h+ G. F3 E
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);7 s% g+ }& ^* c, y5 v3 p
- if(error!=0)+ T; e" \( c1 h+ l# h
- AfxMessageBox("划分网格不成功");
1 g4 o2 p; i# }' w \5 q0 g, u - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
2 a" h7 b/ m8 e( T# T3 q$ w9 [ - }+ Q2 q9 U* K/ E4 x0 ?
-
3 z0 Q6 y1 I3 w -
5 Z5 E1 T7 s2 ?3 U0 g -
$ P" q+ K- E1 e7 B - } 2 M% W: B* Z8 y) @
- //UF_free(geoms_p);- p& x2 O7 t, J. F ^1 F
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);' N" X7 f7 U' k+ q6 p6 Y& F+ ^/ p
- ShowWindow(SW_NORMAL);
; E+ o5 \2 @' W) V8 E: v0 m, w - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
9 S G7 O+ z4 E1 U特此前来求教错在哪里了1 i( x1 T* u( S& O9 ?
|
|