Looking for an iLogic rule/code to add custom properties to parts in an assembly

Looking for an iLogic rule/code to add custom properties to parts in an assembly

Anonymous
Not applicable
2,321 Views
7 Replies
Message 1 of 8

Looking for an iLogic rule/code to add custom properties to parts in an assembly

Anonymous
Not applicable

I am trying to run an iLogic rule (while in the assembly) to automatically go through all the parts as well as sub-assembly parts in the assembly to add the custom iproperties:

 

Job Name: xxxx

Job No.: xxxx

Release No.: xxxx

Extrusion Number/Description: xxxx

Finish: xxxx

 

I have seen some codes similar but I cannot figure out how to have these custom iproperties added. Could anyone be of any help? Thanks!

 

Also, in an .idw, when I add a parts list that references a general assembly of another assembly placed 10 times, for example, when I add the quantity it only has the quantity of one instance of the assembly instead of the quantity x10. The subassemblies give the correct quantity, but the parts just give the part length x10. What could be going on there? Thanks in advanced!

0 Likes
2,322 Views
7 Replies
Replies (7)
Message 2 of 8

mdavis22569
Mentor
Mentor

Do you at least have them in the IPT/IAM template in the Iproperties/Custom?

 

Even if they are blank, but still there? Then you won't have to run the rule all the time.

 

Job Name: xxxx

Job No.: xxxx

Release No.: xxxx

Extrusion Number/Description: xxxx

Finish: xxxx

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 8

Anonymous
Not applicable

Thanks for the reply. I do now, but I didn't for this specific assembly and there are a ton of parts to add

0 Likes
Message 4 of 8

mdavis22569
Mentor
Mentor

Lets see what else we can do to help you with this ...

 


You know you can add things via Windows Explorer ...  this is just one of a few examples

 

ref.PNG


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 5 of 8

Anonymous
Not applicable

Wow, will that add the custom iproperties to all those files at once!?

0 Likes
Message 6 of 8

mcgyvr
Consultant
Consultant

You can also copy iproperties from one file to many others using Design Assistant..

http://knowledge.autodesk.com/support/inventor-products/getting-started/caas/CloudHelp/cloudhelp/201...

 

But if you need to do this quite often then an ilogic tool to pop up a form asking for the information then looping through all the parts should be pretty easy for someone with ilogic skills (I haven't sat down and learned it well enough to help)

 

Here is the only code I have.. 

It prompts for a few standard and custom iproperties via a message box then fills out the information..

But it only does it for the current open file..

I would think someone could make it work and loop through all open documents or something like that..

 

pDescription = InputBox("Enter value for 'Description'", "Description",iProperties.Value("Project", "Description"))
If pDescription = Nothing Then Exit Sub
iProperties.Value("Project", "Description") = pDescription

pRev = InputBox("Enter value for 'Revision'", "Revision",iProperties.Value("Project", "Revision Number"))
If pRev = Nothing Then Exit Sub
iProperties.Value("Project", "Revision Number") = pRev

'Requires a custom iProperty called "MATERIAL"
Dim CustMatl As New ArrayList
CustMatl.Add("Custom Material 1")
CustMatl.Add("Custom Material 2")


Try
'attempts to set the value.. If custom field not found it errors out, creates the property and tries again
iProperties.Value("Custom", "MATERIAL") = InputListBox("MATERIAL", CustMatl, iProperties.Value("Custom", "MATERIAL"), Title := "Material", ListName := "Material")
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", "MATERIAL")
'set the custom property value
iProperties.Value("Custom", "MATERIAL") = InputListBox("MATERIAL", CustMatl, iProperties.Value("Custom", "MATERIAL"), Title := "Material", ListName := "Material")
End Try

'Requires a custom iProperty called FINISH
Dim CustFinish As New ArrayList
CustFinish.Add("Custom Finish 1")
CustFinish.Add("Custom Finish 2")


Try
'attempts to set the value.. If custom field not found it errors out, creates the property and tries again
iProperties.Value("Custom", "FINISH") = InputListBox("FINISH", CustFinish, iProperties.Value("Custom", "FINISH"), Title := "Finish", ListName := "Finish")
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", "FINISH")
'set the custom property value
iProperties.Value("Custom", "FINISH") = InputListBox("FINISH", CustFinish, iProperties.Value("Custom", "FINISH"), Title := "Finish", ListName := "Finish")
End Try

'Requires a custom iProperty called FINISH PRETREATMENT
Dim FinishPretreatment As New ArrayList
FinishPretreatment.Add("Custom Pretreatment 1")
FinishPretreatment.Add("Custom Pretreatment 2")


Try
'attempts to set the value.. If custom field not found it errors out, creates the property and tries again
iProperties.Value("Custom", "FINISH PRETREATMENT") = InputListBox("FINISH PRETREATMENT", FinishPretreatment, iProperties.Value("Custom", "FINISH PRETREATMENT"), Title := "Finish Pretreatment", ListName := "Finish Pretreatment")
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", "FINISH PRETREATMENT")
'set the custom property value
iProperties.Value("Custom", "FINISH PRETREATMENT") = InputListBox("FINISH PRETREATMENT", FinishPretreatment, iProperties.Value("Custom", "FINISH PRETREATMENT"), Title := "Finish Pretreatment", ListName := "Finish Pretreatment")
End Try

'Requires a custom iProperty called ROHS
Dim Rohs As New ArrayList
Rohs.Add("(6/6) FINAL PRODUCT SHALL BE ROHS 6/6 COMPLIANT PER EU DIRECTIVE 2002/95/EC")
Rohs.Add("(5/6) FINAL PRODUCT SHALL BE ROHS 5/6 COMPLIANT (LEAD EXEMPT) PER EU DIRECTIVE 2002/95/EC")

Try
'attempts to set the value.. If custom field not found it errors out, creates the property and tries again
iProperties.Value("Custom", "ROHS") = InputListBox("ROHS", Rohs, iProperties.Value("Custom", "ROHS"), Title := "ROHS", ListName := "ROHS")
Catch
' Assume error means the property was not found 
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'create the custom property
oCustomPropertySet.Add("", "ROHS")
'set the custom property value
iProperties.Value("Custom", "ROHS") = InputListBox("ROHS", Rohs, iProperties.Value("Custom", "ROHS"), Title := "ROHS", ListName := "ROHS")
End Try

iLogicVb.UpdateWhenDone = True

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 7 of 8

mdavis22569
Mentor
Mentor

Yes ...

 

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 8 of 8

mdavis22569
Mentor
Mentor

@mcgyvr  Option is good too..

 

 

There are probably a few other ways .... 

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes