'------- start of iLogic ------ 'original idea: B.Han 'check that this active document is a part file Dim partDoc As PartDocument If ThisApplication.ActiveDocument.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then MessageBox.Show("Please open a Part document", "iLogic") Return End If 'define the active document partDoc = ThisApplication.ActiveDocument 'check for custom iProperty and add it if not found Dim prefixPropertyName As String = "Prefix" Dim customPropertySet = partDoc.PropertySets.Item("Inventor User Defined Properties") Dim prefixProperty As Inventor.Property Try prefixProperty = customPropertySet.Item(prefixPropertyName) Catch ' Assume error means not found prefixProperty = customPropertySet.Add("", prefixPropertyName) End Try 'write the part number to the Prefix iProperty if it is empty If String.IsNullOrEmpty(prefixProperty.Value.ToString()) Then prefixProperty.Value = iProperties.Value("Project", "Part Number") & "_" End If 'get input from user Dim bodyPrefix = InputBox("Enter a prefix for the solid body names", "iLogic", prefixProperty.Value.ToString()) 'write input back to custom iProperty prefixProperty.Value = bodyPrefix 'rename all solid bodies incrementing suffix Dim i As Integer = 1 For Each solid As SurfaceBody In partDoc.ComponentDefinition.SurfaceBodies solid.Name = String.Format("{0}{1:00}", bodyPrefix, i) i += 1 Next '------- End Of iLogic ------