|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式: ]: e) B. p* d: j
) |. ~5 V, R; S9 P
% b( o( i4 k6 N. H! Q5 c' B' O) V- #include <uf_defs.h>/ b# _! T7 b! p
- #include <NXOpen/NXException.hxx>
0 g/ u( `! \9 @$ I/ J - #include <NXOpen/Session.hxx>+ l* S- P! q7 b( S- O/ Y% r6 L4 z
- #include <NXOpen/Builder.hxx>& _1 J- x0 s1 r$ N7 F5 M$ b' p
- #include <NXOpen/FileNew.hxx>/ [# x5 ^) ]8 d* a, ^7 h O, F8 p
- #include <NXOpen/NXObject.hxx>
! \5 a9 B# I( e0 C- U9 Y3 O! f! T% k% \ - #include <NXOpen/Part.hxx>2 y0 O% O! d2 {1 W+ a
- #include <NXOpen/ParTCollection.hxx>
7 r! J+ M2 o" e - #include <NXOpen/Preferences_PartPreferences.hxx>, W& J, b' r$ s0 o2 z
- #include <NXOpen/Preferences_PartSketch.hxx>
+ t+ n+ y: J' \5 X* d( o - #include <NXOpen/Preferences_SessionPreferences.hxx>: \7 s: S% b% p' l+ V& c/ |( R
- #include <NXOpen/Preferences_SessionSketch.hxx>
5 t2 S! _8 e' T2 t - #include <NXOpen/Preferences_WorkPlane.hxx>
* U* H/ R5 X. z" h$ g L q - #include <NXOpen/Session.hxx>
! ?& i3 w3 K: S1 ]8 Q$ p6 n' w' @ - using namespace NXOpen;* C# }& H# O" V4 N' b
- 4 d3 G( D0 b$ E% Z% }' m. d
- extern "C" DllExport int ufusr_ask_unload()
5 y0 M; e4 t/ f3 R - {0 |$ P; o1 K) `$ V% }9 P% \
- return (int)Session::LibraryUnloadOptionImmediately;8 Q# g4 q S( S* A6 A
- }# z' a$ i& }6 h' e# q: r
8 {# C2 C+ X) n- Q( T3 t6 r! v- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)' I; N: U) {( u5 d" q6 R
- {
^% i9 v: u" u/ z9 S! |- Z7 V0 \: | - Session *theSession = Session::GetSession();
. Z. v3 ?) H' U - ) a0 s V3 ~$ w. k/ ~4 i0 \# e
- //Creates New Part with name as Preferences.prt
. B9 n [+ @7 }+ v$ x0 H% u - NXOpen::Part *part1;# D3 P4 E; q F" E+ ]( y
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
7 G: S) r( o J0 M - Part *workPart(theSession->Parts()->Work());
+ A7 w0 X/ S% g: X% U2 ^6 |! M - Part *displayPart(theSession->Parts()->Display()); 2 J/ h, j) g+ F( K" ^3 S7 \0 F
- p7 _! [* \! \' ?+ v
. l# q8 Y. _6 a, ^9 ]: [4 x' }- ! w* Q& w! S. x( b/ a
- // ----------------------------------------------# h% y1 p t& {6 t# G! ^% o
- // Changing Sketch Prefix names% R5 n0 P% c0 B% B
- // ---------------------------------------------- & ]& r1 C2 U/ n# Q
-
8 x# _- b' n( C9 r: H - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");0 ?4 M" G5 a% s( f4 m1 ]0 g5 T( Y5 K$ m
, Y; H- i/ k9 [/ w% x- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");7 B3 ~* U7 S' E; C+ P% C; f
- 0 j% U b- W! h
- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");8 j" l* h6 w$ M% F. V1 G
- 9 r. A3 y, Z5 w% N6 {1 B3 Y! w) ?
- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");. W" D0 X2 o ], R( x/ t8 o
- % v/ p3 ?: r6 S& L/ ?& R
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");
0 B4 d/ P% V3 l& l, x
. I) P1 L0 |3 S5 x1 s+ M- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
# P5 i: ~( Z% } - ( e; H" y8 V) f7 L4 o
- % S% h# l" @! \, c, k: w
- // ----------------------------------------------& K3 g9 w+ F! Q5 j5 H/ w- t" `2 e
- // Changing Grid values! B/ q. D) ], n5 d
- // ----------------------------------------------
5 y0 w( f* w1 K -
1 v3 v5 T/ d% I& F$ q8 o" F/ I - Preferences::WorkPlane *workPlane1;! R q; I6 o* G! t
- workPlane1 = workPart->Preferences()->Workplane();
. ^% b P$ c/ i/ l, @ - * _- i* N2 d% ^# m# ~( `
- workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);$ z. [9 e( V; s. x/ k+ d# s; t
- ! E% R {. E; j( ~" z$ } G; s
- Preferences::WorkPlane::PolarGridSize polarGridSize1;, t% Z$ ~* E( U) M( A" I8 J4 s7 e
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;8 f' @9 i: ` g' V" j
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;: {1 w7 C* o8 U* h, N/ |
- polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
9 }7 a; G6 ^- c6 V# l* Z+ n( b: X+ j - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;
+ {" O! B7 H5 @( z4 _8 `; | - polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
: }7 {3 w; A/ c) v N - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;) [7 W7 p# { O2 w0 `
- workPlane1->SetPolarGridSize(polarGridSize1);
* E2 E5 V2 R8 q5 a' W0 h - . P I% E7 v0 }
- workPlane1->SetShowGrid(true);# L4 m* s. N( j% j+ |0 c, D8 N
- / C3 R. p6 c* W# x2 C
- workPlane1->SetShowLabels(false);
5 O/ S; n# q0 o; i. V, c/ J - 9 f) y3 ?# Z/ m& i6 C
- workPlane1->SetSnapToGrid(false);
9 T' r5 q% x6 g1 X -
) e$ H! a% `: b7 b# S - workPlane1->SetGridOnTop(false);
7 ?! V3 |$ T/ w3 P% l -
% d/ B3 {! j% {; Z/ ~" O5 a# | J - workPlane1->SetRectangularShowMajorLines(false);0 z) q, y/ A3 c- \
- / l z- G# E6 p& |
- workPlane1->SetPolarShowMajorLines(true);
, U; p! k, U) H -
! e( E& m( J: \6 x- P - workPlane1->SetGridColor(130);3 f. T+ B. j# K: Z
- }
复制代码
3 P* e2 ]4 A& i1 v0 ~, r8 c5 N8 d# ^, J# i* n+ e1 ~
o: ]( n% l- ]6 ^0 f$ I6 j
|
|