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

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:
' _  r* G4 n# I9 d
2 K: [  |* f3 `* A
! m0 G: j2 g( ]Option Strict Off
6 @6 E2 ~3 L- a) NImports System3 t$ N6 Z# K1 `* `3 ^" t. l; x
Imports NXOpen& ]+ v8 b7 W9 ?  B' d9 S) y
Imports NXOpen.UF/ x2 j" z9 ]9 G' s: ]) u1 c5 C
Imports NXOpen.UI* _; ^8 k$ l& _. b( R( O
: X" D! z% D, h5 M. `6 x
Module Module1
8 a- e8 l* i: P5 ?8 U, W) S& g3 X: V' V3 c# N
    Dim s As Session = Session.GetSession()
+ S6 y, l& E% Q    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession(), F% v0 q& e4 g' z0 [
    Dim workPart As NXOpen.Part = theSession.Parts.Work
$ D1 P% y5 J! }# l! Y6 i6 ~9 S' [& A; c9 h; y: S
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
# \3 ^: F& o$ w7 f4 w( \" v
1 X; V5 z& e  ]* [    '  Explicit Activation
* W. I8 O% [  Y! N# w    '      This entry point is used to activate the application explicitly" e8 I8 [, G: c5 w- S/ {
    Sub Main()
3 Z# o" l2 t+ a+ @" ?% o# N8 S9 y% F! y) s% V
       Dim sp As New Point3d(0, 0, 0)" A( s& M: }5 S% V+ {$ U9 y
        Dim ep As New Point3d(50, 50, 0)
  B2 k1 h# _  L/ J* s0 ^        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing
3 ]- z7 p+ C' w, z6 `( _        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)
7 f: k! Z. t. M' o! Q        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
) r# z9 g/ P7 @1 v( q' ^) L1 m: J" D- m        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
! o# q) i$ Q; d( a' W4 S: v# |        Dim point1 As NXOpen.Point$ S- n7 I3 G2 n+ \& [, @3 n
        point1 = workPart.Points.CreatePoint(sp), Z& r) M* Q6 h9 A8 q
        Dim point2 As NXOpen.Point9 Y" f0 A2 q' s( z6 C/ K7 m: u
        point2 = workPart.Points.CreatePoint(ep): A4 `5 |( z3 }: y& [* [
        associativeArcBuilder1.StartPoint.Value = point11 }' h# |. c" t( N4 e. G/ b# e4 u
        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point/ Z" m8 |! Y' i/ V) l' P$ [1 s
        associativeArcBuilder1.EndPoint.Value = point2
# B3 @3 m  @" M        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
- H( P8 Z' `( V7 C7 L+ \        Dim point3 As NXOpen.Point% P9 e7 K/ X. c! h+ n/ X7 T& y! }
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))5 X9 E4 X; H" f5 A
        associativeArcBuilder1.MidPoint.Value = point38 s3 Z) P# f& ^9 Z
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point# s: {" e! y2 l. w
        Dim nXObject1 As NXOpen.NXObject
7 G1 }5 J8 e) h( L        nXObject1 = associativeArcBuilder1.Commit(); I& D8 E5 u( t: o/ \4 t
        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)
, O9 U5 V1 J/ c# l; i        associativeArc2.SetName("123")
5 V2 b/ r& M; o3 S7 L0 U        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
! E, b; W  n9 T        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point
( f: G; M. w, S; |        Dim displayModification1 As NXOpen.DisplayModification
9 e; }3 L7 i# q4 W4 Q) T, h! b        displayModification1 = s.DisplayManager.NewDisplayModification()
, ?8 G- A& K; q/ O. [; h        displayModification1 = s.DisplayManager.NewDisplayModification() '
& c! R; q% }0 a5 N' T' N9 v        displayModification1.NewColor = 7     '设置颜色
0 m% ^) b1 c  f. ^" r: [  ?  F% v0 C        displayModification1.NewLayer = 10    '设置图层
7 w7 M! s1 {8 y, ^9 i1 b        Dim objects1(0) As NXOpen.DisplayableObject7 ?1 L4 G" b* w3 D- [' {* b9 U
        objects1(0) = theLine
7 S; a. r  x' Q% l        Dim object2(0) As NXOpen.DisplayableObject- P7 E2 g# f- M# l
        object2(0) = arc1; B+ j5 m( {) x7 ?3 ]- C/ {7 Z& t
        displayModification1.Apply(objects1)
7 X0 n" z! k& x% ]5 t2 Y- K        displayModification1.Apply(object2)
  h* Z- z# o. M& O; l        displayModification1.Dispose()
; P' X$ U' Z9 W3 G2 W; c. z6 b9 o3 N6 k
% g% S4 M( }, R
        ' TODO: Add your application code here 7 e- |( e7 ~$ T7 R7 t& c

3 Z* ~# b+ k2 t- h/ y$ c    End Sub
0 c. I; X3 b6 u- r. }, H; t3 m( A% o7 u# [: r
0 T1 e. @. f" H0 ~; q5 }
    Public Function GetUnloadOption(ByVal dummy As String) As Integer4 F$ d! h& ^" U% I3 g+ f

6 w+ v$ f: s/ h! c' _! s, |, d" m+ x) Y        'Unloads the image immediately after execution within NX+ `8 b! M* a  P, u) @
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately) ?7 N% [- Z3 M! v7 r
  S$ r, G" F$ y. a0 U4 @# ?
        '----Other unload options-------
& F' E& I0 I" M# h8 P/ K% n        'Unloads the image when the NX session terminates6 \+ ]2 M3 ~" u# V( M
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
1 E( R$ g: ]3 p8 x
. Z  a; e2 d: O: O& m' s5 P- N        'Unloads the image explicitly, via an unload dialog5 v" ^+ T% ^, A' ^/ ^
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly' {  b, H5 A$ b! U* z) U* l( |
        '-------------------------------! r5 ?# q( I1 d$ o
6 f! Y# c) N# K" N# ~
    End Function
( y* m* B, q2 d' q' i
, i4 z$ B7 B) o/ B) t. ]) oEnd Module5 h# d7 O" M" t1 _

8 M7 ~2 W! i$ A  q! e) S
% x, O7 n' q; `1 i. ~' N4 ]' `4 `) [( \5 u, q% {: f

运行时报错

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

    我知道了