Filter text notes not in groups

Hello world!
I’m new to Dynamo and the forum, first time posting.
I have a script to change text to upper, but I have trouble figuring out how to only filter text notes that arn’t in a group, cause if the text notes are in a group Dynamo asks to ungroup those instances in order to run the script, which I don’t want to do.

Any help would be appreciated :slight_smile:

Hi @jonas.nilsson,

Welcome to the forum :slightly_smiling_face:.

I don’t know if there is an existing node for this, but it seems you can use the property below to get the text note’s group id:

http://www.revitapidocs.com/2018.1/9508a6c5-9681-bbef-07c5-1351583b0e1e.htm

I’m guessing this will return null if the text node is not in a group, and this information you’d be able to use as filter. It will require a simple python script though, which I’m guessing (no offense intended) will be a limitation for you at this point. I’d be happy to help you, but Im not at a computer at the moment. If no one has helped you out, I’ll take a look at this tonight :slightly_smiling_face:

This is a possible way to check if the Text Note is in a group:

Python Script:

import clr

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

#Start scripting here:

OUT = [str(i.GroupId) for i in UnwrapElement(IN[0])] 

Good luck :slight_smile:

6 Likes

Thank you so much @MartinSpence!
It works like a charm!
This thing with community and helping each other is a new thing to me, hopefuly I will one day do the same for someone else :smiley:
Next thing up, learn python :smiley:

No probs, happy to help :slight_smile:

1 Like

Since you are doing a boolfilter afterwards, you could alter the script that only returns textnotes not part of a group.

OUT = [i for i in UnwrapElement(IN[0]) if int(str(i.GroupId)) < 0] 

Food for thought

1 Like

Yes @3Pinter, that is indeed a fine thought. The reasoning for keeping the python part as simple as possible and doing the filtering part with nodes, was for educational purposes, since Jonas wrote he was new to Dynamo.

@MartinSpence, and a good explanation it is! Couldn’t agree more! :+1:t2:

(and if he gets the hang of it, he will probably figure my suggestion out himself :slight_smile: )

2 Likes