Hi all,
In Inventor, i ususally use make a new part from old one, it lead there is different on Name between General tab and Project tab
What i want Name in Project tab after renaming automatically is New name, the same in General tab. I dont know how to make a code in Ilogic so i need your helps. Thank you.
Sorry for my bad English
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi vudungcom,
Here is an iLogic rule that checks the file name against the part number iProeperty, and sets them to be the same if they are found to be different.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'check to see if the filename equals the part number If ThisDoc.FileName(False) <> iProperties.Value("Project", "Part Number") Then 'make the part number equal to the filename iProperties.Value("Project", "Part Number") = ThisDoc.FileName(False) Else End If
Hi Curtis,
Thank you for quick response. I tested but there is nothing change after running your code. Note that running without error
Hi Curtis,
I tested your code again, it work with part *.ipt but in assembly *.iam, it is not working
i need it work in .iam so i can change multi *.ipt in a second. i run your code in assembly .iam but nothing happen.
Thanks.
Hi vudungcom,
Here is an iLogic rule that checks the file name against the part number iProperty for each file referenced in the assembly, and then it sets the file's part number iProperty to be the same as the file name if the two are found to be different.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments
'format file name
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
Dim ShortName As String
ShortName = Left(docFName , Len(docFName) - 4)
'check to see if the filename equals the part number
If ShortName <> iProperties.Value(docFName, "Project", "Part Number") Then
'make the part number equal to the filename
iProperties.Value(docFName, "Project", "Part Number") = ShortName
Else
End If
Next