PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

PLM之家PLMHome-国产软件践行者

[求助] 设置线的颜色

[复制链接]

2016-7-21 21:18:53 3070 0

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

45guop 楼主

2016-7-21 21:18:53

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

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

x
怎么才能设置线的颜色呢代码:- ^$ [  J. {0 V9 b

. t) @. x- x% O; p* X4 Y' d6 g. @: Z0 D  O3 j9 h+ ?7 j9 a: v
Option Strict Off
1 b# P2 O" _6 m: T) r& ]2 QImports System4 y8 d' u% Y: V  S" e
Imports NXOpen
  F& C. X; }9 `3 X; h; y% s3 e7 j3 ?- zImports NXOpen.UF
) P; _5 n0 m6 Y. x5 kImports NXOpen.UI
) d: a/ |  x  B) e6 x" H
0 K" u% z- l% e$ ^3 ]: U9 hModule Module1
0 N9 Z% p; d- ]$ m, r$ Y* }* p% W
- k. G5 V8 x" `: x    Dim s As Session = Session.GetSession()
) Z0 l; o, L& l5 @. P% Y  V    Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()* D, t2 x, f2 ]/ Q4 v
    Dim workPart As NXOpen.Part = theSession.Parts.Work* ]4 q  B1 R/ u) F2 `  e9 \/ j: ~
) ~1 m+ A+ Y( l3 D- G
    Dim displayPart As NXOpen.Part = theSession.Parts.Display
8 e  T4 W/ a, w1 J5 P4 J3 }1 t* Q# ^/ g2 |
    '  Explicit Activation# A/ x, @4 N) _; Q5 h, U& L; l
    '      This entry point is used to activate the application explicitly
$ X. ^5 r2 K/ @+ r9 @+ |5 D    Sub Main(). c( t! Q3 h& g) f, s

$ N0 O* {1 n) I       Dim sp As New Point3d(0, 0, 0)2 w5 l9 _( _: J: |
        Dim ep As New Point3d(50, 50, 0)
5 v. q5 n9 S" ]0 X1 @* H        Dim nullNXOpen_Features_AssociativeArc As NXOpen.Features.AssociativeArc = Nothing" \8 {8 t/ y. T' I
        Dim theLine As Line = s.Parts.Work.Curves.CreateLine(sp, ep)) G7 v# `9 M) \& `3 J: G
        Dim associativeArcBuilder1 As NXOpen.Features.AssociativeArcBuilder
1 i+ X+ D& U8 W9 n        associativeArcBuilder1 = workPart.BaseFeatures.CreateAssociativeArcBuilder(nullNXOpen_Features_AssociativeArc)
; X  y# q/ r7 b% Q- X        Dim point1 As NXOpen.Point
& R: W% Q  l3 Q        point1 = workPart.Points.CreatePoint(sp). E. p  }) K$ z/ K: y8 c0 p6 [
        Dim point2 As NXOpen.Point2 h$ U/ D% Q* g% q( E- }$ T
        point2 = workPart.Points.CreatePoint(ep)0 Q& v, g0 X4 h5 `
        associativeArcBuilder1.StartPoint.Value = point1
  m+ S  r: y- k. U" d        associativeArcBuilder1.StartPointOptions = NXOpen.Features.AssociativeArcBuilder.StartOption.Point
8 E6 M! ^/ B  @& M# N5 e* U        associativeArcBuilder1.EndPoint.Value = point2
' @5 w' N: g9 Z! K7 v        associativeArcBuilder1.EndPointOptions = NXOpen.Features.AssociativeArcBuilder.EndOption.Point
; F& d7 w' }2 N$ i        Dim point3 As NXOpen.Point6 M% I  n4 K4 q- O6 T/ i/ m
        point3 = workPart.Points.CreatePoint(New Point3d(0, 50, 0))
1 K. r8 k9 `9 {3 n& d        associativeArcBuilder1.MidPoint.Value = point3" `' N: Q& z+ `) ]' g1 o! t
        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point8 R/ o7 Y  e( Q2 u$ S* A3 C
        Dim nXObject1 As NXOpen.NXObject+ T4 U/ i- a: X0 q( y9 [
        nXObject1 = associativeArcBuilder1.Commit()
* K+ h, L5 `7 ^        Dim associativeArc2 As NXOpen.Features.AssociativeArc = CType(nXObject1, NXOpen.Features.AssociativeArc)' \  |  j) ^" r3 N
        associativeArc2.SetName("123")
3 v- q) U" m4 E1 M' [; |, R! Y0 j        Dim arc1 As NXOpen.Arc = CType(associativeArc2.FindObject("123"), NXOpen.Arc)
- z) U$ ^  V/ v- f' R9 ]6 S        associativeArcBuilder1.MidPointOptions = NXOpen.Features.AssociativeArcBuilder.MidOption.Point: V/ o! L1 @( V& B8 ?9 o5 k5 G$ w0 r
        Dim displayModification1 As NXOpen.DisplayModification
% R5 N( c# L; {0 A" r+ Q) y0 b        displayModification1 = s.DisplayManager.NewDisplayModification()
# f2 h3 C1 D1 E        displayModification1 = s.DisplayManager.NewDisplayModification() '
4 U/ L' T! L5 D1 s0 |- u: L        displayModification1.NewColor = 7     '设置颜色+ j* m! Z2 S; z+ \& K7 h
        displayModification1.NewLayer = 10    '设置图层% N! }  E6 q& o+ N; ]( Q5 P
        Dim objects1(0) As NXOpen.DisplayableObject
6 E5 Q# i  F% S2 [        objects1(0) = theLine
& t* N% W* y3 i# ~1 Z        Dim object2(0) As NXOpen.DisplayableObject
- ~/ R  E1 {0 s0 T$ N1 j        object2(0) = arc1' j# m  z4 P, s0 O: l6 ~& C; o' K4 x
        displayModification1.Apply(objects1)
  h! x% j1 M/ N* P        displayModification1.Apply(object2)
9 W0 \& n* h3 |4 m        displayModification1.Dispose()
1 c* c5 W) ]: m
2 E2 T- P" D4 q9 m
! J& O, @4 F! G8 @        ' TODO: Add your application code here
/ M+ d! b0 V' W' w' H, q1 `  v4 X4 ~$ @8 S2 `9 u) u
    End Sub
+ o/ J2 o6 V% R8 i) u, i2 V" [0 i0 Z7 {

% z7 g9 D; g' \- }; ^6 B& V    Public Function GetUnloadOption(ByVal dummy As String) As Integer* M2 a; S; R6 C' n+ C3 |4 {

- `' r! b0 Y( s/ h* I- d        'Unloads the image immediately after execution within NX
- p1 D+ H. n3 [. _        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
+ {5 x1 u. U( {5 Y: M4 K; Q3 x6 F7 {
        '----Other unload options-------+ b2 @! W6 o: j% _
        'Unloads the image when the NX session terminates
  T1 P9 A' b2 l; p2 l" W( n        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination; o0 x$ W( E. {" y6 U' d) X! @
4 ^, [( f) B1 N- b3 p9 ~. O
        'Unloads the image explicitly, via an unload dialog9 w- [; ?0 s% b
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly" m1 _) A. b5 o( a; G
        '-------------------------------) o# v  h& [: }0 P1 B
$ Z0 A1 T2 P+ ]$ Q3 r2 W( @
    End Function5 D# L( v( F2 U6 w: K6 |+ Y9 p! ^

$ X, X8 _3 t6 a% p0 D7 _5 jEnd Module
! I7 O, H% C, \7 ], @4 J- d
/ k9 x5 E9 ^% B* Z- l8 x( C, N- i5 A% N. K. s/ J- y- u: X

9 l4 G/ X& \+ e, ^2 @

运行时报错

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

    我知道了