- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I made an iLogic rule which iterates through each of the components within an assembly and switches the design view to "Default" but when I attempt to run the rule in a weldment it errors out with "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))". I have tested the code in a normal assembly and it performs as I had expected.
I still have to add coding to add "Default" in event it doesn't exist but I want to first solve this error.
When I look at the logger for the information I requested I notice it is looking at the weldment itself as an occurrence, then attempts to set the design view then errors out. Is this being done because it is a weldment?
The code I am using is below and I have added a test weldment.
Thanks
Dim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oAssyCompDef As ComponentDefinition oAssyCompDef = oAssyDoc.ComponentDefinition Dim oOccurrences As ComponentOccurrences oOccurrences = oAssyCompDef.Occurrences Dim oOcc As ComponentOccurrence For Each oOcc In oOccurrences Logger.Info(oOcc.DefinitionDocumentType) If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then Logger.Info(oOcc.BOMStructure) Logger.Info(oOcc.Name) oOcc.SetDesignViewRepresentation("Default", , True) Logger.Info("Confirm If") End If Next
Solved! Go to Solution.