|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:
: O5 r% e4 y/ \- W6 b/ i! N! N0 c3 N
G( @" O$ j& i) v5 J, j$ G- #include <uf_defs.h>
! `7 y5 \: l5 ?% v/ G - #include <NXOpen/NXException.hxx>
$ I, a% l- S& q+ l% N - #include <NXOpen/Session.hxx>
2 F0 V$ @1 u% E: D - #include <NXOpen/Builder.hxx>
! S' S6 ~& J9 P7 S- H* V3 k* I; N - #include <NXOpen/FileNew.hxx>1 `( h3 H2 T( u( ~
- #include <NXOpen/NXObject.hxx>
8 F, Z2 |: ~( d f* f& F - #include <NXOpen/Part.hxx>/ O4 ]2 s g* J! H2 e. R
- #include <NXOpen/ParTCollection.hxx>4 u a1 Q& I# n E2 _8 T
- #include <NXOpen/Preferences_PartPreferences.hxx>
9 [* n& D. [6 q% a. C% [" ^2 ^& ~ - #include <NXOpen/Preferences_PartSketch.hxx>* c( w0 c- W/ Z/ m# G
- #include <NXOpen/Preferences_SessionPreferences.hxx>
( {3 H/ e4 r0 d - #include <NXOpen/Preferences_SessionSketch.hxx>! i( y2 Q/ Z# ~4 {! T ]
- #include <NXOpen/Preferences_WorkPlane.hxx>
% i. _8 |( Y9 R$ q. _- \2 \ - #include <NXOpen/Session.hxx>
1 a' G, v) U3 B* @2 y: @8 y - using namespace NXOpen;
* @9 L: u2 ]9 A - 7 ^1 r" a( W! x% a
- extern "C" DllExport int ufusr_ask_unload(); I7 t( |+ S3 Q, A( B
- {" Q/ o+ N% G$ v; I( \( p
- return (int)Session::LibraryUnloadOptionImmediately;& w* L* c, b+ V( `
- }
2 J) J* b( Y) o' F8 q2 h
, W) y. p2 f) c- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)# h2 d4 Q& c0 n' o! H8 c% v2 u
- {3 O! O" z/ m+ R6 [9 a
- Session *theSession = Session::GetSession();3 L( q8 J( X3 r6 }: j: G' {& m& z; r
]/ V X6 ], Y* N. _- //Creates New Part with name as Preferences.prt1 z. y! H0 K, }4 J; d
- NXOpen::Part *part1;# I: h7 \/ H' u* M' L$ [
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
I$ B- F5 y5 N, A% J# x - Part *workPart(theSession->Parts()->Work());
6 g; ^8 @9 l- L! b7 B1 r" N - Part *displayPart(theSession->Parts()->Display());
# z% m0 s) q0 k/ X: p/ e - . t7 d9 B2 q% D6 L7 ^/ l0 ]
- 2 l; Y. A* G* y" I5 ]- k! K0 B8 M9 I
- , Q& q2 Q" m8 D7 w8 @
- // ----------------------------------------------
# n6 J$ r! ^, o) x6 l @ - // Changing Sketch Prefix names7 u; S% D t+ S0 U! A* _$ P# m; d& {
- // ----------------------------------------------
# W+ o1 y9 Q! _. f { - % h8 h# F) O% f' F
- theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");
% h% H: a3 ~( l7 v1 L
9 @! F+ M# U; p9 Z* O- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
8 t( R% A1 P& q: [9 Q
! V a/ j- r# b' Q$ N# l- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
1 r+ h; y+ O3 K$ r) G% ]2 t, _. f2 V - ; e4 z; C2 m2 c- a2 c$ j
- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");" a/ S. ]' y* [" w
! `+ B8 E; L l9 a* j# s7 U% V- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");- H/ N1 j, t. i% f
- 4 m8 S3 t8 v# ~" U+ \& Y
- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
4 d- ^- a0 H( J5 ^( n6 S - ! A+ O* P W" K
- $ b/ z. s* {# \* _% t" X0 v0 [
- // ----------------------------------------------% l8 s- z8 K& T+ w" G" K5 V
- // Changing Grid values. Q( r3 M C/ H2 Z* I, c
- // ----------------------------------------------
* Y& ~' {: Z9 ] y& V - ; E6 v8 Q7 ?! `5 Z( W: ]/ L
- Preferences::WorkPlane *workPlane1;$ I1 u3 ?: A/ F
- workPlane1 = workPart->Preferences()->Workplane();; B. R3 r8 m; J( J: U
-
* ~ K; ^# k$ i6 G( o0 k3 R! p3 c - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
/ _ a8 r5 k* K5 |) l8 K7 e6 N" d -
0 T8 k- E) {# \' n6 [$ R - Preferences::WorkPlane::PolarGridSize polarGridSize1;5 S% R# \! L' A& y
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;3 z+ l0 C: h* i6 D
- polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
& l* t O% g+ E* J7 u# J8 F9 s" M - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
- l$ P7 a8 p. W2 E# o4 @* G - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;
7 A2 b; _' T, I/ s2 O4 j$ ? - polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;1 }( k. b' J! g% I/ }" J# C
- polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
# f/ x* o5 S8 R, b) ` - workPlane1->SetPolarGridSize(polarGridSize1);7 j+ b, H2 R* J0 v% \
-
, ]" b8 ~6 n {: w - workPlane1->SetShowGrid(true);, {! ~- V( ]& `, W" Z
- 2 i( b/ w8 i" ?. [
- workPlane1->SetShowLabels(false);
. m9 }/ j8 i# z5 k) _6 I - 1 U8 A; C/ ~0 F2 @
- workPlane1->SetSnapToGrid(false);
5 [5 ~: M B# X( w4 V' P- e1 C - * k! X7 f. W3 Y) m4 [
- workPlane1->SetGridOnTop(false);
) R& `/ v6 T% n% X& O - ' _# I$ S/ t( c0 C, s: D- B% y1 b4 G) q
- workPlane1->SetRectangularShowMajorLines(false);" a5 f. Y q0 m* }7 K( O
- $ W6 a% W3 i9 F$ j7 H6 B
- workPlane1->SetPolarShowMajorLines(true);
" v/ s! b4 Z$ L$ X- @" @2 { -
. @( v7 Q9 A; \4 o, l' X6 y8 [ - workPlane1->SetGridColor(130);
: u2 t2 f7 l% x2 F, v - }
复制代码 / @% a( w1 R% r$ ]& _1 {% a" G6 y
8 X. _# S6 ?" j- m
* h/ c" I4 A( \ |
|