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: 

ilogic code to fix part numbers / revision number

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
dclunie
3269 Views, 5 Replies

ilogic code to fix part numbers / revision number

Hi

 

I am after some help writing a ilogic rule to look at all part numbers on .ipt DocumentType = 12290

workflow is needed is to find all .ipt within assemblies and if part number on .ipt does notch match file name (without extension) then add.

 

Also on seperate rule if rev number equals (blank) or - then revision number on all .ipt to equal 1

 

Any help would be appreciated

 

Dave

5 REPLIES 5
Message 2 of 6
PaulMunford
in reply to: dclunie

Curtis Waguespaeck has a lot of great information on iLogic on his blog:

http://inventortrenches.blogspot.co.uk/2011/08/copy-design-and-revision-rolling-with.html

 

Check it out

 


Autodesk Industry Marketing Manager UK D&M
Opinions are my own and may not reflect those of my company.
Linkedin Twitter Instagram Facebook Pinterest

Message 3 of 6
Curtis_Waguespack
in reply to: dclunie

Hi dclunie, 

 

Here's a sample rule to do this. And thanks to Paul for the recomendation.

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
Dim docFile As Document 

'kAssemblyDocumentObject = 12291 
If openDoc.DocumentType = 12291 Then
	'Iterate though the part files in the assembly
	For Each docFile In openDoc.AllReferencedDocuments	
		'kPartDocumentObject = 12290 
		If docFile.DocumentType = 12290 Then	
			
			'format  file name		
			Dim FNamePos As Long
	            	FNamePos = InStrRev(docFile.FullFileName, "\", -1)		         
	            	Dim docFName As String
	            	'returns file name with extension
			docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
			'returns the number of characters in the file name
			nameLen = Len(docFName)
			'trims off the file extension (last 4 characters)
			nameNoExtension = Left(docFName,nameLen-4)
                      	
			'set part number to file name (without extension)
        			if iProperties.Value(docFName,"Project", "Part Number")  <> nameNoExtension then
        			iProperties.Value(docFName,"Project", "Part Number")  = nameNoExtension
        			else 
        			end if
        			
			'check for empty Rev #
			if iProperties.Value(docFName,"Project", "Revision Number") = "" then
			iProperties.Value(docFName,"Project", "Revision Number") = 1
			else
			end if
			
			'check for empty description
			if iProperties.Value(docFName,"Project", "Description") = "" then
			'get a description from the user
			myDescription = InputBox("Enter Description.",  "Description - "& docFName,  iProperties.Value(docFName,"Project", "Description"))
			iProperties.Value(docFName,"Project", "Description") = myDescription
			else 
			end if	
		End If 		
	Next	
Else	

MessageBox.Show("You must have a valid Assembly document open before using this code!", "File Type Mismatch!")
End If 

 

Message 4 of 6
dclunie
in reply to: Curtis_Waguespack

Thank's very much for the code it works perfect and really fast ,it is appreciated

 

Dave

Message 5 of 6
PaulMunford
in reply to: dclunie

He's the man 😉

 

 

 


Autodesk Industry Marketing Manager UK D&M
Opinions are my own and may not reflect those of my company.
Linkedin Twitter Instagram Facebook Pinterest

Message 6 of 6
JorisSteurs1246
in reply to: dclunie

Sorry for jumping in a little late 😉

I found similar samples of iLogic on this forum to set iproperties in all leaf occurrences , but these samples never write to suppressed parts in the assembly.

Is it possible to have the code also effecting EVERY part in the assy included the suppressed ones?

 

All help very welcome

 

thanks

 

Joris

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

Post to forums  

Autodesk Design & Make Report