|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
怎么才能设置线的颜色呢代码:- A" K8 R9 k- F7 a
* P' A5 ]9 |5 E
* o! Q0 b+ V5 r; R7 C
Option Strict Off
# E: E% Z. Q* y3 d7 ]Imports System
( V4 M7 ?- U) M/ L$ x% `& oImports NXOpen b( |8 Q4 b3 @( \6 e! U/ m$ T
Imports NXOpen.UF
! d5 v4 f1 L$ G# pImports NXOpen.UI! u3 @! r& G( J, \$ X: C+ t
2 S1 d* ?0 K! i" O' k2 N+ h
Module Module1) Y, N7 V9 L) O5 |' k4 b9 Z
6 K$ B: `( H$ T# L! |/ Y Dim s As Session = Session.GetSession()
! W" U Z1 s( ]6 c0 n Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
- x- d& I6 }7 ]6 a( } Dim workPart As NXOpen.Part = theSession.Parts.Work
" I2 j7 }' {4 D# ?7 U
! U1 _$ N; X$ y Dim displayPart As NXOpen.Part = theSession.Parts.Display
4 ]1 X8 D o7 O6 K# b7 V! m! H5 \% @' \6 [/ d* C
' Explicit Activation5 n/ \7 f, X2 s7 W t( p- N
' This entry point is used to activate the application explicitly
! R! ~% m) s( ^- K+ X# f Sub Main()- L: [8 p: S0 ^. x% p& x
* F4 c8 j& H d4 b1 { Dim sp As New Point3d(0, 0, 0)
+ r4 X; D$ D. }$ t+ v& _ Dim ep As New Point3d(50, 50, 0)
* I f0 D; M. x Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing
3 ^. D6 E! P9 |8 H. U% A* Z: @7 x Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)) T: G: {* [1 y; `1 m& g! [7 ~
Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
* E; ~$ B6 t% M6 O% E$ b& M associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)$ Z1 [5 Q L+ x9 ?
Dim point1 As NXOpen.Point' O5 E, S: w: ]( ^6 d
point1 = workPart.Points.CreatePoint(sp)
) X0 ~: ~" u; U2 O% w& k Dim point2 As NXOpen.Point+ J$ Q6 ]- o% a# O0 c/ X
point2 = workPart.Points.CreatePoint(ep)& E$ e( |/ f6 h1 |. J' Z: n
associativeArcBuilder1.StartPoint.Value = point1
9 c3 m) f! q0 g, q5 p9 m4 Z( p$ E- v associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
6 }/ w& u- s q associativeArcBuilder1.EndPoint.Value = point2% R+ N: i. X8 m- P" h9 d
associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point1 T$ `; m( `# Z# |* p
Dim point3 As NXOpen.Point
1 q: ]' |, x) t, p0 ]( V point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
$ w( j, g' k# |& n0 C8 `9 ^ associativeArcBuilder1.MidPoint.Value = point3
3 |# V: N7 L* w. A5 d, L" x associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point% x6 x3 R, A- j/ X2 M
Dim nXObject1 As NXOpen.NXObject }( C! V; L, o; I9 {1 t
nXObject1 = associativeArcBuilder1.Commit()& f! O( M1 K% E% U; P* |
Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
0 K) E1 d8 s" b7 m2 N7 I- p5 O ~ associativeArc2.SetName("123")
. o: j: c8 j$ e0 c( z3 Y Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
) ^5 [$ L# _5 J& d associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
: O4 b9 L$ x5 Y* g0 @ Dim displayModification1 As NXOpen.DisplayModification
# q, E$ w" g' k$ g displayModification1 = s.DisplayManager.NewDisplayModification()' A( P7 r! [5 a6 C& P! q4 U
displayModification1 = s.DisplayManager.NewDisplayModification() '3 _% T; M( | D! m
displayModification1.NewColor = 7 '设置颜色+ z2 K2 Y% Q" o
displayModification1.NewLayer = 10 '设置图层
2 O. ]: d! O4 N9 n2 z5 P0 p; w/ f Dim objects1(0) As NXOpen.DisplayableObject0 O% h. l+ p8 h# j, b
objects1(0) = theLine2 s: R9 \7 w8 ~( ^$ `
Dim object2(0) As NXOpen.DisplayableObject7 s+ q$ o5 O& w$ E# N. D, D2 i
object2(0) = arc1
) ~) E3 V2 ] H displayModification1.Apply(objects1)
* ]* F3 n3 s, ^: f displayModification1.Apply(object2)
6 h Y) a& w& g. j7 N displayModification1.Dispose()
5 \: M2 B8 h; d! a2 i5 z+ `2 Y# C. R
v" f! [' C7 P6 j' l ' TODO: Add your application code here 4 w& R/ }$ z0 P$ x
3 Y7 X3 t9 U1 D0 G! a. w
End Sub
0 L5 ^5 d+ ]* r \" M
0 o! K6 {$ ~5 O+ D8 k& N: `4 @6 |0 s
7 w; f( j! P0 F' v4 E3 A0 A/ l Public Function GetUnloadOption(ByVal dummy As String) As Integer. x( W' ?# X' J, l7 @8 a
5 u/ ?1 u q0 N" Z
'Unloads the image immediately after execution within NX
9 `3 j" `/ u8 I* o0 K GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
- y$ N7 I/ L8 T! P& ?
: u( Y, F9 K+ A9 G; e4 P; N '----Other unload options-------# R- l' o I5 J# f
'Unloads the image when the NX session terminates
& M$ I6 W w4 Q1 H7 W K' h 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
4 U4 I+ n3 `4 K. h* ~- s \* A
: ~% D5 z8 H7 p! @. ] 'Unloads the image explicitly, via an unload dialog
# C4 l4 n0 A6 F' f( x 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly' b; K- ^7 U: }$ f6 J
'-------------------------------
/ S8 q! L7 q+ J5 @+ @9 M' ?9 X1 X' I0 K$ d' ~% @
End Function3 c2 X" P6 Q- P- b+ X
, n+ A0 y3 t" S! WEnd Module
+ t6 Q& f$ _1 p& J; U; c( Y) w1 J7 W- d0 b6 b7 {, |9 B$ {( u" I+ ~
+ {) e6 l1 W. ?; E6 t+ M
* Q/ P8 I2 A* O* m t4 R3 I5 I
|
-
运行时报错
|