|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
, C( U% J" T; {* b - {
. n+ T7 Y) W4 ]$ s0 y. o# v# ]: \ - // TODO: Add your control notification handler code here
) i% z& I2 I% a; ^0 P3 c - char cue[] = "please select a face of body";
% }5 X# _; H9 b/ l - char title[] = "select face";
0 S2 j6 e& {# R( w( E! ^$ @ - int response1;- c' P! @. k q$ U# a& l
- tag_t view,temp,temp1,point;
7 W' S* |9 }, o6 a. _% e3 G - double cursor[3],matrix[9];
6 p! k2 E$ E# B# V8 J8 e2 [ - int ret=0;$ Q6 p& [9 @0 k3 B( w
8 ^3 `* j% S7 s4 [; Q% b2 F* t% H- //UF_UI_specify_screen_position()函数的初始化参数
# w5 Z( J! |4 l2 {# \1 z - char message[] ="please specify a position";
/ ], x/ m2 m B# m+ N - int response2;
. R8 u/ h- J( j3 N9 _ - 1 H9 e! C% [7 \2 k' ^+ i, i
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;
7 w& ]1 j9 u! K2 h. F/ x4 O( M, N8 } - int num_geoms;//几何体数量
& L2 f ]2 ]$ j7 @) g- u4 h - tag_t geoms_p;//几何体2 m! }4 S$ Q! r( `
- tag_t mesh_tag=NULL_TAG;/ Z: k, ~# c5 O
- tag_t scenario=NULL_TAG;5 Z) H7 O) I9 C/ }8 ^0 {
- tag_t display_part_tag;4 S1 ~) b, _+ A1 L( F
- tag_t proto;. c3 g8 ] a4 a% s( E( m( ^
- //最小化当前对话框; z) _; m' v, C( J7 {0 ~7 o
- ShowWindow(SW_HIDE);! F) A5 }* Q7 {* j6 M
- int num_bodys=1;
6 H; H+ ~& A/ j# m c3 D8 Z - tag_t body_tags=NULL_TAG;4 A+ R7 K) ?3 V: b+ I% d
- int num_desc_lines=1;
+ F6 A- S" x9 [- K2 W4 O2 D4 \ - const char *description="";5 _. P; _7 n7 z k) m
- tag_t new_fem_tag;5 k' z- t4 r; Z9 c3 w
- display_part_tag=UF_PART_ask_display_part();6 E ~1 d! r4 n9 d0 Z
- tag_t work_tag=UF_ASSEM_ask_work_part();2 z x5 Q8 F/ a% F' \, q2 w
9 R N$ A* l8 Y1 A- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
( Q% v" m% h7 j- ^; h - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;+ |4 [6 P" v: }
- mesh_parms.element_size=1.0;
9 v! @& K6 _: I5 O8 s0 f2 z% f - /* mesh_parms.element_size=dDefaultElementSize; */
4 h9 \6 a* g! G+ x5 _: q - mesh_parms.edge_maTCh_tolerance=0.508;
/ R; s: J. f8 |$ c - mesh_parms.format_mesh=true;
3 v* W: i: W) {$ q7 c% r- g - mesh_parms.attempt_quad_mapping=true;% a# x( F; l6 P/ f) v, H4 `
- mesh_parms.split_poor_quads=true;
* n( v6 t4 S, A# N - mesh_parms.maximum_quad_warp=5;
1 m, g1 \* q* d. p. P1 _- p - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
# i& v" T1 l# \+ B& h) w5 M3 M - mesh_parms.maximum_midnode_jacobian=5;7 L- h& w' v; c, P. @
- mesh_parms.minimum_face_angle=20;
- R. Z5 O) O0 q- g2 n+ ?5 x: y4 ]2 X - mesh_parms.surf_mesh_size_variation=50;
0 i. M/ F( ?4 p6 G1 p+ o - num_geoms=1;8 P. G) w: N @( A
- geoms_p=NULL_TAG;3 Q" k# F7 T+ C. O3 ], r" `6 e# z; Y9 \8 |
- : _+ ^5 A. @. e$ C8 v. {7 U9 R! Q
1 t* S; H1 l0 u& G3 |( T2 x
+ ?1 K! V' h: q) n
# u3 q+ `& B( r& W5 X6 n- //把控制权交给UG
; y. a- p; w, ~9 p \ - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);* M S2 I0 t+ q- J
- if (ret != UF_UI_LOCK_SET)! t* B0 ~/ g8 ?. d+ V5 M
- {- X* h4 ]" A0 T: A! J+ _3 I5 _* t0 d( V
- UF_UI_set_status("Could not lock Unigraphics");
5 g- l0 v" x; M F! {6 i1 a - return;3 \ j5 ? L- q/ z6 s
- }7 i& X$ s' l Q8 Y
- ret = UF_UI_select_with_single_dialog(cue,title,- v' N2 V* q m; l$ d8 [8 H
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
* ` w- y/ @5 ~; |7 ~4 P, U - &response1, &surf, cursor, &view);//调用面选择对话框
. w; c3 N* O+ Y -
, e: t# y" p6 h& N - m! `1 s- x# a- X3 y' l
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
: T# r; y' [6 c5 C! p
; C0 q3 f Z& ]. `) p' F- int count=0;
! T' X; H+ ?" K& R5 P$ o: Z' Z -
; w) o' H5 b" \$ i9 G! s4 C - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
7 n% R4 e4 B% ~6 D, s$ q - if(!ret)
# A' p+ {6 k6 V+ g* ? - {2 ]' t s; A# O$ B# P
- if (response1 == UF_UI_OBJECT_SELECTED ||
) ?2 i" S! k- B4 d0 j) n, q - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
/ i3 f+ {* @" v2 e - {
4 d1 d+ H" K6 o* H2 L) W" j, X* c - num_geoms=1;
& Q, ^, B$ Y* i4 z' c, Q7 ] - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
' U% G8 I H n. o+ h& v! X/ Z - if(error!=0); D) {$ c& j; \2 X, j
- AfxMessageBox("划分网格不成功");
0 G0 w: \. z( d - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");" K% E6 I/ `& L9 |3 D
- }6 n9 ?7 P4 g. k. J
-
1 w, |+ |) x6 Y/ [7 p: U: c -
. Y8 F- @, X7 U2 ?9 B - 3 I8 d) Q. f4 ^9 i
- }
; S' I7 B/ t* R - //UF_free(geoms_p);
: y. R) j; K& @% D& W% n. X$ x8 D - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
n5 ~ b, G1 ]/ e - ShowWindow(SW_NORMAL);" r* V5 {; X7 y5 A7 M) g* f. M, S
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,4 K( n6 C/ I4 R2 j9 a- i# f
特此前来求教错在哪里了/ t# s: g4 j- `( e' a+ r
|
|