|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
有关用户设置的使用,如果你想设置一个模版文件,可以通过下列方式:+ H3 G. c; ~. w" X( n
: [- m0 `- ? \( e# t& B
- . J+ B! b3 L B! w" a
- #include <uf_defs.h>$ r, s4 N4 o; L7 l4 A6 ]
- #include <NXOpen/NXException.hxx>! h, k& P+ b2 l& ]2 |+ ] C* r2 a
- #include <NXOpen/Session.hxx>
0 w1 f) W9 }. j$ I& S, T, Q+ k - #include <NXOpen/Builder.hxx>9 x0 q+ A( k- ]5 K& A7 ~: k
- #include <NXOpen/FileNew.hxx>
* Y# Z3 b# t/ ]* q" X% f" z - #include <NXOpen/NXObject.hxx>
" }* u! {$ z! l - #include <NXOpen/Part.hxx>
3 t, B( P; `+ K' E( @* d. m - #include <NXOpen/ParTCollection.hxx>
4 }6 k1 x# ~$ n% b9 \2 g - #include <NXOpen/Preferences_PartPreferences.hxx>
4 f: `, f( ^6 c - #include <NXOpen/Preferences_PartSketch.hxx>, @1 L) K$ K3 O$ T8 k4 v
- #include <NXOpen/Preferences_SessionPreferences.hxx>0 U3 M. ^3 M) b5 G/ m, Q) b
- #include <NXOpen/Preferences_SessionSketch.hxx> t4 {1 m) N9 @* U( _$ a" a
- #include <NXOpen/Preferences_WorkPlane.hxx>
! F( N' a( b% z - #include <NXOpen/Session.hxx>/ a0 S: ^# q" {; ?0 ]) G& G) ?
- using namespace NXOpen;6 t K) S0 n5 r" n. ]3 q9 O) c3 `
/ P/ O; j) L6 b/ ^% v' m- extern "C" DllExport int ufusr_ask_unload()
1 ]$ A7 t% A' |- C7 x( t - {0 F, n$ F0 ~8 C
- return (int)Session::LibraryUnloadOptionImmediately;, Z* e9 [ q1 P! U! a6 [
- }
) C$ a; o8 `: Y) i8 Z8 G, G* J - 0 `- t- j2 J4 c% @! \1 V
- extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
7 z5 U, u% @" E( g: I) W - {# k, x W. b' v. U3 r, J; G6 M
- Session *theSession = Session::GetSession();% `8 c! Y6 {) _0 x6 N+ Q' e
F6 W' R5 Y. J' W# M+ |- //Creates New Part with name as Preferences.prt
2 E* t5 K. C3 d. W" Q) Y' q1 T - NXOpen::Part *part1;
4 A6 p% T, _6 ]- y1 Y' U& r - part1=theSession->Parts()->NewDisplay("Preferences",Part::UnitsMillimeters);
, d" r b( c8 Z4 w) y - Part *workPart(theSession->Parts()->Work());/ Z) v) O8 Y, n: ^5 X0 O8 T7 w, h
- Part *displayPart(theSession->Parts()->Display()); / J. t P( |& B/ m
- 1 m1 L5 i, f4 R- o1 [* {/ y: w' w* m
- 3 G3 c6 J3 y! z
- , [0 ?) ^( E+ K! a! A# V6 P
- // ----------------------------------------------
. r; b- _5 i3 i5 K - // Changing Sketch Prefix names. u" q$ _5 w# F5 ]" G3 o5 }
- // ----------------------------------------------
6 J9 M' `9 Q6 N; T U/ p" M8 L; t -
; l* G: X# q% I. S. d/ d/ s: Q* z - theSession->Preferences()->Sketch()->SetDefaultSketchNamePrefix("SKT_");0 p9 K) l; M3 c
, v) K D: z) s3 N6 T- theSession->Preferences()->Sketch()->SetDefaultVertexNamePrefix("VRT_");
+ t, K# _0 x* f! ?
" e# W1 ?( W, u; l: j* B3 C- theSession->Preferences()->Sketch()->SetDefaultLineNamePrefix("LIN_");1 ]% j K% \4 @; E d' c' ?7 M" V' c
* z, ?, l5 {- [% `8 B; ^- theSession->Preferences()->Sketch()->SetDefaultArcNamePrefix("ARC_");
& o. J" m/ e& _" N& R
: [; h" D# y9 m" O" m( m- theSession->Preferences()->Sketch()->SetDefaultConicNamePrefix("CON_");
. l# O$ V; R$ W: y! K
% m5 ?' `4 Q& |) S7 j7 C- theSession->Preferences()->Sketch()->SetDefaultSplineNamePrefix("SPL_");
4 ?3 q. Q6 y: B: v2 q -
! O: I5 }! t7 o1 b) t - ; }! T; S" D. h I! ~( r" n
- // ----------------------------------------------+ h+ P0 D, J! `: [, \. y
- // Changing Grid values- m& N. v1 e* q3 E, i
- // ---------------------------------------------- - K& W3 h& h9 C. y$ O# |( Z
-
; p/ U0 W- l2 i - Preferences::WorkPlane *workPlane1;
4 t2 V( q( `( F) t/ B* z - workPlane1 = workPart->Preferences()->Workplane();/ N2 i$ |( J3 @5 s) a
-
8 S2 c0 q6 A/ ^ - workPlane1->SetGridType(Preferences::WorkPlane::GridPolar);
2 B, O+ @, p+ N' o/ D+ x% L9 K -
. p# b/ m5 F2 L" M* ~0 W& j& c, p - Preferences::WorkPlane::PolarGridSize polarGridSize1;7 b/ M R6 [ X4 P0 U9 X9 M
- polarGridSize1.RadialGridSize.MajorGridSpacing = 75.0;
0 h; R; D: J8 W5 \' B+ g - polarGridSize1.RadialGridSize.MinorLinesPerMajor = 3;
8 p/ J0 g/ x" c4 R - polarGridSize1.RadialGridSize.SnapPointsPerMinor = 5;, V. E' N$ X. q; N/ [$ z; N0 R
- polarGridSize1.AngularGridSize.MajorGridSpacing = 45.0;* H+ v) ^ P$ {+ u6 n; X# O) |9 i. Q/ Y+ ~
- polarGridSize1.AngularGridSize.MinorLinesPerMajor = 4;
7 \5 {$ `' \1 z, u4 w# U! o - polarGridSize1.AngularGridSize.SnapPointsPerMinor = 2;
( q9 x' q! J1 d/ l2 y& a5 m2 ^ - workPlane1->SetPolarGridSize(polarGridSize1);
; k: f8 u) ?! B2 V4 \0 M$ z - . l# {2 d3 v0 c- |! M
- workPlane1->SetShowGrid(true);
$ Q/ ]8 N. T! c3 [3 h0 W -
7 x' c6 s# S5 a3 q5 U - workPlane1->SetShowLabels(false);& m1 E* ?, ?; V! j! n
- - A5 Z' |" v" N# ^# w' X; e
- workPlane1->SetSnapToGrid(false);9 b& |" d, t! {
-
# A* K; G8 U- x* V1 ?/ I - workPlane1->SetGridOnTop(false);
6 q) Y1 i q, u/ y* Z! E& K6 K - 2 d! a; } z3 J$ Z1 W- j: |
- workPlane1->SetRectangularShowMajorLines(false);
# l- O7 u! l# C - 4 t/ b( z+ e. U8 X6 r
- workPlane1->SetPolarShowMajorLines(true);+ e% }3 j8 G6 w. s4 e4 s! R
-
) g1 ~ _7 {: O2 f0 C( |8 b5 x - workPlane1->SetGridColor(130);# V* s# Z8 p" H
- }
复制代码 7 q' @7 ^8 c; J) w% r8 S5 s
1 |) B- k$ \, Y% f" n
3 s) D/ Q% M2 e3 p! s3 R, _% B |
|