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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:
4 F- T3 `: ]$ \3 u# ]# F
  S) Q; ^. Z( K3 D/ b, I
1 H2 k$ b  t% n# \Option Strict Off
! ?  g- z9 m6 cImports System
" `6 A$ I! W. JImports NXOpen
- {5 Q. F4 ^$ _& x( _Imports NXOpen.UF: r4 w; g. `# `* {  C8 ?
Imports NXOpen.UI
# k& ^- v4 E+ o/ E
# Z/ S! n4 c$ g  c7 h' T& R' g, CModule Module1
- i' y; S- i. B. Z/ e$ A) V" H: H  L' ^4 c# i3 f
    Dim s As Session = Session.GetSession()
) ^7 t* K3 J& B' ^, c    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
8 j. p# {$ d7 U3 \! Y. o6 X9 z8 Y+ D9 H    Dim workPart As NXOpen.Part = theSession.Parts.Work( n* C# Z5 L7 S( |  e  v( J5 b
3 C, ?& o6 h1 @. F6 b
    Dim displayPart As NXOpen.Part = theSession.Parts.Display( ~1 S* x$ E  u8 W6 a
, Y8 w* v) Y) l6 t3 {+ B
    '  Explicit Activation
: p% l- A+ q9 e7 V7 M, |    '      This entry point is used to activate the application explicitly# K$ O1 H8 s8 W0 G0 \; I( K; q
    Sub Main()
- s' N5 D" u; d# C& ^, w+ [- M  l* q* |1 a: O( z4 d4 N
       Dim sp As New Point3d(0, 0, 0)8 S" b6 E; G3 A2 l6 x
        Dim ep As New Point3d(50, 50, 0)
( ~) l- B2 m3 S0 o6 u2 d% M7 p8 O+ a        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing
8 X  A) [' U3 O4 ^3 y) i  g        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)
9 T0 `" m7 S0 K* m- A        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder1 M* K5 M, k, s: C4 `, B3 ~, D
        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)! ]7 E2 Y0 O* q$ u* F6 q. U0 [
        Dim point1 As NXOpen.Point
- w, {, P3 a: @+ G" I' C        point1 = workPart.Points.CreatePoint(sp)
1 @! e5 G7 p& I, \7 X% l" z        Dim point2 As NXOpen.Point9 n8 t6 Z8 {- @. o% F
        point2 = workPart.Points.CreatePoint(ep)
1 N  |1 Y, K& |  J        associativeArcBuilder1.StartPoint.Value = point1
6 g5 W$ Y/ x2 z9 B$ C: a3 b, X        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point) @0 k/ ^$ E+ \% s0 l7 i7 `! `
        associativeArcBuilder1.EndPoint.Value = point2' j" v1 T" s* z8 q
        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point# W. G* K. S! r- n. w& I
        Dim point3 As NXOpen.Point
; w" g# Y- g- K0 }+ l        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))) ?/ K9 K- ~/ Q
        associativeArcBuilder1.MidPoint.Value = point3& W5 Z2 N6 G, c- r( ^
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point# c( F8 p" Z4 ~/ f
        Dim nXObject1 As NXOpen.NXObject: ]) E* t' q4 m! s% `# P( K
        nXObject1 = associativeArcBuilder1.Commit()
% m. c( c1 z, e1 a" e        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
/ r" z4 {" {. ^$ K! |( W$ }        associativeArc2.SetName("123")
# r  l# o  Z: g$ A( X        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)3 s% ?; k9 u* ?1 N7 B
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point4 v3 i' T# j9 y3 g0 N7 F
        Dim displayModification1 As NXOpen.DisplayModification: B8 f% A+ Z! X6 ~/ A2 d; X* _
        displayModification1 = s.DisplayManager.NewDisplayModification()7 _  f( e+ m1 G/ Y) p
        displayModification1 = s.DisplayManager.NewDisplayModification() '3 Q" L8 W3 r6 _* L5 w- f
        displayModification1.NewColor = 7     '设置颜色
1 D0 V6 L% k' q. e        displayModification1.NewLayer = 10    '设置图层  N2 _, s7 P+ J) N1 u
        Dim objects1(0) As NXOpen.DisplayableObject
& Q2 i. p2 Z4 M9 i        objects1(0) = theLine
5 I5 P8 j2 w' ^# B( c, L        Dim object2(0) As NXOpen.DisplayableObject* |* T8 L% ]# H
        object2(0) = arc1' o5 i) l9 }9 k7 P  x
        displayModification1.Apply(objects1)7 a8 ?+ a% R. {
        displayModification1.Apply(object2)
" |' D* a) C7 _* k% n) W& V6 y        displayModification1.Dispose(): ?# ]2 S5 g- ?% j( e

) F& Y+ S% m$ l; h' f9 g& o6 h7 I6 ~% F- p8 C
        ' TODO: Add your application code here ' }* f5 b1 z0 j% E2 P8 S
8 U% N# @9 k* D) f( e0 ^
    End Sub5 k# N! w4 M) @" P, Y

$ w- K$ R" F$ ~1 E" d1 s. H; j- Y  b$ [  h& E7 k, J" Q
    Public Function GetUnloadOption(ByVal dummy As String) As Integer5 ]2 q  f( \" ~" }7 B7 w) y. @

, t9 ^6 Y9 S, ~3 I3 O  G        'Unloads the image immediately after execution within NX
- x& {3 Y+ }; N, ~" s; c2 W        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately2 p  v) g8 s7 ]! z1 a
4 D/ r. S8 j6 N2 f5 X# b" ^$ d& y% m
        '----Other unload options-------3 I2 h2 i& V- h
        'Unloads the image when the NX session terminates
* o# e5 A9 R/ G        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
: B  K. y' b! M. ~$ o
! n9 V; E1 K( v+ K. w+ _. x        'Unloads the image explicitly, via an unload dialog1 B+ D6 m/ i$ F: ^! s
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
$ z$ G# y7 y  ~! O* M# J. A        '-------------------------------
$ @& Z9 u7 x1 \3 ?. Z& r, g  @, Y3 m7 l* Q8 |8 |' k* N
    End Function
2 t" s0 M4 ^5 ^6 }
* a; N$ P7 t: N  b/ m8 t5 V# G# }End Module
$ r; n! d5 a4 j' F1 K# z
5 G: l! n+ @% ~
& `* D7 F8 S# ~" P8 Z/ v! R* c# v0 Y0 Z" S" `9 y

运行时报错

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

    我知道了