Message 1 of 3

Not applicable
01-29-2020
12:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've used code similar to this and never had a problem with it. I've added some additional code to get to a sub assemblies components and I can't seem to get it to work. I'm not sure why I get the error I do. My first msgbox returns the correct count and my second returns the correct name, so I know it's getting the component, but I don't know why it can't add it as a participant.
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim BATCUT As ExtrudeFeature = oDef.Features.ExtrudeFeatures.Item("BATCUT") Dim EWL As ComponentOccurrence = oDef.Occurrences.ItemByName("FR END WALL LEFT WIZARD") Dim LPAT As OccurrencePattern = EWL.Definition.OccurrencePatterns.Item("BATTENS") 'MsgBox(LPAT.OccurrencePatternElements.Count) For Each LELM As OccurrencePatternElement In LPAT.OccurrencePatternElements For Each LOCC As ComponentOccurrence In LELM.Occurrences 'MsgBox(LOCC.Name) BATCUT.AddParticipant(LOCC) Next Next
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Inventor.ExtrudeFeature.AddParticipant(ComponentOccurrence Occurrence) at ThisRule.Main() at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem) at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Solved! Go to Solution.