Replacing string with different figures attached


So I want to modify my list by replacing/dropping the “Laag+(number between 1 and 8)” but how can I do this without placing the node 8 times (searchFor Laag1, Laag2, Laag3 etc). I tried making it a list with all the values in there but that didn’t work.

Result now:

Wanted result:

Thanks in advance!

1 Like

For me this doesn’t work

*note, replace on the left replaces another word, not a “Laag” word.

Hi @remco.dejong ,

That is very weird, I don’t see anything wrong with your node setup.
Maybe restarting Dynamo and its’ host might help.

If that doesn’t work:
Which version of Revit/ Civil3D are you using together with which Clockwork package?
Also, could you maybe send some files so I can test it exactly with your .dyn script? (Or test it yourself on another computer and maybe even with an empty dyn-file like i did.)

Hi, restarting didnt work

I used the newerst clockwork package, version 2.4.0
Civil3D 2022 (I don’t know exact version number)

I could send you the dwg, and the part of dynamo I put before it so you can check if it works for you or not.I will also try to replicate your exact script to see if it works for me then. If it doesnt work the problem is probably clockwork 2.4.0.

When I think about it the host application couldn’t cause any problems, since my example has been created inside Dynamo Sandbox & the Clockwork node doesn’t interact with the host itself.

That aside I recommend updating Civil3D 2022 to version 2022.1.3, some other packages may conflict with a non-updated Civil3D 2022.

Sorry, my bad that had nothing to do with it.
Any idea on how to solve it?

You are probably missing the IronPython2.7 (old Python) engine. You can download this one from the package manager.

If I see this right that aint the case because I have IronPython2 installed

nevermind, you were right about it.

I installed ironpython and restarted it and it dit work, Thanks!

I will mark your script thing as solution.


I’m playing with python today… So I did it in Python


Pretty useful if they stop supporting IronPython and the clockword package isn’t updated yet

Another approach.

in your case that would work, but nog for mine because the word isnt always on the same spot, also looks more complicated and there seems to be a bigger chance for mistakes.

Anyways thanks!

I wasn’t sure if your word allways was in the same spot. In your example they were.

I also posted this example to show there can be multiple solution to a problem :wink:.

Maybe if someone ends up in this topic for a solution then maybe Daan or mine approach would be
the solution (depending on the problem) or a combination.


You were right, in my example it was. But the list contained about 170 more items in wasnt in the same spot in some cases.
Its always good to know that there are multiple ways to come to a solution

Some more / other ways i came up with after your comment.

Only OOTB nodes and DesignScript, so no Python needed.

Bottom half in the image would work for you @remco.dejong.
This way you only need a part of the word (String) you want to replace / removed.
Top half only works with when the word is allways the same.

Top and bottom half combined with the List.AllIndicesOf Node would work too for you @remco.dejong

Came up with those examples for my own practice too.

1 Like