Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to port this function to vb.net and get "Type not defined errors" when I try to declare the Asset and Asset Library object variables. My thought was that adding "Imports Inventor" to the header would be sufficient to get past the error, but no luck...apparently I'm missing a step that is likely right in my face, but I can't see it. Any guidance would be appreciated
Private Function GetAsset(oDoc As PartDocument, anAssetName As String) As Asset Try GetAsset = oDoc.Assets.Item(anAssetName) Catch ' Failed to get the appearance in the document, so import it. ' Get an asset library by name. Either the displayed name (which ' can changed based on the current language) or the internal name ' (which is always the same) can be used. Dim assetLib As AssetLibrary 'Type "AssetLibrary" defined error here assetLib = ThisApplication.AssetLibraries.Item("MG_Material") ' Get an asset in the library. Again, either the displayed name or the internal ' name can be used. Dim libAsset As Asset 'Type "Asset" defined error here libAsset = assetLib.AppearanceAssets.Item(anAssetName) ' Copy the asset locally. GetAsset = libAsset.CopyTo(oDoc) oWrite.WriteLine(vbTab & vbTab & Now & " -SUCCESS- Assigning asset """ & anAssetName & """") End Try End Function
Solved! Go to Solution.