Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamo - List.ReplaceItemAtIndex+ Troubleshoot

4 REPLIES 4
Reply
Message 1 of 5
ochoarTWDZH
366 Views, 4 Replies

Dynamo - List.ReplaceItemAtIndex+ Troubleshoot

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

Labels (1)
4 REPLIES 4
Message 2 of 5

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

Message 3 of 5

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

 

 

Message 4 of 5
robert2JCCH
in reply to: ochoarTWDZH


@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.

Message 5 of 5

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report