09-10-2023
07:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-10-2023
07:51 AM
Hi @kresh.bell
I think here we'd want to use a highlight set, to maintain the selected components as we pick.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Sub Main 'https://www.rapidtables.com/web/color/index.html '(255, 0, 0) 'red '(0, 255, 0) 'green '(0, 0, 255) 'blue '(255 255, 0) 'yellow '(255, 0, 255) 'magenta '(0, 255, 255) 'cyan Dim HLset As HighlightSet = ThisApplication.ActiveDocument.HighlightSets.Add() HLset.Color = ThisApplication.TransientObjects.CreateColor(255, 255, 0) 'yellow Dim doc As Inventor.PartDocument = ThisApplication.ActiveDocument Dim partdef As Inventor.PartComponentDefinition = doc.ComponentDefinition Dim bodyCol As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection While True Dim body As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select Body (Bodies). When you finish, Esc Key") If body Is Nothing Then Exit While If check(body, bodyCol) = False Then bodyCol.Add(body) HLset.AddItem(body) End While Dim distance As Double Try distance = (Double.Parse(InputBox("Chamfer distance", "MJM iLogic", 0.707))) / 10 ' 0.707 Catch HLset.Clear Exit Sub End Try Dim edges As EdgeCollection = ThisApplication.TransientObjects.CreateEdgeCollection() For Each body As Inventor.SurfaceBody In bodyCol For Each edge As Edge In body.Edges edges.Add(Edge) Next Next partdef.Features.ChamferFeatures.AddUsingDistance(edges, distance) HLset.Clear End Sub Private Function check(input As Object, col As Inventor.ObjectCollection) If col.Count = 0 Then Return False For Each obj As Object In col If obj Is input Then Return True Next Return False End Function