Is there a way to put the Parameter.ParameterType in a Code block / DesignScript?
To test stuff like this in the future:
- Select the node(s) you want to convert to design script.
- Right click the workspace background and select “node to code”.
You have a conflict with other packages. Try using
You probably need to install a newer version of Dynamo or update the packages that are causing conflicts.
Ah this old issue
I am on the latest build for Revit 2020 and have updated packages installed, but the same error occurs so…
Another option using Python perhaps or just the OOTB solution without node-to-code…
element = UnwrapElement(IN) ep = element.Parameters result = for e in ep: p =  p.append(e.Definition.Name) p.append(e.Definition.ParameterType) p.append(e.Definition.UnitType) p.append(e.StorageType) result.append(p) OUT = result
FYI @Konrad_K_Sobon there may be a namespace issue here. I’ll try to confirm and track in the GitHub but I may not get to it until next week (booked pretty solid right now).
We (the Dynamo team) have made some fixes recently to namespace resolution issues in code block nodes and in the conversion of nodes to code in CBNs. You can expect to see them in new releases of Dynamo (2.7+).
However, even in current versions of Dynamo, in the presence of class conflicts with other packages, you should expect to see all the available options for a particular class. By that I mean, if you begin to type ‘Parameter’ in a code block, the autocomplete should begin to list all of the classes by that name from all the packages loaded in your session of Dynamo, which in @Fernand77’s case would be:
Note that these options, however, will be displayed by their partial names in a way that they can still be differentiated uniquely from each other. In this example, they would probably be listed as:
This partial naming is just so that the code in the CBN will be less verbose. Once you see these options in autocomplete, you can select the appropriate type you want to use. In the above example, @Fernand77 would choose “Revit.Parameter” and placing a ‘.’ after that qualified name would reveal another autocomplete list of all the methods and properties available on that class and that class only.
Now, converting the “Parameter.ParameterType” Revit node to code should automatically also qualify (prefix) the same partial namespaces before the “Parameter” class and generate the following code (like in the above example):
t14 = Revit.Elements.Parameter.ParameterType(t9);
with just one input port for the variable ‘t9’. So, obviously, in the above case, there is a bug as it did not recognize the word “Revit” as part of a namespace and instead mistook it for a variable and generated another input port for it, which is wrong. This should also be fixed in the latest releases of Dynamo.
Your next question might be (which is very valid) as to how would the user know which class to choose from the list of partial class names. Currently there is no easy way for the user to tell which is which but there are plans of addressing this in the future as well.