查看: 1815|回复: 0

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

[复制链接]

6

主题

4

回帖

60

积分

管理员

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

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

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

×
: v# j+ y2 [! L) x
NX二次开发源码分享: 打印已经修改的零件信息
8 q8 S! r9 W# i/ [. M3 W. K1 p; q
7 `* B, X6 ~" m- e6 Q[mw_shl_code=vb,true]Option Strict Off* z/ N2 K1 l1 R" n

5 {" q  a: u/ C* u. dImports System
) `9 L8 m1 `3 d$ i0 k8 r6 [8 _6 AImports NXOpen
  f- V7 g5 p9 O5 j! q! ]7 ~4 z2 v* m5 sImports NXOpen.UF; o8 q# n! A  C5 D: A% h! M" |# u! t

% N! ]% W* e7 Y/ e0 d  S0 A1 kModule report_only_modified_parts' ~0 `0 y. W* N# Y9 d0 m

% E7 E) _% g9 ~( z# k* H1 R    Dim theSession As Session = Session.GetSession()0 ~" C6 L0 p; }, M" r5 C' {7 ^3 N
    Dim theUFSession As UFSession = UFSession.GetUFSession()
1 I, `: d6 v' l) _4 l    Dim lw As ListingWindow = theSession.ListingWindow8 w0 q# h8 @5 D$ J% N" `

) k9 G9 |  z8 H- l  |    Sub Main()! `' n9 L  n4 \- p9 E

, |  y7 E# k5 R0 }$ k7 {" E        lw.Open()
. w3 c0 m! e; h* m7 X. k$ d( h8 n* i2 f
        Dim pc As ParTCollection = theSession.Parts
% r5 t2 q" c6 G8 g! l+ g        Dim part_array As BasePart() = pc.ToArray()
4 B5 v; K/ Y; x% V; K8 o        Dim num_modified As Integer = 0! h8 k  [" j2 v! ^# ~
        Dim num_parts_in_session As Integer = part_array.Length()' b8 K  T7 I5 X$ W9 E! K2 y

6 K+ h# {( B. i& s1 n- B- a* t        lw.WriteLine("There are " & num_parts_in_session.ToString & _$ l" }7 h; j0 \2 P
                                             " parts open in this session.")0 T/ R9 e! a' q
        lw.WriteLine("  ")
3 [( n! I* q  t  ], G) E/ i" u! o" Q& W8 p! L& }9 N
        For Each p As Part In part_array8 P8 c1 Z7 o7 U. x: j
6 h, T! \% R  S  g' m
            Dim isModified As Boolean = theUFSession.Part.IsModified(p.Tag)7 \: i# e4 ?9 k" w# I$ w% C# \
7 l4 k$ w  s9 {7 B$ H! O9 A
            If isModified = True Then
" O' G. E& {8 ^3 i' f' M$ G                lw.WriteLine("Modified Part: " & p.Leaf.ToString)  n+ k% H2 I; ?: Y" ]$ A
                num_modified = num_modified + 1& j6 H4 J, K, @9 o7 \$ e$ f
            End If4 `% R* c" |4 O$ [
+ B9 i) N$ I( W2 b
        Next! D( B9 M' d, [  ?# B+ Q( z0 h" J

2 w+ P* Z! h5 b# a9 ]        lw.WriteLine("  "), Z) M, O1 Z$ ~$ u
        lw.WriteLine("Number of Modified Parts: " & num_modified.ToString)
, p4 W% b- F2 Y& P% `" s: `5 ^* S3 K% B! w
    End Sub
( d) v, M0 o4 b6 G! L
0 _+ m9 S& s/ Y7 B* u+ R    Public Function GetUnloadOption(ByVal dummy As String) As Integer, {7 h1 D+ I, L" u7 @; A: X& i
        Return Session.LibraryUnloadOption.Immediately9 @+ ~+ L5 G# {5 K7 _
    End Function  {+ ~8 m& S1 D
% A6 n0 {7 U# X& F
End Module[/mw_shl_code]( @: y/ y9 _1 G
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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