PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

PLM之家PLMHome-国产软件践行者

[二次开发源码] UG NX二次开发源码分享:有关用户设置方面的使用

[复制链接]

2014-3-13 11:22:36 2926 0

admin 发表于 2014-3-13 11:22:36 |阅读模式

admin 楼主

2014-3-13 11:22:36

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:& f  Q* D+ F/ c% J- s

7 `+ d* A1 T4 D& x) J2 q
  1. ' F+ O7 `% N0 X. L& R; ]
  2. #include <uf_defs.h>" ]) J# d* o7 W2 j$ G
  3. #include <NXOpen/NXException.hxx>
    5 |/ i: Y' O6 u3 [
  4. #include <NXOpen/Session.hxx>
    " [( b! O$ ]  O3 B
  5. #include <NXOpen/Builder.hxx>
    , J8 G) [3 |$ a- n& Q, ~# Y
  6. #include <NXOpen/FileNew.hxx>- D2 r5 B  F) _  f2 \
  7. #include <NXOpen/NXObject.hxx>$ s. N) k2 q: r, n. \
  8. #include <NXOpen/Part.hxx>
    1 s9 }# n) r4 f1 `! a3 p- J( K
  9. #include <NXOpen/ParTCollection.hxx>
    + }  s- v8 _" ^7 M
  10. #include <NXOpen/Preferences_PartPreferences.hxx>
    5 {' Y: h, N) Q0 p( Z6 Q. e7 D
  11. #include <NXOpen/Preferences_PartSketch.hxx>
    ; I* o' p- m1 A: J" y$ z
  12. #include <NXOpen/Preferences_SessionPreferences.hxx>+ f: v0 S) x2 Q4 n8 O, B+ Q
  13. #include <NXOpen/Preferences_SessionSketch.hxx>3 U& v- _+ q! \" C
  14. #include <NXOpen/Preferences_WorkPlane.hxx>4 @1 N* z. B6 C/ ^7 `
  15. #include <NXOpen/Session.hxx>
    + C! R; ]  l" }: J
  16. using namespace NXOpen;, r2 a8 ]; J) ^# a
  17. ; u1 e; }' w- R& i) {& t) N# h' @0 O
  18. extern "C" DllExport int ufusr_ask_unload(): i' J9 O& h$ z5 n; y9 A
  19. {
    3 M3 k& G/ V1 T3 s+ a. i( Y
  20.     return (int)Session::LibraryUnloadOptionImmediately;
    , P: X: w7 Y, v- g
  21. }0 [" Y! O  {' r7 z2 M3 z& R

  22. 6 \# s3 J1 l- h% g
  23. extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)2 R. e/ w* o4 U6 l! {7 E6 t
  24. {
    " \: G5 I0 Z2 G' a* ?4 [
  25.     Session *theSession = Session::GetSession();' x6 a! _4 W& d! V  K: W! S3 R

  26. ; I; P- L. S/ L# `
  27.     //Creates New Part with name as Preferences.prt
    7 _- }: v2 M' V% j2 y; ?7 ?1 k) {
  28.     NXOpen::Part *part1;% `, P5 u8 Y- f# s7 G
  29.     part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
    * a5 V  p/ E! L5 ^, S6 s$ h! {/ d7 ?+ U" R
  30.     Part *workPart(theSession->Parts()->Work());
    ; u0 E' K6 X$ W# K8 R/ Z( B
  31.     Part *displayPart(theSession->Parts()->Display()); * {3 B0 M4 ~8 I& S1 Q$ j/ }" J

  32. & l8 i2 v1 G5 M% f

  33. & K7 l0 ]- v9 m( N
  34.   b; z8 G1 r/ B# t
  35.     // ----------------------------------------------& ?8 V2 A  f+ ?
  36.     //  Changing Sketch Prefix names7 n0 I* X' ]' E% Z
  37.     // ----------------------------------------------   ; q; O+ z7 a  w4 M9 k
  38.       8 R% W0 g8 x( n
  39.     theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");* `) k+ c4 L, {- W% t% A
  40. . E' ?! I# @: @* x! W
  41.     theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
    5 \. q, O6 g0 D( H- q
  42. # X, m1 i8 Q% _
  43.     theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
    ( [( g8 Y' a( i6 C

  44. . q2 ?. f, k; ]7 h4 z# b) C
  45.     theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");% F$ n' g+ U8 S+ ]' G/ q  e9 A

  46. 1 N4 H. N  y9 q* B/ k8 i
  47.     theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");: F3 s, C* h1 {, Y6 g8 w7 i
  48. 0 p5 u2 a' e# y' ^, F
  49.     theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");       3 g3 c6 c) V1 y
  50.    4 e; u0 ~2 p! g- {, R4 \
  51.     ( R0 n( A( Q: {& k% a3 A
  52.     // ----------------------------------------------- y  E9 e1 C( n% X
  53.     //  Changing Grid values- [9 ~* N+ z% ^% F3 E
  54.     // ----------------------------------------------  
    , h; ^6 w6 g) i& Z; ^$ `$ f$ p
  55.    
    0 ?' b% e! ~7 K+ E2 m1 j
  56.     Preferences::WorkPlane *workPlane1;
    2 i$ t2 M/ w  ]. I1 F0 P+ e
  57.     workPlane1 = workPart->Preferences()->Workplane();
    & j& E+ @8 Q# A; a4 f
  58.    
    - g8 v- s1 p, M1 Q
  59.     workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
    ) ]$ f! x7 A: C6 U+ G9 [
  60.    
    ' \' t- ~0 r" Q: }. w
  61.     Preferences::WorkPlane::PolarGridSize polarGridSize1;9 H$ K' g' `4 |5 ~) `
  62.     polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;
    : k( m+ W0 b7 Z! }& I
  63.     polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;9 B. E* H) o: V* q# z" J$ g
  64.     polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
    ; d8 ~3 d% C+ }, ]3 |
  65.     polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;8 x+ _- F  [! R) O. m
  66.     polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
    & M, ?1 p( N8 X, e9 S6 Y" ~
  67.     polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
    # r* e) C3 `% e. g9 h% @6 S8 s% s
  68.     workPlane1->SetPolarGridSize(polarGridSize1);
    ( k7 f2 U1 q/ N1 `4 z' T$ W) ?
  69.     2 d6 N1 r+ R9 W/ a/ {
  70.     workPlane1->SetShowGrid(true);
    , m. }+ x3 H6 Y2 J! ?
  71.    
    % X+ H0 i! r2 w* g5 @
  72.     workPlane1->SetShowLabels(false);: l5 g2 w* m! S
  73.    
    8 {4 S1 g0 L# |9 @: F6 H6 @
  74.     workPlane1->SetSnapToGrid(false);: F' o4 T) W- {; Y
  75.       h, }+ F: [2 [% ^! [
  76.     workPlane1->SetGridOnTop(false);
    / U% P4 h# B/ e. N
  77.    
    6 V% ?/ F3 D# A" H! E5 l
  78.     workPlane1->SetRectangularShowMajorLines(false);
    + V: }7 D; r5 N5 g
  79.     ( t" h; z0 h7 A' }% D( _/ a
  80.     workPlane1->SetPolarShowMajorLines(true);0 [5 J0 r/ C& L9 y" i
  81.    
    1 @. }- W% K' G1 L5 `
  82.     workPlane1->SetGridColor(130);: ?0 D" `! P  r9 G8 _' ]+ b% G- i
  83. }
复制代码
$ L8 }2 j" G& W  T* B
9 o1 E/ \' }( S5 }7 o2 b
# r( x( t4 S  Q' [8 M' y
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了