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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:
! l& ]) B+ l3 c% o9 g; K0 A$ a
/ b4 i+ s% d* u6 `9 ?. Y/ C4 e: d0 m# R% h5 r
Option Strict Off
, b3 v8 D0 D' A; n2 t4 N3 ^Imports System% c' j; o# h' O5 x+ F
Imports NXOpen
1 I# R6 c5 S7 |) T, H/ G1 SImports NXOpen.UF% P; u5 K3 s0 a; r4 T
Imports NXOpen.UI
. v1 y+ v. V6 @( V. y: p3 }* P
* n% A6 f6 j7 `( m$ q! _  bModule Module10 o1 g3 f# ^- O# e" s$ M

. i* i6 M0 a/ X6 {' k5 C! [+ e    Dim s As Session = Session.GetSession()9 q1 x9 Q  o5 Z& ?- R+ R# w4 M
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()  q2 |  C( e: z% f/ f! n9 x' s
    Dim workPart As NXOpen.Part = theSession.Parts.Work8 @. ?5 |7 n; N# }- G1 u( n6 I
3 g# A4 R4 ~' k9 I8 S
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
% Y( e4 K6 |: l" |! L4 ], R* Q; ?* U. e, c
    '  Explicit Activation
1 B' j) Y& x5 S9 O4 _    '      This entry point is used to activate the application explicitly) ~7 F: ]; ]( y5 I- v3 u, u
    Sub Main()
4 `- G9 ?+ M, S1 S& C( }- L
! p/ J- x; d* _       Dim sp As New Point3d(0, 0, 0)7 ], g8 i  j1 y( q8 e
        Dim ep As New Point3d(50, 50, 0)7 x. g2 R: m; E& |% B
        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing0 p2 x7 b) S% q# v. X' ^
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)1 J5 Y- ]" p1 J6 @" w+ p
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
* S; B7 q' v; X/ R2 c- k( B        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
: q) ]. x6 x3 Y3 @. Z        Dim point1 As NXOpen.Point  P9 N0 v# b  S
        point1 = workPart.Points.CreatePoint(sp)2 K) d* q5 E- e4 J! R' S& a
        Dim point2 As NXOpen.Point. H1 x% G# e, X" w+ d: x4 ?
        point2 = workPart.Points.CreatePoint(ep)
: x: s- v5 }- ^; [+ Z% A  k4 T        associativeArcBuilder1.StartPoint.Value = point1
& x2 C+ X/ s5 z7 P. K! G        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point+ Q7 |0 _2 |& M# O- q4 Y/ \0 S
        associativeArcBuilder1.EndPoint.Value = point2
9 ~7 V  R0 z: A! ?, e% D        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
: f0 }# [# k! t/ @: A        Dim point3 As NXOpen.Point0 f! N* L; c7 @* b$ ~) F
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0)), L; n8 P2 O  `+ u& T
        associativeArcBuilder1.MidPoint.Value = point3/ k/ b# F& f( L8 t+ X7 [
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point' [) D; g2 R* B2 r5 D  V% `* p+ d' o
        Dim nXObject1 As NXOpen.NXObject
) Q6 Z$ Z7 Z5 p  w% K        nXObject1 = associativeArcBuilder1.Commit()- f' i! M; L6 {& X, K
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)/ N- ~! n2 ]3 D* J/ t& g7 Q) J* V
        associativeArc2.SetName("123")
* D2 ]4 b) j7 f3 C& y( B/ c        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)5 f2 L$ Q" G1 }, m
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point. T' }% U- _3 k# i
        Dim displayModification1 As NXOpen.DisplayModification
2 q! X# I0 Y, p- q& p        displayModification1 = s.DisplayManager.NewDisplayModification()( ~+ J) l4 T5 [! S) u: s
        displayModification1 = s.DisplayManager.NewDisplayModification() '
4 X% W6 f  b1 S: {        displayModification1.NewColor = 7     '设置颜色7 ~& W; N8 U& p
        displayModification1.NewLayer = 10    '设置图层
5 @2 W! P. X. B- p5 s  Q        Dim objects1(0) As NXOpen.DisplayableObject0 e2 r* t: F3 n: _; e, E
        objects1(0) = theLine0 D5 ^2 F+ S% Z; R% k2 R
        Dim object2(0) As NXOpen.DisplayableObject
# {0 l. m! D' O$ b        object2(0) = arc1
) R; e1 l( |" L) K" A3 l6 g        displayModification1.Apply(objects1)
  [. V' B. N; ~        displayModification1.Apply(object2)
) Y, i7 R& K7 M7 |        displayModification1.Dispose()
* f' `6 S) N& O) A) e) L, x7 i/ B4 h6 d9 }" R+ N8 t, p* ]' A1 X
/ t" ?. T( c: x7 Z
        ' TODO: Add your application code here * G, a8 i! l% H# ~' T9 }

+ z3 a9 _* D8 k2 I    End Sub
2 A+ d* y4 \4 w$ S
- B  h2 L0 N) b/ |& Z' H( ]9 K+ H+ L8 @
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
3 M; z' h/ I0 H% m* y( t# [7 T2 q  ~& L
        'Unloads the image immediately after execution within NX
, W: E6 d, |; [  B! d% B        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
& R2 n7 ?4 K' p5 N' ?1 c- P$ k5 o- G% t; V% a$ P3 M
        '----Other unload options-------
" S3 N  ~: u0 f) ^' B. l        'Unloads the image when the NX session terminates
% S. c2 Y. P/ S, R        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination' y! f- \' d5 t; b

/ E- x- S* b, r$ M) w% A! T$ O, u        'Unloads the image explicitly, via an unload dialog
9 d: F% @* ?+ a3 ?3 O        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly7 F# ~) p3 \0 ?% _% O3 \
        '-------------------------------
% N' O- \, B; B/ ]# Z3 f6 U
+ f) L$ A/ [, F$ N8 ^    End Function
0 S0 X) S7 O# r, h1 H# z1 X. \0 B1 J# v" w
End Module- C0 @3 U$ \8 ~+ x* P

6 N4 x( e4 ^' Z1 T; }! ]# a$ B
7 T0 Q1 g5 a/ e% `; \8 H" @
6 P* _- j0 H$ ?7 P' G* m/ e- }

运行时报错

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

    我知道了