|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
! w, W: `. A; X, K# @! N/ e - {
( l1 H! j8 { R - // TODO: Add your control notification handler code here' L% K# Y+ Q& g1 T
- char cue[] = "please select a face of body";
4 A2 ?% y! L$ P* [4 ^% [* X- @ - char title[] = "select face";
d6 F* y$ Q: T/ R! N - int response1;
) j8 S( O/ Z6 T - tag_t view,temp,temp1,point;( G% H# ?8 @3 m+ X- q' V" C+ H
- double cursor[3],matrix[9];
4 f8 ]' d' L2 B; r( M( I8 O+ R3 B - int ret=0;
0 n3 s& ^: v! y* u7 a" X6 _$ n$ A
0 Q/ l( ] s& }) f: `& T- //UF_UI_specify_screen_position()函数的初始化参数& r( Y' R+ @/ e; u3 c! V T. E
- char message[] ="please specify a position";
) C" e4 M0 @- g0 e! _ - int response2;3 ` Z& ~* r4 x4 F
-
8 N5 n4 w- g2 G8 V6 V" v - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
$ P$ v. g# q( f2 T. w - int num_geoms;//几何体数量& n4 Q/ R6 K5 T
- tag_t geoms_p;//几何体) X- C% X& m1 D
- tag_t mesh_tag=NULL_TAG;
& T4 t* ]6 Z2 g/ \ - tag_t scenario=NULL_TAG;
, D5 v( h! D. w" s" q - tag_t display_part_tag;
2 g' O3 A6 n" D5 G( y- G9 j - tag_t proto;
6 h' | Y. d" C, q6 Y" z- W; t - //最小化当前对话框( |7 D$ T7 j4 {
- ShowWindow(SW_HIDE);2 s; i" w. V" m& ?* J$ D
- int num_bodys=1;- \; E( L. j. v& q! R5 |- M
- tag_t body_tags=NULL_TAG;4 h# E+ v0 A) N3 J: ? q$ @1 ~
- int num_desc_lines=1;5 z5 ~( a( i! d2 g
- const char *description="";
! [ G0 w& J- V4 T) o+ A - tag_t new_fem_tag;. K$ k' |. B# E& ~
- display_part_tag=UF_PART_ask_display_part();
0 `' e$ w, Z5 R. Z0 N - tag_t work_tag=UF_ASSEM_ask_work_part();
, v% ^6 ^# u/ n4 K2 @/ `0 F
, F9 P& |: A L4 _- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;! n i0 G9 m1 c K+ J# A
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;0 u" L; `7 E5 U/ w
- mesh_parms.element_size=1.0;/ w, \' _. K2 _4 v# \1 |; ~+ W$ t
- /* mesh_parms.element_size=dDefaultElementSize; */
0 c3 p. a* m, l - mesh_parms.edge_maTCh_tolerance=0.508;
- I# |, k# V) O1 z; ] - mesh_parms.format_mesh=true;
. V {$ Z1 X2 B4 T) f" c6 M - mesh_parms.attempt_quad_mapping=true;
9 ]6 v1 E) b+ U$ r# ?2 F$ }( n: R% [% |" ~ - mesh_parms.split_poor_quads=true;% E3 v( I, Y m$ K: Y7 j0 x
- mesh_parms.maximum_quad_warp=5;
5 s/ r0 g# n4 o( Q0 j5 l3 D( r - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
0 ]: W$ \% x0 L3 E* J - mesh_parms.maximum_midnode_jacobian=5;( U3 F- M4 t' i: B; F8 w
- mesh_parms.minimum_face_angle=20;6 n v5 F' y( y2 c+ |9 |, V
- mesh_parms.surf_mesh_size_variation=50;
5 |2 j3 R- t7 V0 p& I9 S" u, F - num_geoms=1;
: `6 @& q( n N/ |7 \% g - geoms_p=NULL_TAG;
0 ] L4 Y! K4 v* m
! c6 g `4 z$ v- v- ) u2 y1 k' M0 d
- # `8 v* ?5 |0 o' K* l7 z2 S- \
- # Z7 S; C0 e6 `: c4 z+ z
- //把控制权交给UG
0 B- q, ?+ s; k7 B4 c - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);( }6 Q& i) }+ C. h
- if (ret != UF_UI_LOCK_SET)
8 K$ ]; |% [ [ - {; G: u8 N/ z6 q( [! w. w/ m
- UF_UI_set_status("Could not lock Unigraphics");5 ]& t& o- D5 Y' f9 }& A
- return;1 C+ j/ a8 f: ~6 ~6 u
- }
3 \) b: E- \6 Q& W! c. F: e - ret = UF_UI_select_with_single_dialog(cue,title,
5 |- t3 U: i: b% ? - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,/ E( O% U( K/ S- C k8 e$ k+ h6 G
- &response1, &surf, cursor, &view);//调用面选择对话框& H, }5 o* p) a) i
-
- O6 O( C5 Q8 w: u8 q3 E% G - % a' i. T0 c; j
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
- q2 h. I9 P9 K/ G
; M& H. q, _/ f- int count=0;. ]% I$ V- z3 Y: ]% _' N3 j
-
6 m& p$ D% x. I& y% n8 @) u - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); - l) e2 h8 I& s- Z& ?6 q( u
- if(!ret)( n" {* T4 \& j
- {
) [0 ]+ K6 f2 N7 V - if (response1 == UF_UI_OBJECT_SELECTED ||
* I% I; O& |# h2 k: M- ]0 j - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)4 r+ T V& ?8 [' W5 d
- {8 F% ]$ Z. @; B/ e9 u
- num_geoms=1;
: x+ s. s q% y* y) D - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
4 @1 D' p% u4 {9 t# V( f6 V - if(error!=0)
% Q- L& P- S; p7 I5 J - AfxMessageBox("划分网格不成功");
- k) Y1 l5 ?3 d( G/ z! `. \- @ - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");* C; g( k" q+ ?! h
- }! C6 F. q* O7 I: h
- 2 @/ _0 b2 c5 t! U% F* S, d$ N8 s. s: z
- 1 d' B; ]$ q. A3 Y" v# L( q
-
( H; l. x6 }% m9 x- q - }
& s3 D" O* P; C3 |6 ~9 [ - //UF_free(geoms_p);5 p" ` _# r- d6 c0 `4 F6 p* g( d( e
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);6 ~% D |2 [$ t" T+ ^3 E( `( Z+ H
- ShowWindow(SW_NORMAL);9 |' B- z0 }+ {7 ?
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,# k+ M0 q7 D2 t+ ]' W
特此前来求教错在哪里了! p l' R8 l! }) ?9 i
|
|