- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear all,
i am currently working on an Add-In to give the user an enhanced GUI to pick the material for an inventor part.
I had a similar solution working in VBA.
It is no problem to read the active material in a listview and attach the material asset object to the tag.
When doubleclicking an Item in the Listview i like to take the material object from tag and assign to my part document.
This is the code snippet to assign material from listview "lvMaterial":
Dim oDoc As Inventor.PartDocument
If g_inventorApplication.ActiveDocumentType = DocumentTypeEnum.kPartDocumentObject Then
oDoc = g_inventorApplication.ActiveDocument
Else
MsgBox("Document type is not kPartDocumentObject")
Exit Sub
End If
Dim oMaterial As Inventor.MaterialAsset
oMaterial = lvMaterial.SelectedItems(0).Tag
oDoc.ComponentDefinition.Material = oMaterial
When Executing the code i get an error in the compiler telling me "Interface not supported, HRESULT: 0x80004002 (E_NOINTERFACE)".
I assume the Problem is to assign a MaterialAsset Object to a Material Object.
I know in VBA there was the Option to define a variable of type Material, but in VB.Net I can only find MaterialAsset.
Do you have any hint for me how this could work? in the SDK Documentation there is nothing documented on how to assign a material. I can only find how to read out all the materials, but that was the easiest thing.
I hope for your support, thanks in advance
Julian
Solved! Go to Solution.