Bug with Design Script - Rhythm

Hi all,

Found a bug with Design Script and Revit Views.
Wanted to ask first is it only for me or anyone else.

If you pass an ElementType to the .ElementsOfCategoryInDocument function it deletes all the views in Revit (Except one ofc).

Also to note, first I got the Views By Category and than I just changed Revit.Category.ByName(“Views”) -->Revit.ElementType.ByName(“Views”) and then it deletes them.

image

I discovered this while playing around in Design Script trying both of the collector functions to answer this question.

Revit 2023
Dynamo v.2.16.2

This was not the case for me in 2.16.1.

What do your warnings say? “Views” isn’t a valid ElementType and you’re only doing a collection here, so I don’t see how Dynamo would even be opening a transaction in Revit to delete anything. I don’t think you have the right document type either.

What happens if you do the same thing with nodes?

1 Like

here is what I get in Dynamo 2.16.1 and Revit 2023

edit: the collector I only manage to have in Python in DesignScript (I have never had, even if I have already seen topics where we see it, perhaps a class coming from an uninstalled package)

cordially
christian.stan

Very weird behavior.
Replicated on multiple projects.

DeletingViews

Can you post the dyn? Were those views created in Dynamo or pre-existing?

1 Like

Figured it out.
This Collector is not a OOTB Class.

It is pulled from Rhythm.

@john_pierson sorry, more problems with custom nodes I guess :laughing:

Correct, but that doesn’t explain any of the weird interactions with these invalid arguments.

Weird comment but ok…


Either way, my node has no delete methods in it, so it is definitely odd.
See: https://github.com/johnpierson/RhythmForDynamo/blob/2e2bf0b81fadcd3380b2ad8517bac1f2b42130bd/src/RhythmRevit/RhythmRevit.SharedProject/Revit/Selection/Collector.cs#L65

Please post actual sample RVTs and DYNs to reproduce.

I apologize did not mean it as an insult or something, just referring to the latest talks you had about a lot of work on the package itself.

Project1.rvt (7 MB)
TestingFilteringViewsDesignScript.dyn (7.7 KB)

Here we go.

It still does not delete anything for me in your sample file. It just errors as expected.

I’m not saying it isn’t a bug introduced in the latest build, but it seems very unlikely.

I am able to reproduce.
20231102-DynamoCastingBug

That is a very strange error and is something on Dynamo’s side. I think my node just happens to be using a method in Dynamo that is freaking out when an end-user uses it incorrectly. It seems to be related to when I try to cast a category as an element type.

  1. The Collector.OfCategoryInDocument node is meant to be used in a document other than your current one. You are literally using this incorrectly in this example. But either way it shouldn’t allow for this perhaps. I will fix that now.
  2. Views is not a valid input at all for ElementType.ByName. You are also using this incorrectly. But once again, that is probably doing something weird because of this method: https://github.com/johnpierson/RhythmForDynamo/blob/2e2bf0b81fadcd3380b2ad8517bac1f2b42130bd/src/RhythmRevit/RhythmRevit.SharedProject/Utilities/Converters.cs#L58

Let me look at fixing the node to where it disables this kind of use.


Additionally, I will be looking at how to disable it from being allowed in design script to protect from issues like this.


No problem. But it might be worth thinking about the language when referencing someone’s work.

Sorry for my tone here, but the way this came off initially (on the comment I was tagged on), I am honestly thinking about removing that node altogether and being rid of this issue immediately.

3 Likes

Definitely my fault for wording it wrong, didn’t think it would be interpreted in a negative way.

Hopefully my comment didn’t discourage you completely from trying to resolve this anomaly, because as we seen demonstrated in the past, we all learn a lot from your input on custom node debugging.

1 Like

An interesting discovery:

  • Node to code does not work on the OOTB All Elements of Category node. I bet this is on purpose because of this exact issue.

This is the best solution I have at the moment:
image

Simply disallowing that interaction altogether.

3 Likes