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

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

45guop 楼主

2016-7-21 21:18:53

请使用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

运行时报错

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

    我知道了