|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh() 6 N9 b- ~$ ?* u4 l. v) S- R
- {% C1 a2 r1 T& B
- // TODO: Add your control notification handler code here0 d2 b4 _7 f3 Y- S6 [
- char cue[] = "please select a face of body";
( R. @8 z1 R! ~& Z! C' S n7 K - char title[] = "select face";
- l$ Y) `! Y( H% H ?5 Y - int response1;
2 L5 q T" N% ?% J - tag_t view,temp,temp1,point;7 F& V. ?7 p$ o" w$ }) T
- double cursor[3],matrix[9];; D+ z& N6 E% E+ N( w
- int ret=0;
9 [. C% X' T# X
& h. ]: ^" |4 F! u' ~1 I( z- //UF_UI_specify_screen_position()函数的初始化参数
! c) H1 F- X2 @3 B! Y - char message[] ="please specify a position";
" W$ K8 f+ @ J' y3 O - int response2;3 [& `8 j# ~$ ]0 @ _
-
( i D" J$ b7 `7 R% u, O( b# Q - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
6 ?( W: W6 l) e5 H6 b8 ? - int num_geoms;//几何体数量* u2 @. ~7 I7 v# D
- tag_t geoms_p;//几何体
0 E# y8 a, f; J& T' W% L; W, b - tag_t mesh_tag=NULL_TAG;
9 q; m- S$ @# F- ] - tag_t scenario=NULL_TAG;0 D5 C6 ^$ x, D: y* S% s! N
- tag_t display_part_tag;
5 S# X2 S* i, Q' Y# m% u2 H - tag_t proto;% Y* \- l2 A/ d2 C7 w
- //最小化当前对话框
0 N" b0 v- ]6 {3 K: O. O: v - ShowWindow(SW_HIDE);6 y! G& B5 }9 U! u( C' D h) a
- int num_bodys=1;, o) q, m5 [, g
- tag_t body_tags=NULL_TAG;
. t( v, l% d7 A$ k. n - int num_desc_lines=1;' U0 y: p7 E6 e" a7 U. ^" R
- const char *description="";
$ k) M$ d' j6 g1 Q - tag_t new_fem_tag;
! o3 H! T! i& D - display_part_tag=UF_PART_ask_display_part();$ y' h, r+ X# d8 x1 |. x
- tag_t work_tag=UF_ASSEM_ask_work_part();/ ^. D- ^- |6 |" N @5 P- @; x4 L
- 4 I" K( t* F" H$ B* C" f: T
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
?$ _" N1 \. x) ]5 k5 v - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;5 L) @* e" v& {9 N
- mesh_parms.element_size=1.0;8 Y% e6 i( z, |
- /* mesh_parms.element_size=dDefaultElementSize; */
1 k* x- ^; U- G$ E8 H+ o: I" H: I - mesh_parms.edge_maTCh_tolerance=0.508;
# W' N+ H( Z& Z) h7 v, n/ J ^) \ - mesh_parms.format_mesh=true;) q, E* l- B2 I: w& ~- a) z7 N: m
- mesh_parms.attempt_quad_mapping=true;
6 n% W$ P/ V( Z - mesh_parms.split_poor_quads=true;- Q2 J7 f* @6 K+ W) a# g* O' F: n
- mesh_parms.maximum_quad_warp=5;
( G" c# r7 N* j2 Z+ A - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//+ u a5 V" O$ Z) u- i) {- [ t: J! V
- mesh_parms.maximum_midnode_jacobian=5;
+ B9 `" J( G6 B0 ^ - mesh_parms.minimum_face_angle=20;2 k6 F8 n! F1 a7 R
- mesh_parms.surf_mesh_size_variation=50;: K) @2 J8 H3 J2 }. o2 _' Y
- num_geoms=1;
2 P# G( X* R# K - geoms_p=NULL_TAG;
, N L9 n1 S/ _9 g& c - ! X8 F% h7 k- m, s6 j
- + o9 f! D* u" Y( _
/ q% u# o2 c m) L
" x. g! n: W0 W* W6 {# s+ }' u- //把控制权交给UG5 H, ^/ p0 n/ ]# D U; ]4 @
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
+ |# f$ `) V+ } ? - if (ret != UF_UI_LOCK_SET)- w/ b4 A4 J* f% r! e
- {
4 q8 i% x5 I! v* u+ N& V4 g - UF_UI_set_status("Could not lock Unigraphics");' c3 ^8 r7 c9 ?5 p' ~
- return;
- f9 P8 K& m, C( I$ Z5 o - }
6 N8 T; }9 C* X2 K2 Y* ^5 b9 `0 ? - ret = UF_UI_select_with_single_dialog(cue,title, {' t( s8 ]+ p/ N
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
& ~$ |, ~- F. L: q: A: S) I/ {2 h5 k - &response1, &surf, cursor, &view);//调用面选择对话框
& w$ s' j, Q/ _9 F9 f -
x9 V7 B* z2 R* z+ T& c8 j -
, T& w8 U% M4 J( _. b7 j' j - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
Z* Q3 i' t9 E0 R/ r - 9 ^; Q( c# n- O
- int count=0;6 h" E7 T3 a; d# L# S
-
$ `1 X3 k6 i1 s" f3 s - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
0 w* B, G }9 e+ Z$ t* |3 B0 {: P2 \ - if(!ret)
7 H: ^1 i$ q3 A, D+ v: t( \ - {
6 x( d7 r0 r3 J# o - if (response1 == UF_UI_OBJECT_SELECTED ||& u( v- A% r; d1 X" w5 D9 Z
- response1 == UF_UI_OBJECT_SELECTED_BY_NAME)3 b( y- B$ O* `/ i8 V" K+ x
- {
5 G% Z- v8 v. T7 s - num_geoms=1;( p% ^. y- q( c% d, s6 R
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
5 [- K2 Y n# e& B* e+ L - if(error!=0)
; l F) h, J" ^1 B - AfxMessageBox("划分网格不成功");
) r% f' L+ O0 b2 e8 E ^$ W - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
( I1 t6 S6 E& n+ S* `: q0 m - }
2 d- ?4 y9 b1 F* ?0 ` -
; k! t3 q6 x9 E* Z1 `) S - " }1 Z/ i' Z; @( V( [' g- K
-
% X5 h$ k" C5 A; A - } ! e9 ]& t0 Z% c; \
- //UF_free(geoms_p);
! \7 h# U# g4 ~) l9 K3 M! }. F - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
6 ~6 I# ^* |0 E4 O* w - ShowWindow(SW_NORMAL);
; s1 F a) Y# |1 s$ ~ - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,. b% X6 B! v7 [: B1 `% J: a7 h0 n
特此前来求教错在哪里了
. L' @9 Q% o" f0 w8 k4 ]0 Y4 L |
|