|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
- void CMainDlg::OnMesh()
4 m0 k8 m1 H* o: ? - {9 D1 l4 G4 L$ o* a; b- Z, Q$ ]
- // TODO: Add your control notification handler code here+ y1 F* ]: ^' r' w: V; s
- char cue[] = "please select a face of body"; ~9 l9 ~# ^, J @0 u
- char title[] = "select face";5 j3 i3 L/ g0 E6 n t0 \9 X. h
- int response1;/ R4 D* s2 s3 W; w
- tag_t view,temp,temp1,point;- f0 c$ o& v; @( L
- double cursor[3],matrix[9];0 ?& Q! |( I5 Y+ k" }( @4 |' N* ^
- int ret=0;
$ I! G0 v- O; K* F$ A; c - 3 g- P% p |" {& B- | u
- //UF_UI_specify_screen_position()函数的初始化参数
% r; y- y6 I8 @. z2 {2 Z1 f y5 n" N! S - char message[] ="please specify a position"; : w' i( \7 z( ~2 k
- int response2;$ g; k. h$ W+ C1 I
-
! k5 M) u) g# @6 S - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
; s A- l" _2 l+ Z - int num_geoms;//几何体数量 F# p! J& a/ U. F. W3 ~
- tag_t geoms_p;//几何体
1 C: w) ?* }+ A6 T# I$ b9 m - tag_t mesh_tag=NULL_TAG;
0 z. r1 Z4 O" p; X2 n9 f8 ^ - tag_t scenario=NULL_TAG;
4 W* ^: K- p# H: t - tag_t display_part_tag;6 c* ?3 R2 {: a5 N
- tag_t proto;5 u; [1 I9 Z: m' D+ r0 w9 q
- //最小化当前对话框
8 J a; y: @7 C) U3 o( Z4 `* T; p8 c0 l2 C - ShowWindow(SW_HIDE);
% }& [# L0 }1 k& N8 \/ d. S - int num_bodys=1;. o0 `; r6 B) T, B8 T
- tag_t body_tags=NULL_TAG;" h* \9 Z" \& P7 j( W
- int num_desc_lines=1;
/ @! e7 M0 J+ g& e - const char *description="";6 E1 n0 ?: h; _, @
- tag_t new_fem_tag;4 ?; m$ C- J& ]( t2 {; d# B' l
- display_part_tag=UF_PART_ask_display_part();
. \; w8 o+ l5 f& ^" a9 _ - tag_t work_tag=UF_ASSEM_ask_work_part();
" @, H; G& Q f! n) b
+ d2 G+ z& Y# N9 }8 j( I% V7 p& l- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;: \# z, U, d; d0 `
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
9 M$ ~3 [ O& q! V8 B. _ - mesh_parms.element_size=1.0;" p- R; v5 ^ ^/ v# l2 ?6 h Z+ ^1 o
- /* mesh_parms.element_size=dDefaultElementSize; */ 4 C# {/ D4 o/ {( o
- mesh_parms.edge_maTCh_tolerance=0.508;
, `# \( ^1 T3 Q" ]* r$ l - mesh_parms.format_mesh=true;; u4 X$ ]. r% [
- mesh_parms.attempt_quad_mapping=true;
7 }3 V, R. v6 \9 ^% W. \! I - mesh_parms.split_poor_quads=true;) v, N, g) W% ^: v& t
- mesh_parms.maximum_quad_warp=5;4 O% a7 Q) _2 N! P: ^0 A4 H
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//' M4 s; l0 Z `3 r" j9 u4 p" Q6 q
- mesh_parms.maximum_midnode_jacobian=5;% U4 O( ? {7 c$ G1 L
- mesh_parms.minimum_face_angle=20;3 q8 h5 j4 E9 R# [1 e7 ?# |
- mesh_parms.surf_mesh_size_variation=50;( o% ?7 t& ]+ w+ d/ F
- num_geoms=1;8 L/ _1 }9 h: H! y: m# r: g# d3 t# X
- geoms_p=NULL_TAG;
- Y9 q, `; z5 z3 I6 v+ K1 N
- P# l: h: q: I
4 J% `5 }; R7 i
0 F% t* n0 z, ]: _3 W- , a, z6 B( [" _& M* J
- //把控制权交给UG* ?7 w; r6 k' @4 [0 G1 @- N7 N
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);4 Y/ \# \) Y% i1 }
- if (ret != UF_UI_LOCK_SET)
% o) k" @ w$ e a - {0 L" h0 p0 D D6 L0 b
- UF_UI_set_status("Could not lock Unigraphics");* J/ j/ L, e8 u3 q2 j6 D( d
- return;
) L3 L |+ w3 E6 Z - }3 M3 i( z0 Z7 e+ P
- ret = UF_UI_select_with_single_dialog(cue,title,
9 s" y2 W- h y - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,! d6 [$ O) d& @4 W6 u
- &response1, &surf, cursor, &view);//调用面选择对话框
* g1 U! z3 g% H: p m - , j: C6 G& d4 K
-
7 H) g9 i$ r$ W - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);- ^$ D- Z& p4 x) ^8 M) \0 c
+ q' R6 Z( L( C" J0 _$ n, F D8 M- int count=0;
5 c L, _ P+ T( e# ~- ~ - 4 V4 A* [' X3 g
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
9 Y$ ~8 Q, x; I# H) E6 n" R* N - if(!ret)/ w9 N* z+ f! _% o
- {" h& M+ o/ M- f% C- c
- if (response1 == UF_UI_OBJECT_SELECTED ||
9 H y7 G1 w" V2 I6 S( _- I - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
( W+ ^/ k: T9 |3 L$ I - {0 a/ \) x H! Y4 |) x. ~5 V; d
- num_geoms=1;
# ]. [0 p, @% N& A$ N - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
# d4 L0 U, M; e/ J& f1 L7 c - if(error!=0)
. f) Z5 @8 {6 o1 {( ` - AfxMessageBox("划分网格不成功");
/ D: J, V& D- X8 J {# C6 w9 Y2 E - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
$ i; x' R+ v. {9 }2 s. y - }
. }8 m- P- c V8 f4 S& h$ M - 7 A% q& Z3 l3 r2 E5 i( u3 R. p
-
& i/ c( {1 j, x' Z/ [ -
! G8 m( X4 y' ~$ B - } ) B9 R. P+ K5 |0 b; A+ D
- //UF_free(geoms_p); V8 t) \3 K5 W7 a4 W8 B! b2 _
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
7 {9 \8 x. U; E6 J - ShowWindow(SW_NORMAL);
+ |7 B3 ~5 u2 e7 v - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,& ?) X* n$ ~! e2 |/ \8 w: _
特此前来求教错在哪里了
! w1 _1 C' K9 N5 a9 a8 W8 v |
|