Hi @Formsprag
Ahh, okay the example posted in this thread was authored for VBA, so a bit of reformatting is need to run it in iLogic
Firstly, you can do a search for "Set" and just replace it with nothing, and then secondly you can just remove the "Sub..." and "End Sub" lines like this or make the Sub line read "Sub Main"
so basically here are two versions that will run via ilogic:
Public Sub Main
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument
Dim oderivedPart As DerivedPartComponent
oderivedPart = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Item(1)
Dim oRefPart As PartDocument
oRefPart = oderivedPart.ReferencedDocumentDescriptor.ReferencedDocument
Dim oRefPartDef As PartComponentDefinition
oRefPartDef = oRefPart.ComponentDefinition
Dim oMaterial As Material
oMaterial = oRefPartDef.Material
MsgBox (oMaterial.Name)
End Sub
or
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument
Dim oderivedPart As DerivedPartComponent
oderivedPart = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Item(1)
Dim oRefPart As PartDocument
oRefPart = oderivedPart.ReferencedDocumentDescriptor.ReferencedDocument
Dim oRefPartDef As PartComponentDefinition
oRefPartDef = oRefPart.ComponentDefinition
Dim oMaterial As Material
oMaterial = oRefPartDef.Material
MsgBox (oMaterial.Name)
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com