Issue with Custom Node Behaviour

Hi All,

I’ve created a custom node “ViewTemplateByName”, however it is behaving unpredictably.

The issue is highlighted in the image below:

My project contains multiple view templates. When I feed in the name of one of the templates A1 - DOCUMENTATION FLOOR PLANS, it returns the desired View Template, as expected.

However if I enter in the name of another View Template, for example A1 - DOCUMENTATION SLAB SETOUT PLANS the node returns an empty list.

I’ve cross checked that the slab setout view template really does exist within the project using Archilab’s View Templates node.

I’ve also copied the contents of my custom node (blue groups) to double check it’s behaviour, but this method gives me the same errors.

I have tested with about 10 of the view templates in the project (and have tested in other projects with the same or similar list of view templates) however the node seems to only return the A1 - DOCUMENTATION FLOOR PLANS view template. For all others the node returns an Empty List.

Has anybody experience a similar issue? Or could anybody provide some insight as to why the node is behaving like this?

I’ve attached the .dyn file and the .dyf file below as well as an image of the .dyf.

ViewTemplateByName.dyf (13.0 KB)

Test File.dyn (35.0 KB)

Should you require I can upload a sample project as well.

Thanks in advance!

So after playing around with the node a bit more I’ve realised that the issue lies within the designscript code I’ve written (the smaller code block in the pink group below) which converts the Parameter.ParameterByName node to code.

I think I’ve got a syntax error as “Revit” is showing as an input in the code block, as shown below:

If I remove “Revit” from the front of “Elements.Parameter.ParameterByName” I then get “Elements” as an input?

I thought I’d found a temporary solution by converting the green group (refer first image in this post) to a custom node. This node now works for A1 - DOCUMENTATION FLOOR PLANS and A1 - DOCUMENTATION SLAB SETOUT PLANS however is still returning Empty List values for other view templates, as shown below…

Any suggestions would be greatly appreciated. Little lost here… :expressionless:

Can I ask why you need to use all the DS nodes and not just OOTB nodes for this?

1 Like

Hi @SeanP,

Thanks for taking the time to respond.

In short, I don’t need to use the DS nodes at all. The DS code is me taking baby steps into the world of writing code (albeit poorly) :slight_smile:

If you think there’s a chance the node would function better using only OOTB nodes I’ll try that option too.

Thanks again for your reply.

Hi Sean,

I’ve tried replacing the custom node in the test .dyn file (last image from my original post) with OOTB nodes (I know the example below uses a Clockwork node but I’ve also tested replacing this with OOTB nodes):

Unfortunately this approach still yields Empty List results for most of the View Templates.

What does the Warning message say? I think this may be a lacing issues since you are trying to use one string but check it against all of the views. Change the lacing on the “==” node to longest and see if that helps.

1 Like

The error message on the Element.Name node is “Warning: Internal error, please report: Dereferencing a non-pointer”

I think that is because I have null values in the list. If I clean the list to remove the nulls the error message disappears.

I’ve just realised that the method I’m using to give me the list of View Templates in the project (below) is not giving me all of the View Templates in the project, hence why the filter by name part of my scripts is not working.

If I use Archilab’s View Templates node I can extract the View Template I need. I had done this initially but wanted to try this approach as the input for the Archilab node can’t be ‘locked’. That is to say when I open the script in different projects it yields different values for the view template by default, which then need to be manually adjusted…

Just creates the potential for error if one isn’t careful to double check these.

So I’ve realised I’m an idiot.

The list of View Templates spat out by the custom node differs to the string inputs I was feeding in to search for a match. I thought the View Templates list was erroneous but it turns out I was feeding in the wrong information.

I was using the name of the View Family Type (as in most cases this is identical to the View Template). I realised however that a View Family Type didn’t always have a matching View Template name - hence why the node was working for some of the View Template types and not others.

I’ve doubled checked my string inputs now and the node seems to be working fine. :man_facepalming:

Apologies for any inconvenience! A lesson learnt.

You can achieve it like this I believe without any custom nodes:

Or even just a tiny bit of Python that isn’t dependent on selections.

1 Like

The View.IsViewTemplate node is new to me and is exactly what I was looking for!

Thank you kindly for providing this information.

As for the Python, I think it’s about time I bit the bullet and started learning. Seems to be the best way to achieve anything out of the ordinary.

Thanks for your assistance and informative responses Sean, they are greatly appreciated!

1 Like