|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:
f* [; F) v; o, a# o1 i/ R/ }
; U X2 ]2 i+ F. w$ H7 X+ r: F. n
7 d. h( n4 j, I( S* L1 y: Z- #include <uf_defs.h>: G5 N7 t2 j( J. e+ x4 W
- #include <NXOpen/NXException.hxx>
f% n/ K8 |$ e1 O) M( @, H - #include <NXOpen/Session.hxx>
# Y- p: J* l; u. [, h - #include <NXOpen/Builder.hxx>
% Z" s. K# i( \" Z, y* z - #include <NXOpen/FileNew.hxx>9 h" I, C9 N W( w+ n3 l, ^
- #include <NXOpen/NXObject.hxx>: f3 U) k, m. B
- #include <NXOpen/Part.hxx>' \9 X3 o3 R% e# P0 ?$ a) [
- #include <NXOpen/ParTCollection.hxx>! W2 M3 ~1 Y5 y& w2 ?
- #include <NXOpen/Preferences_PartPreferences.hxx>+ W" n+ i5 m& Z j2 c! @! B
- #include <NXOpen/Preferences_PartSketch.hxx>
1 d8 F6 z% M" z) b7 K/ c - #include <NXOpen/Preferences_SessionPreferences.hxx>1 a3 ~! c* B$ U, f* ~
- #include <NXOpen/Preferences_SessionSketch.hxx>
) v% N3 n5 M& V! F7 K - #include <NXOpen/Preferences_WorkPlane.hxx>
+ O5 M+ I2 S2 Q4 @* A* G4 X - #include <NXOpen/Session.hxx>
8 Y. n& l" t9 H) Y6 s" F9 A - using namespace NXOpen;
+ {' H' P, O. t+ V. h) x( L - " H9 e c; W. j
- extern "C" DllExport int ufusr_ask_unload()
+ K: l# i- Y# S- `' [2 o - {) }1 e4 E$ C9 n. r
- return (int)Session::LibraryUnloadOptionImmediately;
, v6 _4 m; e) x' o) y# Q - }
& S8 V7 `" Q# O! Y* @. A S - + w! G8 L& x( j
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
3 N. W) ^* f) R8 }1 s s. C - {
5 L4 y' c$ I+ Q. F+ n9 ]9 C - Session *theSession = Session::GetSession();
. ?+ v2 @: u/ F T; f" V
" e1 q) Q: t& h# E; t6 K- //Creates New Part with name as Preferences.prt
! D3 k6 G1 P2 ^9 u - NXOpen::Part *part1;# k% k5 V+ c" a0 b2 X
- part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
/ p& ^1 S# y, R+ R2 m9 J - Part *workPart(theSession->Parts()->Work());
# F# U0 Q: c7 ^2 _4 K - Part *displayPart(theSession->Parts()->Display());
3 U( m9 L" Y! A" q% U% W3 a; S: @
. R8 J* R* D4 J# A# C" E
: w/ ], j+ a5 }0 b! T: D- 4 Q0 Y, d8 A1 j" U& s7 m$ V) T
- // ----------------------------------------------
; U; D# q6 g: b* n - // Changing Sketch Prefix names
9 `/ k) g8 `5 ^$ l1 p5 l! j+ | - // ----------------------------------------------
- S; i( D+ h. L1 C( S; a -
6 @7 j7 a: n6 L z0 q! x& j - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");5 y( _7 G4 `+ p' y
- A# }, K; s. }) E
- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
* P" k* f& X0 W Z. l; S& D
$ Y, Q" y8 a/ T* X6 e) W3 ~- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
U# P" C) L! Y) |- [( |" U" K
+ m m/ q6 R0 e) V- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
5 L( b& Z$ i X: m. N - 7 B9 @1 V4 F- p+ w5 j) f, M
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");; \6 n( K8 M" T
@, S8 a. |# v! K" [4 f/ a* Y- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
% F* ^' e0 L' Q2 g/ l- h" [ -
; t4 a- @ g2 ~3 \. |$ Z! M+ s -
0 W8 S* I o9 t, N; k7 k - // ----------------------------------------------) |! p& Y) L( v) d- X; l9 f; Q
- // Changing Grid values* |& ?8 {& ~& r5 g# X) R
- // ----------------------------------------------
6 D; i! D* ^" [! ~' d - ' v, p$ i, o# H5 p. M- J5 a
- Preferences::WorkPlane *workPlane1;
3 e1 M+ \( ^8 C7 ? - workPlane1 = workPart->Preferences()->Workplane();0 \6 p# s( H7 _* J
-
' ^+ i5 S, Y" a$ i - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);1 p6 i$ D3 `. W1 n; Q0 Q
- - J' C# x$ ~! @" X6 [
- Preferences::WorkPlane::PolarGridSize polarGridSize1;
2 y5 t* u% `( [% ^0 _ - polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;
" w7 }- Y* A2 K( j - polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
$ ^) R' w R. i* U. r - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;- x c5 l' [& R2 B. M3 c( q
- polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;& ~ i$ _4 y& W2 R
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;5 I6 Z/ {5 M+ l, T" M
- polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
6 U9 o/ b. }$ m3 F) T! r - workPlane1->SetPolarGridSize(polarGridSize1);3 S1 r! K* ~2 Y* l7 O
-
8 U+ J5 ]0 N% i) c+ v+ c - workPlane1->SetShowGrid(true);- j" w6 c G" A3 D8 M
- ( c# z/ M' u1 X8 {& ?
- workPlane1->SetShowLabels(false);
" }2 n+ a" ~# ?7 c& Z4 w! |- W! n -
8 ]1 K" }8 w$ c' S# I) Y2 z - workPlane1->SetSnapToGrid(false);
3 i8 }! a$ v6 z- P: e -
# y( X! N- f0 l7 @2 j - workPlane1->SetGridOnTop(false);- z3 D# L7 K( t& e
- ) c- W5 d7 j/ j2 D4 _; \: J! C
- workPlane1->SetRectangularShowMajorLines(false);6 x1 m; K0 }! k8 A" S. m/ O
-
6 F7 `% f6 Z& m% {/ A. O - workPlane1->SetPolarShowMajorLines(true);: f B" s# _3 o3 z
-
7 k6 S7 t$ M$ }) K1 |, f& E - workPlane1->SetGridColor(130);
e% l" N3 }: Z - }
复制代码
7 i6 v2 ~! n4 e- _3 s: l9 N4 e2 H1 l4 I; [+ W3 k4 C& ^, O
; ]/ u2 ]! d# y( L
|
|