Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need a script of Ilogic to Renaming automatically

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
vudungcom
382 Views, 5 Replies

Need a script of Ilogic to Renaming automatically

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

 

 

5 REPLIES 5
Message 2 of 6

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

 

Message 3 of 6

Hi Curtis,

 

Thank you for quick response. I tested but there is nothing change after running your code. Note that running without error

Message 4 of 6
vudungcom
in reply to: vudungcom

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.

Message 5 of 6

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

 

Message 6 of 6

Hi Curtis,
It is working like a charm. Thank you for your help.
Problem solved.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report