Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
This is a continuation of one of my previous posts (https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/delete-selected-component/m-p/114407...).
Would it be possible to convert the following code to iLogic? I do not understand what is going on when I see code like this separated into two parts...
Sub Main MessageBox.Show("Select parent of the pattern", "Delete pattern") here : If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then MessageBox.Show("This rule is designed to only work in assembly documents.", "Wrong Document Type") : Exit Sub Dim PickLeafOC As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select a Component to Delete") If IsNothing(PickLeafOC) Then Exit Sub' If nothing gets selected then we're done oObjToDelete = GetAssyLevelItemToDelete(PickLeafOC) oObjToDelete.Delete Try PickLeafOC.Delete Catch End Try GoTo here End Sub Function GetAssyLevelItemToDelete(oOcc As Object) As Object If oOcc.IsPatternElement oOcc = oOcc.PatternElement.Parent oOcc = GetAssyLevelItemToDelete(oOcc) End If Return oOcc End Function
Tom
Solved! Go to Solution.