ilgoc Enter the coating method for each material.

ilgoc Enter the coating method for each material.

tkddud711
Advocate Advocate
491 Views
6 Replies
Message 1 of 7

ilgoc Enter the coating method for each material.

tkddud711
Advocate
Advocate

In the assembly environment, I want the custom iProperties "Coating" to say ANODIZING for all parts with material A6061. Is it possible?

0 Likes
Accepted solutions (1)
492 Views
6 Replies
Replies (6)
Message 2 of 7

dalton98
Collaborator
Collaborator
Accepted solution

Try this

Dim oAssy As AssemblyDocument = ThisApplication.ActiveDocument
Dim oRefDoc As Document
For Each oRefDoc In oAssy.AllReferencedDocuments
	If Not oRefDoc.ComponentDefinition.BOMStructure = kNormalBOMStructure Then Continue For
	If Not oRefDoc.DocumentType = kPartDocumentObject Then Continue For
	
	If oRefDoc.PropertySets.Item(3).Item("Material").Value = "Aluminum 6061"
		Try
		oRefDoc.PropertySets.Item(4).Item("Coating").Value = "ANODIZING"
		Catch
		oRefDoc.PropertySets.Item(4).Add("ANODIZING", "Coating")
		End Try	
	End If
Next
Message 3 of 7

tkddud711
Advocate
Advocate

thank you
Works fine.
One more request here, I would like to write ANODIZING in the message box. Is it possible?

0 Likes
Message 4 of 7

tkddud711
Advocate
Advocate

thank you
Works fine.
One more request here, I would like to write ANODIZING in the message box. Is it possible?

0 Likes
Message 5 of 7

dalton98
Collaborator
Collaborator

@tkddud711 

myparam = InputBox("Prompt", "Title", "Default Entry")
'------------
'----------
'-----------
oRefDoc.PropertySets.Item(4).Item("Coating").Value = myparam
Message 6 of 7

tkddud711
Advocate
Advocate

I'm not familiar with ilogic.
Please tell me the full code ㅜㅜ

0 Likes
Message 7 of 7

dalton98
Collaborator
Collaborator
myparam = InputBox("Enter Coating Name", "Custom iProperty - Coating", )
Dim oAssy As AssemblyDocument = ThisApplication.ActiveDocument
Dim oRefDoc As Document
For Each oRefDoc In oAssy.AllReferencedDocuments
	If Not oRefDoc.ComponentDefinition.BOMStructure = kNormalBOMStructure Then Continue For
	If Not oRefDoc.DocumentType = kPartDocumentObject Then Continue For

	If oRefDoc.PropertySets.Item(3).Item("Material").Value = "Aluminum 6061"
		Try
		'custom iproperty exists
		oRefDoc.PropertySets.Item(4).Item("Coating").Value = myparam
		Catch
		'custom iproperty doesn't exist
		oRefDoc.PropertySets.Item(4).Add(myparam, "Coating")
		End Try
	End If
Next
0 Likes