Message 1 of 4
Ilogic Sub Assembly set view rep

Not applicable
09-07-2017
02:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Hoping somebody can help me to get my ilogic code working.
Am wanting to use ilogic in the main assembly (Single Hinged Door) to set view reps in 2nd level assembly (61 LK 1806 L) and have that rep shown in both 1st level (Dynamic Door) and main (Single Hinged Door) assemblies. Want to avoid LODs if possible.
My attempt below is based on old forum posts for older Inventor versions (currently running up to date 2018) and comes up with a the "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))" error
SyntaxEditor Code Snippet
' set a reference to the assembly component definintion. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'define the Component Occurrence collection Dim oCompOcc As Inventor.ComponentOccurrence Dim oSubCompOcc As Inventor.ComponentOccurrence 'set top level view rep to CUSTOM oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("CUSTOM").activate For Each oCompOcc in oAsmCompDef.Occurrences oCompOcc.SetDesignViewRepresentation("CUSTOM",, True) 'True sets the view rep to be CUSTOM Next Dim occurDocDef as AssemblyComponentDefinition 'modify actual subassembly document If oCompOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then 'get assembly component defintion in the subassembly document occurDocDef = oCompOcc.Definition For Each oSubCompOcc in occurDocDef.Occurrences If oSubCompOcc.Name = "61 LK 1806 L" Then oSubCompOcc.SetDesignViewRepresentation("CUSTOM",, True) 'True sets the view rep to be CUSTOM End If Next End If
Any Help would be hugely appreciated.
Regards,
Harrison