PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

PLM之家PLMHome-国产软件践行者

[求助] 设置线的颜色

[复制链接]

2016-7-21 21:18:53 3048 0

45guop 发表于 2016-7-21 21:18:53 |阅读模式

45guop 楼主

2016-7-21 21:18:53

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
怎么才能设置线的颜色呢代码:  v1 y9 I. e" D# _
7 p$ o# T3 q3 X" V8 [( O

4 m1 o" {7 b8 _% a! POption Strict Off  w- r1 M3 |) |6 y! [0 ]
Imports System
! l& b# H9 R" g% \5 A; T8 r2 C! tImports NXOpen1 H2 F5 S/ g  T! k" J, y
Imports NXOpen.UF0 a0 L; ~$ s( X# X
Imports NXOpen.UI
+ F& m8 o, q1 d; t% H! @4 l! F7 _5 G0 p" `; a' z+ q, u
Module Module1
1 C  H, W' O* H3 t+ e; S2 [; u
5 [( U  x; k1 s1 [    Dim s As Session = Session.GetSession(): K+ R' J0 w' s; L( P( o  A$ d
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()" f* N, ^( U9 j6 S% [) g
    Dim workPart As NXOpen.Part = theSession.Parts.Work7 S0 i0 ]! c* Z& s2 \
5 B$ j" o: e! Z
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
6 v6 u) c1 @7 D( m  K1 L
# v( m$ x2 H) t% g: p    '  Explicit Activation7 ?3 c" I, R+ P" B" Y& p! \+ e
    '      This entry point is used to activate the application explicitly
& N- ?0 X7 S* Q4 ?  Z# _7 n    Sub Main()
( [, Y8 m1 \2 j( s- a' q- c, x8 m0 S' J! u* g  d4 z8 ~! l
       Dim sp As New Point3d(0, 0, 0)* I$ h: P, {1 r+ h  ?0 |* q
        Dim ep As New Point3d(50, 50, 0)- Q. ~7 w; g3 n+ g
        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing4 k/ q+ k) x4 c' B! r* d: Z
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)
) X' a% A: K7 o$ Q3 d& ]$ ~/ A        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder% `/ V. T+ L! Z" |
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
- \0 q4 A0 ^, a" P! O& {        Dim point1 As NXOpen.Point. J  q5 b$ C  u' m6 U) c
        point1 = workPart.Points.CreatePoint(sp)
. ~/ d: f$ ~: t. h6 t) W% t5 S5 Z        Dim point2 As NXOpen.Point- V1 B3 }1 {. D) S9 R0 k$ j
        point2 = workPart.Points.CreatePoint(ep)
# J: Y) [6 Z, @9 r% f, S+ ?0 Y5 `        associativeArcBuilder1.StartPoint.Value = point1# X9 L1 z  N9 z$ Q- q$ y9 p
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point& W/ K/ a" L9 C) |! v
        associativeArcBuilder1.EndPoint.Value = point2
( M  v# Z) D8 x- [) O3 Z        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
3 j2 o0 p! p& d% A% @6 w        Dim point3 As NXOpen.Point
8 X: P  Q; r' h        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
( E$ k( K0 g4 l) `+ ^2 ^1 s        associativeArcBuilder1.MidPoint.Value = point3
/ K/ H' ^. d/ A5 o, n# {        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point2 \# J0 P* R; W9 I6 Q$ G
        Dim nXObject1 As NXOpen.NXObject5 s+ [9 {* J. @5 n5 y' x: }
        nXObject1 = associativeArcBuilder1.Commit()# z+ ?! j9 w* n! H1 w0 _
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
8 Q4 B' R) _+ Q0 w, w* i3 l0 b3 p        associativeArc2.SetName("123")& ^+ k$ k- p: b) o$ l9 I5 g0 g
        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
7 @. t7 \5 o+ t  R7 Z  F  Q. c  x        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point; b- ?# k) h+ G
        Dim displayModification1 As NXOpen.DisplayModification/ ]) w4 D. k- u# J
        displayModification1 = s.DisplayManager.NewDisplayModification()
/ H2 L9 H  X+ Q0 w9 e        displayModification1 = s.DisplayManager.NewDisplayModification() '
& s  r( h+ E% X5 G+ ?9 C1 J$ E& E: Y* |        displayModification1.NewColor = 7     '设置颜色
  k& }9 H# I8 i* T# M# y  ~        displayModification1.NewLayer = 10    '设置图层5 `3 e" k6 O  g! S9 {
        Dim objects1(0) As NXOpen.DisplayableObject
! X3 k" {; E) x        objects1(0) = theLine
" |, d1 e. n% o: @7 M3 z' S        Dim object2(0) As NXOpen.DisplayableObject' ?0 N- B! A4 M$ m
        object2(0) = arc16 X+ L+ c+ t9 J& W
        displayModification1.Apply(objects1)
1 x) v" W* ~' t" ?# Z# {) m        displayModification1.Apply(object2)
; s, O# f7 e; e  m2 i7 |        displayModification1.Dispose()
5 P4 u7 K0 ]: p; q! y( p" v7 H+ x2 ~) o8 [* X
3 K0 A; A% D: G3 q( T
        ' TODO: Add your application code here
; D1 f' @8 i. j
- Q5 l  a+ i8 ^5 |    End Sub
/ Y( C2 v; D( I! ?
9 p1 ~# p+ \) G' [4 W
2 |* s+ q8 `( [' G    Public Function GetUnloadOption(ByVal dummy As String) As Integer
" y% d$ n# c5 H' \; H" Q7 ~/ j5 l% i+ s6 `. J$ h
        'Unloads the image immediately after execution within NX
9 H7 w+ q" f, e* U. [        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately2 g- D& E$ i  R  |# L1 N# {+ B

/ ~5 i# z6 W1 B& z. ]  w        '----Other unload options-------
0 N: I( q6 K' L) ~        'Unloads the image when the NX session terminates
0 Q8 Z7 C% d0 q: Q( q$ c0 Y' I        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination6 u# {- {3 K8 o# _' [% r, N: ~; k

4 |' d" k5 Z! p6 K' o        'Unloads the image explicitly, via an unload dialog9 z" R4 r9 ?6 B/ O0 t* E2 m) q+ U
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly7 N3 x  v6 F( v
        '-------------------------------* _+ I! i9 g( E

# T' @' Z0 r* ^; R$ R; o* T    End Function
$ b, a3 v$ a. _
6 e: s4 o5 V7 |3 {  @. Q+ @End Module: t& K4 [- i2 q+ [( E' C0 S4 ~$ e
- w6 V" {& q3 w4 P) \0 d' G

" V4 ?0 ?! e# R8 U0 N% M1 H" v8 B4 B. H2 I

运行时报错

运行时报错
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了