Message 1 of 6
View Representations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to put together some code for automatic view representations.
I have part with no view representations, only Master. I want to create 17 new representations and set up each representation appearance correctly from my appearance library.
My code sets all seventeen reps, asigns colours and if I put this part into assembly, I can switch representations of it easily in right click menu.
My problem is when I upload it into content center. When I add the part from content center into the assembly, these representations are there, but colour schemes are not working.
Code bellow is for ACCESSORIES view representation. The same is written for all other 16 (see attached IPT).
Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument Dim oCompDef As ComponentDefinition oCompDef = oPartDoc.ComponentDefinition Dim oViewRep As DesignViewRepresentation 'Definice 3DCG Appearance Library Dim oLib As AssetLibrary oLib = ThisApplication.AssetLibraries("3DCG_Appearance_Library") Dim libAsset As Asset Dim localAsset As Asset '[Aktivace reprezentace ACCESSORIES oViewRep = oCompDef.RepresentationsManager.DesignViewRepresentations.Add("ACCESSORIES") oCompDef.RepresentationsManager.DesignViewRepresentations.Item("ACCESSORIES").Activate libAsset = oLib.AppearanceAssets.Item("ACCESSORIES") Try localAsset = oPartDoc.Assets.Item("ACCESSORIES") Catch localAsset = libAsset.CopyTo(oPartDoc) End Try oPartDoc.ActiveAppearance = localAsset ']
Thanks for help.