|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:& f Q* D+ F/ c% J- s
7 `+ d* A1 T4 D& x) J2 q- ' F+ O7 `% N0 X. L& R; ]
- #include <uf_defs.h>" ]) J# d* o7 W2 j$ G
- #include <NXOpen/NXException.hxx>
5 |/ i: Y' O6 u3 [ - #include <NXOpen/Session.hxx>
" [( b! O$ ] O3 B - #include <NXOpen/Builder.hxx>
, J8 G) [3 |$ a- n& Q, ~# Y - #include <NXOpen/FileNew.hxx>- D2 r5 B F) _ f2 \
- #include <NXOpen/NXObject.hxx>$ s. N) k2 q: r, n. \
- #include <NXOpen/Part.hxx>
1 s9 }# n) r4 f1 `! a3 p- J( K - #include <NXOpen/ParTCollection.hxx>
+ } s- v8 _" ^7 M - #include <NXOpen/Preferences_PartPreferences.hxx>
5 {' Y: h, N) Q0 p( Z6 Q. e7 D - #include <NXOpen/Preferences_PartSketch.hxx>
; I* o' p- m1 A: J" y$ z - #include <NXOpen/Preferences_SessionPreferences.hxx>+ f: v0 S) x2 Q4 n8 O, B+ Q
- #include <NXOpen/Preferences_SessionSketch.hxx>3 U& v- _+ q! \" C
- #include <NXOpen/Preferences_WorkPlane.hxx>4 @1 N* z. B6 C/ ^7 `
- #include <NXOpen/Session.hxx>
+ C! R; ] l" }: J - using namespace NXOpen;, r2 a8 ]; J) ^# a
- ; u1 e; }' w- R& i) {& t) N# h' @0 O
- extern "C" DllExport int ufusr_ask_unload(): i' J9 O& h$ z5 n; y9 A
- {
3 M3 k& G/ V1 T3 s+ a. i( Y - return (int)Session::LibraryUnloadOptionImmediately;
, P: X: w7 Y, v- g - }0 [" Y! O {' r7 z2 M3 z& R
6 \# s3 J1 l- h% g- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)2 R. e/ w* o4 U6 l! {7 E6 t
- {
" \: G5 I0 Z2 G' a* ?4 [ - Session *theSession = Session::GetSession();' x6 a! _4 W& d! V K: W! S3 R
; I; P- L. S/ L# `- //Creates New Part with name as Preferences.prt
7 _- }: v2 M' V% j2 y; ?7 ?1 k) { - NXOpen::Part *part1;% `, P5 u8 Y- f# s7 G
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
* a5 V p/ E! L5 ^, S6 s$ h! {/ d7 ?+ U" R - Part *workPart(theSession->Parts()->Work());
; u0 E' K6 X$ W# K8 R/ Z( B - Part *displayPart(theSession->Parts()->Display()); * {3 B0 M4 ~8 I& S1 Q$ j/ }" J
& l8 i2 v1 G5 M% f
& K7 l0 ]- v9 m( N- b; z8 G1 r/ B# t
- // ----------------------------------------------& ?8 V2 A f+ ?
- // Changing Sketch Prefix names7 n0 I* X' ]' E% Z
- // ---------------------------------------------- ; q; O+ z7 a w4 M9 k
- 8 R% W0 g8 x( n
- theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");* `) k+ c4 L, {- W% t% A
- . E' ?! I# @: @* x! W
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
5 \. q, O6 g0 D( H- q - # X, m1 i8 Q% _
- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
( [( g8 Y' a( i6 C
. q2 ?. f, k; ]7 h4 z# b) C- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");% F$ n' g+ U8 S+ ]' G/ q e9 A
1 N4 H. N y9 q* B/ k8 i- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");: F3 s, C* h1 {, Y6 g8 w7 i
- 0 p5 u2 a' e# y' ^, F
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_"); 3 g3 c6 c) V1 y
- 4 e; u0 ~2 p! g- {, R4 \
- ( R0 n( A( Q: {& k% a3 A
- // ----------------------------------------------- y E9 e1 C( n% X
- // Changing Grid values- [9 ~* N+ z% ^% F3 E
- // ----------------------------------------------
, h; ^6 w6 g) i& Z; ^$ `$ f$ p -
0 ?' b% e! ~7 K+ E2 m1 j - Preferences::WorkPlane *workPlane1;
2 i$ t2 M/ w ]. I1 F0 P+ e - workPlane1 = workPart->Preferences()->Workplane();
& j& E+ @8 Q# A; a4 f -
- g8 v- s1 p, M1 Q - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
) ]$ f! x7 A: C6 U+ G9 [ -
' \' t- ~0 r" Q: }. w - Preferences::WorkPlane::PolarGridSize polarGridSize1;9 H$ K' g' `4 |5 ~) `
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;
: k( m+ W0 b7 Z! }& I - polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;9 B. E* H) o: V* q# z" J$ g
- polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
; d8 ~3 d% C+ }, ]3 | - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;8 x+ _- F [! R) O. m
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
& M, ?1 p( N8 X, e9 S6 Y" ~ - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
# r* e) C3 `% e. g9 h% @6 S8 s% s - workPlane1->SetPolarGridSize(polarGridSize1);
( k7 f2 U1 q/ N1 `4 z' T$ W) ? - 2 d6 N1 r+ R9 W/ a/ {
- workPlane1->SetShowGrid(true);
, m. }+ x3 H6 Y2 J! ? -
% X+ H0 i! r2 w* g5 @ - workPlane1->SetShowLabels(false);: l5 g2 w* m! S
-
8 {4 S1 g0 L# |9 @: F6 H6 @ - workPlane1->SetSnapToGrid(false);: F' o4 T) W- {; Y
- h, }+ F: [2 [% ^! [
- workPlane1->SetGridOnTop(false);
/ U% P4 h# B/ e. N -
6 V% ?/ F3 D# A" H! E5 l - workPlane1->SetRectangularShowMajorLines(false);
+ V: }7 D; r5 N5 g - ( t" h; z0 h7 A' }% D( _/ a
- workPlane1->SetPolarShowMajorLines(true);0 [5 J0 r/ C& L9 y" i
-
1 @. }- W% K' G1 L5 ` - workPlane1->SetGridColor(130);: ?0 D" `! P r9 G8 _' ]+ b% G- i
- }
复制代码 $ L8 }2 j" G& W T* B
9 o1 E/ \' }( S5 }7 o2 b
# r( x( t4 S Q' [8 M' y
|
|