|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
& t7 | v) L9 O - {( _; r ~9 \. r2 ]3 I
- // TODO: Add your control notification handler code here6 A, z9 ~! V8 f! c
- char cue[] = "please select a face of body";! a* n( n `0 w) F% L% a
- char title[] = "select face";8 a6 h/ x7 O' J
- int response1;8 m( q7 b `0 f/ @( d6 y
- tag_t view,temp,temp1,point;
9 d& N6 b( K& x, P% Q D; e - double cursor[3],matrix[9];& u Z/ g' J& t8 e5 w( }
- int ret=0;4 Q) q: P; R5 h+ `7 B
- 9 O/ r* z# h- v! J* ]: K
- //UF_UI_specify_screen_position()函数的初始化参数
, [6 t k5 s3 b. h" g- ~ - char message[] ="please specify a position";
0 ?; B4 O$ J& D- ]2 z4 t o' U( `1 _ - int response2;
1 S7 I$ U* `2 |9 M' H0 h: a -
6 [$ K( ^3 X) s) D* T) t - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
, I2 h2 _2 o" B: Y* S - int num_geoms;//几何体数量
$ Q+ C8 n" s- ~% d; ` - tag_t geoms_p;//几何体
2 Z0 k) Y5 K0 d f - tag_t mesh_tag=NULL_TAG;
& {' C! a0 W5 W5 e( G - tag_t scenario=NULL_TAG;
* p" Q& ^! D# T+ ~5 ^" k( H9 i9 w H3 K - tag_t display_part_tag;
& U& r# k W) S# b$ {" d - tag_t proto;$ ]; A) b. F/ F$ I2 F
- //最小化当前对话框" _+ W; }5 n9 \) Y
- ShowWindow(SW_HIDE);
- n9 v7 e/ Q0 F - int num_bodys=1;* v; I& D4 d/ Y. E0 G, [( @
- tag_t body_tags=NULL_TAG;! x5 M/ N( p3 R, v3 _. u, {
- int num_desc_lines=1;/ C; @4 J* b- q
- const char *description="";
9 B' ~6 y# l8 b3 M" H - tag_t new_fem_tag;' l. ^0 n; `3 _
- display_part_tag=UF_PART_ask_display_part();
N s8 B7 @: Q2 {' }5 L - tag_t work_tag=UF_ASSEM_ask_work_part();, B* o$ s5 j/ X
- 0 h' L& |$ ^4 n" b+ ~" b
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
5 k6 h4 g+ |& h$ H1 W' K5 l) P; ` - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
( ? R. b4 V) T$ B* o& m% e j7 S - mesh_parms.element_size=1.0;9 b+ V- y( ~& f( ~4 w
- /* mesh_parms.element_size=dDefaultElementSize; */
: W2 [: _) J' U) ^5 Q - mesh_parms.edge_maTCh_tolerance=0.508;
; f5 @! }; l9 @2 _$ T8 ]: u; e - mesh_parms.format_mesh=true;
S, I/ G: A0 }, N1 ~( N7 @9 P - mesh_parms.attempt_quad_mapping=true;2 g; `( ~, h* U, b1 m; R
- mesh_parms.split_poor_quads=true;
s( w7 O. ^2 x - mesh_parms.maximum_quad_warp=5;
8 {9 ^: J) I8 _9 k1 ?% \5 z4 S - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//4 U3 E. \* \$ |* L9 L z* S
- mesh_parms.maximum_midnode_jacobian=5;8 h: j6 [" U+ X2 d- p }
- mesh_parms.minimum_face_angle=20;
. K8 U; E8 X/ b0 ^ - mesh_parms.surf_mesh_size_variation=50;, x, t) C* Y; u1 {2 Z7 E8 W, V# m
- num_geoms=1;/ ^' `( ^3 ~+ w
- geoms_p=NULL_TAG;) h" l6 ^ K8 R: c( t6 E
- ! B" G* _+ x5 Q9 ?# g
- / h4 L8 p% D# t
6 I) N* i6 q, Y- 9 Y, \' u! a# |7 J3 I3 |% i
- //把控制权交给UG
# X4 _# x2 F# O8 R# ~ - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
% n0 K* ]% _8 b - if (ret != UF_UI_LOCK_SET)
3 s$ ~: L+ o% s - {
/ @/ z% A* `: K! U. w# B - UF_UI_set_status("Could not lock Unigraphics");9 K1 J4 N# Q3 w8 u! F0 R
- return;
% X4 z# ^( o7 w - }2 L# Q$ @+ k- i2 P. P; S0 r) E
- ret = UF_UI_select_with_single_dialog(cue,title,/ b3 K- ^% a9 H$ P
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
8 u, U8 `3 U9 v) }& e' K - &response1, &surf, cursor, &view);//调用面选择对话框: |4 X; K& O3 b7 {( B8 x3 j
-
$ _( D1 D, t/ \* T& t4 r - 9 S& v, {+ Y3 J2 c8 |
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
& M( m, N% T) B9 [( z. E V- w - , e5 @$ w% g! H0 V
- int count=0;
2 `# H6 t" @0 c$ W, l! \/ t -
- N: h! Q0 M9 {" j% S( Y. m/ z - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
- [/ \% O# p% o6 o& B - if(!ret)+ ^- B* y/ r1 @ B$ N
- {
, W. a/ M( v; `0 C - if (response1 == UF_UI_OBJECT_SELECTED ||6 w( D2 b& s$ [0 }
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
8 i5 j1 U, g- _+ c1 ~5 |5 i Y - {& g% K6 T" V& {
- num_geoms=1;
1 W5 R, U3 }) H& ]8 ~: D @ - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);* v7 s: _7 g2 h0 b9 U2 t( B. K5 s
- if(error!=0)
$ L# R C7 Z1 u# _ - AfxMessageBox("划分网格不成功");
5 e) }$ ^, I( E9 `, R - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag"); E& S, ?( K. V& J
- }' [" h; t, ?+ X, |( g
- - H- i7 p2 v" [$ V* }2 m/ g5 M
-
; [8 U u2 I0 z) X -
) z3 I! J# z c% | - } , ^# N% b c0 ~) g
- //UF_free(geoms_p);- o. }4 _/ U9 w8 h# M
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
9 F6 ~6 q1 m" n& B; T- ~ - ShowWindow(SW_NORMAL);
, j- s+ }' f! _; w - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
; s9 T7 }8 R8 A3 E- J特此前来求教错在哪里了
) ?& \6 y& |1 H7 Z0 ~! S! | |
|