|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:
6 G8 E: t3 |" I% v: A4 X2 s& H' y5 N5 h" I9 ~
, ?5 M2 a2 I* ~2 J- #include <uf_defs.h>( R Y M3 x$ R/ G5 h n! v' `/ n
- #include <NXOpen/NXException.hxx>
- U9 x9 E- q8 U$ u7 e9 f - #include <NXOpen/Session.hxx>% r. Z1 G k$ ]8 C
- #include <NXOpen/Builder.hxx>: b2 G* M2 M" T
- #include <NXOpen/FileNew.hxx>
* c! R. Q( G8 T+ Q! O, t$ | - #include <NXOpen/NXObject.hxx>
4 P3 V( ?5 O3 }2 O# c' ~& r2 U ]" x - #include <NXOpen/Part.hxx>3 S2 f$ ~0 m/ w
- #include <NXOpen/ParTCollection.hxx>
) s4 H1 J$ l2 H) E. y3 T - #include <NXOpen/Preferences_PartPreferences.hxx>
' G' y- ?0 J& P; A6 G; H - #include <NXOpen/Preferences_PartSketch.hxx>
* A; P% I7 q9 ?: _ - #include <NXOpen/Preferences_SessionPreferences.hxx>! Y0 b& E$ |7 Z) m1 X$ c7 O
- #include <NXOpen/Preferences_SessionSketch.hxx>
: h6 C( `9 D, i8 E* l- w" q' b - #include <NXOpen/Preferences_WorkPlane.hxx># B: k; @0 [$ h7 d
- #include <NXOpen/Session.hxx>
+ t8 |1 L% r$ L4 c% P. p, f+ a1 N A; d* f- P - using namespace NXOpen;5 k' [0 f9 ~+ a/ w
- 8 i) v; H/ Z! E9 a. ~
- extern "C" DllExport int ufusr_ask_unload()& T/ O2 @. [) C
- {
/ d/ O/ E/ k$ M+ ` - return (int)Session::LibraryUnloadOptionImmediately;
9 W5 J$ b3 i) I, W( C) i, R - }
, p M. [" K9 `; i" r* K' U - 9 h) V Z% K* Q6 _( k
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
7 x. n5 u7 c+ v9 m& h9 Y, w - {* }0 {3 F4 E% X" F! K
- Session *theSession = Session::GetSession();
6 `' u+ Z5 g1 C6 q
8 E* |" m* @, v5 B4 i- //Creates New Part with name as Preferences.prt! Q. d. d5 S+ K/ k7 j$ S M
- NXOpen::Part *part1;
1 Q; e- G5 F1 d F7 Q# J - part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters); $ K/ v% C' O1 O0 j
- Part *workPart(theSession->Parts()->Work());
9 e$ o! Q' H, l7 Y8 [ - Part *displayPart(theSession->Parts()->Display()); ' Y& D# X7 d$ |, b: z- F4 S
0 Y/ D% U3 g- ^: t1 b) L- % w% T0 M) g6 P# n- B4 D5 L$ v
8 _+ H. X! I2 \; g7 h$ b2 I1 v- J6 ?: \- // ----------------------------------------------- E4 X' g, c9 F o! Z# @, U
- // Changing Sketch Prefix names
) D: u" M/ }% |; u4 w! j5 \% ^* \ - // ---------------------------------------------- % G9 ]' T0 x6 N+ V, O7 l; K& Q
-
6 j5 o9 T* p, B - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");; ?3 y+ i/ N3 v
- " T/ Y$ [* q) g
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");3 N$ B8 {0 h( N
1 T6 B1 A: r1 |* e4 J: l- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");% z: j0 V+ @6 \* }; w
# [ V% {& ?. Y: y9 t$ Y" S) o- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");# I( o$ ?7 U. t3 u- A- f
- : a$ X# h' P/ ^6 [
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");, t+ b: S0 C* m3 \, W
- 9 G3 e% e6 U; }
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_"); * [: w3 n8 N1 z5 }: X
- " K& V8 }/ g1 ?) _; v
- / ~. P( G) ~8 a" ]/ T5 G+ s3 `
- // ----------------------------------------------+ O1 R1 G; v8 A, S8 i
- // Changing Grid values) r/ l% d9 r' l3 _. N( j
- // ---------------------------------------------- 0 h# W9 j& A8 X8 L W" w
-
* U% L0 F. d2 @# X1 `8 ^ - Preferences::WorkPlane *workPlane1;
4 d. m) G; v# X! q - workPlane1 = workPart->Preferences()->Workplane();' K/ u0 S+ @& c# }) Q$ p& h
- ' L" ~' n. @3 f9 i% W% R
- workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);: w5 b1 r, F1 E: r3 c* p# l
-
1 b5 n. V" |% {' y8 ?5 o! x' b# Y - Preferences::WorkPlane::PolarGridSize polarGridSize1;
) o4 f6 m% Q" M3 w$ N9 o# ^- x4 @ - polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0; k# }( }- }, O0 @9 N
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
' V, I8 x) H: s% x7 z) D - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;5 d! Z: n6 d0 `6 E
- polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;
0 m# Y; _& Y# Z% ~# u - polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;7 a) Q2 O$ q$ Q' b. j/ Q
- polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
0 z& t) i; U- `" i7 K* C) l0 R - workPlane1->SetPolarGridSize(polarGridSize1);
8 V8 |4 B" Y7 y |: n: H$ D0 n/ k - 0 I, ^1 t/ q& U2 s/ u
- workPlane1->SetShowGrid(true);
& V- ^: C3 w d( @- {5 B -
: F1 N0 ?0 g0 m. n) h - workPlane1->SetShowLabels(false);
# o8 ?8 _. S# i6 V, ?+ J0 y - # l" C& m$ U' o% ^
- workPlane1->SetSnapToGrid(false);) o5 \" @2 |+ a0 ?+ a+ S1 u R
- ; d% X) ^8 {9 k
- workPlane1->SetGridOnTop(false);
6 y% Q% T/ Z5 I2 W8 r Q$ P* C -
" q7 h7 X) ]& N - workPlane1->SetRectangularShowMajorLines(false);# D5 u M5 g F0 P# W9 D) e
- % E% {" K; ?: n( F) r* M% C
- workPlane1->SetPolarShowMajorLines(true);/ P' E Z+ C- D7 ^
-
# d& x" a% w+ j( Z6 m$ ]- o- y - workPlane1->SetGridColor(130);7 w$ W3 `1 M5 `2 s6 b
- }
复制代码 * w5 x. @8 C- U
$ c) _9 \' O0 A7 {/ y/ Q
" p f6 c) h6 Y" u |
|