|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:
3 q2 G2 p9 M0 t9 F/ U
, m q/ W5 l+ D, ~' p
9 Z' t; R0 G6 X o- #include <uf_defs.h>
9 \5 j8 E0 ^1 w, Y A' w - #include <NXOpen/NXException.hxx>
( @. [4 O9 C D/ F, G - #include <NXOpen/Session.hxx>; G5 r& T" N; c
- #include <NXOpen/Builder.hxx>
/ y1 R& }. a" J4 b. S6 j0 d: U4 F; `0 V - #include <NXOpen/FileNew.hxx># m; x; m, B5 r6 a+ I
- #include <NXOpen/NXObject.hxx>
4 e, m" T# V6 a - #include <NXOpen/Part.hxx>
% q9 m" ^) B" T9 c. R2 t. f - #include <NXOpen/ParTCollection.hxx>) s0 v2 x$ x% | }& D1 {; h
- #include <NXOpen/Preferences_PartPreferences.hxx>
: t# p: h% s- p" `* [- s - #include <NXOpen/Preferences_PartSketch.hxx>
+ ?# ?' ~1 d5 ]5 R7 d# x* ] - #include <NXOpen/Preferences_SessionPreferences.hxx>
+ {% _& r7 \% ?* ` - #include <NXOpen/Preferences_SessionSketch.hxx>
: I4 l9 l+ N2 K5 ^9 A - #include <NXOpen/Preferences_WorkPlane.hxx>
$ \7 t* [# v, ~+ ~3 M: K) K" z; p - #include <NXOpen/Session.hxx>
% p3 ? |) _) b# u5 T) `7 K - using namespace NXOpen;
& J: e8 T: [) W( F( z# H
+ n5 f6 M0 J9 p" t. N- `- extern "C" DllExport int ufusr_ask_unload()
- C# E# ~' ?6 ` - {5 P! s3 G; F2 Q* U
- return (int)Session::LibraryUnloadOptionImmediately;
6 h: V+ i1 S0 x- A6 ? - }
. q/ o* _1 v/ o% ?+ [ - ) B6 p+ @& o4 l* g. v/ b$ ~( F2 O
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
5 u6 W) ^0 g& v* K - {& q% y7 Q1 {' P c5 [
- Session *theSession = Session::GetSession();
- W8 H) _# {0 M. R$ u E- ?
0 a9 \2 _; d. B( o# `9 g/ A2 d- //Creates New Part with name as Preferences.prt
$ ~2 {0 L$ T+ A& E - NXOpen::Part *part1;8 z7 o5 p. ~# h, I+ `
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
3 c/ a; ]( Z9 E+ b7 m- K - Part *workPart(theSession->Parts()->Work());0 k0 `1 V# Q2 a" R5 T# `
- Part *displayPart(theSession->Parts()->Display()); 8 [- A( @, q7 J3 J
- 5 h) j9 M0 t# |: v+ D( r" Y( Q
- 1 ~$ C: H- U# g
- 3 Z/ U, j) F# G8 [. T$ O2 U
- // ----------------------------------------------4 g- {$ u3 C" Y: U
- // Changing Sketch Prefix names
0 ?! h, s# A2 l" U: O - // ----------------------------------------------
4 J& d% _3 ^1 o8 R; s - 3 o. ^( y( j5 T: D% U
- theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");
& A: m% ] Y; v - 6 k& _3 v. P7 z( h
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
/ w( \! |9 ?. j6 V3 j - - D% w; q" X3 M2 G* J/ m
- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
9 F- \- l9 F1 r+ I7 Z - 3 n" Q) g7 t# a# ]3 p
- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
: O& q/ H. u8 O5 M, M2 Q( a0 g
# u1 X* r; B+ o3 ]- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");4 E: {* {& a; G+ g0 @1 }
- - ?) v* l/ C: X
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
6 Y' ~% {( d' G$ Z6 ^ -
0 j. e4 G8 h: R - . m+ d4 e3 @+ n8 m7 W* |" z
- // ---------------------------------------------- T% t4 L ]8 A
- // Changing Grid values
& u5 |/ `" B2 d& V - // ----------------------------------------------
' Y6 D. d" C2 Y# f4 B/ ?, z -
9 m5 Q) l4 |: ~ ]4 w - Preferences::WorkPlane *workPlane1;
# l7 ~: Z! ` q - workPlane1 = workPart->Preferences()->Workplane();
8 {" V3 e! p9 O -
9 I8 h& I. N. t" k - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);2 @& F I( K3 G7 a: b
- 7 ?! _" q* Z. M
- Preferences::WorkPlane::PolarGridSize polarGridSize1;8 F! ?+ N. p" }- @0 _3 }1 V
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;+ R6 v1 N4 j& F
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;6 _, h2 S" F$ R' b9 N: L
- polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
, \# E) I, z# N4 l3 @, x5 B - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;
; \$ i9 C. J) b" C; {& K; A - polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;2 X" z1 v: S Q- K
- polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;5 v1 e" o; {2 {6 i: I
- workPlane1->SetPolarGridSize(polarGridSize1);
' l6 N s8 t$ m6 ?( y: o8 | - ( P, {& t. b) H6 m3 Z
- workPlane1->SetShowGrid(true);3 S, S! a( f9 M: T* T0 Z" [
-
+ E$ n% N- E7 [! s; ] - workPlane1->SetShowLabels(false);
% H3 y9 v0 _# Y1 Q/ R+ {7 y - 3 p4 a! T3 t0 ~) c% y3 Q* d
- workPlane1->SetSnapToGrid(false);. {( S/ ]- O+ G6 R- o b. `
- : F) h5 U7 B4 g$ {0 _/ P' i: O6 U
- workPlane1->SetGridOnTop(false);; I! j2 a# G6 S3 L- \
- 2 R! B5 j( C/ I
- workPlane1->SetRectangularShowMajorLines(false);+ b/ b* H1 {/ b+ `! T; ?$ a* b6 J
- " u t+ O. n% m0 ~* q8 W
- workPlane1->SetPolarShowMajorLines(true);, d+ B8 d% E5 K( w
-
* j( O( l8 s" k! q/ z2 p, X - workPlane1->SetGridColor(130);
" ?, J. C6 `: I) f6 c) e3 [8 m - }
复制代码 ! T5 l. a8 [* z+ @. {
% g" U* ~4 E7 [% X/ o7 W
* T) Y+ o1 }' J/ U8 D |
|