PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

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

[求助] 设置线的颜色

[复制链接]

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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:$ {7 R8 s# s' F' }4 }3 M
3 P4 w  K# _' o+ K5 K

# P* ~! P. L! A' G2 N/ iOption Strict Off
$ S% d+ i& M& k6 }Imports System0 b9 a& `2 y" C0 e  D% B3 ~
Imports NXOpen
' ]# w2 s  c" v- o* e: ?" |# bImports NXOpen.UF
0 M' O7 @- M, kImports NXOpen.UI
4 _2 X; r( v4 j) x% b0 q: v2 g' ~5 ?
Module Module1
/ {' P0 O+ A( P3 [) o+ m# i
  H5 o+ ^6 H9 f5 O  D5 |4 _; J6 l$ T    Dim s As Session = Session.GetSession()
. H( v/ c2 Y( ~. y; d5 ~    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()+ \7 I2 g; Y% n0 `; c
    Dim workPart As NXOpen.Part = theSession.Parts.Work' |; Z( X% z  B. {/ T
1 r/ F# G7 T; `+ \
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
/ ~' m9 K1 j' o  |/ L2 {& d8 y' \6 U! V- v
    '  Explicit Activation" |# S( e8 q  x5 O
    '      This entry point is used to activate the application explicitly& `  u! b" C, h% Z, ^
    Sub Main()
% O, d1 |0 y( C0 o3 j1 R) ?2 E; P5 w: y; l) a9 l+ X
       Dim sp As New Point3d(0, 0, 0)
5 r; T. E! Q5 f, D: r        Dim ep As New Point3d(50, 50, 0)
7 O2 g/ L! y5 B+ D        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing" j& ^1 Q7 d5 K& V; m) i% E
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)2 U) u& H( ^+ ]+ ]/ U% e2 e- Z
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder, A9 h, v" e" a' o2 o0 t. i
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
( n3 s$ r% @+ X4 F) k) `; @& r        Dim point1 As NXOpen.Point
) \& R( a- E; }+ h* e3 Y+ k        point1 = workPart.Points.CreatePoint(sp)
0 |* K+ \; ?9 S" w* N4 Z! k        Dim point2 As NXOpen.Point
% o; K1 _: o6 d. U" b- W0 k        point2 = workPart.Points.CreatePoint(ep)
  t5 t+ v$ u- a9 A( H. ?  m9 R        associativeArcBuilder1.StartPoint.Value = point1
$ T) i8 W! O& S; k3 f/ a; P* h        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
2 M3 V) W( ^" C        associativeArcBuilder1.EndPoint.Value = point2: P& X6 k  ^2 J4 [/ m0 ^
        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point( M& F1 Q; m+ i" p
        Dim point3 As NXOpen.Point
# V# p9 G7 p  W( s" V& K% `( q        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))% E0 N6 K0 G2 k$ M$ |+ `8 _
        associativeArcBuilder1.MidPoint.Value = point3
1 i( z' h+ R; ?4 x        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
5 v, b4 `4 B# B6 k; r* w+ Z        Dim nXObject1 As NXOpen.NXObject
/ E# e$ b) s( I+ F        nXObject1 = associativeArcBuilder1.Commit()
# d: Q5 S! x0 m( i' c        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
. }5 j4 R- }, j" B# F        associativeArc2.SetName("123"): w% g8 ]% @& j' d% Z. \( \7 k
        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)  X7 f+ P( C' y4 ^0 E8 p0 f
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point. z1 `$ J' v( L) C/ [
        Dim displayModification1 As NXOpen.DisplayModification
: v0 L7 P1 \0 p. P% l        displayModification1 = s.DisplayManager.NewDisplayModification()/ `0 u: g5 g% J0 f
        displayModification1 = s.DisplayManager.NewDisplayModification() '
1 a; w2 c& i2 F4 y: x8 K        displayModification1.NewColor = 7     '设置颜色: c) Y. e3 h, R
        displayModification1.NewLayer = 10    '设置图层
9 B. z, b  O4 u% L5 H: H        Dim objects1(0) As NXOpen.DisplayableObject
4 x' ~$ |/ T# X* E+ U7 x7 r. z& G        objects1(0) = theLine
& n+ r' M3 u5 c$ C) I7 n% j        Dim object2(0) As NXOpen.DisplayableObject  j/ a& S* [" T" U4 l& h$ a
        object2(0) = arc1
2 n. K: w; m$ m* y7 J' a9 C        displayModification1.Apply(objects1)
2 h) k8 z4 c( u# O4 \        displayModification1.Apply(object2)/ Y" w* A$ b! R' z' r% t" q
        displayModification1.Dispose()" m+ q! O9 W( V
. m9 p9 I! J# l; b5 f8 ?! {% R$ N

- y( s1 k8 _  T: w& Y" Z, ~        ' TODO: Add your application code here " s/ I. o# {" Q1 y4 d
- v- N* r  D1 Y6 R9 w
    End Sub
5 d" \" M& s+ y  m
2 ?0 b6 q; W1 k( V/ l( Q( H  ~' V* H( @
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
% a% l) F9 n2 _& l! R7 I$ S* Q: m7 W/ Y& x
        'Unloads the image immediately after execution within NX
- h) f) i9 a& M( y, U  C/ l' S6 u        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
, Q" ?7 A% k8 j3 v5 Y/ m
. ^, n: T2 q; H! O' Z  V0 @        '----Other unload options-------
/ Q. _; B2 v! F4 B        'Unloads the image when the NX session terminates- s  Y$ ]5 E, O7 r2 p& l0 z
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
' v  P# i0 ^$ w9 ~0 N8 q/ @  G3 X/ E* L2 `  I4 ]# a+ U) u
        'Unloads the image explicitly, via an unload dialog
( B3 c+ G3 e& G: _4 B9 D" |) N        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly3 y( Y, p* A4 M& M
        '-------------------------------: ^3 t" m- ~4 M# |1 L& ~
7 a% m$ W; l, ]- V
    End Function
3 D. U7 \  C1 ^, a: ^* ]  k7 S! K1 `- ?8 d! V
End Module
9 O6 Y7 a+ r) }, k) K! L; n7 \: e: Z. ]

( M/ p( o; o2 h* {! }7 I9 r7 h+ L5 T8 c6 U

运行时报错

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

    我知道了