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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:3 l# V% A$ Y8 b3 n5 C3 b% K' S

/ k! p, m: M8 D6 x( c2 e  {8 v7 H( X; q8 k2 R4 H$ T
Option Strict Off
% o9 A7 K4 i0 _Imports System2 `; ^4 k; v  B) u; N5 `; A2 x
Imports NXOpen1 \' q7 P$ F# j' }' J6 ]5 R# m
Imports NXOpen.UF
8 Q& x6 W6 P% g5 h% zImports NXOpen.UI' M5 a2 r1 J* O) s

( |3 V( Z; U" ?% @9 jModule Module1) D; _! e8 @6 R- {) H# P9 h% O

: Z* @" D- M3 V  o# o4 {    Dim s As Session = Session.GetSession()# n) J$ r2 V& u, t- G
    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
; e# G' u2 q; V9 y% X9 y    Dim workPart As NXOpen.Part = theSession.Parts.Work$ M% U/ x7 v/ D' ]- C  L" c, H/ j
& K# j& ?( c( b
    Dim displayPart As NXOpen.Part = theSession.Parts.Display9 f4 j2 a: i5 c: O: ^  I# l
  t) w" t2 M( S8 V
    '  Explicit Activation: V9 T+ f. v  Z. m4 r2 }! {. T* ?
    '      This entry point is used to activate the application explicitly
& O: @+ E$ _5 z) u7 u: E    Sub Main()
- S' n/ V0 O8 f4 l! r! v
& S/ g! P1 y  s$ }: n. P( C4 N" s       Dim sp As New Point3d(0, 0, 0)1 W  M* y& p9 j. g3 n
        Dim ep As New Point3d(50, 50, 0)
4 j3 Q' _$ @; @        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing; l, x  N0 s( ]+ j: {
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)1 Q7 m9 W' Q! t; [
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
: H9 R" h; R) D, L1 P6 w& G* b        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)% P2 ~; B( q0 z) {% Z
        Dim point1 As NXOpen.Point
5 S1 V( X- v) `* T- z- G. W        point1 = workPart.Points.CreatePoint(sp)
- @9 D7 p# G  n3 G$ W        Dim point2 As NXOpen.Point; U) P, D* Y$ t: q7 l0 E+ z
        point2 = workPart.Points.CreatePoint(ep)+ `- p- }, `! ^
        associativeArcBuilder1.StartPoint.Value = point1
) W( m# Q; L5 Z: e1 X, j! y5 _6 `        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
9 s4 O: ~7 p# c        associativeArcBuilder1.EndPoint.Value = point2
, }, [' X/ p  b2 g        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point/ a+ ?# [& V1 l; j: {' k
        Dim point3 As NXOpen.Point
. `$ w: [- k1 S( \        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))! l, `1 H; @5 j2 p5 K
        associativeArcBuilder1.MidPoint.Value = point3
5 ?1 x( R+ D5 @& U( L4 q5 d        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point; {% k$ l* c( u# ^- q& i
        Dim nXObject1 As NXOpen.NXObject
" X! M3 J  d+ m! T        nXObject1 = associativeArcBuilder1.Commit()6 H4 k4 w4 q7 g
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)6 P/ ^, d: \( O
        associativeArc2.SetName("123"). o2 l2 h; p' `3 K: o
        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
, V/ g& Q% s' x% n; B! h        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point( x* S: [0 b. u. `4 e
        Dim displayModification1 As NXOpen.DisplayModification
0 ~3 j( E! ]7 C( U: m% |" m% ^" m        displayModification1 = s.DisplayManager.NewDisplayModification()/ H6 ?5 Q) S% ~# q
        displayModification1 = s.DisplayManager.NewDisplayModification() '
4 Y, W8 L  Q% q. ^# U/ z        displayModification1.NewColor = 7     '设置颜色
) Z$ D% A# g& x7 p        displayModification1.NewLayer = 10    '设置图层
& a( M( v. k/ u% l        Dim objects1(0) As NXOpen.DisplayableObject
  g2 G4 u: _" `6 v" r- u% J: ?        objects1(0) = theLine
( R. x- O$ F6 ^& M& S9 c: ]        Dim object2(0) As NXOpen.DisplayableObject- _3 H$ N# k& V( r5 H
        object2(0) = arc1
- m( m7 K% n! p9 u7 A7 E6 I, `( ]        displayModification1.Apply(objects1)# f  z7 M' C) U" P2 m: V
        displayModification1.Apply(object2)% m( N' G0 i; v8 y8 G
        displayModification1.Dispose()
% o% {! W$ A; @6 |
* q6 F4 V/ l* V* I% n* u
: d6 ~6 r& K( O8 x        ' TODO: Add your application code here ( z3 e5 l9 v0 W- |& ~. _

: T# ~& R$ C6 _0 S; u: z    End Sub
: i/ \% O" L" m7 y# ^7 e3 B( s
. C' ~3 e- {0 }  i0 O- J1 D$ I6 g' p5 H
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
! B$ l5 g/ h: V* q0 l. f& t- o' _* |4 @1 j+ J# N/ H7 P( V! [
        'Unloads the image immediately after execution within NX, U5 A+ t% o9 s/ {* w
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
3 {3 j2 C8 P0 ~0 \
0 ]  `6 J7 J" O: x        '----Other unload options-------
3 F3 K: {! n5 x0 {& U3 D        'Unloads the image when the NX session terminates
5 O* m$ i3 K; V$ i8 m" e        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination3 ?$ F) k6 [8 C! R3 l9 t1 U6 c$ }- i8 P0 H

' q/ @9 Q/ E& `' _: k7 t, }" |        'Unloads the image explicitly, via an unload dialog
: c& j9 ^( ]% N! e' q: x/ f- Z        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
+ a' I- F( K4 @7 J3 Y8 k% j0 d        '-------------------------------& f% H% ~6 U- _! k2 O3 z

+ ^5 d3 X5 ~7 I' o+ z7 b    End Function
3 v7 r; q2 ^6 o( I
- k9 ]6 W& _, c  P4 A4 m' EEnd Module
  K# w$ Q4 s6 Z% D/ [0 O2 ?: G6 S; E6 V# ~% _$ _

; g- b- t  u9 Y% D# R0 d; c: |6 c6 n/ ?" G5 N% t& n+ F: d

运行时报错

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

    我知道了