Message 1 of 4
Set Appearance to ComponentOccurence
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
In an assembly I try to pick a color from an occurence an apply it to another one.
I got some code from the API help and i am adding some code.
Public Sub SetOccurrenceAppearance() Dim asmDoc As AssemblyDocument Set asmDoc = ThisApplication.ActiveDocument Dim assetLib As AssetLibrary Dim libAsset As Asset Dim localAsset As Asset On Error Resume Next Dim occ As ComponentOccurrence Set occ = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Selecteer welke kleur overgenomen moet worden.") Set localAsset = occ.Appearance If Err Then On Error GoTo 0 Set assetLib = ThisApplication.AssetLibraries.Item("Breston") Set libAsset = assetLib.AppearanceAssets.Item("Yellow") Set localAsset = libAsset.CopyTo(asmDoc) End If On Error GoTo 0 Dim occ1 As ComponentOccurrence Set occ1 = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Selecteer het te kleuren onderdeel.") Set occ1.Appearance = localAsset End Sub
The last sentence (Set occ1.Appearance = localAsset) gives errors in the inventor VBA.
The same problem appears in Microsoft Visual Studio when i try: oOcc1.Appearance = occColor
Is there anyone who knows what the problem is?