|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() n3 |5 ]! `# \% I
- {+ Y* C1 _* ~9 y; X
- // TODO: Add your control notification handler code here
0 e0 J- z8 {2 b( Z) u5 c) W3 K - char cue[] = "please select a face of body";$ g4 F" B/ X8 ~% b5 g t. l
- char title[] = "select face";
; K* n+ \9 H/ u0 M1 [3 P$ W3 z - int response1;# u u: |$ W2 E9 K) L- U" r7 G' q
- tag_t view,temp,temp1,point;' i0 I6 f: @7 R0 T# B+ B
- double cursor[3],matrix[9];& b' s+ P0 _$ C _( ~3 y% |9 c& ~
- int ret=0;1 n' D y9 W) ^$ s O8 ~3 P X
- 8 R& \. K9 \" v6 k3 Z& S
- //UF_UI_specify_screen_position()函数的初始化参数
, @ U8 |3 n# l) K" L1 c r - char message[] ="please specify a position";
5 I. y( c7 ~0 I/ S - int response2;7 r! L A; Y& A& T' v* f: \; @
-
/ a, W& ?% N; a4 @; g - UF_SF_UGs_2d_mesh_parms_t mesh_parms;1 w8 U2 W! E! j% [, y* C
- int num_geoms;//几何体数量
8 M* Y9 L( d1 N7 ]3 k+ D% h8 u& } - tag_t geoms_p;//几何体
+ H% y& M0 s2 U; {0 U - tag_t mesh_tag=NULL_TAG;
) A5 }: }+ j; J4 S9 C - tag_t scenario=NULL_TAG;
' J& y6 q: Q% Z& P( m/ n - tag_t display_part_tag;
9 x& i6 N# ~9 d" W! H; ~0 `, a - tag_t proto;/ m8 v( U0 R+ X- {
- //最小化当前对话框
3 N _* h$ R: Q- @; H - ShowWindow(SW_HIDE);
4 F1 s, Y$ E- c) f3 M% y - int num_bodys=1;7 E, @$ z: D, ?' w: ]7 K
- tag_t body_tags=NULL_TAG;8 i1 |8 i. A- a; o7 ]3 T2 I% O0 K
- int num_desc_lines=1;6 _: D, t6 l0 }0 h' Z; G
- const char *description="";
& u8 s# U) c3 q/ U% O - tag_t new_fem_tag;( H, t" g( r: k
- display_part_tag=UF_PART_ask_display_part();
. ^# ` d5 R. \, } - tag_t work_tag=UF_ASSEM_ask_work_part();
8 t4 E: w" [2 E) ^
& e( ]2 e n0 J4 i3 C" s8 x- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
# B- s3 S( x$ ]( j# i4 V - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
) v% i/ @9 N9 C - mesh_parms.element_size=1.0;- G& X' b4 r# }* ]8 j
- /* mesh_parms.element_size=dDefaultElementSize; */
( O7 \+ _7 X+ M% |9 f3 G( Z5 ?( n - mesh_parms.edge_maTCh_tolerance=0.508;
+ W. K5 [% _- s2 v* V& U9 m - mesh_parms.format_mesh=true;
4 r9 t5 I- D( R! g - mesh_parms.attempt_quad_mapping=true;$ B& `- \. B" q2 Z
- mesh_parms.split_poor_quads=true;
* i8 o% r$ \0 Y3 S: M& ~& g7 `/ ?4 b - mesh_parms.maximum_quad_warp=5;( s" E6 s0 ~ }8 [* E
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
9 o% b3 X( e2 E2 t2 m - mesh_parms.maximum_midnode_jacobian=5;
( w$ ~: B( ]& ^+ b+ a- ? - mesh_parms.minimum_face_angle=20;; [! [2 V2 }6 a. T3 t* O" |
- mesh_parms.surf_mesh_size_variation=50;" r. G$ ~6 U' V
- num_geoms=1;# l9 ?% [% m) Z' d( V
- geoms_p=NULL_TAG;
9 @2 Z8 W" y, T6 G+ { q - ' T! L0 i. {7 ?1 t* _" L1 {
- ( |/ p8 p: f) L- |3 A1 g
- ! L- C' _+ H$ @% ~$ Q2 H2 _! `
- ' p! x& w" d7 t* u" ~8 m0 I
- //把控制权交给UG
/ c( o2 b3 n0 q7 E. [# g4 D1 D - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
$ r1 x1 L( V7 z4 s0 ~ - if (ret != UF_UI_LOCK_SET)9 u' `, J6 a7 J4 ^! l
- {
( G1 b" M0 i0 H9 c: a/ } - UF_UI_set_status("Could not lock Unigraphics");$ E! X( N# N9 B) x. Q5 R6 d
- return;+ d' T) c) Q8 U+ @5 d0 c
- }
& f) s R) C- f! t - ret = UF_UI_select_with_single_dialog(cue,title,4 F1 G* S0 `; M' P; C
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
, C, b8 Z, P: E, q" ^( E - &response1, &surf, cursor, &view);//调用面选择对话框0 x C' W, @8 S: T
-
* a* H6 @) g; g t- p -
* {$ a# x6 Q# c1 H" R1 f& K6 M - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
5 N3 @+ Q9 w8 q' [6 F0 ]
3 f# N% }: N4 j5 Y$ N& t- m3 T+ b- int count=0;
" P. o% x+ S5 N- u+ z! y) K - 0 `# z% S- Q) s; X% ?
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); , I& z+ F& ~1 J9 }
- if(!ret)
5 t; Y( j/ S$ B0 E- A$ `4 ~ - {$ c$ M; v: ?, d: E, N. [2 T9 q! U
- if (response1 == UF_UI_OBJECT_SELECTED ||
6 s+ b, U* S" r( w6 X. _, o - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)& I5 K6 |8 G) M
- {
4 M- y% S! t; z- a# D1 f/ q6 Y0 h - num_geoms=1;
' t& b2 D4 ?/ ^0 j5 K - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
) {, d) @% o8 I7 z1 p - if(error!=0)
. G1 Y4 ?) \! M4 |% A9 M9 u- D' i9 V - AfxMessageBox("划分网格不成功");7 K, W# A; r& s/ \: G% h H4 V5 d
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
Z# V" [. n4 p7 {6 H; U. m9 ^ - }
6 R7 [% _! q: S - 3 u% k) P# ~# I( Z& n( }& |/ C8 F( p
- 8 e2 |- g% l: j0 n `6 n) z
-
) h4 k# ]% z3 I" O - }
' f7 h- D6 G% _+ R r1 @ - //UF_free(geoms_p);
, j& C( Z; f* k* t i) `, c ]1 I) D) _1 A - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
4 m( K" k' x. H1 W n0 n - ShowWindow(SW_NORMAL);' z# Q) \8 A( G" _: ?0 }' K
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
! w& L" S7 K- x) ?# ?特此前来求教错在哪里了
- ?! T" ~" ~4 Y7 B. ~( r( }( _* S |
|