Repetitive descriptors in drawing Workflow advice?

Repetitive descriptors in drawing Workflow advice?

paulZKN98
Advocate Advocate
391 Views
5 Replies
Message 1 of 6

Repetitive descriptors in drawing Workflow advice?

paulZKN98
Advocate
Advocate

I have a sloppy workflow that I want to tighten up and I would be grateful if anyone could weigh in.  Here's a typical situation I'm trying to automate:

I'm making a lot of drawings each with it's individual file and one sheet each.  In the title block I want to put the client name, ex. "Client A".  Currently, I redefine my titleblock with "Client A" then whenever I make a new drawing I copy and paste the title block with "Client A".  I would rather put "Client A" in a iProperty somewhere in all parts then have my drawing look for that iProperty but that would mean I'd be doing the same copy and pasting, just now in a different spot.  

 

The best workflow I can sort out is to drop all parts/assemblies into some master assembly, then use the BOM to do one massive copy + paste "Client A" to ensure that all have been updated.  This feels a bit clunky. 

 

I would love for the info to live with the part in an ipropery, but does anyone have any suggestions on a sleeker way to do this?  This seems to have ilogic answer written all over it, but I'm pretty inexperienced in writing new code.  

 

Many thanks in advance!

Paul

 

0 Likes
Accepted solutions (1)
392 Views
5 Replies
Replies (5)
Message 2 of 6

blandb
Mentor
Mentor
Accepted solution

Do you use vault? If so, you can mass edit files and copy paste the values in there to whatever property you have and is mapped into vault. Let vault take care of the check out check in process. Another way is you can use the design assistant. With the open dialog box in Inventor, right-click on the file you want to copy properties from > choose design assistant. Then go to  > tools > Copy Design Properties. Check the properties to transfer, select the files on the right, and then go!..

 

Hope that helps.

Autodesk Certified Professional
Message 3 of 6

A.Acheson
Mentor
Mentor

If you want a quick ilogic code to push custom iproperty to all documents in an assembly this will cover that. This assumes all are writable. 

Dim sClientName as String
sClientName= InputBox("Enter a Clients name", "Client Name","Oscar The Grouch")
Dim oAsm As AssemblyDocument = ThisDoc.Document
oAsm.PropertySets.Item("Inventor User Defined Properties").Item("Client Name") = sClientName
Dim oTransaction As Transaction = ThisApplication.TransactionManager.StartTransaction(oAsm, "Push Client Name to all files") 'Make this a single transaction
For Each oDoc As Document In oAsm.AllReferencedDocuments 'Traverse all referenced documents
oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Client Name")= sClientName
Next
oTransaction.End 'End the transaction

There is many other ways too to achieve this one alternate could be to take in the name through an excel sheet, place in the drawing iproperties then push back to the part/assembly in your drawing, or do this operation in the file and push it too the drawing. It will just depend where you find yourself thinking about this tracking info and where it might be stored like in a purchase order or project file.  

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 4 of 6

paulZKN98
Advocate
Advocate

We don't use vault but I just ran the test using design assistant and it copied my custom iproperties over, many thanks @blandb !

0 Likes
Message 5 of 6

paulZKN98
Advocate
Advocate

@A.Acheson Sorry for the delay, but I am just now able to test this out.  Thanks so much for the code, however I don't have much experience with I logic to self-troubleshoot an error I'm running into. I'm receiving the error code below:

 

Rule Compile Errors in iPropertyPush, in 2446-0000-test.iam

Error on Line 4 : Property 'Item' is 'ReadOnly'.
Error on Line 7 : Property 'Item' is 'ReadOnly'.

 

How would I allow this property to be writable?  Or is it the file that is writeable? I've made sure to create an assembly and placed parts in an active Inventor project  that has Read/Write permission but I don't think that's the error I should be solving. I then checked the file(s) itself but they have write permission (see screenshot). Pardon my ignorance, but I'd love to get your code working.  Thankyou for any additional help you can offer!

 

paulZKN98_1-1652904540344.png

 

 

0 Likes
Message 6 of 6

A.Acheson
Mentor
Mentor

The original has no error checking so would fail on read only files like content center /library files.  I think I actually missed assigning the "Value" property as well.

Edit: Had an error so tested and the below rule works, the addition of adding the custom iProperty saves manual entry. 

Dim sClientName As String
sClientName= InputBox("Enter a Clients name", "Client Name","Oscar The Grouch")
Dim oAsm As AssemblyDocument = ThisDoc.Document
oAsm.PropertySets.Item("Inventor User Defined Properties").Item("Client Name").Value = sClientName
Dim oTransaction As Transaction = ThisApplication.TransactionManager.StartTransaction(oAsm, "Push Client Name to all files") 'Make this a single transaction

For Each oDoc As Document In oAsm.AllReferencedDocuments 'Traverse all referenced documents 
	Try
	oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Client Name").Value = sClientName 
	Catch' Failed to set value 
	Try' to add iProperty and set value
	oDoc.PropertySets.Item("Inventor User Defined Properties").Add(sClientName, "Client Name")
	Catch ' Failed to add iProperty so must be read only
	Logger.Info("Failed to add iProperty to :" & oDoc.FullFileName)
	End Try
	End Try
Next 
oTransaction.End 'End the transaction
    

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan