Can you use Dynamo to replace line styles of elements?

Can you use Dynamo to replace line styles of elements?

David125
Collaborator Collaborator
2,503 Views
7 Replies
Message 1 of 8

Can you use Dynamo to replace line styles of elements?

David125
Collaborator
Collaborator

I'm trying to clean up our line styles but it takes too long manually. I'm hoping Dynamo can do the following steps:

-Select all instances of Item in project.

-Change line style from "Joe 1" to "1"

-Delete "Joe 1" from line styles.

I'm an infant when it comes to using Dynamo, and I usually make a mess of things with it.

0 Likes
2,504 Views
7 Replies
Replies (7)
Message 2 of 8

RLY_15
Advisor
Advisor

Line styles are classified as GraphicsStyle in the Element Type menu in Dynamo.

 

You can get the Line Style of Detail Line elements, and it'll output a list of GraphicsStyle ID numbers. You can use the ID to also retrieve the name of the line style.

robert2JCCH_0-1698438671849.png

You need to know what ID your final line style is, so you'll have to browse the list. You can also attempt to search for it:

robert2JCCH_2-1698438855174.png

Here's all parts together:

Line swap_2023-10-27_01-42-26.png

 

0 Likes
Message 3 of 8

David125
Collaborator
Collaborator

Holy moley! I'll give it a shot, thanks.

0 Likes
Message 4 of 8

David125
Collaborator
Collaborator

What is the item I circiled in red on attachment?

0 Likes
Message 5 of 8

David125
Collaborator
Collaborator

I uploaded the wrong picture on my previous post, this is the correct image for my question.

0 Likes
Message 6 of 8

RLY_15
Advisor
Advisor

Equals operator (==)

 

It checks if something in list 1 is the same as list 2, depending on how you set up the lacing for the node.

 

For this script, the lacing is set to Auto which is defaulting to Longest. All that really means for this use case is that every item in List 1 (name of the line style of the detail line) is checked against the one entry in List 2 (<Hidden Lines>).

 

The output is a list of true + false values, which is then used as a mask to filter the list.

0 Likes
Message 7 of 8

David125
Collaborator
Collaborator

I'm using DYNAMO v.2.16.2 , some commands (nodes?) are no longer the same. For example, ELEMENTS OF TYPES

Is no longer available. Also I can't get the CODE BLOCK  to connect to both the STRING and the ELEMENTS OF TYPE. Iv'e uploaded my file.

0 Likes
Message 8 of 8

RLY_15
Advisor
Advisor

Couple of things:

 

At some point (I don't follow newer Dynamo versions yet due to versions used at work), Element Types became Element Classes. Not sure if it's a nomenclature switch or if Classes became all-inclusive. Regardless, you'll want to use Class nodes now.

 

Passthrough node is from the Clockwork Package, which you'll need to install via the Package Manager in Dynamo. Normally, Dynamo attempts to do everything simultaneously, which is a problem if you want to change something then delete the original (imagine it going the other way around). The node basically tells the script "Don't do this section until this other section is done". You can do this with normal Dynamo nodes (Transactions), but I'm terrible at setting those up so it's simpler to show it via Passthrough. Clockwork is also a very useful package to have, it's got quite a few nodes that can come up in daily work.

 

I looked through the file, I think there are some misunderstandings based on the wiring graphics between nodes (some of the wires graphically pass through nodes in my screenshot but don't actually connect to the node). I rewired the nodes and attached the updated file, hopefully this makes the workflow a bit clearer.

0 Likes