|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:" H) `; j# q8 @: ]
2 t) n, X ~, d3 r
" h A1 X5 }3 X; T! v1 O0 R- #include <uf_defs.h>1 C+ b0 Y8 ^9 K. G8 [) z' w& H
- #include <NXOpen/NXException.hxx>
, r5 s' @4 w7 R - #include <NXOpen/Session.hxx>, m2 G. a9 b2 `3 s2 }( |
- #include <NXOpen/Builder.hxx>
; R2 X0 i Z" _- V$ P - #include <NXOpen/FileNew.hxx>
R( a h+ y5 O - #include <NXOpen/NXObject.hxx>
, y6 _7 G" i9 A1 K8 J/ Z+ ` - #include <NXOpen/Part.hxx>
' a& X. J$ }3 d2 j& H! F - #include <NXOpen/ParTCollection.hxx>
2 [+ M) v6 E- H - #include <NXOpen/Preferences_PartPreferences.hxx> j$ G3 X9 _% I
- #include <NXOpen/Preferences_PartSketch.hxx>0 [9 k- {0 l" S& {- G
- #include <NXOpen/Preferences_SessionPreferences.hxx>
# o* w* u$ C$ m+ f* W, j - #include <NXOpen/Preferences_SessionSketch.hxx>
) N7 a; Q+ u \. a0 m6 [ - #include <NXOpen/Preferences_WorkPlane.hxx>
. w/ c" e' C; k$ a9 I) p; m ? - #include <NXOpen/Session.hxx>8 A3 d: }0 u1 F, G2 w6 I: y |7 [' W
- using namespace NXOpen;
- u! `8 w- Q' n
% T8 o0 h6 ?( V* y- extern "C" DllExport int ufusr_ask_unload()+ t% Z4 |* W- M
- {1 y6 F. k4 K6 _% b: l
- return (int)Session::LibraryUnloadOptionImmediately;
& _6 X6 u5 {8 M2 ~% o8 s - }
5 U' F8 f5 e) F V- x - 0 b# { | v/ N% z2 ~- L+ C
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
2 f8 i4 q% Z& Y; ?# U5 Y - {
- N# ^4 i% j+ o; z - Session *theSession = Session::GetSession();
$ r5 Y1 y7 w/ A; L# }9 N! J - # n1 ^7 ~* P2 b* K% ~
- //Creates New Part with name as Preferences.prt
6 ?+ ^2 s3 w# N. B! k - NXOpen::Part *part1;$ T0 C8 z) `* o1 z
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
: \. g8 e: [, o5 h8 J! u - Part *workPart(theSession->Parts()->Work());
1 }* f5 y+ S+ T4 r" Z8 \8 l - Part *displayPart(theSession->Parts()->Display()); * ?; [1 r* n8 e3 w! L8 z/ _
' a, D; J5 h! b2 c0 |8 V- 4 h2 V$ P+ h- R; L; H
( n) l4 M8 L* j- // ----------------------------------------------- F& I* Z" m- x$ m& o0 M, e
- // Changing Sketch Prefix names: v% @: l9 h: _0 _( i& ^$ p
- // ---------------------------------------------- 6 d% A8 z3 s5 C4 H/ W
-
+ ^1 Z. d) a! d# x# d0 N - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");
7 Y9 A7 @8 C0 {$ T - " i1 ]8 T2 v7 r" `
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");5 C# N" d+ e7 p4 S' |
- 4 a, w+ D" J3 r& L& L
- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");) s8 @" M/ W2 _" X) M- Q; s: P
: `1 n+ k$ I- G; R( H3 e4 h- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
% b3 V+ c+ V- x) j' U4 ^1 ^ - 0 N# X5 }& K6 B: j! ?3 b
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");! p& M) k) X. h. d" {) J
- 5 d& N% h2 d3 b9 N2 C1 K6 }
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
: s2 N0 f# a2 r4 W -
' x7 O% \( S; t) e* N/ n -
3 b+ _% ^: U" |1 j - // ----------------------------------------------( P6 c, X+ K" K$ K" J% k( A' @
- // Changing Grid values
+ m1 y# F' B/ H - // ----------------------------------------------
6 b" ^; H4 H. t: u0 J% J$ `( q - 5 j8 e5 R4 Q/ C H- k
- Preferences::WorkPlane *workPlane1;9 g6 E$ ~& o8 ?1 {
- workPlane1 = workPart->Preferences()->Workplane();
4 T# y1 d3 N8 ?# u I" j - 7 M6 T! ?4 \: v$ T* {9 n0 T
- workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);, Z) X( M; e3 @7 J. W7 A, ~
- " X. ^7 r m* o' n. @
- Preferences::WorkPlane::PolarGridSize polarGridSize1;( n, z3 q; ]4 }
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;7 E% O, f5 i z0 A& x2 L
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
, G2 t* I- l3 y3 c+ m7 t - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
% h) @0 i7 D: a: a6 T& ^ - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;4 |$ k3 v0 @1 p
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
5 e0 \+ w/ e. Z - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;) _ R6 {7 K. U4 U
- workPlane1->SetPolarGridSize(polarGridSize1);
; r: y$ C9 B2 l0 j3 P - / i9 R, N7 G" Y* b. T
- workPlane1->SetShowGrid(true);' G9 y9 E+ e! G0 H
- 4 v: y6 m* A' C i, l
- workPlane1->SetShowLabels(false);8 j& q/ l* \. v) X( B5 r
-
+ t9 \* }' g; e/ O: v- k" G$ O V( P - workPlane1->SetSnapToGrid(false);8 G7 T6 r& u! e' f. _) b6 L, U
-
) m% I" O8 j* Z0 k' `7 p - workPlane1->SetGridOnTop(false);
6 j/ [5 x' w0 R -
( B' a5 @8 S2 w% M) }( ?4 N8 e - workPlane1->SetRectangularShowMajorLines(false);5 ?! \( D5 K* j( p/ r
- * `" a4 D6 ]9 i+ b8 b
- workPlane1->SetPolarShowMajorLines(true);5 i+ @0 \1 G! J4 h
- 5 G0 @- h# G+ ^/ R7 S3 q
- workPlane1->SetGridColor(130);
. k* v0 ], N+ I) e4 [! `/ g - }
复制代码 : K) o0 p0 ]$ l: q: o
' l* F- n5 |8 s6 M6 S; |7 ]
: @2 ^: j" b( _+ }4 k, C |
|