Traceback Error with 'Get All Viewport Types' (Archilab) Node

Hi there,

I have a script (see .dyn file ‘assign viewport type’ or image ‘working’) which when run on it’s own works perfectly fine. However, when I add it to another script (see .dyn file ‘Sheet Generator_V6’ or image ‘Script Section’) my Get All Viewport Types node returns a ‘traceback’ error… (see image ‘error’). If i freeze the upstream nodes and run the script again the Get All Viewport Types magically works again, returning the desired outcome (see image ‘desired return’).

I’ve not seen this before…Can anybody please explain what’s causing this to occur in the larger script? I have a hunch that it’s an order of operations issue but I can’t feed a passthrough node into the Get All Viewport Types node…

Alternatively, is there another method I could use to get the names of all viewport types so that I can assign the correct one to my viewports.

Not sure if it’s worth mentioning, but the file I’m running this in doesn’t have any viewports UNTIL my script creates them with the Tool.PlaceViewsOnExistingSheets node by Dynatools.

Thanks in advance!


Script Section:
Desired Return:

assign viewport type.dyn (30.0 KB)
Sheet Generator V6_02.04.19.dyn (317.9 KB)

Try running just that node in the file without any viewports in it. If the error matches then it’s likely
because the node from Archilab doesn’t have a way to control when it runs, so it’s executing before the viewports are created.

If that’s the case, open the custom node and try adding an input (it doesn’t even have to do anything) to the node and wire the output of the viewport creation as the input. That should force it to execute after the node is run.

This does mean that you’ll have to deploy a custom Archilab version though, so switching to a modification of the base python could be in order.

1 Like

Hi @jacob.small,

Thanks so much for your in depth reply. I think you’ve hit the nail on the head with your assessment of the situation. Unfortunately what you’re proposing is a little over my head at the moment but I’ll do some research and will try to carry out your suggestions. I’ve run the node in a file without any viewports and got the exact same error message… I’ll let you know how I go.

In regards to the below, could you please explain in layman’s terms for a novice like me?

Thank you kindly.

If you modify the Archilab node, you’d have to send the modified version of the node to every user who wants to run the graph. Even as a ‘sole user’ this will matter as the next time you update Archilab the revised code will be overwritten unless you save the modified version to a new package/location. That is the biggest reason I don’t recommend that (unless you want to help the author develop by doing a pull request on their github).

I may have jumped the gun on the other option (away from the CPU this last week), but I believe this node is Python based. Either way it is a standard custom node, so you can open up the custom node, Select the relevant nodes, and use copy/paste to move them into your graph. Once in the graph you can modify the copylied nodes as needed (adding a useless input to a python node is one possible fix here).

Hi @dynamo_den

You can find another possible way to get ViewportTypes from here:

1 Like

Just be sure to add an input to that code (something like IN[0] = Wait) so that the input has to be fed before it calculates. :slight_smile: