03-31-2024
10:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-31-2024
10:26 PM
Hi @autodesk0343ART . Please try this iLogic code:
Public Sub Main()
Dim oInvApp As Inventor.Application = ThisApplication
Dim oPDoc As PartDocument = TryCast(oInvApp.ActiveDocument, PartDocument)
If oPDoc Is Nothing Then Exit Sub
Dim oBodies As SurfaceBodies = oPDoc.ComponentDefinition.SurfaceBodies
If oBodies.Count = 0 Then Exit Sub
Do
Dim oBody As SurfaceBody
Dim sName As String
sName = InputBox("Please enter the name of the body.", "Rename body", "Body123")
If String.IsNullOrEmpty(sName) Then Exit Sub
oBody = oInvApp.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select Body...")
If oBody Is Nothing Then Exit Sub
Try
oBody.Name = sName
Catch
MessageBox.Show("Fail rename body.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Loop
End Sub
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.