Vb.Net "AddIn" dll - AssetLibrary & Material Asset Problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anybody help?
I have the following code that is part of a Vb.Net "AddIn" dll.
The code is taken from the sub: Private Sub ApplicationEvents_OnSaveDocument(.................)
If BeforeOrAfter = EventTimingEnum.kBefore Then
Dim oDoc As Inventor.Document = TryCast(DocumentObject, Inventor.Document)
If oDoc IsNot Nothing And oDoc.DocumentType.Equals(DocumentTypeEnum.kPartDocumentObject) Then
PartMaterial = "Brass, Soft Yellow"
Dim partDoc As PartDocument = oDoc
Dim AssetLib As AssetLibrary = InventorApplication.AssetLibraries.Item(MaterialLibrary)
Dim oMaterial As MaterialAsset
oMaterial = AssetLib.MaterialAssets.Item(PartMaterial)
MsgBox("MATERIAL CURRENTLY SET TO: " + partDoc.ComponentDefinition.Material.Name)
partDoc.ActiveMaterial = oMaterial
MsgBox("MATERIAL UPDATED TO: " + partDoc.ComponentDefinition.Material.Name)
End If
End If
I have a problem with the lines highlighted in blue.
Does anybody know what is wrong?
Many thanks in advance
Darren