- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to delete specific sketch entities from a silhouette curve using iLogic but when I do if I need to go back and delete the Silhouette curve it causes Inventor to Crash whether I try to delete the silhouette curve first and then the 3DSketch or if I just try to delete the 3DSketch with the silhouette curve still in it. The only thing that allows me to delete the silhouette curve and then the 3DSketch is to let it crash the first time then reopen the part and enter into edit mode of the sketch and click save which throws a warning that you cannot save a part while in sketch edit mode and asks if you'd like to exit edit mode and continue to save, then click OK which will exit edit mode and Save. Then enter edit mode again and repeat trying to save in edit mode only this time it doesn't give a warning it just exits edit mode and saves. Then I can enter edit mode one more time and it will let me delete the silhouette curve without crashing then exit edit mode and then I can delete the 3DSketch. I don't know if this is a bug or if there is something in my code that is causing it to become locked in a mode that if not exited will cause inventor to crash. Here is the code I'm using if someone can tell me if it's my code or not.
Sub Main()
Dim ThisDoc As PartDocument = ThisApplication.ActiveDocument
Dim oFace As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Pick a Face Sketch will be on")
Dim oPartDef As PartComponentDefinition = ThisDoc.ComponentDefinition
Dim oSurf As SurfaceBody = oPartDef.SurfaceBodies.Item(1)
Dim oSketch3D As Sketch3D = oPartDef.Sketches3D.Add
Dim oSilhouette As SilhouetteCurve = oSketch3D.SilhouetteCurves.Add(oSurf, oFace, True)
For Each oEnt In oSilhouette.SketchEntities
If oEnt.Type = ObjectTypeEnum.kSketchLine3DObject Then
DeleteEntity(oEnt)
End If
Next
End Sub
Sub DeleteEntity(ByRef oEnt As SketchLine3D)
oEnt.Delete
End Sub
Solved! Go to Solution.