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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:, `4 S, s& k# u8 B; y
/ {) d5 [$ I9 j5 G6 ^
* n% ]7 h6 j: m, A$ V
Option Strict Off
! k. ]" x: D3 a/ y% ^Imports System
7 R- A/ n) P' {4 ]Imports NXOpen
) f7 y. f8 _7 R2 ~) MImports NXOpen.UF; w3 v+ d6 M9 M6 J* i0 |
Imports NXOpen.UI7 ~* `6 ^/ k$ {( Q* @
3 L) [7 K7 W' ]3 L% z7 i/ {
Module Module1; C+ H' F+ n+ U  j. k

4 f, m2 E: }  l- S6 y    Dim s As Session = Session.GetSession()+ i6 g; Z3 Q4 l( y
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()* j$ B8 x" P% |5 U: N
    Dim workPart As NXOpen.Part = theSession.Parts.Work8 i. v4 T9 E( H# R

* {9 u; f2 i* ~/ H    Dim displayPart As NXOpen.Part = theSession.Parts.Display) L$ ?1 R5 O# u6 N# z! G! W: X
: E3 z3 N$ _: N0 G! U+ J; i
    '  Explicit Activation
/ x* h' y- c3 p1 ?( P! w    '      This entry point is used to activate the application explicitly
. [" U; t! h2 w/ a9 B+ @    Sub Main()
) a- l/ w  b# z6 f
' Z& r( [! m/ b. s8 Q       Dim sp As New Point3d(0, 0, 0)
& U) H$ f! E+ i( |        Dim ep As New Point3d(50, 50, 0)9 W/ b1 y7 `( O  b" K
        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing' o; f" q' n" p: `
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)  j4 L! t3 ~6 S0 W
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder7 d  \- N! Z8 ]4 [, ?7 a+ I
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)8 v$ Q3 A8 Y+ m- E5 \4 k
        Dim point1 As NXOpen.Point3 i, \( Y# }7 F' Q6 x3 P
        point1 = workPart.Points.CreatePoint(sp)9 M+ ~5 w) [/ B  r5 |' h" ^
        Dim point2 As NXOpen.Point4 x5 `8 M! Q1 |7 c) B
        point2 = workPart.Points.CreatePoint(ep)
- h. g  ^3 A$ i" }        associativeArcBuilder1.StartPoint.Value = point1( e8 A2 M+ d1 U4 Q
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point3 ?1 o( ~) S) h- |# U
        associativeArcBuilder1.EndPoint.Value = point23 M0 `8 Y0 M+ ]2 T# k
        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
. V& h' G. g" K3 W" u        Dim point3 As NXOpen.Point2 W4 \' @0 n  R% U: ]2 E6 W6 y
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
* {8 M9 t1 F. E3 _' z; E        associativeArcBuilder1.MidPoint.Value = point3
/ q1 g' [4 i$ ?! v% T        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
7 G3 M( s2 F/ Z* e        Dim nXObject1 As NXOpen.NXObject1 x* A- z# `  ?; B, ~
        nXObject1 = associativeArcBuilder1.Commit()
" O0 u7 o3 P! Z( S. P% I) O        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)* V9 I* t5 K2 o( k
        associativeArc2.SetName("123")
6 F) _1 ^3 j' F7 E: X; g) m        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
& O$ V; H; Z/ @4 o2 x4 B! \        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point! A$ N# F- p$ p( x# S! n$ u9 G; R
        Dim displayModification1 As NXOpen.DisplayModification
4 J' u$ A+ p( X        displayModification1 = s.DisplayManager.NewDisplayModification()9 [( Y( w0 \. u! v2 P, s
        displayModification1 = s.DisplayManager.NewDisplayModification() '
3 V. V2 y3 p% k! |+ b& o5 J9 {$ }# y        displayModification1.NewColor = 7     '设置颜色
5 K& U/ t2 N+ {1 {! r        displayModification1.NewLayer = 10    '设置图层
5 A, T" N6 N: o! V. i7 s        Dim objects1(0) As NXOpen.DisplayableObject0 }, [: @/ k# o, z. k  }
        objects1(0) = theLine
' N* }. }* t4 A+ o! n  Z        Dim object2(0) As NXOpen.DisplayableObject
! f9 a$ G5 ]) L2 t        object2(0) = arc1
  h& m, ?4 ]; F# e        displayModification1.Apply(objects1)% ?+ c0 ^! S+ E
        displayModification1.Apply(object2)
9 K5 X& y, J2 h' g) Z- W        displayModification1.Dispose()) d& n7 e& ]& h* S$ A$ _; b

" M3 f# E( ~& N3 r& w0 b
% N& L, H/ v5 ]) k1 \        ' TODO: Add your application code here
/ ?4 G+ u/ ?& ?7 l7 i. x2 l6 b. j' g  D/ X- c3 y$ M# n
    End Sub8 {. Y2 M2 C( U2 A9 _
4 k' U; O* e1 m: F6 z1 d" d

; u6 x. r$ ?0 c$ f+ T- r! E# w3 o    Public Function GetUnloadOption(ByVal dummy As String) As Integer
) d% N- v7 g3 ^
4 J# W5 f- G% m9 r# a, \. L        'Unloads the image immediately after execution within NX
2 w8 ^4 R. d$ U; k7 D5 J; s" ^        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately& O3 R0 _4 F0 I& E% b5 Q
0 y  ^% }) J. o3 n6 n! S2 N
        '----Other unload options-------$ z. ^" p6 m( r" m' w* A4 ]5 ]* q. W! c
        'Unloads the image when the NX session terminates' b. B) b" |" g
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination; [2 X0 C+ J9 u2 {( m
( P- e" K& j- ?0 D9 l0 c; P
        'Unloads the image explicitly, via an unload dialog
1 y3 R, o$ s! @2 j- Q        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly) e: y5 k2 T/ W* e- T( u+ t
        '-------------------------------
6 ]5 I) K$ h6 c4 V, @, |, F  c( F- f, ^" p0 _
    End Function2 W5 O1 V1 y" ~: O
1 H2 U+ b4 M- N5 z& k
End Module
$ X# j6 A9 \/ M# h6 ^; O
1 H* b* s! W, i( {; I1 R7 j  k9 V3 Y: C2 n: c' o5 d6 }! M. `

1 Y  y1 o+ ~6 Z, V0 I# c

运行时报错

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

    我知道了