|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
( j. [6 }1 a9 O - {/ L' z* ?; A+ V, |7 @; b
- // TODO: Add your control notification handler code here
" K2 y9 N1 i" ]& H0 R - char cue[] = "please select a face of body";& i9 X- j* F& x8 ^: E! p: n8 E6 N
- char title[] = "select face";
; g( X }; H: q- K - int response1;' z" l# h0 q! k4 k1 O- t! J
- tag_t view,temp,temp1,point;
1 E9 w7 Y( P8 }1 d% E - double cursor[3],matrix[9];
* u" r: I4 z7 S# t - int ret=0; J8 [" T. i# c5 O9 \
7 g b. R* O w8 V0 C! c% ?- //UF_UI_specify_screen_position()函数的初始化参数
/ e$ u2 A% y# k1 P% v - char message[] ="please specify a position"; ) C3 G2 r' I3 c# H) O: X) E& [3 k
- int response2;6 [6 K0 R$ y/ c2 ~" ]
- . Q0 |+ P: }. k" @. W' i
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;% w& z0 r0 N, n5 W2 P
- int num_geoms;//几何体数量
' s* U1 }' p y' ?) \ - tag_t geoms_p;//几何体
1 S/ t' g% f6 b. B& R& `! T/ J - tag_t mesh_tag=NULL_TAG;7 P% F+ v. ^( U- @
- tag_t scenario=NULL_TAG;
b9 ]" e( d! Y, K# A5 S4 A) X& h. L - tag_t display_part_tag;
, o6 y8 J3 d) w, s1 w - tag_t proto;
- W! d8 f; Z4 L1 |+ ] - //最小化当前对话框
6 `+ @$ Z$ e, o - ShowWindow(SW_HIDE);" u1 p3 c, q7 r! e1 f/ k0 A
- int num_bodys=1;
* M2 f; ` q6 c8 C6 _' T+ x3 Y1 B - tag_t body_tags=NULL_TAG;: p1 E0 p5 `5 J
- int num_desc_lines=1;8 x& @$ z, l0 @! `! m
- const char *description="";7 D2 h: r& a" l
- tag_t new_fem_tag;
& F/ P8 q! L* Y9 I8 R1 s - display_part_tag=UF_PART_ask_display_part();" ?% e; f% U( E; @3 ]
- tag_t work_tag=UF_ASSEM_ask_work_part();
* t; N R7 n4 `. m* y
5 x; A- {: o# t. i5 H8 b- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
6 z9 i9 {$ |& E8 i) F - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
1 w% X% f9 {. ?4 X0 g( q9 o4 [ - mesh_parms.element_size=1.0;
& `4 J5 K6 g$ R& R - /* mesh_parms.element_size=dDefaultElementSize; */
1 [& ?9 C" E0 @. s" U: Z! [1 a7 l- l - mesh_parms.edge_maTCh_tolerance=0.508;; }1 G; f8 r# f0 n; K4 N
- mesh_parms.format_mesh=true;
) L G# h4 }! H - mesh_parms.attempt_quad_mapping=true;
, {1 _2 u/ t, l5 k; c: J) ?' [4 l - mesh_parms.split_poor_quads=true;
* z5 ^6 w1 U& _# _4 g# ]3 z - mesh_parms.maximum_quad_warp=5;; T2 c1 C+ S0 A4 c" G
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//) O3 D- Q2 [0 z( F- ?" J" Q
- mesh_parms.maximum_midnode_jacobian=5;
/ S& m" \6 Z" Q( H, ]+ `4 U# x- S - mesh_parms.minimum_face_angle=20;
/ V: I8 H! {; C H5 I6 u9 M5 f - mesh_parms.surf_mesh_size_variation=50;# G" T3 [. @ C, N
- num_geoms=1;2 B4 q4 j( a3 v: A
- geoms_p=NULL_TAG;- q* W4 O# Y8 E
- 7 p; q0 b& k7 X9 P4 B# U
- . t3 B( s H1 h' N5 s. Z
- : i- j; L: y7 Q, K B9 `. @6 Y
- 4 p! x7 {4 b3 `/ |4 C
- //把控制权交给UG; t; T$ H( M8 h8 w
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);9 p. g1 v- E! U# g. M% c
- if (ret != UF_UI_LOCK_SET)8 Y( j, {% f" J6 V1 ?' X
- {! q: q. }. h$ x
- UF_UI_set_status("Could not lock Unigraphics");9 X4 l/ [. X s
- return;6 X; @0 L: S0 W0 }& P
- }
% `( v2 y1 V) \! t t& B% p - ret = UF_UI_select_with_single_dialog(cue,title,) S9 J: V* e/ ]; G3 j0 _
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
$ q, [" G- F( ]% c+ O. Y - &response1, &surf, cursor, &view);//调用面选择对话框
% x7 |8 N _/ I! Q7 ]) `; ^ - 6 I- J! D3 w1 m8 }! z) W
-
- p. d- A/ V0 z, c% i - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
( s3 T! Z' [$ @0 y - , B$ P' c" l! n, U6 X
- int count=0;
# j" E/ c2 D! e! }& {) r -
4 u, t& f3 U7 E$ d - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
9 I* P8 Z: y% U4 z- x - if(!ret)
* J& e, X- U Z4 g6 y; o - {
4 P9 r3 a [3 z; b - if (response1 == UF_UI_OBJECT_SELECTED ||
% a& v8 ^, w# }0 _/ n/ E8 Q/ M9 R - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
! L2 C: l' W: ^" o+ `" f# t - {
5 P5 i- a5 z! o* C9 | - num_geoms=1;
4 j" ^$ P9 w4 t( W/ i- E" I - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);+ D$ k% O, f k4 K( e4 Q) I
- if(error!=0)
' y( f. W, f% |$ P% e - AfxMessageBox("划分网格不成功");
! ~) W T( @* |' \4 j - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");1 z( w1 \- U5 b+ {2 o: b! e; I% T+ Q
- }
# h5 ]! M& ~2 e) I2 K -
3 B9 T% P- O) r) l% L - # ?& o0 h. A! c8 W* [5 w: ~: i
-
8 q8 i" J$ b1 Q3 s; P6 F: T3 A - } # z* j) v; F# b, w1 _
- //UF_free(geoms_p);4 d: y7 z& A: T! D3 X
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);& r8 T! T" f6 O( C( V9 v5 b
- ShowWindow(SW_NORMAL);( b/ A7 S+ j# h
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,/ w5 p% W. A7 d2 x& f/ k
特此前来求教错在哪里了, L% @% c5 `8 Q0 ?' N, D
|
|