Set Parameter By Name node is writing different values

Hi Guys,

I have been developing scripts for almost six months. I have been assigned to analyze one of the previous inter’s scripts. While doing this, I realized that the Set Parameter By Name node is writing different values to the element. Surprisingly they are correct. I could not understand how it happened.

I tried resetting and running the script again. It is happening the same every time.

I will explain block by block.

  1. The first block reads data like column coordinates and corresponding forces from a sofistik database using python and gives out of coordinates Revit points and three forces as a dictionary.

  2. Second block gets corresponding columns from the corresponding floor and gives their location (XYZ points)

  3. Third block (important), here, we are comparing coordinates from both sources (Sofistik and Revit) to find the closest point pair. So that we can match Sofistik columns with Revit columns. The output is a sorted list of Revit columns according to the sofistik columns.

  4. Last block is to sets parametric value (forces) from sofistik to elements of revit (column) by name (parameter names, strings)

Doubt.dyn (88.9 KB)

Problems:

  • If you see the image below, the index-0 of each list is not exactly written to the element of index-0. the element in the index 0 position gets values from somewhere index-82. And so on index-1 is getting from index-109 of values.
  • Also the values are repeated by . in the decimal position. But while writing them to the element parameter the node is using , as a decimal separator. Why is this happening?

Hi @kuladeep561
If I am understanding correctly, one of the things that may be causing your first problem is that you are comparing the coordinates of all columns to a filtered list and then trying to get certain coordinates based on the indexing. Try filtering the full list of columns first by using the Filter.ListByBoolMask node and then pull the coordinates of just the columns that are returned from that.

Not sure about your second problem, other than maybe the units of the parameters are not set correctly in Revit.

HI @staylor ,

Do you think filtering at the initial nodes causes an issue at the end node before passing elements to the set parameter by name node?
Typically, in Dynamo, we tend to focus on the nodes that come before (output) and after (input) a specific node, don’t we?

However, I tried as you said, yet there is no change in the output.

  1. I did reset the values, see below
    image

  2. Run the modified script

  3. After the execution
    image

  4. Values are (Same indexes, no change)

When it comes to filtering, you have to be a little more methodical with the approach. If you end up comparing a full list against a filtered list, you will get indexing issues, because the elements in the filtered list are re-indexed and won’t match their original index in the full list.

Looking at your pick where you reset the parameter values. Your default value is pre-formatted 0,0000 so the number getting written to the parameter is being converted to that format. How do you have those parameters formatted?

Thanks @staylor. Now I realize my german BIM colleagues prepared the template. So I guess it was formatted according to the standards.

Regarding your first explanation, I did not understand the concept of “comparing a full list against a filtered list”. Both lists are almost the same size. The list from Sifistik DB has 135 points, and the filtered list from Revit has 132 points. However, I cannot avoid filtering right. I need specific elements, So I should do filtering.

I conducted some tests and found that connecting the nodes SetParameterByName directly with filtered elements from Boolean-mask resulted in the desired output. The nodes now function correctly and accurately, assigning the correct indexing values to elements and writing them to the respective parameters.

Do you have any solution to why they act weird after performing the Block-3? How should I avoid this index mismatching?

Try filtering the main list and then pulling the locations of the filtered elements as shown below. I don’t have a model to test on to see the results, but this may resolve your indexing issues all together.


I did the same thing after you suggested filter by boolean mask in the first reply. Pulled the locations from the filtered list, then connected them to the geometry node.

After recreating the script in a new .dyn file to avoid any copying glitches, I observed that the issue seems to be limited to the first element index-0 in the list. All other elements are working correctly. Despite trying several other approaches, the issue still persists with the first element.