Hi,
I need a solid renaming rule that works as follows:
In a multi-body environment, I would like a form window to pop up and in it I would have the option to enter the name of a solid and then after clicking on the solid the name would be assigned to it. On the other hand, after pressing the "esc" button, nothing would happen.
Thanks
Solved! Go to Solution.
Solved by Andrii_Humeniuk. Go to Solution.
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.
Can't find what you're looking for? Ask the community or share your knowledge.