ParameterByName and Parameter Type


#1

Hi all, im trying to get the parameter type based on the elements and parameter name.

I had tried to design a design script based on that function but it seems to not work?
The line above [Imperative] is used to test on whats wrong with the script.

Any help is much appreciated

elements[0][0];
ParaName[0][0];
count = DSCore.List.Count(elements);
elements[0].ParameterByName(ParaName[0]);
[Imperative]
{
	x = 0;
	y = [];
	while (x<count)
	{
		a = 0;
		for (ele in elements[x])
		{
			y[x][a] = ele.ParameterByName(ParaName[x]).ParameterType;
			a = a + 1;
		}
		x = x + 1;
	}
	return = y;
};

#2

@stillgotme the following works in Python and it should work in your code block

OUT = Revit.Elements.Parameter.ParameterByName(element,param)


#3


Hello @salvatoredragotta, im still getting null values on the codeblock.

The reason why i dont want to do on nodes is due to the complex list level whereby more data will be added on subsequently.


#4

Also, if i were to use the last line, it will come out with this error


#5

What are you feeding as elements?


#6

Mechanical Equipments (MEP families)


#7

Do i need to use FamilyInstance.GetParameters instead?


#8

The node works also with mech equipment .
Can you post your rvt and dyn files (or a link)?


#9

Unfortunately, i cant share with you the link or dyn file as the other portion contains confidential information about the company im working at. But to give you a better understanding of what is being fed in. i will attached some screenshot of it


But i suspect is something to do with the input list.

Below is the actual code

elements;
ParaName;
count = DSCore.List.Count(elements);
[Imperative]
{
	x = 0;
	y = [];
	z = [];
	while (x<count)
	{
		a = 0;
		for (ele in elements[x])
		{
			z[x][a] = ele.Parameter.ParameterByName(ParaName[x]);
			y[x][a] = z[x][a].Parameter.ParameterType;
			a = a + 1;
		}
		x = x + 1;
	}
	return = y;
};

#10

Don’t jump into imperative functions, and stick with basic design script here. Feed it line by line and then you will find the issue.

If I had to guess, you have a namespace collision issue with multiple custom nodes sharing the parameter namespace, and because you’re calling them in a function you’re missing the error message.


#11

I might be total off here, but is it something like this you want to do?


#12

@erfajo hello, and yes you are totally off there :slight_smile:

@JacobSmall you are partially right and i had solved my own issue.

Thanks for the great help guys :slight_smile:


#13

Thought so… but many users write one thing meaning another. In your case you only want to add a new type of a family, you don’t want to edit the family as such. But it could have been the case that you wanted to open the families resident in a project, and then tweak the families before loading them back again into the project…


#14

Please post your solution for future reference.