Select all instances of a certain line type & replace

Hi all,
I am currently trying to select all instances of a given line style and replace them with a different line style.
I.E. Select all instances of “Bold Dashed Line” and replace them with “Thin Solid Line.”
I’ve had a dig through the forums here and have found some similar threads mentioning the Archi.lab node “Get Line Style By Name” but it is not working for me - see attached.
If anyone has some advice I’m all ears!
Thanks - HW.

Hi, you could try this way to see if it works better:

Thanks for the reply.
The issue with this is it seems to not select symbolic lines - within a shaft opening for example. I have devised a way to output all of the lines of a certain type within a project but none of them come through when matching a list of the object ID’s against the object ID as seen in the modelled symbolic line.
Any suggestions?

I can’t see how to access symbolic lines in Dynamo indeed. You can check it through these nodes:

List.FilterByString is from SteamNodes, Categories.ListAll is from Ampersand, GetLineStylesAttributes is from BimorphNodes and Line Styles is from Archi-lab Grimshaw.

Hi @hayden.wright

Here is my workflow for the issue.

In the begining I have two lines - thin line and wide line.
At the end I’ve changed all thin lines to wide lines.
You can use the idea. Hope this helps!

Cheers!

3 Likes

To all useful ends:

If we are talking about lines inside family you need to edit the family in order to change the Symolic Line line style.
My approach is dealing with lines( no matter detail or model) that are placed in the project enviroment. You should use different approach if you need to access the lines from specific Family.

Thanks for the reply Petar,
I have tried this method previously but unfortunately it does not select symbolic lines within model elements.
Seems this may be harder to overcome than I first thought.

I believe that Peter was implying that since the symbolic lines are in a family you need to edit the family in order to change the contents. Same as you would in a normal Revit workflow. Just cuz we are using dynamo to drive the output in Revit doesn’t mean we can ignore the results.

Try opening a family with symbolic lines in it and running the script from within the family environment.

You can try to change the symbolic line subcategory with this graph within a family (but I didn’t get any result yet actually):

Hi @Petar_Penchev1, I am new to Dynamo.

Basically what I would like to do, is change all the OTB line types from typical details to a Corporate standard. In essence I am trying to map line style x to linestyle y when cleaning up typical details.

I am trying to use your solution but want to specify the value for the “Element.SetParameterByName” node (at the end) to “Wide Lines” rather than (as you have done) targeting the value of [1] from the “Element.GetParameterValueByName” Node as this value could change.

I figured the easiest thing would be to use a code block

with the value I want. But as you can see it didnt work.

This is probably really easy but i’ve been searching for the right node and trying different things for the last couple of hours without a result. Any advice would be appreciated.

Found the answer! Thanks for your help! Of course as is often the case, it just takes asking someone for the anwer to become apparent!

As a newbie, I am still confused why a code block plugged into the value did not work,

1 Like

The code block value didn’t work as you were feeding a string into a parameter which needs an element as a value. Wire a watch node into both the code block and the Get Line Style By Name node and this will make some sense.

1 Like

Nice work!

Would you mind posting the full script you ended with Sean? I followed the steps but am still having trouble getting my detail lines to transfer styles.

1 Like

Can you share your full script for this please? I am also new to Dynamo and am trying to do a similar process changing line styles in drafting views. Thank you!

SSOE Line clean up.dyn (439.2 KB)

This looks a lot worse than it is. basically, you need to map each line type to a new one. So, all you do is copy the group, then paste, change your original to what you want it to be, rinse, repeat.

3 Likes

Hello Sean_Spence;

This does what I need except that unknown number of the lines I am trying to change are nested inside of an unknown number of groups. Running this script in this case results in an error. Is there a way to filter the element list that is fed into SetParameterByName so that only elements outside of a group are included? Or perhaps create a Python script version of SetParameterByName that has an error routine that skips over the error situation?

Sincerely;
Michelle