09-10-2023
05:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-10-2023
05:24 AM
Curtis,
thanks again. Show selected body in your iLogic is realy very usefull.
I have one iLogic, but for part envirovment, for add chamfer to selected body. Is it posibble edit this iLogic that I see selected bodies on same way as I see selected parts in your iLogic?
Sub Main
Dim doc As Inventor.PartDocument = ThisApplication.ActiveDocument
Dim partdef As Inventor.PartComponentDefinition = doc.ComponentDefinition
Dim bodyCol As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For i As Integer = 1 To partdef.SurfaceBodies.Count
Dim body As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select Body (Bodies). When you finish, Esc Key")
If body Is Nothing Then Exit For
If check(body, bodyCol) = False Then bodyCol.Add(body)
Next
Dim distance As Double = (Double.Parse(InputBox("Chamfer distance", "MJM iLogic", 0.707))) / 10 ' 0.707
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)
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