Dynamo - List.ReplaceItemAtIndex+ Troubleshoot

ochoarTWDZH
Explorer
Explorer

Dynamo - List.ReplaceItemAtIndex+ Troubleshoot

ochoarTWDZH
Explorer
Explorer

Hello,

 

I am trying to replace blanks in a list with the text value "TEST". I am using the node 'List.ReplaceItemAtIndex+' and when I run the script it places each letter of the word into separate rows of the list instead of replacing the row with the entire word. (picture attached below)

 

I have used this script before in Revit 2022 and it works fine; however in Revit 2023 it does not work. All my packages are up to date. Any assistance would be greatly helpful. 

 

Replace Item at Index .png

 

Thank you

0 Likes
Reply
748 Views
4 Replies
Replies (4)

casandraarmeanu
Community Manager
Community Manager

Hi @ochoarTWDZH it looks like you are using a node from an external package. Can you please try to replace the List.ReplaceItemAtIndex+ with the native Dynamo Revit node List.ReplaceItemAtIndex and let us know if it works? If not, can you please send us a simplified version of the script and the Revit model to reproduce the issue, so that we can further troubleshoot it? Thank you!

NodeDR.jpg

0 Likes

ochoarTWDZH
Explorer
Explorer

Hi @casandraarmeanu,

 

Thank you for the suggestion. I've tried the OOTB node  'List.ReplaceItemAtIndex' but that only lets me replace one index instead of several indices at once which I'm trying to do. 

 

I've attached a simplified Revit Model and script for reference. Using the 'Mark' parameter to find blanks and replacing them with the text "TEST". 

 

Thank you, 

 

ochoarTWDZH_1-1724690115355.png

ochoarTWDZH_2-1724690147223.png

 

 

0 Likes

robert2JCCH
Collaborator
Collaborator

@ochoarTWDZH wrote:

Replace Item at Index .png


Going to be honest, I've never seen this behavior before from that node, including in 2023-compatible versions of Dynamo/that package.

 

Beyond the actual replacement issue, I'm also noticing that your element count in the bottom right of the preview goes up by 93 items...that shouldn't be happening with the replace node unless you have weird lacing/level setups, which you clearly don't.

 

Can you upload the graph? I'm curious if the node was modified. EDIT: Missed the file attachment, I'll review and update this if I notice anything weird.

 

The other thing you can try is to simply update your custom package to a different iteration of a 2023-compatible version and see if that fixes it.

0 Likes

casandraarmeanu
Community Manager
Community Manager

Hi @ochoarTWDZH it looks like there was an issue with formatting of the python script used in the custom node from Clockwork. Dynamo Revit 2023 uses IronPython2 engine which requires these formatting changes. To fix this issue, you can:

  1. edit the node List.ReplaceItemAtIndex+
  2. edit the python script
  3. make the changes to the script as shown in the attached image or paste the code below
  4. save the script, the custom node and rerun the script. 
 _list = IN[0]
rValues = IN[1]
iValues = IN[2]
if isinstance(iValues, list):
    if not isinstance(rValues, list): 
        rValues = [rValues] * len(iValues)
    for (index, value) in zip(iValues, rValues):
        _list[index] = value
else: _list[iValues] = rValues
OUT = _list

Let us know if it works as expected for you after these changes!

node1.jpgnode2.jpgnode3.jpgnode4.jpg

0 Likes