|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
8 [, ^) O3 L6 Z8 ? F+ C) M/ _5 P - {' r' W6 ~ [6 k# q: M
- // TODO: Add your control notification handler code here
) M1 g9 e7 E/ M# ^+ r$ G- Q - char cue[] = "please select a face of body";8 ] \" s1 ^$ j
- char title[] = "select face";
1 ?" j0 w. { Y - int response1;
& {, d7 X& }2 Z9 Y - tag_t view,temp,temp1,point;% T0 T8 ]! N* R
- double cursor[3],matrix[9];% }9 L3 Z9 `- l
- int ret=0;
* M5 s2 i% ?5 H0 C - + C8 u% D+ ~# ?( W" [7 ]. _# a0 j" X
- //UF_UI_specify_screen_position()函数的初始化参数
+ Q& W; n' p; U2 N - char message[] ="please specify a position";
7 V- k& Q7 k4 R+ m - int response2;
, y) O" k) _! x6 t% ]% X/ V0 r/ b! z -
4 @$ r6 t" n( k/ b J& H - UF_SF_UGs_2d_mesh_parms_t mesh_parms;2 ~1 h% _2 ?5 Y( y# Y
- int num_geoms;//几何体数量; c/ v, N4 a$ w
- tag_t geoms_p;//几何体
h) j2 W1 ~2 O - tag_t mesh_tag=NULL_TAG;" E: Z0 o( m9 r. h3 F- b; S
- tag_t scenario=NULL_TAG;
7 O' e0 H9 [. w - tag_t display_part_tag;
9 z- U8 X% }8 d# U. H* Y2 r- L - tag_t proto;
6 z' M' O7 o' L4 h+ ` - //最小化当前对话框4 v. P/ I5 x8 z* d/ p4 S8 D* u0 j% M
- ShowWindow(SW_HIDE);
( T' f! w$ ^0 }: A$ B0 ^8 t - int num_bodys=1;8 q- H, l/ ~+ a% J
- tag_t body_tags=NULL_TAG;
$ Y3 r7 s5 U! O* L2 y" y - int num_desc_lines=1;2 ~/ L8 a; U4 C1 ]
- const char *description="";
$ C* y& R$ }. b8 J - tag_t new_fem_tag;6 R3 y4 i1 d' w% O& [& M# }
- display_part_tag=UF_PART_ask_display_part();% U: w( p# T! e; v9 c; w5 `
- tag_t work_tag=UF_ASSEM_ask_work_part();3 e# c5 T' s5 S' C0 ?) _
. M1 l8 q$ ^4 ^8 O- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;- f4 m" f! \, w( w/ R6 b0 }* m
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;* D9 f: y6 R# y! \' ]
- mesh_parms.element_size=1.0;7 c S# u! U5 K# A: g' S9 v" d
- /* mesh_parms.element_size=dDefaultElementSize; */
/ k. G1 O8 K3 M b0 k( {0 Z! s - mesh_parms.edge_maTCh_tolerance=0.508;
( ~" a) I/ j4 ~$ z- p: @2 { - mesh_parms.format_mesh=true;
# E) |% y$ u+ |: j- r - mesh_parms.attempt_quad_mapping=true;
9 _+ a% G4 g6 Y# Q% w - mesh_parms.split_poor_quads=true;. n. x, ~0 E" U E5 O5 _( U$ [# l
- mesh_parms.maximum_quad_warp=5;! R0 }( y- ?- {& h! d9 P
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//3 A4 q; G( R9 ]6 G/ r9 d d
- mesh_parms.maximum_midnode_jacobian=5;4 D: I' R1 m% \7 n [
- mesh_parms.minimum_face_angle=20;
f5 B5 v9 n" g6 C6 I2 c - mesh_parms.surf_mesh_size_variation=50;* f/ g" x! X: t& P& n
- num_geoms=1;
2 C: a8 n5 U. p/ l0 a9 Y0 b - geoms_p=NULL_TAG;3 u T2 n$ k. D5 n
0 s3 h: ~" w5 F- u- # m. G) m) J+ W/ Z; Z
& N" o9 p% Y+ }1 O+ Y) I" N' _6 B- 3 e4 p2 P4 v( B+ c r
- //把控制权交给UG+ J' n( d X1 O0 F2 F5 U
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
) D9 F" T3 |2 k1 U( u - if (ret != UF_UI_LOCK_SET); N1 g5 a+ \+ x1 o
- {
* r$ J: C7 `7 R3 m$ O - UF_UI_set_status("Could not lock Unigraphics");
* R1 k6 n5 ?( h - return;, K# W$ F8 W; E& G) W, `9 m
- }
4 b) A+ s- A) ^3 m% e! p! K9 \ - ret = UF_UI_select_with_single_dialog(cue,title,
t2 Z9 | v' }" I - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
6 a( q' l H* H - &response1, &surf, cursor, &view);//调用面选择对话框
0 S, p N9 u9 t/ e: F* L- R - 2 o$ k0 B( Y m( Z+ M
- ' M9 i3 Z) ~6 l* ~& \# c
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
3 ~. _; j3 O3 ~$ t6 m9 t- z - 9 |5 ]- j) G" F5 ^
- int count=0;) f( T, b7 t* Y- {! j5 [
- * `8 g) K8 P( g# }4 q3 f: A, f
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
* S- ~8 ?+ R2 Y5 k - if(!ret)
1 p- ^8 n- w+ L2 k& b% F4 t! @ - {8 w; Z7 m- w. W+ o% ^ M S
- if (response1 == UF_UI_OBJECT_SELECTED ||
]( ~0 |. u. l# k" j! e! H - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
, e; p1 c! |' N' H9 D$ E - {4 C U N8 i6 U
- num_geoms=1;
+ z0 Z5 q, ~5 o1 C: l+ X5 k - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
0 W' c3 N' Y! v$ p* a" @8 ^! A - if(error!=0)$ G5 ~" m% l) K9 e
- AfxMessageBox("划分网格不成功");, X% c4 q% Y/ D4 L+ e7 ~& `) Q) F
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
1 F6 t$ C3 ?" u9 z( j& B# v Q3 { - }4 r4 m& b- y" v$ d2 i# p1 [. d
- 6 C6 b9 c+ a( \: l8 P) f5 R
-
; D5 ~( [8 Q2 b- C& V2 |0 |7 R2 G - % l" a4 @: A: [
- } * Z8 g; Z3 j+ H7 g
- //UF_free(geoms_p);
7 O9 X+ H. V% M( V5 a - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
- U9 X+ D. G3 T - ShowWindow(SW_NORMAL);6 t: k. Y4 `4 m6 k7 B- B$ e
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
( A% L( U; g+ U' z: n) r7 ^特此前来求教错在哪里了
0 W! S8 r/ e% u. g5 ~ |
|