Hi @op_thorsager & @tyler.warner. Just dropping in a good tool I created a while back for assigning names to stuff in Inventor that you want to be able to find again easily. It works similarly to the 'NamedEntities' interface, but does not use the same naming conventions. There is a custom Sub routine for taking care of the technical stuff (main task), but it is best to specify as much as possible, as preparation, within the Sub Main area. I made it fairly flexible, by having extra lines of code in there, but leaving them commented out, just as ideas for different ways to use the tool. As it is right now, it is customized for letting you 'Pick' a DrawingDimension, then asks you to enter a name for it. The AttributeSet name and Attribute name have already been specified, specifically for dimensions, but you can either change those values, or use the InputBox options. This is all within a loop that will run as many times as you want it to. The loop will break/exit when either you do not select anything, or you do not enter a name, so it will not be an endless loop. As you can see, if you choose to not supply values for the AttributeSet name or the Attribute name, it will attempt to create values to use for you. However, those names are driven by the selected object's Type name, which may be a lot more specific than you have in mind...such as "Named_RadiusGeneralDimension" for the set, and "RadiusGeneralDimension_Name" for the attribute, if that is the Type of object you selected.
Here is the code:
Sub Main
Dim DimName, SetName, AttName As String
'SetName = InputBox("Enter AttributeSet Name", "AttributeSet Name", SetName)
'If SetName = "" Then Exit Sub
SetName = "Named_Dimensions"
'AttName = InputBox("Enter Attribute Name", "Attribute Name", AttName)
'If AttName = "" Then Exit Sub
AttName = "Dimension_Name"
'Dim oInt As Integer = 0 'could use this in naming routine, within loop
PickAgain :
oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select A Dimension To Assign A Name To.")
If IsNothing(oObj) OrElse TypeOf oObj Is DrawingDimension = False Then Exit Sub
Dim oDDim As DrawingDimension = oObj
DimName = InputBox("Enter Dimension Name", "Dimension Name", DimName)
If DimName = "" Then Exit Sub
AssignName(oDDim, DimName, SetName, AttName)
' AssignName(oDDim, DimName)
GoTo PickAgain 'will exit if nothing is 'Picked', or no Name entered
End Sub
Sub AssignName(ToName As Object, Name As String, _
Optional SetName As String = vbNullString, Optional AttName As String = vbNullString)
If IsNothing(ToName) Or Name = "" Then Exit Sub
Dim sType As String = TypeName(ToName)
If String.IsNullOrEmpty(SetName) Then SetName = "Named_" & sType & "s"
If String.IsNullOrEmpty(AttName) Then AttName = sType & "_Name"
'MsgBox("SetName = " & SetName & vbCrLf & "AttName = " & AttName,,"")
Dim oSets As AttributeSets = Nothing : oSets = ToName.AttributeSets
Dim oSet As AttributeSet = Nothing
If oSets.NameIsUsed(SetName) Then
oSet = oSets.Item(SetName)
Else : oSet = oSets.Add(SetName) : End If
Dim oAtt As Attribute = Nothing
If oSet.NameIsUsed(AttName) Then
oAtt = oSet.Item(AttName)
If oAtt.Value <> Name Then
oAns = MsgBox("That " & sType & "already has a different name assigned to it." & vbCrLf & _
"Do you want to change its name [Yes] or leave it alone [No]?", vbYesNo + vbQuestion, sType & " Has Other Name")
If oAns = vbYes Then oAtt.Value = Name
End If
Else : oAtt = oSet.Add(AttName, ValueTypeEnum.kStringType, Name) : End If
End Sub
Of course, there are also a few Inventor add-ins out there for similar purposes that may work just as good, such as Nifty Attributes.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)