My overall goal is to create a dynamo player script so I can select all lines of a line style and change or replace them with another existing line style. My script is almost finished but I’ve hit a snag. My List.GetItemAtIndex returns a warning because of the negative coming from my List.IndexOf. I’m sure I’m over complicating this whole script. Any advice or help is appreciated.
We can’t read that image. Try reposting with the Export Workspace As Image button in the top right of the Dynamo window.
From your initial post it looks like you’re getting all parameters, searching for the one with the Line Style name, getting that parameter, and converting it to a string and removing the name so you’re left with just the value. This is the same as the GetParameterValueByName node you’re using except that I’m guessing that node returns the LineStyle element instead of a name. You should be able to get the name (Element.Name) from the LineStyle object to use for filtering rather than trying to pull apart the name from a list of parameters.
You can’t compare elements with strings. You need to either compare the elements directly or convert them all to strings. There’s also no need for all the IndexOf nodes. You want to convert all the lines of the given style.
You’re almost there. When you set the new line style you want to use the element, not the name. The parameter value uses the actual element. Always match what’s being returned to you when you read the parameter.
Besides that, you have a common issue with dropdowns bugging and giving you multiple outputs after running. There are other threads discussing this problem that can probably help you sort that out. For now, I think you just need to place new instances of those nodes, save, and close your graph. Just be sure you only run your graph once before closing/reopening to run again.
Hi Justin, I’m trying to replicate your graph and can’t figure out how to place the “New/Original Line Style” node. Are this custom nodes? how can I get them?
I’m just starting with Dynamo so I appreciate if you state the obvious. I need to replace the line styles in our standards.
Thanks!!!