NXKnowledge

Community Knowledge > Block UI Styler

Building a Tree List Control with Block UI Styler

A worked example from NX Journaling showing how to populate a Block UI Styler tree/list control from live assembly data — a pattern that comes up often for BOM-style or component-picking dialogs, and isn't well documented in the official reference.

Setting up the tree control

The example configures a tree_control0 block's basic layout properties before populating it:

tree_control0.Width = 1600
tree_control0.Height = 500
tree_control0.CanStretchWidth = True

Defining columns from a dictionary

Columns are driven by a dictionary mapping a display name to an attribute specification (e.g. mapping "Name" to a component's PartName, or using a wildcard like "SEQ" for a sequential row number). The dialog then iterates that dictionary at initialization time to insert columns with the corresponding widths — rather than hardcoding column definitions inline, which makes the tree reusable across different attribute sets.

Populating nodes from an assembly walk

Nodes are built by recursively walking assembly components. Two custom attributes are checked during the walk to control what shows up in the tree:

  • PLIST_IGNORE_MEMBER
  • PLIST_IGNORE_SUBASSEMBLY

Suppressed components are filtered out as well. This is a practical pattern for any tool that needs to present a curated (not literal 1:1) view of an assembly structure — e.g., hiding fasteners or standard parts from a review dialog.

Filling in cell data and reading selections

  • Individual node cells are populated via SetColumnDisplayText(), pulling attribute values with GetUserAttributeAsString().
  • Selected rows are retrieved with GetSelectedNodes(), then iterated to pull out per-column data — the pattern used, for example, to export a filtered BOM list to Excel/CSV.

Practical takeaway

  • Drive tree columns from a dictionary/config structure rather than hardcoding them, so the same tree-population routine can be reused for different attribute sets.
  • Use custom attributes (like PLIST_IGNORE_MEMBER / PLIST_IGNORE_SUBASSEMBLY) as a convention for marking assembly components that a review/reporting tool should skip, since Block UI Styler's tree control has no built-in filtering concept of its own.

Source: https://nxjournaling.com/content/blockstyler-tree-list-example · retrieved 2026-07-08