quickly rename parts and assemblies to new job number

quickly rename parts and assemblies to new job number

slphantom
Collaborator Collaborator
581 Views
2 Replies
Message 1 of 3

quickly rename parts and assemblies to new job number

slphantom
Collaborator
Collaborator

I am wondering if there is a way to quickly update our job numbers on details and assemblies when copying
them over to a new job. It takes a lot of time in Design Assistant. The details are usually similar but always different.
Checked out Design Cloner but I am wondering if there is an app or Ilogic program that could do a whole directory at once?
I am not good at Ilogic so how hard would this be to do?
Our job numbers on detail and assemblies are as follows:
1234 will be the number that changes.

DETAILS---- J-1234-D05678_DETAIL NAME.IPT
DETAILS SUCH AS IN WELMENT COMPONENTS---- J-1234-D05678A_DETAIL NAME.IPT
SUB ASSEMBLIES---- J-1234-U05670_SUB ASSY NAME.IAM
MAIN ASSEMBLIES---- J-1234-L05670_MAIN ASS NAME.IAM

Scott
win 11 64 bit
Nvida GeForce RTX 4000
Inventor Pro 2023
Space Explorer
0 Likes
582 Views
2 Replies
Replies (2)
Message 2 of 3

firelinsgs
Enthusiast
Enthusiast

Hi,

if i understood that correctly. You want to replace specific numbers in names of parts?

 

MAIN ASSEMBLIES---- J-1234-L05670_MAIN ASS NAME.IAM >>> MAIN ASSEMBLIES---- J-6789-L05670_MAIN ASS NAME.IAM  ???

 

So I think you answered yourself. Design cloner can do that a whole directory at once.

 

Výstřižek.JPG

0 Likes
Message 3 of 3

JamieVJohnson2
Collaborator
Collaborator

highly detailed pseudo code (that means not tested or spell checked) I write in vb.net, but this should also work in iLogic, but VBA will need modifications:

 

public property invApp as inventor.application

 

public sub copyInventorFilesFromDirectory(strDirectoryIn as string, strDirectoryOut as string)

invapp = GetInventorApplication 'this my custom routine for vb.net, for ilogic you can use = thisapplication

dim diOriginal as directoryInfo = new system.io.directoryinfo(strDirectoryIn )

dim diNew as directoryInfo = system.io.CreateDirectory(strDirectoryOut )

for each fi as fileinfo in dioriginal.enumeratefiles

select case fi.extension

case is "iam"

copydoc(fi)

case is "ipt"

copydoc(fi)

end select

next

 

public function copydoc(fi, diNew) as inventor.document

dim newFilename as string = getnewfilename(fi, diNew) 

dim fiNew as new fileinfo = fi.copyto(diNew.fullname & "\" & newfilename)

dim invDoc as inventor.document =invapp.Documents.open(fiNew) '.OpenWithOptions has many more features to help

control opening issues.

Dim props As Inventor.PropertySet = invDoc.PropertySets.Item(Tools.DesignTrackingPropertySetID)
Dim prPartNumber As Inventor.Property = props.Item("Part Number")

dim newPartNumber as string =  System.IO.Path.GetFileNameWithoutExtension(fiNew.Name)
prPartNumber.Value = newPartNumber 'construct this from file name, or get filename from this

invdoc.save

return invDoc

end function

 

 

public function GetNewFileName(fi, dinew)

'do the work to convert the old file name to the new file name using the new directory path, then return as string value of full file path (drive:\folders\file.extension)

return strNewFileName

end function

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes