查看: 1827|回复: 0

[二次开发源码] NX二次开发源码分享: 打印已经修改的零件信息

[复制链接]

6

主题

4

回帖

60

积分

管理员

积分
60
发表于 2020-3-8 18:37:55 | 显示全部楼层 |阅读模式

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

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

×
9 L" J% ~' s: t+ y9 L
NX二次开发源码分享: 打印已经修改的零件信息
. w% y) l7 h6 p1 F, y& T" z- @4 i# H( V
[mw_shl_code=vb,true]Option Strict Off- P* Z1 N' O9 O2 ~; g+ L

" E5 W8 h9 ^/ w) X9 gImports System
# b! ?$ r" R4 S+ Y1 h2 T" EImports NXOpen
; c, W& t9 `% K( s; L% gImports NXOpen.UF$ O8 [$ T, n9 h! R' ?
6 A/ g+ B$ U  a/ [! v* u; y- u- I
Module report_only_modified_parts3 N% R5 f$ ~# x; d

/ g& a. a3 D. }0 ^    Dim theSession As Session = Session.GetSession()
& o- L$ c  Q6 e, ?( L    Dim theUFSession As UFSession = UFSession.GetUFSession()
  `3 E: V5 Z4 c8 T8 \    Dim lw As ListingWindow = theSession.ListingWindow* Q. j7 ?3 A1 t7 c, N0 v

% t* l, v1 @" b, C    Sub Main()( X  X9 B: m4 o2 U* _$ U
- A; ?& U5 p4 Y7 }! Q7 ]
        lw.Open()
7 P* Q* H+ n( d* S! q
+ g6 K* l6 N* h8 W        Dim pc As ParTCollection = theSession.Parts: h) }" J4 F! K( q2 |( s" x
        Dim part_array As BasePart() = pc.ToArray()' a+ Z4 ^! {0 i% H1 e7 s) D
        Dim num_modified As Integer = 0( J5 L) u- M& p; z" C* [  B4 g5 S
        Dim num_parts_in_session As Integer = part_array.Length()  b. J/ M# S. V6 C2 ?
: d- h" E9 T' d# a  ~% S8 `
        lw.WriteLine("There are " & num_parts_in_session.ToString & _
( q9 u2 |6 `- w# |9 [: f                                             " parts open in this session.")
3 C+ k4 L6 |/ ?0 R, q7 T( g        lw.WriteLine("  ")
& ]& W+ j4 e# _6 A! F  v0 |
; U; ], f' }* p1 f2 W        For Each p As Part In part_array
! ]4 j  G% }% H/ x/ |9 J8 o1 R) {/ ^6 p5 Y% c- W. `3 j
            Dim isModified As Boolean = theUFSession.Part.IsModified(p.Tag)5 J; [. |: y3 a, d

% F) R. R. r$ p$ M7 d& B+ h3 C            If isModified = True Then
! _6 `5 u) Y" j) w; F0 `                lw.WriteLine("Modified Part: " & p.Leaf.ToString)6 B3 U0 E6 t, ]# x; c
                num_modified = num_modified + 19 G& ~1 s1 ~; W" h$ `  W0 C4 _
            End If
% I/ S1 M- i$ Y/ u6 U- C8 ?" K, L: [# \5 l% {$ ]
        Next
- I2 N6 x3 X! o) n) U/ @' `8 _' J7 d2 K, t" s6 \+ `- s2 E
        lw.WriteLine("  ")9 y5 u( k- U3 P& Z1 [0 w  S
        lw.WriteLine("Number of Modified Parts: " & num_modified.ToString). t( x6 K8 p2 w, @3 T
# {  |2 R- z5 m
    End Sub, q2 ]. m, ~  M4 Q) E' ?
2 G/ b& G$ p, c. Y9 }4 v
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
# r& p+ ^$ e: l9 {6 X! q- T        Return Session.LibraryUnloadOption.Immediately( S) I: [8 r5 p9 u6 D
    End Function3 t# a/ B, y) v
$ u& X; e- h. v  S7 c
End Module[/mw_shl_code]6 y, R. \' {9 |3 g4 a  w$ S( |! N
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部