Get count of all types of attributes from a part | Get total count | NX Open | CountAttributes

An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature).

Attributes can be referenced in expressions and (in drafting) in notes/labels/other drafting text (including parts lists, etc.)

 

The journal below returns the number of attributes of any type present in work part.

Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main(ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow

Dim count As Integer

theUfSession.Attr.CountAttributes(workPart.Tag, UFConstants.UF_ATTR_any, count)

lw.Open()

lw.WriteLine(count)

End Sub
End Module


API Inforamtion:
Attr.CountAttributes is UFUNC APIs present under UF_Attr namespace.
UF_Attr is a wrapper contains functions and data types for part attributes.

Social Connect

Learn CAD Automation using NX Open & Automate Design Tasks in Less Than 90 Days Without Any Prior Knowledge.

Attend the NX Open Masterclass to Discover

What’s Popular

Browse Popular, evergreen tutorials and how-to guides.

This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …

This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …

Datum Planes are a planar reference feature to help define other features, such as swept bodies and features at angles to the …

The use of computer-aided design (CAD) software has become an essential tool in engineering and manufacturing. There is no industry today that …

An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …

An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …

Design Engineers always spend more time on drawings for several reasons. A few of them are; Drawings are prime source of information …

It is quite possible to create a blank part and drawing sheet with one click of a button. Yes, you are right, …

NX Open is a powerful tool for automating NX CAD tasks. Below is source code that creates a new blank prt file …

As engineers and designers, we often have to work with complex 3D models and drawings, and extracting important information from these can …

NX Open is a powerful tool for working with imported geometries in NX.One common task that engineers and designers may need to …

https://youtu.be/5NWHlSM0sQ0 Q:Can you teach me nx open using visual basic .net? ChatGPT: Yes, I can help you get started with using Visual …