|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void CMainDlg::OnMesh()
T$ [1 K) S- u- E- j! d3 | - {
; F, ?5 d2 K. w# S7 k( G+ E - // TODO: Add your control notification handler code here
9 K5 m# c1 _0 [1 K& W2 u - char cue[] = "please select a face of body";
8 {" b5 P7 t" e* B& | - char title[] = "select face";. }, H1 k. L' r) w" }* x" Q, L" G
- int response1;" k4 f9 T* P5 b. d& r1 g- n% S' V
- tag_t view,temp,temp1,point;
. `7 Y* `- g# s$ g! J - double cursor[3],matrix[9];3 f/ G: R, P9 U
- int ret=0;) ~* v. g; K: `# B; {
: ?$ M" ^# z/ H4 _ s5 E- //UF_UI_specify_screen_position()函数的初始化参数' T, B: x; l, f3 o; N: u; T' v
- char message[] ="please specify a position"; % S D8 m- d3 y7 ~" d7 c. c
- int response2;1 [! Q. h1 Y0 q5 e `# D
- 4 X( _6 G* a. X; Y# `$ E
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;
1 G$ u8 X9 H9 l3 _) K - int num_geoms;//几何体数量# E$ e a( k+ D' D0 A9 I" I
- tag_t geoms_p;//几何体
' @& a; A4 {* v. ?9 L - tag_t mesh_tag=NULL_TAG;# q& C5 R6 q$ x1 r. L. @9 k
- tag_t scenario=NULL_TAG;
1 G8 A# u& c2 r2 z$ T2 } - tag_t display_part_tag;
) I4 h& G- _' ^* G* J4 d' `# n x - tag_t proto;
1 \- |" o, y, m9 h3 n6 m9 E% g - //最小化当前对话框6 {/ J; l% e, }2 A4 M
- ShowWindow(SW_HIDE);. T" D* n/ G6 L. m9 P
- int num_bodys=1;
; j7 G& C- \7 F9 V" ^ - tag_t body_tags=NULL_TAG;; X! d) }5 R7 P7 l9 ?- R& J( B9 |4 p
- int num_desc_lines=1;+ o8 {8 S7 E0 h3 {7 u& |
- const char *description="";1 u" a7 r9 h+ @; S5 H V
- tag_t new_fem_tag;
5 l9 `1 j3 N) X. G; s5 E. D0 U* x - display_part_tag=UF_PART_ask_display_part();4 `; N1 N! ~4 c3 s% `1 l# C
- tag_t work_tag=UF_ASSEM_ask_work_part();# W* `0 y. v3 R( S: E3 s7 ?* h
- , K' ~, t) w. G3 z
- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;: R" n$ H5 ^4 { W; W+ T' O* E
- mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
; U$ Q6 i/ \* [( T! V - mesh_parms.element_size=1.0;
' @& C' W5 l% k+ Q( Y+ s - /* mesh_parms.element_size=dDefaultElementSize; */ 6 _0 y, c* e* S! E
- mesh_parms.edge_maTCh_tolerance=0.508;
7 P5 |* z# ?& n% _! b - mesh_parms.format_mesh=true;
! I: F Z: J i( S9 u# f - mesh_parms.attempt_quad_mapping=true;
9 ^8 C- z' h) @: |/ G1 m - mesh_parms.split_poor_quads=true;
& M" w; l) h6 e - mesh_parms.maximum_quad_warp=5;8 D7 _$ C$ A( q/ D8 }% q" s
- mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//( {4 i7 m8 }, [! D' }
- mesh_parms.maximum_midnode_jacobian=5;
3 J: E8 N( l# m# d8 J! F. i - mesh_parms.minimum_face_angle=20;
4 C/ M* G0 l# E9 _- L- G - mesh_parms.surf_mesh_size_variation=50;
. f) W% W% o% ?+ b% J# c - num_geoms=1;
2 n! ?& n5 o/ f* a, F - geoms_p=NULL_TAG;
" k h- B; b! X- H5 a, i4 e2 L4 u - % ~: f. i# h/ ^7 H
- + k5 R8 Y% j+ C
- 0 u* N4 S4 B1 w9 z- K
m* m+ K1 @& v5 G5 F5 R8 e- //把控制权交给UG3 r7 @; o" @( o" k
- ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);4 p4 D: h6 K. F4 D. d& D
- if (ret != UF_UI_LOCK_SET)$ N. \( Z4 I. i4 |9 j
- {
1 ~, ]3 i! p4 K3 i - UF_UI_set_status("Could not lock Unigraphics");
: b! ~7 q, v" P, N - return;0 r( L# Q/ j3 E, g2 v) c, H
- }" T4 J, \) m( a' i
- ret = UF_UI_select_with_single_dialog(cue,title,
" Q e J9 _( v" ^! p - UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,% y* b! i' _6 W3 F- l9 g
- &response1, &surf, cursor, &view);//调用面选择对话框
& Y" X2 C, J# F+ \ I; N7 M -
' T) T% | j5 V5 T, }1 ]( p( V- q! H% D/ @ -
. m0 u( G8 T2 Z, c& ?5 x - UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
+ k4 l/ e, Z1 x9 [% m
, T3 e! E& }4 d, B# v- Q- r- W- int count=0;
5 f+ h; u2 }( {! p1 q: Z - : r; N. t3 x+ z- F+ Q% g6 X$ F
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag); # u; c1 \4 C9 a' ]- ?2 {
- if(!ret)6 `. t' C/ O, i% s
- {$ f4 i- w. w- o# B$ L" w2 F4 E
- if (response1 == UF_UI_OBJECT_SELECTED ||
7 ?" {1 S, j1 k9 a2 l" F - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
2 g: }) q1 y. P+ n" b; _3 w - {8 Q. S3 q2 \2 d$ K6 w
- num_geoms=1;
2 M& z. N4 o$ U% D - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
7 V6 p7 y7 }) G. N - if(error!=0)
; b) I% r8 \7 | - AfxMessageBox("划分网格不成功");8 q$ B; E* U6 e4 C8 @9 P
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
# N) {& u3 ?" B. q0 b - }$ w: g) b* A' s1 M/ Z& k' H$ z+ Z; p: {
-
4 u, Y" |% M7 D. ?8 L5 q -
' y( c* k3 U6 `6 \( ?% B -
+ T* y. Y% `. y7 ~. z8 Y5 j - } 5 a' Y% G4 d5 @3 D' a b3 A& `
- //UF_free(geoms_p);8 Z* b7 [9 Z7 s/ B( h$ ^: y
- UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
W6 k; U0 W! k5 {3 s7 g - ShowWindow(SW_NORMAL);
7 t* g# y/ q+ ^, _ Y - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
( R6 }4 `% t5 H, A1 p8 ?特此前来求教错在哪里了. o7 h7 Q0 M# n& U: T |
|
|