Merge Textnotes together

I am relatively new to Dynamo. My company has a mandate that we only use a set amount of Textnote Styles with the names being. Font-Background-Qualifiers.
Ex
3/32"-Arial-Opaque-Boxed
I may have 35 different Textnotes styles that fit that name. I want to gather them all up and merge them into the one style as this example does.

Problem is building that without Lunchbox is kicking my butt. I just don’t have the knowledge.
I’d like to do it myself so I can do other scripts if someone can point me in the right direction I would appreciate it. I would also settle for a script that works and wait until I do the dimensions to figure out what to edit in script.

You might suggest using flags rather than full descriptors. That can get real long in the browser and is prone to typos.
For instance: 3/32 Arial BTUIX.
Examplee - default settings for:
3/32 Arial
would be 3/32 high, Arial font, opaque, not bold, not italic, not underlined, not boxed.
3/32 Arial BT
Would be 3/32" high, Arial Font, Bold and Transparent.
Always keep the flags in order. Makes it easy to program down the road. Flags are easy to parse.

A. You will need the styles - not the instances.
B. You don’t need lunchbox. you can just use:

I can see that would be a bit nicer and if I had my way I’d do it that way.

I still need to grab similar Textnotes and merge them together. This is as far as I’ve gotten.

I know it’s a far cry from finished.

Sorry I started to replay before I saw your second post.

The merging can be done without Dynamo.
Select undesired type. Right click, select all in project. Pick a desired type.
Will work for everything but legends.

If you want to do it programmatically, you’ll have to collect all instances and switch them to the desired style. Or change the name of the existing style on the fly.

Note that you will have a bigger job on schedules, and text used in families such as Door tags, titleblocks, keynotes, etc.

This is one of those things that is simpler to do manually if it is a onetime deal in the template. Only reason to program would be if you have to update a lot of projects.

This is not only a lot of projects it’s a lot of text styles 100’s x 100’s. I have already purged over 150 Textnote styles in just the one model and the list still scrolls forever. I also thought it may be a good thing to get my feet wet Dynamo wise.

Perhaps I am mistaken. I thought this would be right up it’s alley.

Ouch. What guru created 150 text styles?

If you stay within the scope of project text types it’s relatively simple. If you were to extend this to all families and objects loaded into the project it would get exponentially harder.

As for grouping similar types within a project… I would setup a dictionary with the standard text type and the properties it has. Gather all your text instances in the project and get their text type. Check the properties for a match with a standard text type. If it matches, change the current text type to the standard.

You may have to add options for similar matches if you have types that aren’t an exact match, which is likely. You’ll have to determine what should count as “close enough” and what shouldn’t.

You probably lost him at “Dictionary”…

I’d do it as two routines to keep it simple as a first timer.
A. Make the code to create all the needed text types for the new standard. Simple to gather the parameters and generate a new style name based on existing text notes.
B Switch the existing text notes to the proper standard. (The merge part.)
Manually purge the undesired styles.

Wow
Thank you all. You’re heading me in the right direction.

Nick I can for the moment stick to text types so that’s a help.
I don’t (Think) I’d mind creating a dictionary. 14 or so lines is not a great deal of work. (Is it?)

1/4" Arial Boxed NTD
1/4" Arial Opaque
1/8" Arial Opaque NTD boxed
1/16" Arial Transparent
3/16" Arial Opaque
3/16" Arial Transparent
3/32" Arail Opaque lw1
3/32" Arial BOXED NTD lw6
3/32" Arial BOXED NTD
3/32" Arial Boxed lw10
3/32" Arial Opaque
3/32" Arial Opaque NTD
3/32" Arial Opaque NTD lw6
3/32" Arial Opaque Underline
3/32" Arial Transparent

Should do me up about right. All my fonts are pretty much just going to be these under different names.

Aaron
I don’t mind making a bunch of simple scripts to do this if I have to. Still I think I can get away with one.
For the Textnotes styles I would create a drafting view with my Textnotes styles and import (Cut and paste.) my naming convention that way instead of creating a script. (Assuming that saves me time. One down.)
My big problem. (I think.) is gathering the out of compliance styles and merging them. Once merged purge won’t be a problem at all.

Is there a simple way to see all the Textnote Parameters and pick the textnotetype by that list of those Parameters? If I can do that then I can take those pesky autocad fonts 11\128" and turn them to the standard 3/32" Arial Opaque they need to be. (As an example of why these files have so many Textnote types.)

Hey that sounds like one script to rue it all. lol

A Dictionary is a data structure that allows you to store and lookup properties of matching data inputs. You could build one in Dynamo or just build a logic structure that allows you to look for matching properties via a bunch of nested conditions. This is where the gathering and merging of styles comes into play. You can get all the text type parameter values and compare them against the standard values you’ve defined.

Look at the example I posted. You’ll make a series of branches off the types - one branch for each parameter. The code block is simply the name of the parameter you are collecting as a string. The value will be the output of that parameter. In the example, the value of “Bold” is 0 - so it is False or unchecked. For this parameter you would do a if statement (node).

If param == 1:
    boldtxt = "Bold"
else:
boldtxt = ""

For other parameters you are just pulling strings.
When you have all the bits, you put the name together as a new string for the name of your new style. Nake the new style and pass the parameter settings back to the newly created style.