Here I need to see Elements.Parameters, which I could easily see through Dynamo Node. I was wondering if I can get DesginScript equivalent for each Dynamo Node ( I am not sure if I am using the right terminology ) I can think in terms of Dynamo nodes but I dont know python command to get that API/ function.
The reason I want to see the Parameter is because I like to see the correct Parameter spelling before calling it.
For example if I write ""out = Autodesk.Revit.DB.ParameterElement(p1), would that give me all the parameters of element ?
( I got this from here ApiDocs.co · Revit · ParameterElement Class
I’m not sure what you want to achive, if you are trying to do a python script qith the same result that de dynamo node, just dont unwrap in this case.
If you’re looking for Dynamo nodes in python, @Manel_Fernandez has got you on the right track.
Before we get started, I have another primer for you to look at, in addition to the Dynamo Primer. The Dynamo Python Primer should help you grasp some of the basics a bit better, and answer some questions like this ones.
To answer your main question - how to use Python to see all the parameter names - you were headed the right direction. p1.Parameters returns a list of parameters. If you look around you’ll notice it has no name property. This is because it’s stored in the definition property of the parameter. If we follow from there to the Definition Class you’ll see that here we have a .Name property. So we can use your_parameter.Definition.Name to retrieve the name of any given parameter.
Aside from that there’s a couple other things happening here with your code. I’ll walk through it.
p1 = UnwrapElement(IN[0])
This is good, if you want to use the API to acquire your parameters. The link above talks about this, but the API is more or less a way to interact directly with Revit.
Using Dynamo nodes in python (DesignScript), is sort of like having a middle step between you and Revit. If you use DesignScript, as you can see in Manel’s example, you don’t need to unwrap your element. This will be important to keep track of if you intermix the API and DesignScript.
p1a = p1.Parameters
Also good, this will return a list of parameters for that object. As @GavinCrump pointed out, you can also use .GetOrderedParameters. .Parameters will return all parameters associated with the object, where .GetOrderedParameters will return only the parameters you can see in the properties box in Revit when you select the object.
p2 = p1.LookupParameter()
Here’s our first snag. Take a look at the page for LookupParameter. You’ll see it wants the name of a string in-between the parenthesis. For example: p1.LookupParameter("Comments"). Something to be aware of, is if you have multiple parameters with the same name, it will only return the first one it finds, which will be random. In the case where you have multiple parameters with the same name you will want to use GetParameters(“parameter name”).
p3 = p2.AsString()
This is also good, aside from the fact that p2 is not currently holding a parameter, since you didn’t give the function a name.
Edit:
One more addition - If you do start getting into the API, Jeremy Tammik’s blog is very handy. There are a great many explanations and examples for just about everything in the API.
That said, everything here is written in C# so far as I’m aware, so you’ll have to get used to reading that and converting it to Python, but it’s doable with some practice.