However I'm having problems getting the padding to be even and constant on all sides. I can recreate the built in functionality with fitAroundContents(), but I cant figure out how to correctly figure out the bounding rect from that and then expand it evenly on all sides. I think this is partially because I'm not correctly calculating the center point from sel.position
Here is my code so far (my python knowledge is very basic). Any help is much appreciated!
sel = hou.selectedNodes()[0] all = hou.selectedNodes() pos = sel.position() parent = sel.parent() box = parent.createNetworkBox() box.setPosition(sel.position()) # add selected nodes for node in all: box.addItem(node) # set color box.setColor(hou.Color(0.3, 0.3, 0.3)) # fit box box.fitAroundContents() # fit box size = box.size() center = box.position() pad = hou.Vector2(2, 2) # set bounding box bbox = hou.BoundingRect((center[0]-size[0])-pad[0], (center[1]-size[1])-pad[1], (center[0]+size[0])+pad[0], (center[1]+size[1])+pad[1]) # set to bbox box.setBounds(bbox)