|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:
/ X( N" a7 |# H$ A/ c* f1 ?; i7 v
& E1 V# S8 X2 b ?$ Q
% n) f- [$ V, c4 S- #include <uf_defs.h>3 r. `+ a( |2 k9 u0 m/ s* X
- #include <NXOpen/NXException.hxx>
, a+ e2 t" S& n8 x1 Q' E3 {+ O+ S - #include <NXOpen/Session.hxx>
6 K: A5 x# Z! _+ y+ q - #include <NXOpen/Builder.hxx>
- S- ~* E+ @7 K. j% y; ^( `* i& E% G - #include <NXOpen/FileNew.hxx>4 @+ f2 z& Y. v6 y0 F8 p! s- e
- #include <NXOpen/NXObject.hxx>
; k2 U X9 T2 _ - #include <NXOpen/Part.hxx>3 i7 N2 q9 D L
- #include <NXOpen/ParTCollection.hxx>2 j! w; @2 n# p
- #include <NXOpen/Preferences_PartPreferences.hxx>
8 _' b& _' W7 }; W7 s' y2 @ - #include <NXOpen/Preferences_PartSketch.hxx>
+ {$ M; r% x* @/ w: k: j. y - #include <NXOpen/Preferences_SessionPreferences.hxx> H; C0 {* X9 O4 X/ ^5 @
- #include <NXOpen/Preferences_SessionSketch.hxx>6 [/ l; c1 ?% U, u
- #include <NXOpen/Preferences_WorkPlane.hxx>
% @0 l" k- W6 g& N" `# K+ N - #include <NXOpen/Session.hxx>
, Q6 k: R7 T- `- ^/ P1 g( u - using namespace NXOpen;
8 ]# D. }$ V1 T; f0 _ - 7 k2 \- U- K& _' ]! ^# _) U
- extern "C" DllExport int ufusr_ask_unload()
8 {* y v( B' o" n# | - {
1 {! Y* C1 Z/ H7 R - return (int)Session::LibraryUnloadOptionImmediately;( |# X: q9 p1 ~6 O; r
- }
. u3 K: }0 ~3 i - 8 h( ]3 R7 S3 Z/ @; H% j
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)4 \: n: i( O, W
- {. v0 A- h; h2 a
- Session *theSession = Session::GetSession();2 {# j' A* O& \, P# U; g( S
- o% _- ?, F0 f* I" u5 @3 ~- //Creates New Part with name as Preferences.prt
f3 i( E- l( h1 p, n! ? - NXOpen::Part *part1;
& h/ [8 i+ I W8 o+ e - part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters); + y& d3 U6 A' Q. H9 X7 q
- Part *workPart(theSession->Parts()->Work());
1 E" S( a# m1 n2 | F - Part *displayPart(theSession->Parts()->Display()); # D$ h; |0 r4 W: X N
# y; ]( j6 `% |8 i4 k- * z6 b0 c+ L& i7 ?7 B4 [2 o
' H: |' w1 F& s- // ----------------------------------------------! l5 U9 m& f( y
- // Changing Sketch Prefix names
1 X9 \& @8 j% a - // ---------------------------------------------- 6 |/ j; L5 ~& a, ~4 m$ t
-
?9 N- ]9 c! g; t0 ?. J. f- [ - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");3 R7 L: k" r! t
0 q$ r% }3 x3 U2 E1 M& b- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
5 k) U1 M' @; ]& W# e# i* D - ' ^, ]- J: T- f
- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");$ h" A8 ^1 p& v! V* I& Q" N
3 q2 \- L2 r* u3 \& b( u5 C- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");/ w( Q! d# ^* I9 |
- 3 a, ?- I' \0 N% b( r8 C5 C
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");
' r% S! K* J, Z) h1 e7 E
8 E1 h9 D8 F: S7 _, U- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
3 g2 {0 n" }" J( d -
# t/ H2 l. ^& n1 v4 p: H* N - 5 B8 G) q4 W# |! D' y
- // ----------------------------------------------
0 ]7 g+ q5 m% J- L+ z4 Y - // Changing Grid values
$ M% i( n+ y ^% M3 j - // ---------------------------------------------- 1 M. y, k" X9 D& O+ G* ]
- # Q7 L0 t- o; |/ g
- Preferences::WorkPlane *workPlane1;6 [3 Z# \5 @6 |& T
- workPlane1 = workPart->Preferences()->Workplane();: G/ i. S6 B8 {# z
- $ W5 z( [$ I, }/ T
- workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
5 l9 s$ z% F7 z; _( S) D -
7 E! ]( I, I6 C+ K" {7 p5 }0 `6 z - Preferences::WorkPlane::PolarGridSize polarGridSize1; d3 n. D" K. a. d6 Y
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;* g' q, A+ R* z+ Z7 F8 `. O% ^
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
6 Z3 J8 v$ I0 J5 f1 w) c - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;- _6 F! i# K$ y* a6 M5 p& R
- polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;! D# ^+ h4 _# y* H4 K0 C
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;% e& v7 r; J$ M' |1 P
- polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;( Q& y; s2 U! ~0 N/ O
- workPlane1->SetPolarGridSize(polarGridSize1);" r5 s. P$ A9 l7 ?
- 4 G5 C1 u! ~+ y, @
- workPlane1->SetShowGrid(true);7 j' V* m! {6 V* N C/ B9 t* ]6 ^
-
_ F& k9 d0 w( V [4 Z - workPlane1->SetShowLabels(false);/ W# Z3 Z5 X( ]1 ?
-
/ ]- X& o/ {4 L" G9 F" C9 j5 f - workPlane1->SetSnapToGrid(false);
/ {) O1 w, C2 H$ X! w -
7 [. T+ ?6 ?, r' M - workPlane1->SetGridOnTop(false);3 [3 O* X2 J( ] q4 e
-
& u# i/ G) U- \1 ? _2 K0 Y - workPlane1->SetRectangularShowMajorLines(false);5 L7 s1 p& L5 y( i( p
- 2 a' K% E0 R6 H7 ?8 N0 a; m+ E* Z
- workPlane1->SetPolarShowMajorLines(true);
8 Y0 S) N1 e2 p -
, M: \/ v! z1 F; o; K+ p - workPlane1->SetGridColor(130);
1 }+ r- I! Y6 S2 @/ G$ y- n - }
复制代码 + R5 |6 \: j2 U0 ]6 S
$ s! X9 S5 ]/ ~0 B$ h L4 G
6 q: o* _ c& y, h$ e |
|