Working Netboxes: part 2 — Inside and Under

Often when working with a network box, a node may inadvertently be removed and appear to have dropped beneath it. To get it back inside it needs to be dragged outside the box, let go, and returned to the inside.  This is a well known bug.  A shelf button to pick up a node without dragging a u-turn in the graph would seem useful. Well… there’s a half sarcastic old code adage — ” A well documented bug is a feature ..” What if we took advantage of this behavior.

H11 Netbox with node dropped beneath

Typical network box with a node dropped beneath.

By making dropping and picking up nodes accessible, they can be used in new and interesting ways.  When the node is ‘under’ the netbox it has a ghosting effect highlighting the others. Another workflow could involve having a group of alternate nodes where one is dropped down to be worked with temporarily so the box can be collapsed moving the other nodes out of the way. I’m sure there are other interesting ways these behaviors can be taken advantage of and would be interested in hearing of them.

# get all nodes inside network box
my_node.networkBoxes()

… the above wouldn’t return what here forward will be referred to as ‘under-nodes’ ( the nodes dropped beneath). Since many the introduced functions/tools rely on querying node and netbox size/positions in the graph  they  currently rely on the netboxes NOT being collapsed. Logically this makes sense since they would not have much visual effect otherwise.  Most functions from these posts can optionally consider under-nodes via flags, however on the shelf, the merge button doesn’t consider them by default although allows this feature to be flagged on. The tools presented should accommodate such alternate workflows. Along with the provided hou.NetworkBox.nodes() method, there will be three ways of retrieving membership depending on what is being looked for.

  • my_netbox.nodes() — hou provided method returns the nodes ‘inside’ the netbox
  • evt_nodesOverlapping(nodes=[]) — eyevexTools function (shown with the method prefix) returns all nodes inside the box and under-nodes (netbox must NOT be collapsed). Optional nodes args allows passing of a list to filter through returning only the overlapping members rather than all overlapping nodes
  • evt_nodesUnder(nodes=[]) — similar to above nodesOverlapping() but only returns the under-nodes

Elemental to keeping things clean is the creation of a layoutNodes() function that will layout the contents of a network box similar to layout() as it applies to networks and nodes. This layout function is mapped to a shelf button for easy access to operate on selected network boxes, as well as a flag on most other tools including mergeNetBoxes and moveNodesInside It is flagged on by default on all shelf buttons and functions. It too relies on the netbox being uncollapsed (why would you layout something you can’t see anyway?) and preserves under-nodes by default.

**NOTE : A word of precaution. The layout shelf tool allow multiple selected netboxes to be operated on in a single click. Layout does its best to recenter the resized netbox. As a result it can inadvertently overlap with another box. In such cases an under-node can get “passed” from one box to a subsequent netbox being operated on, that detects it beneath it as well. Care should be taken when running on multple netboxes in close proximately to each other.

The next section will take a closer look at these and other techniques for getting a reference to a Network box.

Leave a Reply

Your email address will not be published. Required fields are marked *