|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
- void CMainDlg::OnMesh()
4 o- C5 z+ y# s- l6 _+ Y - {
& z6 N H' o+ H& F- L+ L& O. }# ^ - // TODO: Add your control notification handler code here
0 a5 b3 w9 o! b8 c: {) ? - char cue[] = "please select a face of body";
; j0 p* P2 C- q# G, X" r - char title[] = "select face";' m1 R, b# a* r* s
- int response1;) f7 C3 \1 u. H% v! a) h
- tag_t view,temp,temp1,point;
7 a( K; @( X2 Z7 {# E - double cursor[3],matrix[9];
7 {, R( L1 Q9 ^% @2 j+ k; \ - int ret=0;9 K v' m, N% V
- . T k4 f% a/ _4 F! C, k3 d
- //UF_UI_specify_screen_position()函数的初始化参数
" A6 r$ _* V4 |/ @; P - char message[] ="please specify a position"; - m' n$ P9 ]: {' z; S( D: x' @
- int response2;5 Y% \ F- i3 d( V4 @
- / }$ u3 }, n+ I- \# h1 k) O
- UF_SF_UGs_2d_mesh_parms_t mesh_parms;6 d& I: [6 c4 `3 l7 V* d4 A
- int num_geoms;//几何体数量: [! _- [0 ~8 ^1 q# }
- tag_t geoms_p;//几何体1 G* B; a& ?+ a% @
- tag_t mesh_tag=NULL_TAG;
4 R6 \" O5 M( \1 P - tag_t scenario=NULL_TAG;
+ K5 _+ u# s0 J - tag_t display_part_tag;
: I8 B _% I) \" S3 Y' c - tag_t proto;) K; n. B! ^" z m1 P
- //最小化当前对话框) M) |" W. T! d, f& K- N) z
- ShowWindow(SW_HIDE);
7 H; \1 b3 v3 e% N; }% J - int num_bodys=1;
9 h: w3 o5 S( V$ Z7 U - tag_t body_tags=NULL_TAG;( D G% z" s" R3 B' d0 U1 j0 Y; Y
- int num_desc_lines=1;/ E* ^7 _3 L$ m, j3 K( }, \
- const char *description="";8 d6 e6 ]+ Z% A* f1 D$ Z2 M
- tag_t new_fem_tag;
' ~/ q6 t4 k1 F0 M. n H$ f& J - display_part_tag=UF_PART_ask_display_part();! L) {- D& W8 T
- tag_t work_tag=UF_ASSEM_ask_work_part();
/ Q" B: \, g* u$ ?5 `4 J- ^* b
5 j \% o' T! m- //mesh_parms.format_mesh=UF_SF_UGS_MESHER_tri3;
) b# Z+ o6 U. m7 @$ G9 c( |' \ - mesh_parms.format_mesh=UF_SF_UGS_MESHER_quad4;
5 I$ P$ D$ ~; A) Z - mesh_parms.element_size=1.0;
* q8 O! _7 F# m( x - /* mesh_parms.element_size=dDefaultElementSize; */
$ K' S0 O+ [0 v - mesh_parms.edge_maTCh_tolerance=0.508;
( N/ L/ J% H# v - mesh_parms.format_mesh=true;# p' W2 I# i! W2 h" x) ]* N1 V
- mesh_parms.attempt_quad_mapping=true;. G, o/ Z. |0 j B; R
- mesh_parms.split_poor_quads=true;% _2 e' j g, G8 [
- mesh_parms.maximum_quad_warp=5;
7 n d1 |* V+ j8 p" ] - mesh_parms.midnode_option=UF_SF_UGS_MESHER_mixed_midnodes;//2 O2 j9 @) E3 y0 C1 N( T
- mesh_parms.maximum_midnode_jacobian=5;# f7 | G8 _' s. ]- o- i
- mesh_parms.minimum_face_angle=20;/ c& l: E9 u( j, g
- mesh_parms.surf_mesh_size_variation=50;
9 p' e8 C$ ^! t! `3 Z - num_geoms=1;- r. _4 h' f0 x3 ]: \0 v e
- geoms_p=NULL_TAG;
J5 A2 W. X0 k0 N$ F6 ^
% H# Y. _% s0 o- 5 ~/ I8 f& S- X3 S9 z. `" v
- 7 o+ A0 C, ? d: C" `" h1 v
) F$ @) o: F8 `' y- //把控制权交给UG
9 Z' I8 C- T* g- Q" J. q# k3 ` - ret = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
% R3 x! t: e, y- D - if (ret != UF_UI_LOCK_SET)
: d7 H; S6 D0 u u9 q+ x/ [, h) [ - {
8 B/ |1 N7 Z% i$ L - UF_UI_set_status("Could not lock Unigraphics");
$ }* Y; u5 b, U# `( A$ | - return;
: `* W8 D' Y0 d( G0 ` - }
/ Y0 f. X5 }& a1 S# W+ H - ret = UF_UI_select_with_single_dialog(cue,title,. r( m6 E w* ^1 L* f4 b
- UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,$ Z, W4 x7 l8 n8 P
- &response1, &surf, cursor, &view);//调用面选择对话框
' B9 x; E1 L X7 U - " Z7 {. A, f6 p9 `& v$ H' x5 N# {- `
- * a: w8 G3 |' G9 U0 p: n" X* s) J
- UF_UI_unlock_ug_access (UF_UI_FROM_CUSTOM);
8 ?2 z. y4 f k$ ^1 m' F6 L# u
; j7 U* J- n# q# w- int count=0;& L7 {9 \6 l0 w
- 5 ]& [& S' R" `' A( w; z
- //UF_SF_open_scenario("Scenario_1.sim",display_part_tag);
$ X6 K1 C4 D1 f4 W; p4 h6 T - if(!ret)6 t% Y) S. t2 i( d7 u( Q) |& [
- {
" L9 g0 S( f7 t5 O8 q - if (response1 == UF_UI_OBJECT_SELECTED ||
. n, n' L! N6 [0 s D - response1 == UF_UI_OBJECT_SELECTED_BY_NAME)
P5 X9 f* n$ y. `# m* P0 P+ K5 w% ]* } - {' ?5 @$ e2 J; c O
- num_geoms=1;
/ w( ^0 M, C4 c/ d: S+ ~3 ]1 k, P - int error=UF_SF_create_ugs_2d_mesh(&mesh_parms, num_geoms, &surf, &mesh_tag);
0 M7 Q: q8 g+ u4 s3 l/ l - if(error!=0)* T( b$ B7 x' F8 X' }
- AfxMessageBox("划分网格不成功");1 O. f e- w& r- z8 e1 j4 R
- if(mesh_tag==NULL_TAG) AfxMessageBox("未生成mesh_tag");
/ y% W) K3 q& @' G) ] - }
; G5 g- H' X0 N -
& T$ i+ i- h9 M1 A- |# I4 p7 k' z -
- O Q* }9 B% I$ l0 W, a% i6 ] -
: {( N0 A) h, N' {5 i+ R& @ - }
& p8 I6 L+ R2 l; D' Z0 ]* e - //UF_free(geoms_p);
+ ?5 J' w7 m9 @' u: b - UF_DISP_set_highlight(surf,0);UF_SF_display_mesh (mesh_tag);
& {. J# u2 i, O; B - ShowWindow(SW_NORMAL);
4 O5 E9 W& [% c! r - }
复制代码 这段函数 在ug高级仿真环境下, 对*.fem文件选中面之后,无法对面进行2D网格划分,UF_CALL提示对象不正确,
5 f- x6 P: r4 r0 d% f特此前来求教错在哪里了
* s* p/ E/ {1 f M$ S) x |
|