|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() & o @# w; D M8 y$ m
- {
" D+ h6 z$ k) Z! [1 D/ {7 w3 N0 l - // TODO: Add your control notification handler code here
& u3 e" x2 t8 D* t2 c" t - char cue[] = "please select a face of body";
# @5 n* l! }; C9 D$ z - char title[] = "select face";
- u Z- b/ e# C$ r. F - int response1;
7 M( |: e2 ]" Z - tag_t view,temp,temp1,point;/ F/ f b2 _5 G! U5 [# M# ? D
- double cursor[3],matrix[9];
, ~8 E# ~* S/ }( J) X) x- l! A - int ret=0;
3 F- i5 Y4 S# o3 G/ X
1 c5 R2 [+ n T, r4 m$ @/ N; N- N- //UF_UI_specify_screen_position()函数的初始化参数 }/ ]7 ^# N: Z0 G
- char message[] ="please specify a position"; 5 E5 t, H% B/ C+ K8 d, M
- int response2;5 k/ n% B$ k% U. ]
- % C6 Q( @5 V4 h9 g# T8 \4 l3 T) T! w
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;. F1 x8 H, p) x4 u1 m
- int num_geoms;//几何体数量
6 t; L6 K( ]4 M; } j5 j; l - tag_t geoms_p;//几何体
. p* U) N& \- Y9 o5 P, r - tag_t mesh_tag=NULL_TAG;) G. B, {3 ~: {' _
- tag_t scenario=NULL_TAG;
4 ^4 K1 J3 A4 l$ ^ - tag_t display_part_tag;
: z' }3 Z8 j9 e7 ?: H! l9 } - tag_t proto;* b# v: Q2 {! C& R# T
- //最小化当前对话框- N9 v1 @% _" P9 e9 y. }4 Q- f
- ShowWindow(SW_HIDE);6 @) Z3 ?% ], t5 Y+ X* r% [
- int num_bodys=1;
* e' S2 z& W: `# @5 a" q3 j6 y - tag_t body_tags=NULL_TAG;
" F4 D0 d2 U. i& m/ ^) W' K - int num_desc_lines=1;0 h/ K! z( f% F. k
- const char *description="";
1 c: t& ]# ?( k: o A' g; ~ - tag_t new_fem_tag;
8 [% |9 X$ n- j# ]1 E3 P - display_part_tag=UF_PART_ask_display_part();
' G I4 [0 G/ G: L8 h$ L - tag_t work_tag=UF_ASSEM_ask_work_part();
8 E+ b- o0 ?; b1 I1 A: K5 U5 G
9 e# \. r: N5 t* R- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
/ N, O1 N5 |3 s( U* g, D - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
' X; L6 g: ^* r - mesh_parms.element_size=1.0; Z( C6 C" u3 F8 F0 {+ g
- /* mesh_parms.element_size=dDefaultElementSize; */
0 D( ^& F" ^5 H' W - mesh_parms.edge_maTCh_tolerance=0.508;
^. p; c& Q5 G* o9 T - mesh_parms.format_mesh=true;
. \7 ~, N! V1 s5 s$ e0 J - mesh_parms.attempt_quad_mapping=true;4 {9 C3 x2 O! C Q- y/ W
- mesh_parms.split_poor_quads=true;
; G& s' a( V5 h. }+ w6 W ?& q5 y - mesh_parms.maximum_quad_warp=5;; Q. A! b% e5 e: H N
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
! O% [) J! X8 A" a) ] - mesh_parms.maximum_midnode_jacobian=5;
1 ^+ y4 @/ z/ }. }# P5 e1 o% c) c - mesh_parms.minimum_face_angle=20;
" p! _8 B+ q* ?! M5 n1 Q - mesh_parms.surf_mesh_size_variation=50;3 I: x& j$ V( n" B
- num_geoms=1;
& o3 `' u j" d4 V# \ - geoms_p=NULL_TAG;2 U& S) o0 x9 N/ {) k2 P; q
- 6 r6 a# h8 u- \- ^0 T; C5 b
2 E0 T0 Q: H. f$ N% z& W- , g9 i9 O- G7 l8 K
9 F/ f9 {. p& U& B+ k- //把控制权交给UG
7 u; a* [4 ]4 E. }$ O& c* C - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
) W* v$ o/ K" }! Y7 D* N - if (ret != UF_UI_LOCK_SET). }# |! d2 U' A6 M2 [+ q
- {
6 T: W. i6 x2 p; F6 D, X - UF_UI_set_status("Could not lock Unigraphics");; l! \5 S3 N7 s1 F H
- return;
9 G8 L, _% ]8 r5 F5 N - }
6 S: G: c- t d0 M6 ^ - ret = UF_UI_select_with_single_dialog(cue,title,% F; t5 I8 H" k% K2 a3 D
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,4 ?3 d: u \5 ?! H k3 j
- &response1, &surf, cursor, &view);//调用面选择对话框% h* W: o9 W- J; ]4 A4 q8 K% D
-
' Z2 k+ @0 }! o2 a2 f. Y! f" N - # q( d+ L& q$ Y7 i9 Z
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
" ]4 l- g, o: \, ~8 d8 l2 }% \# Y# b5 y
0 i/ [7 `6 b' {2 R8 ]+ H) z0 s- int count=0;
8 |( k* z7 e. _+ |- O% \9 n q -
' ^0 {+ g# ]6 e6 F# n4 }7 z2 I" m - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); 3 H' O' r1 [8 }. c7 }" {
- if(!ret)$ h) i+ I/ X: Z0 I3 `: Y
- {
* s5 \: [; w7 z! x. S - if (response1 == UF_UI_OBJECT_SELECTED ||1 u3 H' P5 z/ e
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
9 b* X, h. u. u/ [- A1 S& l - {
* A1 O' q/ [, c - num_geoms=1;& ~, F" K" a& S
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);; f& q% H3 I; B7 K( m. O& P' I
- if(error!=0)
, c3 g/ }! G' ?! @+ M6 k - AfxMessageBox("划分网格不成功");
& q$ e! f9 |6 N. G/ w; ? - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");+ n+ P( i P6 t7 l' z, E3 Z, ~
- }- L2 l3 V5 d- a) j5 N
-
- Q6 ]7 W5 K' H7 _% k$ u -
- ~! N u# F3 _% o1 X3 a# Z3 @. u -
8 c. m/ D; A2 a - } 7 w' {+ t/ e J# d; t/ v
- //UF_free(geoms_p);
$ m- F2 H! z4 F1 @ - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
% M7 H" W4 H' z4 n D8 V/ U1 n - ShowWindow(SW_NORMAL);
4 ?. d: x0 h+ t0 y5 t1 O - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,: U7 R$ s* q V, T& c) B
特此前来求教错在哪里了
( l' e1 {* R& Y) V/ v, t/ j/ W |
|