Python script failing for recentering room locations and tags

Hello all,

I am having an issue with a graph that I am working on. The problem is that the node that is failing is python code, and I don’t know python at all right now. Can anyone please look it over and let me know what they think is going on? I have a small, simple project that I use to do my basic testing of graphs before testing them on actual projects, and it was working with my simple model, but failing on the much bigger one. I have attached the graph as well as a screenshot of the errors after the graph is run. Any help is greatly appreciated!

Recenter Room Locations & Tags.dyn (137.2 KB)


Screenshot 2020-11-13 111400

Likely you are feeding a list or a singleton when the Python was expecting the opposite. Did you break this out of a custom node perhaps?

@jacob.small

I did break this out of a node that wasn’t working before. It was having an input error, so it took it out and modified it. It had been working with the smaller model, but just not with the larger, more complex model.

Can you confirm you don’t have any empty lists or nulls in the data set? With clean room data I cannot reproduce the error.

@jacob.small

I went through it and thee do not seem to be any empty lists or nulls that are being fed into the node. I noticed that there was a room with no sq footage because it was overlapping another room, but even when I fixed that issue, it still did not work. To you think it may be having a problem if there are two rooms overlapping that I don’t see?

Hi @lshannonEQEBT
Do you have filter before any unplaced and unbounded Rooms? And be carefully with the level list structure as input in your python node.
Cheers

Overlapping, unplaced, unbound, etc. will all cause issues with this type of graph. And that is before you look into links.

All of this is doable, but needs a high degree of management for error handling from: room status, room topology, room access, bounding elements. There may not be a ‘usable’ case for all rooms in your project as a result of any one of those issues causing a failure is going to cause the entire graph to fail based on how your python is written.

Adding a more robust error handling would help (a try except method would do the trick at the cost of efficiency), but likely the easiest way will be to wrap the python code in a custom node so you can force processing at a given level more easily, thereby exposing which room or rooms are failing.

Thank you all for your detailed responses and thoughts! I’ve been wracking my head about this.

@jacob.small Could you please elaborate on the try except method and why wrapping it into a custom node would help?

The try except method can be reviewed here:

Your exact method won’t be copy and paste from there, as you’ll have to integrate it into your existing code and loops.

The custom node method would be to select the node and right click on the workspace background and select “create a new custom node” (not the exact words but I am away from Dynamo at the moment). Alternatively you could go back to the original custom node and leverage it as is, or even do a save as and edit the Python to include the changes you made to the code. Once that is done set the list lacing and levels correctly to get the node to iterate over every one of the combination of points and rooms, and see which fail and which pass (or if all fail).

Gotcha. Thank you Jacob! I will see what I can do with this.