|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
怎么才能设置线的颜色呢代码:# }9 r7 v, Z% @" O6 ~
5 b# K" L: e' `/ B% Q* k" O& Y( H% T& G' P8 [# w) J
Option Strict Off
' w9 _- p1 m' dImports System$ B! l& s2 l8 d: I, h) c y
Imports NXOpen
9 g% K7 @; o0 I$ [- S, h, TImports NXOpen.UF
8 m0 w, i; i* W3 O, |Imports NXOpen.UI
0 a2 |0 a7 d$ e6 K& L+ g
1 W& J7 o; k; \8 M* l4 ]" \Module Module1 D; ~( R3 }) @2 I- `5 K
6 Y+ x: c5 W. \
Dim s As Session = Session.GetSession()
2 j% R' k" a: [2 J Dim theSession As NXOpen.Session = NXOpen.Session.GetSession(). f! `, P' H% \+ l* A
Dim workPart As NXOpen.Part = theSession.Parts.Work0 ]9 V6 C N3 U) v
3 o' q1 j& W/ a+ O) B Dim displayPart As NXOpen.Part = theSession.Parts.Display5 ^2 R( g, L: Q& u
" u/ u$ @/ J( G- l# t/ Z ' Explicit Activation+ }# a; u4 F% p6 m
' This entry point is used to activate the application explicitly! F+ x) n7 f! j! B1 U
Sub Main()
: h: a g: r7 s& \4 e6 x
/ H0 J8 j+ f2 I Dim sp As New Point3d(0, 0, 0)5 ^ \' U, W9 N$ w
Dim ep As New Point3d(50, 50, 0)' _% C* e. ?3 Z) I+ N7 }
Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing
6 A' j W/ H7 q; D Q! c Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)
" n; K% X9 ]& T5 y' x Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder3 D/ ^) k# X: T# ^$ j W
associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc); @6 \% m* A, U1 B
Dim point1 As NXOpen.Point) Y# x$ D9 J: g) | X2 w
point1 = workPart.Points.CreatePoint(sp)4 i$ c8 V6 y3 @9 \$ o
Dim point2 As NXOpen.Point
9 E# N$ L, J0 p# Y' y+ Q point2 = workPart.Points.CreatePoint(ep)9 M% ^3 P$ [+ P. ?& ]
associativeArcBuilder1.StartPoint.Value = point1: w& Z& c0 W8 D1 A4 A1 Z
associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point9 `: l5 J! z: @! s; I( t
associativeArcBuilder1.EndPoint.Value = point2: P4 d: D& e. V; ^& ]
associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
% p8 `! K0 N8 j5 k" _# |" ~. R Dim point3 As NXOpen.Point
: N5 T" c3 |# w' _ point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0)); K. E. W% C7 q
associativeArcBuilder1.MidPoint.Value = point3
+ K! n; G v% ]" y/ X& \ associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point" {$ X/ N& F/ I6 ~
Dim nXObject1 As NXOpen.NXObject
! e& [' Y3 W4 q; D6 W* D nXObject1 = associativeArcBuilder1.Commit()
1 m5 Q; N$ K Q0 X Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)5 v" J9 Z2 V- v. \$ ~) l* \$ z
associativeArc2.SetName("123")7 [. D- j$ x Z- S
Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)8 } @7 {$ H8 o3 v& d* ~! K
associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
) M8 \0 M: j& U' u0 V2 ^$ N Dim displayModification1 As NXOpen.DisplayModification: \) P) v1 D' P
displayModification1 = s.DisplayManager.NewDisplayModification()
/ `7 e4 [8 D4 @ displayModification1 = s.DisplayManager.NewDisplayModification() '
3 Z8 F( b2 w* g/ @) t displayModification1.NewColor = 7 '设置颜色" y& s1 V$ r: a
displayModification1.NewLayer = 10 '设置图层
# i; [6 x) t1 k" x7 I Dim objects1(0) As NXOpen.DisplayableObject/ c! M8 d3 u2 x, `$ L7 F
objects1(0) = theLine2 j `. u! g8 @8 T
Dim object2(0) As NXOpen.DisplayableObject
! p3 v2 `$ [5 \: h5 U. z object2(0) = arc1
$ n7 a. d% t, C/ @# U displayModification1.Apply(objects1)
. t1 s7 k% d4 m3 i) N displayModification1.Apply(object2): e2 b; v* [! z3 f* S6 F
displayModification1.Dispose()' i/ P$ }. E0 `
. v% g$ v9 f! t3 g0 M
9 [- \9 U0 ?# C7 R! t4 ? ' TODO: Add your application code here * {2 p0 ^. R7 J9 C8 n2 ~
$ b" ^5 {4 [" N' z# q- Q" _
End Sub
/ h/ x) {8 B& k, M( a. }2 C" l4 E1 k3 a+ V
{' `( u4 k; c" q$ M Public Function GetUnloadOption(ByVal dummy As String) As Integer3 h" s" j6 O7 @4 O ^4 R# h6 b
, J! @8 P* Q3 x7 Y
'Unloads the image immediately after execution within NX+ A' u. W; V* S# u+ X
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
, k- v! p C( S: w7 K) ~& D8 P- _/ k$ m+ ?* }# z3 Z* S7 q* Z; h! E
'----Other unload options-------
. }& }2 d+ p! \* M" E( p 'Unloads the image when the NX session terminates4 e' w/ ]4 s) Y1 s( D7 d T M7 o, i
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
4 r4 B9 n c" ^% T5 j7 K; }3 p! a J; e8 i
'Unloads the image explicitly, via an unload dialog4 F4 ^8 G" `* b. F
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
3 @- z$ K9 A7 i* ~/ a '-------------------------------
/ N7 v3 U2 n" I; _. `- t9 j$ Z' U7 \' D$ I7 b
End Function
# k5 J3 w1 n8 F) H/ q
2 N3 F) G' \/ c/ j) LEnd Module
4 B" E0 Q& |1 M. K% r5 a: G& v2 s4 S) \3 f& V! e
( P" J( D# E- e! l4 V1 p
/ [! a- g& }* L
|
-
运行时报错
|