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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:
1 b; n; h) z( N+ R
7 ~- U) m  W; I9 p
: B# i( [. g# j' ^6 B3 IOption Strict Off
3 U0 B$ X, \; xImports System
- b. f) V% p  W$ l' HImports NXOpen
% W) x* G( u& {8 I$ j9 g+ \Imports NXOpen.UF5 \9 [4 m- F' a/ a3 Q7 B$ X
Imports NXOpen.UI( ~6 H! L# O: v9 ~: p

7 F' _0 _" J4 W5 rModule Module1' V7 m6 d: L  p# R% d

. f! X' I' U# x    Dim s As Session = Session.GetSession(). s9 g$ s3 I& L  U( S' h( `
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()4 B# _. J% C% G& s0 Y* x# f9 c
    Dim workPart As NXOpen.Part = theSession.Parts.Work
. M( X" d: r; }' T! V3 A
& ?+ O  e0 J3 x4 P% x3 ~    Dim displayPart As NXOpen.Part = theSession.Parts.Display2 C0 ~5 M# s, R' T: Y; `! _

! u( m7 W# O% Q7 X$ d    '  Explicit Activation0 J. R7 o8 f# b6 X8 a0 E! S
    '      This entry point is used to activate the application explicitly
( S# z5 o& j( i2 K    Sub Main()  c5 L! f8 l1 B/ {  m3 B% r: L
, E2 h% x- S1 q% |
       Dim sp As New Point3d(0, 0, 0)' o8 ]" D& t/ L- L) b' }
        Dim ep As New Point3d(50, 50, 0)( u9 L( g) Y6 p, {/ z6 N! }3 k
        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing9 C& X8 s' c  v2 J+ t9 ?
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)' ^  N, F" I) G' [) L/ {
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
$ o# T5 [8 y& J! d7 [' D+ @        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc). w/ h" Z  \" O$ o
        Dim point1 As NXOpen.Point
: ^) K! g8 A/ g. q/ x# g5 ?        point1 = workPart.Points.CreatePoint(sp)
1 e) x3 ^: b# [" U# ^  H4 }        Dim point2 As NXOpen.Point9 H* \7 [) s! |9 \  A8 I; q: m4 g, D
        point2 = workPart.Points.CreatePoint(ep)- j! }; T5 k/ ~! `. N
        associativeArcBuilder1.StartPoint.Value = point1. T  n5 K; m" k7 z
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point/ J( o$ y6 z' {) \. D- ~6 s
        associativeArcBuilder1.EndPoint.Value = point21 A# V5 ]/ y, q4 H7 N4 X/ V
        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point) q' _* U+ O, m% o& s2 f
        Dim point3 As NXOpen.Point4 [/ d" z. s- C
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
9 A, A5 O3 y% M& b( H        associativeArcBuilder1.MidPoint.Value = point3
& Y7 ~1 @, ^/ F9 f" Y" _# S3 I        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
; i9 x$ e8 f+ c* f" O) O- X5 X        Dim nXObject1 As NXOpen.NXObject6 w5 [4 R3 a- i! {
        nXObject1 = associativeArcBuilder1.Commit()- n5 e" Z6 O' s; b! c/ O
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)( X- P. U! c5 f$ x3 ~1 k% f* x
        associativeArc2.SetName("123")
$ Y" t  F; E9 k8 L9 j7 q  [        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
8 @6 W6 Q: V" S2 V        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point1 q( B8 ~& G1 Q7 M. Z8 G
        Dim displayModification1 As NXOpen.DisplayModification  q- f, b5 G! s* E/ r
        displayModification1 = s.DisplayManager.NewDisplayModification()
- J/ l' e# L( l4 m, d$ O: C        displayModification1 = s.DisplayManager.NewDisplayModification() '4 Y# D  |# s  B2 f
        displayModification1.NewColor = 7     '设置颜色
6 S' y" C& \7 x% Y; t        displayModification1.NewLayer = 10    '设置图层( d! _5 d1 b, P8 \; I
        Dim objects1(0) As NXOpen.DisplayableObject
+ G) M, h9 Z3 g/ o$ F& o        objects1(0) = theLine
: _0 i! z4 o: q. i' C& ^: V        Dim object2(0) As NXOpen.DisplayableObject
9 ~( q# g% _# v. w        object2(0) = arc1
4 E3 B: ?) b/ b, H        displayModification1.Apply(objects1)5 j3 g( ?3 P2 Q7 @3 j
        displayModification1.Apply(object2)# n$ d! A0 O& S
        displayModification1.Dispose()0 c$ J3 m& D1 E0 }  K- L

4 `" _3 O: W' F0 g! a! N. I# z. Y8 L( G
        ' TODO: Add your application code here 4 k. L) T- L' I7 k8 a6 O# F

5 H" ]4 u; a2 m    End Sub% g; m4 ], N' c" Z

+ I" ]3 g5 t6 c) e1 w' Q: ?; P7 z/ x: x
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
/ p' R( r3 P) n; A+ b- q; }
8 \8 K5 `3 ?- I1 q' X4 z6 g        'Unloads the image immediately after execution within NX- `4 P! n% V* o& q3 k+ i
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
  D1 C" W' s6 ~4 X# Y  i7 W& Z; {' ]9 p. }! H+ c1 x+ d/ ~
        '----Other unload options-------
! f* v" [- e- s6 j. M9 w7 _        'Unloads the image when the NX session terminates! P) d) s; M& K# K2 v2 I6 g6 p9 M
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
" c# V) ]0 y, `, r' j+ R: {8 D4 H$ Q" P+ H) E
        'Unloads the image explicitly, via an unload dialog
1 G- A; S7 x6 f( C6 \7 `4 r        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
3 c6 T1 o& J8 j8 f! t+ R1 L9 J        '-------------------------------
1 e: m" g: f5 k4 g% f! A2 z/ f3 f
    End Function" U: r4 \( R* K! w; ]! L
" T$ ^% g7 j3 i  n* d9 y
End Module
3 U. S6 @1 K5 J- h8 l3 }0 L
) o! q. b/ w, @; _  l
: B$ |; E7 f- y6 u. @3 _% J1 q9 Q- |2 L/ U$ p; o: \; L

运行时报错

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

    我知道了