|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
) N; e: \4 P3 j! a" q - {* h7 Q5 Z& y+ p# ^! U7 y
- // TODO: Add your control notification handler code here
5 g$ \. E) W6 E7 ]! f$ M - char cue[] = "please select a face of body";
& \' V1 p1 f! b0 S2 Q* @ a+ d6 D K - char title[] = "select face";$ X1 S+ q0 z& y
- int response1;, _: k4 b. h, z0 g
- tag_t view,temp,temp1,point; d! X6 U, o2 [4 n2 Q( K% v
- double cursor[3],matrix[9];1 j1 B8 W, p3 I7 q- B; S8 g
- int ret=0;* G2 t+ s3 A: R, R7 {
- / ]. Z' K$ t7 G7 v" M9 Q! Q$ O
- //UF_UI_specify_screen_position()函数的初始化参数2 B8 s; y) D6 m6 ~
- char message[] ="please specify a position";
$ O S+ {* f& V" @: Y/ [3 }3 Q/ c - int response2;5 n9 D1 m9 f0 j7 h, w- |: Q/ \
-
O' j; }9 ]/ M7 Y# s - UF_SF_UGs_2d_mesh_parms_t mesh_parms;
! |9 B( y0 c1 _5 ]0 t9 @' P - int num_geoms;//几何体数量% l+ H0 {. T4 ]" b+ l
- tag_t geoms_p;//几何体3 |1 A8 V% M+ g9 k
- tag_t mesh_tag=NULL_TAG;
, ^8 G: x& O/ Q# R: ?- e - tag_t scenario=NULL_TAG;+ [4 ^/ ~5 @# T+ ^2 m9 R6 Z7 i
- tag_t display_part_tag;
6 N3 q1 Y7 q, K( S6 N - tag_t proto;: `& c% \. Y8 B: F& _- W
- //最小化当前对话框" f3 J) E. N: ~- e; s' q
- ShowWindow(SW_HIDE);
. Y! o9 c( D: T0 ^ - int num_bodys=1;1 o i3 X$ n/ G9 B* P
- tag_t body_tags=NULL_TAG; c1 }: L9 p+ O6 G* X! W1 @2 i3 r
- int num_desc_lines=1;- o& m' a9 _7 s1 N1 k( I
- const char *description="";) _* L3 J1 @& R2 P6 e% {# a5 M* v
- tag_t new_fem_tag;
1 f1 x8 f8 }! W, r - display_part_tag=UF_PART_ask_display_part();
& @: z6 m; b- S& n. f - tag_t work_tag=UF_ASSEM_ask_work_part();
0 J1 `! J0 i. o5 [) ~# Z& x - 0 l. V7 w" z8 m
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
' E" Z9 E% \; \" L8 s - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;( A. m) m# W. f& E6 X# D) Y$ }+ V" V
- mesh_parms.element_size=1.0;
6 A/ `+ M4 Z2 d a" \1 p( T - /* mesh_parms.element_size=dDefaultElementSize; */ * |* H' D; e' j# r$ F) E+ A
- mesh_parms.edge_maTCh_tolerance=0.508;
7 D; K, F: _8 S' Q& I: ]" E1 j2 M8 r' @ - mesh_parms.format_mesh=true;
& |5 P1 h6 m' @4 l, {5 }- e - mesh_parms.attempt_quad_mapping=true;
% \9 |0 z W, D* X. k - mesh_parms.split_poor_quads=true;8 C* }7 I$ s. r5 O6 I' c$ W
- mesh_parms.maximum_quad_warp=5;5 m6 v7 S) I4 G( |" d C J/ w9 N
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//
0 ^ b$ I( ~. w3 G6 Y: o7 N - mesh_parms.maximum_midnode_jacobian=5;
; G, V& k" d2 r+ R: l+ V; B% z - mesh_parms.minimum_face_angle=20;, P% {+ Q) [7 F$ ]$ b& o
- mesh_parms.surf_mesh_size_variation=50;& M8 u+ V* `9 Q9 G! w0 l1 W
- num_geoms=1;, @* |& Q; e" I- M$ `+ w0 P8 s+ U
- geoms_p=NULL_TAG;
" \- Z& z( x' ?7 M- L. N6 y! L - 4 h! a- m! U2 S9 e8 J( z
- a5 f; W* t6 r
- - U4 R4 L0 q# \( M5 H4 |
3 t9 P& u) P+ G% ]- //把控制权交给UG
6 A& i6 J |! M4 A/ L$ r# k - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
! T( k. o9 K$ E6 a - if (ret != UF_UI_LOCK_SET)
+ E) u* _ y3 q+ i9 v A - {
0 r0 S/ x' d& m- J4 @ - UF_UI_set_status("Could not lock Unigraphics");
3 y. f9 O; \0 {) M - return;- }+ S4 G b4 y, F* y" `
- }7 K: k$ T+ L" {# H, Q, b
- ret = UF_UI_select_with_single_dialog(cue,title,
7 o& z! `5 x+ ~! i - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,+ ^8 J9 h' S1 X4 k
- &response1, &surf, cursor, &view);//调用面选择对话框. a8 \5 l! H0 I! r# D! {
- ' M, r) w& \% [4 q$ I/ G
-
% u& P" ?; g' Q- t5 h; O - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
: ~1 U0 i9 D. N9 `& B" \ - / q0 Y2 g, j* y( {
- int count=0;! x% b: ^; z. T; O% f
-
1 C/ D" |1 `3 L/ a - //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
" i/ ^' w2 ~! c) L0 w - if(!ret)! U( @) I- e* Z8 J) ~
- {
* i A# k$ j; ]! X - if (response1 == UF_UI_OBJECT_SELECTED ||
$ ?- l: j, S' q% D# V4 u - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)9 U5 c) {5 q$ e: W, ^- E% c: V
- {
- F8 h M6 Y- j& w8 O - num_geoms=1;( u( r! H4 H; J8 C2 \
- int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);( [3 t, u0 Z' l5 V( A, j
- if(error!=0)
N2 a6 J! j8 r% K4 V - AfxMessageBox("划分网格不成功");
. R/ d% W' l4 M# d A6 P3 q - if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");/ r* a$ ?- [6 b9 Y+ n
- }- d6 J" Q( n7 X- b* Y
-
, Z3 R/ \" I+ O% L" J1 y - # K1 D2 y, z, i- @ t! |
- & j9 [' v" F1 b! v1 p9 J" `
- }
! j! Z' p; w$ z) {0 ` - //UF_free(geoms_p);$ r9 X* z# L7 S7 g
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
6 `' d6 ~8 H8 f+ x6 ?4 I - ShowWindow(SW_NORMAL);8 h8 c& p* |7 [
- }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,& z. U4 N. E* N8 P
特此前来求教错在哪里了
$ i: G8 y n5 ~ |
|