Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I often need to delete the entire content of a part which mostly holds Extrusion, Lofting Features, 3d Sketches, 2d Sketches and Workplanes.
I got a working code for deleting everything except for Workplanes:
' iLogic code to delete all features and sketches in an Inventor part document
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument
If oPartDoc Is Nothing Then
MessageBox.Show("No active part document found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
' Deactivate the document's automatic update to improve performance
oPartDoc.Update2(False)
' Delete all features
For Each oFeature In oPartDoc.ComponentDefinition.Features
oFeature.Delete()
Next
' Delete all sketches
For Each oSketch In oPartDoc.ComponentDefinition.Sketches
oSketch.Delete()
Next
' Loop through all 3D sketches
For Each oSketch In oPartDoc.ComponentDefinition.Sketches3D
oSketch.Delete()
Next
' Loop through all WorkPoints
For Each oWorkPoint In oPartDoc.ComponentDefinition.WorkPoints
oWorkPoint.Delete()
Next
' Loop through all WorkAxes
For Each oWorkAxe In oPartDoc.ComponentDefinition.WorkAxes
oWorkAxe.Delete()
Next
' Loop through all Planes !!! This Part Does not work!!!
' For Each WorkPlane In oPartDoc.ComponentDefinition.WorkPlanes
' WorkPlane.Delete()
' Next
' Reactivate the document's automatic update
oPartDoc.Update2(True)
MessageBox.Show("All features and sketches have been deleted.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
As far as I am understanding the Error which I am getting is telling me that it is simply not possible to delete workplanes from a part? (Sorry it is in German)
Regelkompilierungsfehler in Features_löschen, in B_3D_011.ipt
Fehler in Zeile 39 : "Delete" ist kein Member von "Autodesk.iLogic.Interfaces.ICadWorkPlane".
Is there any workaround?
Thank you!
Solved! Go to Solution.