Part Navigator

How can I add a Column in the NX Part navigator in front of each feature, but showing the details?
For instance:

Sphere (0) Diameter: 2.5

Knowing only that you want to see some details of your features, my first suggestion would be to expand the "details" pane in the part navigator. This view will show feature parameters of the highlighted feature (pick a feature in the graphics window, the details are shown).

I'm guessing that you want to see some important details at a glance in the part navigator. In this case, you can use the "Comment" attribute (or your own custom attribute[s]) to show information about your features. You can use this to show simple info such as the sphere diameter in your example, but it will fall short on a feature such as an extrude with offsets, tapers, boolean option, start and end options, etc (it will simply be too much info for the comment column).

The API currently does not provide much access to the UI navigators. It may be possible to build some sort of custom addition, but I know of no way with the current API (NX 9 as of this writing).

Please show me!

Right click in the whitespace of the part navigator and choose "columns", enable (check) the "comment" attribute. The comment column will now appear in the part navigator. It will show the contents of the "comment" attribute, if it exists on the feature.

To add a comment attribute, right click on the desired feature, choose properties -> attributes, create an attribute with the title/alias of "Comment", enter the desired values, and press OK. The value you entered should show up in the part navigator comment column for the feature.

Ok, that works. Thanks. And is there any option to avoid add the text manually, i mean, i want to copy the exact value of a feature (sphere)
?

What version of NX are you using?

8

The following code will loop through the features in the work part; when a sphere feature is found it will create a comment attribute linked to the diameter expression.





Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "Sphere Diameter Comment"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

For Each myFeature As Feature In workPart.Features
If TypeOf (myFeature) Is Sphere Then
'lw.WriteLine("sphere found")

If myFeature.HasUserAttribute("Comment", NXObject.AttributeType.Real, -1) Then
'MsgBox("comment attribute found")
'Dim myAttributeInfo As NXObject.AttributeInformation = myFeature.GetUserAttribute("Comment", NXObject.AttributeType.Real, -1)
Else
Dim sphereBuilder1 As SphereBuilder = workPart.Features.CreateSphereBuilder(myFeature)
Dim myDia As Expression = sphereBuilder1.Diameter
sphereBuilder1.Destroy()

Dim objects1(0) As NXObject
objects1(0) = myFeature

Dim attributePropertiesBuilder1 As AttributePropertiesBuilder
attributePropertiesBuilder1 = workPart.PropertiesManager.CreateAttributePropertiesBuilder(objects1)

attributePropertiesBuilder1.ObjectPicker = AttributePropertiesBaseBuilder.ObjectOptions.Feature
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.DataType = AttributePropertiesBaseBuilder.DataTypeOptions.Number
attributePropertiesBuilder1.Title = "Comment"
attributePropertiesBuilder1.Expression = myDia
attributePropertiesBuilder1.Units = myDia.Units.Name
attributePropertiesBuilder1.IsReferenceType = False

attributePropertiesBuilder1.Commit()
attributePropertiesBuilder1.Destroy()

End If

End If
Next

lw.Close()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------

End Function

End Module

Is there a way or journal that highlights certain features in the part navigator. Sometimes I suppress them to possibly delete them later but when I rollback to a feature before the suppressed feature then move back down the tree, it automatically comes on and I don't remember what feature it was. Maybe the feature can be highlighted red or some other color than blue.

Thank you

Unfortunately, the API (currently) does not give you access to the navigators to change things like the highlight color. However, similar to the code above, you could add a comment to the desired feature(s) which will show up in the navigator (turn on the comment column). This is one method you could use to keep track of a feature that you are interested in.