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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:% p; W5 n7 S! @, L* U  w. G

: a3 r' h; ~7 P6 ]/ L# H
5 p  D$ Y$ I  o0 q" v8 mOption Strict Off. z" k0 s7 ~, S: d7 @
Imports System
& c, i$ J. n$ JImports NXOpen
3 ?8 }2 u7 C& ^: b3 `/ O- OImports NXOpen.UF' }1 O! I0 F9 T9 V3 I+ s
Imports NXOpen.UI
4 O$ Y2 u( U; s/ Q: `. k& g8 ^  D) ?) f3 G2 L
Module Module1
% ?9 R2 D- x# P
8 \: T# z8 L+ u    Dim s As Session = Session.GetSession()/ T  d/ R; V* K3 C; S3 k
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()( @; a5 K2 e1 g5 o2 ?
    Dim workPart As NXOpen.Part = theSession.Parts.Work4 k. c. h9 ^, S6 J8 X

1 `: p% i6 U, n0 `. I, }. s    Dim displayPart As NXOpen.Part = theSession.Parts.Display
$ |( p( x1 n9 `. k% u+ Z! S- O( @2 U7 q# z6 U0 J0 m
    '  Explicit Activation
0 a, p+ C4 ]! |; b# d! o# L( P    '      This entry point is used to activate the application explicitly
6 P$ Q5 t5 Y& _, x9 G; f    Sub Main()
6 @; F. i, s2 G+ u7 t% o) Y1 L7 |; q
       Dim sp As New Point3d(0, 0, 0), Z  t0 H/ p" H) r! C0 B* p5 M
        Dim ep As New Point3d(50, 50, 0)
! L9 n+ X: q- n, ]0 ^- I3 D        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing3 w$ Y  Q* P& t( F* f9 E+ g
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)
% \8 T  Z- V" e        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
7 {* U7 q/ h, X% }6 P. [1 X        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)& \9 s: h0 d1 `) B5 h) p
        Dim point1 As NXOpen.Point
' g4 F; }8 p; T' I" U        point1 = workPart.Points.CreatePoint(sp)
+ G" b! J  t( ^9 z        Dim point2 As NXOpen.Point
' ^' M* T$ ?2 X8 O- T+ ?        point2 = workPart.Points.CreatePoint(ep)9 ?2 M# O( ?; t  ^* e! {  w
        associativeArcBuilder1.StartPoint.Value = point17 y# o2 \% p* x! s
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
3 `" ]' o. M0 g+ d- e# h5 J        associativeArcBuilder1.EndPoint.Value = point2
! `  `0 p0 I1 R: l8 _, q        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
- T6 B8 ^& v# ?- f% d! M        Dim point3 As NXOpen.Point4 g2 ^( ]" k) _. Q3 K) n6 ]& X& r
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
' Q5 ^( u, Y# z4 j        associativeArcBuilder1.MidPoint.Value = point3
1 ~2 A% m0 C% F        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
3 V) I/ o( [1 i3 T# c7 b/ I( y4 V        Dim nXObject1 As NXOpen.NXObject- c" }* C& F; t$ y5 ~; s3 [
        nXObject1 = associativeArcBuilder1.Commit()
7 C( R/ n; _. g% ~+ f        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)" z8 y9 N: c2 ]3 [
        associativeArc2.SetName("123")3 V: ~" s* T" P- f0 G6 B0 C  N
        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
2 B* X) i7 t/ Q( d8 B- d' `$ U        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
0 P8 d1 M! r0 D2 U0 n6 M        Dim displayModification1 As NXOpen.DisplayModification0 [" P" ?4 }' M1 a' j. g
        displayModification1 = s.DisplayManager.NewDisplayModification()) a. ^+ v% ?- R! ?) a- n
        displayModification1 = s.DisplayManager.NewDisplayModification() '
: z0 {9 \# ~* f1 t" K" t/ c- |        displayModification1.NewColor = 7     '设置颜色3 o3 |5 u* S7 O0 u- x
        displayModification1.NewLayer = 10    '设置图层
" J- r4 [/ Y# w' H. i* j9 C7 A. P        Dim objects1(0) As NXOpen.DisplayableObject
% t, N) N' O  h: k        objects1(0) = theLine
7 B$ y( c* j# F' E* ~* |        Dim object2(0) As NXOpen.DisplayableObject) K+ L4 L/ [# i( z6 V1 [! d
        object2(0) = arc1
3 |! B! c3 |' n; G        displayModification1.Apply(objects1)
" G" T4 G1 m, n1 f( I        displayModification1.Apply(object2)
' g" [9 M  J+ H; M9 U' p        displayModification1.Dispose(), \' k1 J- x0 ?7 o8 @& O
2 e4 S& |: T5 b- w/ ~7 F" O
; J  {2 H, q* o8 R$ J( A' u
        ' TODO: Add your application code here 0 `! k& V9 E( K

6 a3 S" f) V: }6 E, I; D2 {1 V    End Sub9 J/ l6 N3 c, A# `' |" f, h
5 X) W( Q3 t- H: n" o3 \. U, ?! ?
: M) G; j& s) P# P6 E
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
4 h2 a' T; v9 n+ z
0 B4 ^8 Z1 F/ x' N' e3 R+ E, m        'Unloads the image immediately after execution within NX
: X( f( }/ I" A+ |- V( v        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately9 z# c# ]7 ~5 w- k. R
" F3 _, D: h1 O7 L  |* ?
        '----Other unload options-------
) r) X& m% P- {$ e        'Unloads the image when the NX session terminates
5 B4 N4 Z3 E' [/ u- X        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
3 B: s8 T2 K: {/ [1 B/ F
. A/ L0 W6 o; h$ O3 M        'Unloads the image explicitly, via an unload dialog
8 s$ y( @5 M% {* k" Z2 L' Z        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
$ ]5 y3 ]$ M5 T        '-------------------------------
5 M/ R. |% S+ @1 b# h$ m8 G- h7 [1 s+ q! c! X# x' I1 X  @0 L) e
    End Function5 Q5 I0 Y, H+ L5 j3 U
3 i8 \( P  L* r' R) ^* n
End Module1 s9 b3 v7 l6 k$ J+ N* t. K2 ?

' v& R0 }. \6 n. ]# Q" k4 V/ \! `8 o! a5 J" x

6 p8 s" G2 ^8 F( ^& ]! P

运行时报错

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

    我知道了