'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