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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:8 G0 O, K) j, D2 D
- [  }! b" b) u
+ {" \! k( U, t+ J! Y
Option Strict Off
* Z+ z: N1 X) A1 w% s2 G8 WImports System
7 m) a. q( E" S7 w6 `* OImports NXOpen8 {, n/ {+ n5 R: V9 m
Imports NXOpen.UF
) V, M& u! b( P* l. m. q$ R$ Q# iImports NXOpen.UI  c5 e8 J. r# }* V; w: E

0 w6 T1 r. c" \" ~# ZModule Module1
" M* Y9 y3 i/ B% C: [2 O  W, |
1 t# ~$ d9 r7 W1 }; ^: b    Dim s As Session = Session.GetSession()
! x/ c& S' P/ Q; l    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
0 u; i8 W7 z7 _    Dim workPart As NXOpen.Part = theSession.Parts.Work/ R5 ~2 X9 h/ F+ n4 q8 q7 L
1 W7 }/ R" T- p& L
    Dim displayPart As NXOpen.Part = theSession.Parts.Display* _  s& i5 H/ d  X2 G7 n+ k

; ~$ Z0 j( i( _& D    '  Explicit Activation
5 x7 x! ?& C: c7 f5 O) U5 j  r    '      This entry point is used to activate the application explicitly
) ^/ J7 A1 x2 i6 H+ @- {    Sub Main()' [* p3 R) x7 {6 ^  n
1 F! m3 _) u7 b, g: B" I
       Dim sp As New Point3d(0, 0, 0)/ G2 Y. A2 k* Z" o
        Dim ep As New Point3d(50, 50, 0)
+ P* `" S2 U$ a0 C7 J        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing; t- |& c' [- L4 g2 K; q* I  ?& g
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)" C3 R0 D* p; h
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder4 R- v% [7 N) M1 u
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
  D" I* F7 q+ S: K) e7 |        Dim point1 As NXOpen.Point3 d! l5 ]) x! |& m% X, ?% o; q
        point1 = workPart.Points.CreatePoint(sp)
, i/ v" w. n& K) K2 l0 v. ^        Dim point2 As NXOpen.Point8 Q( B3 U3 y: N0 K
        point2 = workPart.Points.CreatePoint(ep)
- M% A4 u  V7 e        associativeArcBuilder1.StartPoint.Value = point1& i" v& q* |. `4 y
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
8 A/ ^5 n6 I1 V* D/ ]4 x        associativeArcBuilder1.EndPoint.Value = point2
' D; P0 G4 ~0 a0 G        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point  `+ [2 {- `& z" Y& S8 w% U
        Dim point3 As NXOpen.Point
3 W9 ^4 Z2 W2 ?2 e9 G        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))2 l* o7 }% Y1 Y# ^
        associativeArcBuilder1.MidPoint.Value = point3
, T+ x  _! n1 @$ ?        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point3 I4 P* J6 ~4 ~
        Dim nXObject1 As NXOpen.NXObject3 J  q# L) ]" \* Y( ?" s3 y
        nXObject1 = associativeArcBuilder1.Commit()/ k, r! @5 K6 v6 p/ \) j
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
- F" y, J% B, F( c" h        associativeArc2.SetName("123")
' O# R( Z; m7 U. M# @3 u        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)- [  h; h5 E& N, y! b
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point- L& E! Z$ ^5 [+ k* D
        Dim displayModification1 As NXOpen.DisplayModification: ?0 [5 o! J* y; E; }
        displayModification1 = s.DisplayManager.NewDisplayModification()
6 i5 X. y2 h9 G+ c        displayModification1 = s.DisplayManager.NewDisplayModification() ', y4 `; b2 q# `# ~# B; |" `
        displayModification1.NewColor = 7     '设置颜色- ~; Z' ~5 ~* w4 o! Q
        displayModification1.NewLayer = 10    '设置图层( H9 t" o8 u5 w# E' y) Z
        Dim objects1(0) As NXOpen.DisplayableObject+ I6 _6 {6 E. t4 M
        objects1(0) = theLine
2 ~8 J0 m6 _1 V. |/ j/ c# ~        Dim object2(0) As NXOpen.DisplayableObject
4 u2 _0 s: P7 l- F0 t1 b$ J1 I        object2(0) = arc17 V$ C, B  z! q$ L
        displayModification1.Apply(objects1)7 O2 I$ s* {/ M# B
        displayModification1.Apply(object2)
% t- E+ f. O: ~0 {5 K        displayModification1.Dispose()
) {; L9 |+ g/ y) Q  p9 M+ F. E. t- m/ f1 a

" J3 X3 b& X  h7 K$ w        ' TODO: Add your application code here
4 v1 _. N# i  U4 E
4 o1 x9 I0 k8 H, Z4 h7 R    End Sub
) w4 c0 x1 y3 Z* I* Y$ L! S7 U3 b. `* T* O
9 t0 O# P. P+ J
    Public Function GetUnloadOption(ByVal dummy As String) As Integer9 @* y  H; K% }! _" o( C# G9 k
6 s/ q  d$ {0 K' e8 V
        'Unloads the image immediately after execution within NX0 d; c3 O; g5 G. X4 _
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
! l1 K* Q) L* [
' |$ Y1 o) P, ~6 s        '----Other unload options-------
' x* L( a0 I/ C8 E        'Unloads the image when the NX session terminates
( D6 Z5 ^- `! p4 d: D5 S        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination* j& G; ]  |' V4 m" U' @
; k1 _' e. a: q" N1 Q. W6 V
        'Unloads the image explicitly, via an unload dialog. B6 J4 Q9 Z! m6 \1 h, o) A2 ~1 s4 F
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly+ {) t1 a4 t: S0 ^
        '-------------------------------$ y1 D3 O4 U( x0 }
. l# V" C& s- G. p; `# }! M
    End Function
  M+ l/ O& ?' K2 q/ r) D  W# y: ?7 x9 s0 k# s, u: I0 F# c' T" C3 p! E, C
End Module2 E$ w; h3 r& v

5 D! d5 G  V0 a1 R' |9 e) h: d% I
2 |5 g0 b/ U9 L+ O" q$ c4 b; q
  I2 {/ o  F7 M' ~* t* m

运行时报错

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

    我知道了