
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a form with a button.
I am trying to delete all workplanes in a part, but i get an exception?
Wrong Parameter.(Exception form HRESULT: 0x80070057(E_INVALIDARG))
if i click the button multible times the workplanes are deleted else only some are deleted.
what is wrong in this code. Please help with a workaround.
Running VBExpress 2010 and Inventor 2011
Dim oApp As Inventor.Application
oApp = GetObject(, "Inventor.Application")
Dim oPartdoc As PartDocument
oPartdoc = oApp.ActiveDocument
Dim oWorkPlanes As WorkPlanes
oWorkPlanes = oPartdoc.ComponentDefinition.WorkPlanes
Dim i As Integer
Dim oWorkplane As WorkPlane
For i = 1 To oWorkPlanes.Count
Try
If i > 3 Then
oWorkplane = oWorkPlanes.Item(i)
'MsgBox(oWorkplane.Name)
oWorkplane.Delete()
End If
Catch ex As ArgumentException
MsgBox(ex.Message)
'GoTo DoThis
Catch ex As Exception
'MsgBox(ex.Message)
Finally
End Try
'DoThis:
Next
End Sub
regards Kent boettger
Solved! Go to Solution.