|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:- g7 A+ H; D/ w+ Z$ d2 m" I
/ G. w& d4 }$ \* {" T8 [: _: d/ @3 q0 g
2 R$ I( d. i, ~6 J# w: R0 s, m- #include <uf_defs.h>, |& b( }! o9 v7 M/ Y. a8 N2 M
- #include <NXOpen/NXException.hxx> r3 a9 r2 q( |1 ^
- #include <NXOpen/Session.hxx>7 E8 y" q6 @4 v4 T7 f" f0 v
- #include <NXOpen/Builder.hxx>
. }+ c5 H" ^- d% I9 ?" B7 c - #include <NXOpen/FileNew.hxx>; ]6 p' V: k6 T6 @* {
- #include <NXOpen/NXObject.hxx>
+ g$ ~% @% Z9 d! m4 r/ f - #include <NXOpen/Part.hxx>" j1 R+ M j- O0 n. o
- #include <NXOpen/ParTCollection.hxx>
9 }! ~, x5 @; {- o - #include <NXOpen/Preferences_PartPreferences.hxx>
' q1 \7 g1 E9 x0 V - #include <NXOpen/Preferences_PartSketch.hxx>
" V# H+ {( d o. i% @# A0 { - #include <NXOpen/Preferences_SessionPreferences.hxx>/ K V; N' N6 q" L0 H b1 n) v
- #include <NXOpen/Preferences_SessionSketch.hxx>8 L" l; |& O7 @, H- k& {
- #include <NXOpen/Preferences_WorkPlane.hxx>
7 y4 k% o% ^3 J7 R4 m - #include <NXOpen/Session.hxx>
2 ~+ @) e6 C# _ - using namespace NXOpen;
4 g8 y3 E2 v! G& X
k( y1 D, M) l3 h- x, y- extern "C" DllExport int ufusr_ask_unload()
% y. ^" U% [. b" d - {
7 A: l8 W) Q' \ - return (int)Session::LibraryUnloadOptionImmediately;
2 B! _4 J& l* \" {+ I9 n - }
}* Y7 M7 M. H3 |" X - . k4 E& Q# _4 |! d" {2 Y5 D
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
. X# z6 R) I2 n; H: K. \; ]' ^8 { - {5 L$ @$ M. V( U/ S, k: Z+ C
- Session *theSession = Session::GetSession();5 `' r8 T/ G% o8 Z3 A/ Y
7 t& d& q& L) u, B* ~. p ?- //Creates New Part with name as Preferences.prt
9 @5 _" ^1 S0 m- F0 q5 ]' e - NXOpen::Part *part1;
% Q& @/ E) @0 M - part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
" B8 d$ M4 A! y) @4 y& z- t! C - Part *workPart(theSession->Parts()->Work());
* _5 k: ^3 c" f, H# ] - Part *displayPart(theSession->Parts()->Display());
. H2 {% z, H5 x2 U- l
1 r& v. x. b! q
6 d8 L6 l. I8 F$ F- 9 V7 H; H5 w P2 R+ }2 ?
- // ----------------------------------------------: V u2 B- |$ t3 r0 {, H
- // Changing Sketch Prefix names
- T7 ?( N, Y$ I: U6 ^ - // ---------------------------------------------- / }# l6 [! T7 E4 l- t2 {6 e
- ! @: r* U( ^# ^# C% p
- theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");4 U1 {$ B! v1 D# k9 s
; r/ A8 I! H& j4 ?- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");. W" F7 U: B0 M
( b8 _+ j4 B" c3 o+ g/ e! o- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");
; ]% B5 j1 Y3 [' f
+ t) H& Q4 a; g9 b7 n- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
; b8 N' z* U" _# F9 f - 3 T" Q- D( F" L( \! K# I
- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");7 D0 O5 n. o! \& m0 M
# f; B7 ?+ k9 }) k9 R$ U, R& b- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_"); ( ^& h: Y( h. g, v0 ~) ^: g
-
: {) w0 Y, E/ w( d9 y. t -
* ~8 d' @ e( ~! ?9 h& |" I! t2 V - // ----------------------------------------------
* N/ C8 P% a0 p6 ~! s3 y3 r1 i8 Y - // Changing Grid values
. u i5 `& x% t - // ---------------------------------------------- % G% a+ d* u/ @5 t7 _
- : d8 C0 z; X, t, M, G" ]
- Preferences::WorkPlane *workPlane1;$ u9 Z3 Z" ~( q8 v% T3 L$ q5 j0 k
- workPlane1 = workPart->Preferences()->Workplane();/ [$ y9 a' D) G: ~2 x& Q
-
+ T7 Q7 b) u8 I/ ?/ l - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
. V& R5 V( C8 A -
8 @ H, ]( w0 R. Q7 j - Preferences::WorkPlane::PolarGridSize polarGridSize1;
: L3 P; f+ k B: U7 R - polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;
+ N3 }6 s `- |% |" c4 o0 `# A - polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;, E$ n- z; T0 n/ y6 _
- polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;
' @. i& I& A8 d, z% q - polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;! W& w9 H$ V- W' r
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
; F! M7 V! T! C2 s7 }, O - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2; e4 |: w6 ^/ Q w( B
- workPlane1->SetPolarGridSize(polarGridSize1);
7 A* ^/ V& q* u8 y2 | - 0 {, q7 I. H. v, p% L: B
- workPlane1->SetShowGrid(true);. q+ t4 Q+ o2 h' [& v4 j
-
- p/ M6 \+ k6 N - workPlane1->SetShowLabels(false);
9 u: D6 S4 m" d$ R# x k - 3 j) Y- j5 I4 n e+ o- P
- workPlane1->SetSnapToGrid(false);6 z) Y$ @" q" s
-
6 O9 r! W6 u6 P9 n - workPlane1->SetGridOnTop(false);- Y, z0 l2 a. Q {7 a% u
-
+ w. k7 l/ a& w* U. v# U# Y4 t - workPlane1->SetRectangularShowMajorLines(false);
3 o d5 b* r; \# J -
6 f3 _- Q+ @/ W2 n* f) Y7 l0 Y - workPlane1->SetPolarShowMajorLines(true);- `0 q( h+ {3 f/ O3 j
-
+ M1 I n3 k) E" z5 N* K( | - workPlane1->SetGridColor(130);+ J! Z' d. `* u) S
- }
复制代码
, t: F/ `* M3 @, ]" M# } g6 j9 U* J/ G) q0 S! ^6 I
+ h$ f4 r' B" W# n |
|