|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:$ `; \$ L" C* L6 U o: X8 y
7 N1 u$ p7 l8 A5 v ]- D2 o
& p2 t2 t& @ u7 L+ ~- #include <uf_defs.h>
' o; ~! j9 j0 ]3 T: } - #include <NXOpen/NXException.hxx>
$ t& w- k. a2 y1 w3 x% ^0 a1 ` - #include <NXOpen/Session.hxx>7 p5 I, a$ r. |5 @% {7 r
- #include <NXOpen/Builder.hxx>
; V2 f) c+ l6 l& Q' }1 ` - #include <NXOpen/FileNew.hxx>7 o' X# [* [$ j& ?% E
- #include <NXOpen/NXObject.hxx>
& m% H0 G% L6 C2 ?4 [4 p2 s, N. d - #include <NXOpen/Part.hxx>2 D$ u- c/ C$ M) j# l
- #include <NXOpen/ParTCollection.hxx>8 |% L. _! q q1 w; d) e8 W; R
- #include <NXOpen/Preferences_PartPreferences.hxx>0 {7 P9 {1 _' ~9 C
- #include <NXOpen/Preferences_PartSketch.hxx>5 D1 N5 R( c! {( [6 b
- #include <NXOpen/Preferences_SessionPreferences.hxx>
1 T1 D8 P: `2 C7 U - #include <NXOpen/Preferences_SessionSketch.hxx>
$ I/ F7 `7 A+ p! {) Q1 n5 X% L0 N- Y0 L - #include <NXOpen/Preferences_WorkPlane.hxx>
/ ^- d \+ y* @2 S, V( t! z# E - #include <NXOpen/Session.hxx>
. ~& i7 A9 ?$ Z: Z3 C& s - using namespace NXOpen;
5 A6 Q1 C* Y4 v. t
- H( S. |1 c- D: V- extern "C" DllExport int ufusr_ask_unload()
7 n1 L1 u' N. `0 F: ]: M! U7 _ - {" k- D, T& m+ j* A ~* a
- return (int)Session::LibraryUnloadOptionImmediately;2 p/ I) B! m% u/ b* p6 J
- }' x2 \6 F4 i) Z! T( b9 t
- 2 ~7 Z' Z' W6 W+ X: f
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
' o+ N4 k" V# z. s* e/ O/ ^5 T( y" [1 U - {. v: k9 X4 q0 e1 m
- Session *theSession = Session::GetSession();
) f8 [5 ~4 W' y- _7 l/ ?
4 S5 O) ~/ J; t- }1 d- //Creates New Part with name as Preferences.prt
8 G4 Z/ J$ U4 a7 o4 ^ - NXOpen::Part *part1;2 [: X" k! h& z9 e
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
4 v* q/ {! h) G7 z8 C5 H Q - Part *workPart(theSession->Parts()->Work());
, l$ v# n3 c% q - Part *displayPart(theSession->Parts()->Display()); 0 r4 M( x9 z+ V* {- t
- - D2 J+ D8 e$ O6 q
- % a0 f5 T0 ^( \
- ; W% d# {4 W2 @, R
- // ----------------------------------------------+ r7 P6 m, q. x% a1 z8 S1 `+ q
- // Changing Sketch Prefix names9 d# V( ]8 d6 R
- // ----------------------------------------------
0 X2 _' o; O) u" m O -
0 u, F( I" Q) j. s: L - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");
0 w( P K; o- F3 G% x: D- S - . m) H! i" p4 H7 [$ p& n! H
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_"); o+ O: O& e% Y4 U* |6 i; G) F
, y" _9 K0 E4 H/ E7 e, x% e# [- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");/ d) f, T W2 P$ W; x4 |& X& v
- 8 V! f) a% |2 l* ?% D( d
- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
1 }6 q. D3 S! i+ ^2 Y - / t+ j+ w: u; L7 |5 J& T
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");
7 s+ F, l# [, X. k6 \& N2 E - . d) k) `. N# W* t# i
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_"); 1 Z8 W( v% i" _- c/ {5 `2 I( c
-
/ ?" {6 U3 a( i2 y' H! Q7 y9 q( R -
8 d4 r, {% Q4 E - // ----------------------------------------------9 c2 o, b' d( Z/ s0 v# b4 Y3 n
- // Changing Grid values' b* w- l4 [% K# R
- // ---------------------------------------------- ) E" B3 p# W! N
- ' f/ D" w$ D/ U8 s
- Preferences::WorkPlane *workPlane1;
, z" F0 Q( ]% {! X4 J+ n$ e9 F - workPlane1 = workPart->Preferences()->Workplane();
K( ^- T7 W, ^3 i$ I1 } - / j, @# a+ q6 t. t5 Z. v
- workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);0 T: a% _1 i) N% q) {& y
- 1 T! v. R1 `& h. `/ @* t' ?8 O' c
- Preferences::WorkPlane::PolarGridSize polarGridSize1;8 K# H, p+ k+ d) W
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;0 t+ s3 K% \% C# i. M' p
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;8 ~# X! s& x1 k" e
- polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
" i* f+ R' n% W% P/ Y. t5 g# P. z - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0; }3 ?, ?+ z6 h& q& Y, d- }" l. j( ~
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
* O: R- k" R( M - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;$ Z& v) S8 s5 x) _5 T
- workPlane1->SetPolarGridSize(polarGridSize1);
. o! \0 F1 Z) L: {: _* k - , P) X4 L8 |2 Y! i. c
- workPlane1->SetShowGrid(true);
T& X3 I+ e" o) ^! @6 ^( \ - & B7 F5 n* l! G& N4 i) W$ Q
- workPlane1->SetShowLabels(false);: E% x4 `. V6 _& m
-
$ r* m" u' O# A: Z - workPlane1->SetSnapToGrid(false);
0 N7 x& @7 S+ R7 Q -
+ o' V, O5 d2 U3 F - workPlane1->SetGridOnTop(false);2 K5 j! K3 ~2 Y" W& j. m Z& |' X
- # K# C$ Y, V" W/ @
- workPlane1->SetRectangularShowMajorLines(false);; c0 |9 P' v( d9 p
- ' o8 D8 I1 a$ ?) m$ T" T
- workPlane1->SetPolarShowMajorLines(true);
: }# X" Y% r, b+ g/ W+ D -
6 O9 `. t3 K) y4 k1 ~5 X3 ] - workPlane1->SetGridColor(130);
6 i5 e, T j. ^3 G) u/ ]; N* z - }
复制代码 0 J2 ~4 a4 ?% t: E
0 X1 U: h+ b4 |6 [+ G
( m0 b! ]" ?2 Z: R) ^ e5 [ |
|