|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() ! H" Z& l P- q; I
- {2 j6 Z* O. x1 m. C
- // TODO: Add your control notification handler code here( k, l6 [+ S; [ T6 |' V$ N
- char cue[] = "please select a face of body";+ A! \% f1 N" L+ J7 S, W1 o/ U: g
- char title[] = "select face";
. _% u1 B8 H# d) i4 O* ~& v7 A8 `' p* Y - int response1;9 M7 o% k; `) G
- tag_t view,temp,temp1,point;
' Q5 Q7 \) H5 o8 `% M - double cursor[3],matrix[9];
, F- _; M! i0 o1 d4 M4 p2 n - int ret=0;
" d) B+ J# J$ W. a
; w- {4 k' T' [4 W. Z3 V- //UF_UI_specify_screen_position()函数的初始化参数
' v; D6 g$ P6 T( t2 X& X3 |7 {# f - char message[] ="please specify a position";
7 C2 `/ I G7 p/ k - int response2;
: R3 }9 ?, T; `* g -
% p4 ~. _) w( n3 q' k) l8 x - UF_SF_UGs_2d_mesh_parms_t mesh_parms;! y, W) d( v& Y# w8 j
- int num_geoms;//几何体数量
/ G( r# g1 J: a0 T! m' H2 o" N: i - tag_t geoms_p;//几何体
- S" Q) v/ V' ?# Y2 Z! P0 Z - tag_t mesh_tag=NULL_TAG;
0 U; B" c+ e4 F0 p: C8 J7 p h* S - tag_t scenario=NULL_TAG;7 d3 o7 }8 a/ S3 E
- tag_t display_part_tag;0 E& C. q# z3 V2 p0 U8 w+ ^2 O1 z
- tag_t proto;+ B0 F3 ^) y+ A9 n% Q5 z; P3 {
- //最小化当前对话框4 W2 u, g. A& G3 ?" _% t6 b1 q
- ShowWindow(SW_HIDE);
$ Q% r2 c& f( L3 E- z. I2 m - int num_bodys=1;' M# t( ~) l x. e" J
- tag_t body_tags=NULL_TAG;) w9 _7 _& V' P z8 @
- int num_desc_lines=1;1 {6 L) M8 J5 |& m
- const char *description="";
$ w" i1 z+ q$ ]3 Y1 [5 p0 C - tag_t new_fem_tag;8 u$ v& w7 O; X) e* R6 G0 A0 d3 B6 L
- display_part_tag=UF_PART_ask_display_part();& m# Q$ U" c& T9 ]7 r
- tag_t work_tag=UF_ASSEM_ask_work_part();3 i; B, H9 U! E1 w
: B- d) h- [0 E) c& t4 m& Z& H- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
1 r5 m0 |8 t" P8 ?$ M3 d( R - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
6 d2 Y% L3 k* K2 U, m( s - mesh_parms.element_size=1.0;
' U' {" g$ X9 v$ \ - /* mesh_parms.element_size=dDefaultElementSize; */
( f; N5 u8 v1 J! O& g' q8 T( _- Q. x - mesh_parms.edge_maTCh_tolerance=0.508;
0 e( ^, j j `) p- `5 } - mesh_parms.format_mesh=true;6 l9 D1 w% ?6 c
- mesh_parms.attempt_quad_mapping=true;7 U* _/ e1 [$ k, Y2 s
- mesh_parms.split_poor_quads=true;# O$ K: A% n& k& h" H& n+ Z1 t; S& a
- mesh_parms.maximum_quad_warp=5;5 _ \4 t H. f! E+ N- y+ }
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
7 H, g( A- x8 e: d - mesh_parms.maximum_midnode_jacobian=5;7 }, n9 M$ J; w5 \7 {
- mesh_parms.minimum_face_angle=20;
. M w% s' O' i* ?+ } - mesh_parms.surf_mesh_size_variation=50;1 B7 ~+ I0 C# K% I% W0 v
- num_geoms=1;5 A& I+ j- ^, U- C
- geoms_p=NULL_TAG;
3 |, h8 R/ H4 C7 p F/ d - ! d# d! w4 v" R; A! o; e" F
- # J) M# h2 S3 p' F* A" l2 K
3 h7 g3 B3 V) o" P+ v# h$ l
% m% x! h5 ~5 N$ i- //把控制权交给UG
0 f: H% A+ X5 F# p - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);: b. b( h* n8 e
- if (ret != UF_UI_LOCK_SET). J. L3 ?# \& b6 R2 U
- {
5 m! k8 l! K+ c g - UF_UI_set_status("Could not lock Unigraphics");! M- Y3 {- D" h* F
- return;
( r5 p* n5 H7 S! j7 o6 K - }
; |# Y% _8 o; R4 A: ~9 ~: i9 A - ret = UF_UI_select_with_single_dialog(cue,title,
! x9 a3 C, _* S1 y6 Y - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,4 f; ?/ C5 s7 h' T) K- l: u" H3 X
- &response1, &surf, cursor, &view);//调用面选择对话框$ x* U( T. z6 |2 Q: B9 f; ^
-
# }' k8 T: U) ^ x- Z8 F: N - - a, A& ^5 N i- r' T% F Y
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);; W r" e# W# G
0 t+ u: B8 A# ^- int count=0;% }0 ]! Z4 o) T8 A5 c j. \9 D
-
% y) [( z5 F8 U5 |- N* B- _1 k' c5 s - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); - w/ y3 k/ T( F$ p* M
- if(!ret)
9 a w. n1 B' G) X3 f8 _ - {
8 o7 Z/ @7 L& H3 \, W" z ~ - if (response1 == UF_UI_OBJECT_SELECTED ||
0 P O2 n0 [2 u - response1 == UF_UI_OBJECT_SELECTED_BY_NAME), _- S- K" S# q
- {
0 j/ }$ U i: E$ a- x5 h* ^) q- D0 V - num_geoms=1;
+ s- U' l+ J: [" ^) B2 N0 _8 `2 E. N - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
) V0 U# h; l* v' p - if(error!=0)
) P9 U% w+ s/ i$ ] j1 S$ f - AfxMessageBox("划分网格不成功");% Z# p& }9 y; O/ }
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
0 \2 _ h. b+ M& O% [6 v - }+ C4 ^) B1 \; w
-
( \# G$ N! T5 y -
+ _0 b' O6 _, N/ ?& r2 B! @ -
5 E8 {" t# ]! B, I; ?9 g - }
. `1 j3 D& l- h0 F' a& y - //UF_free(geoms_p);
$ x5 R1 k8 M2 S+ l0 k8 c2 S4 g - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);% |! k4 {. B2 ~; e! Y$ S2 g
- ShowWindow(SW_NORMAL);
7 R& J/ r* v2 d) Z1 { - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,3 i2 N+ q7 F- q- Y( H( T8 b! S
特此前来求教错在哪里了
3 ]' z8 M+ p, H7 m, U! t3 [ |
|