• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Explanation wanted for treeItemStruct vs treeItemSymbol...

Stats

  • Replies 0
  • Subscribers 148
  • Views 33
  • Members are here 0

Explanation wanted for treeItemStruct vs treeItemSymbol / inconsistent return from doc

TF202506034656
TF202506034656 1 hour ago

Good evening,

I was implementing a simple recursive expansion callback for my a field - i.e., expand parent -> expand all child trees.

In doing so, I ran into something I don't understand fully and was hoping somebody could clarify.

Here's the scenario:

At the top level, I create a field using hiCreateTreeTable with ?expandCallback 'wmTreeExpandCB
When the expandCallback is triggered, it receives the symbol for the field, and the symbol for the tree which was expanded, lets call that tree symbol X.

From the CIW, I can call:
hiExpandTreeItem(X) and it works, which suggests X is a valid item ref.


However, I discovered that before calling hiGetTree, hiGetTreeItems and others, I must call eval(X), which returns a treeItemStruct at some arbitrary mem loc. If I pass this eval'd treeItemStruct into hiGetTree it works!
Similarly, when I retrieve a list of trees using hiGetTree, and then try to run hiGetTreeItems on those results, I encounter the same issue. Again, I need to call eval on the args before hiGetTreeItems will work.

According to the documentation, hiGetTree, hiGetTreeItems and hiExpandTreeItem accept the same "g_item" input argument.

My question is: why is this necessary? What is the purpose of the unevaluated symbol if it cannot be directly used with most tree functions without first being transformed, especially considering it is listed as the same "g_item".

I've attached my working code below.

I'm on IC 23.1.
Thanks, Trevor

Fullscreen proc.txt Download
  procedure(wmExpandDescendants(_field itemSym)
          let((trees childItems)
                  ;Recursive expand
                  hiExpandTreeItem(itemSym nil) 
                  trees = hiGetTree(eval(itemSym)) ; Note eval
  
                  ;Possibly warrants a seperate forum post, but hiGetTree sometimes returns a list? Which according to docs should be s_treeName/nil
                  foreach(childTree if(listp(trees) then trees else list(trees))
                          childItems = hiGetTreeItems(eval(childTree)) ; Note eval
                          foreach(child childItems
                                  wmExpandDescendants(nil child) ; recursive call
                          )    
                  )    
                  t    
          )    
  ) 

  • Cancel
  • Sign in to reply

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information