遍历folder文件

'DESING BY KUANG
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF
Imports System.Windows.Forms

Module NXJournal
Declare Function DeleteFile Lib “kernel32” Alias “DeleteFileA” (ByVal lpFileName As String) As Long

Sub Main(ByVal args() As String)
Dim theSession As Session = Session.GetSession
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theufSession As UFSession = UFSession.GetUFSession()
Dim ARGC As Integer
Dim ARGV() As STRING
theufSession.UGMGR.initialize(ARGC,ARGV)
theufSession.UI.openlistingwindow()
Dim root AS nxopen.tag
theufSession.UGMGR.askuserfolder(“010200000001”,root)
dim folder_name as string
theufSession.UGMGR.askfoldername(root, folder_name)
msgbox(folder_name)

dim folder_exists as boolean
dim folder_number as Integer
dim count as integer
dim folder_contents() as nxopen.tag
theufSession.UGMGR.listfoldercontents(root, count,folder_contents)
dim i as integer
dim j as integer
dim k as integer
for i=0 to count-1
dim obj_type as integer
theufSession.UGMGR.askobjecttype(folder_contents(i), obj_type)
if obj_type=nxopen.uf.ufugmgr.objecttype.typefolder then
theufSession.UGMGR.askfoldername(folder_contents(i), folder_name)
if folder_name=“data” then
folder_exists = true
folder_number = i
dim contexts() as string
dim count1 as integer
'theufSession.UGMGR.listcontexts(“”,count1,contexts)
'theufSession.UGMGR.listidtypes(“data”,“”,count1,contexts)
for j=0 to count1-1

next j

Dim database_part_tag AS nxopen.tag
theufSession.UGMGR.askparttag(“0207C001702”,database_part_tag)
DIM part_name AS STRING
DIM part_desc AS STRING
theufSession.UGMGR.askpartnamedesc(database_part_tag,part_name,part_desc)

DIM part_revision as nxopen.tag
DIM revision_id as STRING
theufSession.UGMGR.askconfiguredrev(database_part_tag, part_revision)
theufSession.UGMGR.askpartrevisionid(part_revision, revision_id)
msgbox(revision_id)
dim file_count as integer
dim file_types() as STRING
dim file_names() as STRING
theufSession.UGMGR.listpartrevfiles(part_revision, file_count, File_types, file_names)
for k=0 to file_count-1
msgbox(file_names(k))
next k
end if

end if
next i

End SUB

End Module

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值