Insert parameter value in Family Name

Good Morning all!
I’m new here, I’m not very expert at Dynamo.

I have a question: I have created a Dynamo file that allows me to replace part of the family name with a new Code (a fix code).
Now, I want to go one step ahead. I want to replace the same part of the family name with a parametric value.
(I want that each wall family has the Length parametric value in its name).

In the file I shared with you ( which is incomplete, and need to develop ) I have done two tasks: one is to watch out the parametric value length associated to the wall families; an other to replace part of the family name with a new value (which is mean to be the wall length).

How can I finish my work and tell Dynamo to use the value of wall length as a new value to insert in the name of the wall?
Thank you in advance
Fede

I don’t know if I understood very well, but here it is. Then, use Element.SetParameterValueByName to set the new name to each wall.

2 Likes

Good morning thank you for your answer @Guilherme ! It was perfect!!
The only thing I want to do now, it is to get rid of the “,00000” after the number value.
For example, in place of “200,000000” I would like to see “200” , and that’s it!
How can I do it?

You can use the Rounding.Round+ node from Clockwork package (download it on Settings > Seach for a Package).

example

2 Likes

Thank you again @Guilherme! Your solution looks nice!
However, when I tried to do that, Dynamo could not recognise the list of my values . I think this is because the list has some empty values. Do you think there is an efficient way to filter the positive (and existing) values? I tried to filter the values that have a number > 1 . but it didn’t work. (I think I wrote the code block in the wrong way)

Thank you in advance!
Federica

Just put a filter to erase all the empty values. Clear.List is from archilab package.

1 Like

You need an input for your codeblock. You don’t have any boolean values right now.

Thank you both for your answer.

@Guilherme your advice looks cool! But when I use it, the value is empty, and it doesn’t work
:frowning:
here a screenshot with my problem

@Nick_Boyts , what do you mean with the lack of boolean values. Do I need that?

It probably doesn’t worked because you has transformed a value to a string. I think you cant just connect Element.GetParameterValueByName with the Code Block node.

1 Like

@Fed17 - In your last post you are trying to filter a list of strings using a numbers. This will only return null values. See image below:

Number%20vs%20String

With filter masks you want two lists of equal size. One with your data and another of Booleans. You then use the booleans to filter the data list into two outputs. Essentially into true values and false values

See below:

Hope that help explain those two issues.

In regards, maybe try this:

3 Likes

Hello !
Thank you @Guilherme for your comment, you’re definitely right!
And thank you @ben.dowling also for your explication, it is just perfect !

The only think that I don’t understand, it is that it still doesn’t work for my situation. :frowning:

In fact, I cannot obtain the list of positive values rounded to 0.1. When I apply the filter , on the list, at the “0” value, the empty value still persist. Then, Dynamo says there is an error at the math.round command.

Do you have any ideas?

Thank you in advance

Hi @Fed17,

Your very welcome, glad it helped you out. :blush:

The issue you have now is that you are removing the null values. As I said above, the two lists need to be the same size. Basically your filter mask node retained the blank value at index 0 because your mask value at index 0 was true

So to get around this, you need to instead replace the nulls with False Boolean values. As false represents the data you wish to filter out.

See example method below.

The “List.ReplaceNull” is from the Clockwork Package :+1:

Best

Ben

Thank you again @ben.dowling!
Your suggestion works perfectly!

Now the problem of the null values is solved.

However, I still can’t achieve my goal. Dynamo still doesn’t follow the command round 0.1 when renaming families (walls in my case) .
Something is missing, but I don’t really know what it is…
I hope somebody has some brillant ideas…

Hi @Fed17,

The issue now is that you are adding a Number to a String field/value. As you’ll see in my example below, the “object to string” node does the same thing to my numbers.
(which is what the node “Element.SetName” node is doing in your graph).

So what you need to do is convert your numbers to strings before bringing them to the Element.SetName node.

There are a few methods to consider but I’ll list two in my example below:

Number to String - This node is from Springs Package. This is a cleaner number to string method. However with this you lose the decimals place is it is .0.

String.Remove - This is a bit more custom but personally, I prefer it. Basically what i am doing here is using the fact that the “String to Object” node will add the 6 decimal numbers and then removing the excess decimals using the String Remove node. This method means that you will always get a decimal in your file number, keeping it lovely and consistent. (which as i am a tad OCD, will always do haha :innocent:)

So to explain, just in case you are unaware…

In Python, when using indexes it goes left to right by 0,1,2,3,4,5 etc. However when going from right to left its -1,-2,-3. The same goes when using the count input. So -1 at the StartIndex put me at the end of the string (regardless to how many characters it contains) and then the “-5” at the count input is saying remove characters at indexes -1, -2, -3, -4 & -5.

See below an example of positive and negative index calling:

Best,

Ben

@ben.dowling thank you very very much for your help!
And thank also to @Guilherme
Today thank to both of you, I was able to do this task!
Your help has been precise and precious for my work.

My next step will be to try to create wall family names in Revit project browser. The name will be a combination of existing parameters values.
I will try to do this with Dynamo, which is an ambitious task for me.

Your help has set the bases
Respectfully,
Federica

1 Like

Hello @ben.dowling
How are you?
I have followed your suggestion lately and I’ve had a little issue.
Maybe you know how to fix it.
In fact, using “List.replaceNull” , the list changes the order of the values, and this creates disorder for the elements. (1st image)


I tried to use List.Create and then List.transpose , but I still don’t know how to keep the value’s order. (2 image)

Do you have any ideas?

hi @Fed17,

:point_up_2: This is what is suppose to happen. As when you use the ‘List.FilterByBoolmask’ you pulling out two lists at the end. If you look at the picture from my post earlier, you’ll notice that I had a list of 14 that was then divided into two separate lists of 8 and 6.

I think the issue is you are not carrying this filtering method to your list of elements, so when your two lists of data meet at the ‘Element.SetName’ node they are of different lengths/sizes.

I would add another ‘List.FilterByBoolmask’ node (reusing the same mask) and run your elements/family types through it. :+1:

If this is not right, please expand on where the issue is occurring and I’ll see if i can help you out.

Best,

Ben

2 Likes

Wow ! It works perfectly!
You are so GREAT!