
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Couple of years ago, someone helped me for following code to delete a pattern and its occurrences in an assembly. It worked fine before.
SyntaxEditor Code Snippet
Dim oDoc As Document oDoc = ThisDoc.Document Dim oComp As ComponentOccurrence Dim oComps As ComponentOccurrences oComps = oDoc.ComponentDefinition.Occurrences For Each oComp In oComps If Component.IsActive(oComp.Name) = False Then oComp.Delete End If Next
But recently, I found it does not work now. The statement "oComp.Delete" has following error.
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
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.ComponentOccurrence.Delete()
at LmiRuleScript.deleteComponents()
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Does anyone know what it is happened? And I can I fix it?
I do not know how many pattern in the assembly and do not know their names also. I need delete all suppressed occurrences and patterns.
If you could provide modified code, it will be much appreciated.
Solved! Go to Solution.