|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
- void CMainDlg::OnMesh()
1 O; x; G$ W' i2 n0 I) W - {- ^9 M6 i' s( z9 G, n
- // TODO: Add your control notification handler code here
. ^4 l% w8 n* q( H Q - char cue[] = "please select a face of body";
/ A9 _7 M3 ]. k1 c6 r" ~3 W: T - char title[] = "select face";# S* L5 d4 V. @ Q; j# Q
- int response1;. ]2 i# z( w1 K( |/ x3 ~0 n6 m
- tag_t view,temp,temp1,point;) B l$ Z6 Z g% N& P+ P2 |, W7 Q
- double cursor[3],matrix[9];
" k3 C& o6 ~$ s. C - int ret=0;. r* F9 G) \/ o% c- T S) e
- % N; q; [$ |3 X
- //UF_UI_specify_screen_position()函数的初始化参数( u! X% N- n$ f/ h
- char message[] ="please specify a position"; - F5 c2 K" h* x4 a. f1 t! ^
- int response2;
8 V. O/ {+ G( z# U - 4 u \! d0 `6 F# D4 {# Z/ g6 L
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;: V6 c2 Y: o# p5 O8 p6 J4 t
- int num_geoms;//几何体数量
0 q+ C, ?; n$ ^3 I+ p3 o K" g - tag_t geoms_p;//几何体
# Y" ^/ D T( h+ P - tag_t mesh_tag=NULL_TAG;
5 F, L' x( Z! h0 e" n7 C* ` - tag_t scenario=NULL_TAG;9 o3 X. y* h/ ?$ I6 D1 m
- tag_t display_part_tag;
5 r2 @1 B# t1 t% @1 X - tag_t proto;
. M! K9 e0 {( x- o - //最小化当前对话框
9 N$ a) w+ a6 t- O$ q1 \ - ShowWindow(SW_HIDE);3 y! V- {# I' c/ x* V& ~, A+ u0 q* X: R
- int num_bodys=1;
; t# w: ?5 s n! Y2 m: r: R1 | - tag_t body_tags=NULL_TAG;
' l& a: L; H$ Q F& k - int num_desc_lines=1;
6 v! I$ ]5 v$ f- T0 S. f1 A - const char *description="";& a/ D6 S; S j0 Z
- tag_t new_fem_tag;* u5 _( t: h) ^
- display_part_tag=UF_PART_ask_display_part();, {1 z) k5 S, o2 | H4 a% Q
- tag_t work_tag=UF_ASSEM_ask_work_part();
6 R% W, N' v' B$ j( T- v
! B0 _/ x& R( l, t. A: \3 j- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
2 Q4 U0 ~2 V1 }8 g- ? - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;( i/ O, B1 S/ `4 _) g
- mesh_parms.element_size=1.0;8 s2 A5 x# L. X( p& J. I# g
- /* mesh_parms.element_size=dDefaultElementSize; */ # N' S+ D2 R0 H& m3 l* @+ G
- mesh_parms.edge_maTCh_tolerance=0.508;( v' y& b& ]6 l$ Q( `% Q
- mesh_parms.format_mesh=true;
* Q# K0 k2 B: _4 c3 d- c - mesh_parms.attempt_quad_mapping=true;! x- d1 l. U0 @
- mesh_parms.split_poor_quads=true;; q$ r( R) O7 u6 ~$ H8 \0 x# C8 g
- mesh_parms.maximum_quad_warp=5;, f. R" ?6 F, J- |+ U- H
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//' D. a9 }( b- L2 l6 g
- mesh_parms.maximum_midnode_jacobian=5;
0 N4 D% h! @6 L+ O9 }* p - mesh_parms.minimum_face_angle=20;4 p3 [5 U! q. c3 W/ P: b) o
- mesh_parms.surf_mesh_size_variation=50;+ a n4 z- y1 s+ s7 g% _
- num_geoms=1;- q* R% F8 D F% i: S
- geoms_p=NULL_TAG;( u \- \( [6 C# c* p, Q/ ?
- & C4 S7 n2 l4 X/ X2 O( i* J9 m0 }
- 3 T5 K2 C6 {! s" c- E) `& t: [+ i
- + R3 w( g) S ?$ u) t o
- 2 A+ F# `/ I7 Q0 p7 S `( R+ [
- //把控制权交给UG
# ?- a* R7 U6 r! b4 v - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);. d' |" L: T# D. O4 F
- if (ret != UF_UI_LOCK_SET)
6 p4 C2 y% Q G: R, l) b/ O - {8 ~; ^/ c3 P' Z# {( O5 {$ a
- UF_UI_set_status("Could not lock Unigraphics");
d% d7 ~- D1 v/ T9 l) _2 e$ F0 t - return;
* G L1 `+ e6 k - }
: A. w6 U7 l9 z/ Y - ret = UF_UI_select_with_single_dialog(cue,title,7 Q0 ~/ f9 T- }5 r+ O0 ~
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
3 H. ~1 r0 w2 }" q& _0 J - &response1, &surf, cursor, &view);//调用面选择对话框& b0 h$ ~. R% o9 i1 x* }9 a( B; g
-
, H+ D* {6 g7 C- L- Y2 n$ r- l5 A+ W -
a0 u3 i+ w9 R1 s/ B - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
$ \; L; B# [, `8 e( q
+ a4 F/ C+ n4 u& o- int count=0;
( L) S& Z' u1 Q+ `( I1 n9 Q( \: W -
% q1 X8 x5 c a G' } - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); 9 _/ b2 R' t9 }. E0 G
- if(!ret)
2 P$ u1 w# {& L* @ - {* }) V) p7 J+ ]# n( H7 ~/ n
- if (response1 == UF_UI_OBJECT_SELECTED ||% U3 ~' Q9 i2 |2 B1 x' |' Y7 r
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
3 B6 r! E) E1 d; V* q+ W P - {( e" V7 u! \: A5 X6 H
- num_geoms=1;
( o$ a3 u8 e7 D6 b( I6 j0 N! Z - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);; q4 w* M r1 @! t& R
- if(error!=0)1 I4 |1 |+ R* K+ G
- AfxMessageBox("划分网格不成功");
: m5 e& w% F# _8 z8 z0 N - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
. w. Y6 z8 Q& ], _ - }& ] n% r9 H. k. Q8 ]& }
-
v3 e( U! C$ ]' O# x -
4 d# E( A' c0 Z# e - $ j; M; X, S/ F3 a; N0 \" ]3 `
- } & m3 X6 {$ a) r5 { U
- //UF_free(geoms_p);
( W! Z5 \; C4 T: q7 h, l- B& n - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
+ N: H' Y- f& s- r; T5 b - ShowWindow(SW_NORMAL);; `& C; C' ?, _& I; d1 O3 `7 I+ [
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
8 Q2 r1 n' }% o/ i8 k3 c& z5 V% y特此前来求教错在哪里了" d+ H6 J5 q" F
|
|