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 3049 0

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:1 `( U% ^+ _% W0 F6 `

6 F& \& C2 a0 _9 w6 U( A) u, x3 T( @: V' S
Option Strict Off" n9 w5 z% \. N$ t* V
Imports System
" h" r" j4 m4 h; j$ MImports NXOpen
" w6 c6 n% X6 i5 k6 a. D8 V! H6 }Imports NXOpen.UF% @" Y9 q8 O  k& j; p
Imports NXOpen.UI
2 Y7 H( [& P* u! O  Y
, q, e0 t  G) LModule Module1
. l" h4 i( \: j) A/ Z' E4 e! i3 K( ?' q" A5 v
    Dim s As Session = Session.GetSession()% }: N  V# q: t* B% n2 u7 m
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()9 }2 `  Z, A0 w; w$ K
    Dim workPart As NXOpen.Part = theSession.Parts.Work- `/ k& T  G. e2 w
8 `: F/ w/ k" J" e* `( P
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
2 L/ [; g5 f8 ?, j$ K- X# X; f4 N1 L0 E* p
    '  Explicit Activation
4 R! E" h5 `' Z# e2 V  [    '      This entry point is used to activate the application explicitly
8 b% \6 G2 ?' Q. n$ P) Q# H    Sub Main()
$ W$ C1 Y& x8 Y4 j* X0 ^; Z. X1 q2 g7 Q, E3 N& q4 ~
       Dim sp As New Point3d(0, 0, 0)% r3 d3 V& O+ t  L. K  O
        Dim ep As New Point3d(50, 50, 0)
8 n% [" |# Q2 B        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing7 {3 U# I; [% `* U/ G6 a' w* a* T
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)6 K6 _. {: q4 ~' v1 Z+ O8 A
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder  h" D5 S7 x# c: I6 d' T! f
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
; a, Z4 P( [3 C        Dim point1 As NXOpen.Point4 e! y4 j( I' Z; G5 S
        point1 = workPart.Points.CreatePoint(sp)) M& J' C  H& ?! k- \0 C+ \
        Dim point2 As NXOpen.Point  x, d# U' F; G% z
        point2 = workPart.Points.CreatePoint(ep)5 D4 f9 f7 V5 K
        associativeArcBuilder1.StartPoint.Value = point14 T9 B$ F/ m) T1 y" F3 P
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
' g) Q& b7 m* ^' ^+ ^! ]$ l        associativeArcBuilder1.EndPoint.Value = point2) U; K) H0 |% K1 J' D4 U
        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point. X" z) S4 z! w2 e9 Q
        Dim point3 As NXOpen.Point  I: Q: I7 Z4 W7 l  N
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0)): x& J4 W$ r$ E2 t  E
        associativeArcBuilder1.MidPoint.Value = point35 P+ X2 g. f# X) a1 z* F2 p
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
$ d9 T8 r+ d* l. C        Dim nXObject1 As NXOpen.NXObject: ~2 Z3 Z7 @4 x
        nXObject1 = associativeArcBuilder1.Commit()
- C/ M( T, z! b8 Q        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)6 |1 J0 ^7 S' t! B" W9 a8 \
        associativeArc2.SetName("123")% s8 ~; M7 `3 J- u( l3 N
        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
! C) h( s; n. E) N9 p! T  G: c8 R. w        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point: y% v/ {3 Q3 B& T1 @, }* @$ M  o
        Dim displayModification1 As NXOpen.DisplayModification% C0 W" G3 E4 S# v; j( O
        displayModification1 = s.DisplayManager.NewDisplayModification()
3 V6 ^+ G2 A2 u" ?3 a- h2 [        displayModification1 = s.DisplayManager.NewDisplayModification() '
  q( n2 f( ^& G2 G        displayModification1.NewColor = 7     '设置颜色
3 J# {2 d( Q9 ?) T' H. r" s  L        displayModification1.NewLayer = 10    '设置图层
: C0 E: R% I/ m$ o/ _        Dim objects1(0) As NXOpen.DisplayableObject
* p- \' D$ Q3 f, I        objects1(0) = theLine1 H0 T& w2 \6 _( n! O/ ?
        Dim object2(0) As NXOpen.DisplayableObject4 x- \& F! X  I  E1 z; U
        object2(0) = arc1
& ^  @* r! b) F; z& ^        displayModification1.Apply(objects1)6 ]6 F5 A% V: ^7 g. P+ Y
        displayModification1.Apply(object2)" ^. n/ ~  D& r. T; H
        displayModification1.Dispose()
  c$ R" _# ]3 ?6 Q' E' S# M9 r* a) {# z2 P9 z8 b$ {
) M5 d: F! J+ v0 i
        ' TODO: Add your application code here
& w, D* u- D* n6 @/ ]3 R) u! Q3 K! `  A* w
    End Sub
" }+ J- A# B1 s8 ?: |: ?' B# q& l- B: n! `& t1 N, f0 n, R
* o5 J7 Z7 L2 Z) b
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
3 E( n9 k7 ^' [! \/ Q6 N6 Z
* Z$ V$ L' I$ |+ T        'Unloads the image immediately after execution within NX
5 j! a4 s2 K5 N4 ~1 Y        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately5 {4 I6 n, q* _, L
  i& G' X" L) l  N8 \+ ]! \. A
        '----Other unload options-------& j" I# k( A8 V4 k+ A
        'Unloads the image when the NX session terminates$ i3 C% V/ |3 |/ P( E2 Q
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
( ~" ^' ]* H. ]9 o
% C% ]* o# J- H9 F. R$ d/ q% |# V        'Unloads the image explicitly, via an unload dialog6 ~  u9 u# b- k. v% X' F. H- J& Y# p. [
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly6 d" Y, Q! \! U5 A0 S
        '-------------------------------
0 ?6 D# u$ _7 g8 s6 [  q& m) k' U. L5 s7 n
    End Function1 g/ l/ p$ I( a& u& R
2 Y3 @8 c2 N9 X
End Module. D* Q/ H# p0 K& @0 j8 ]

( d' e+ N7 k, i  |6 ]3 l' o. M4 G1 W& U. V
/ K, ?; u1 ~6 ^9 o

运行时报错

运行时报错
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了