Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

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.

EESignature