How to verify if a parameter is empty in Revit Python Shell

877 Views Asked by At

I am trying to verify if a parameter exists or not in a document, and (if it exists) if it is empty or filled.

The problem is that the code always returns that the parameter is filled if it exists. Even if it exists but is empty. So lines 30 to 33 do not really work. I've tried many things already but I don't know what I'm doing wrong.

Does anybody know what is the mistake?

Thank you! enter image description here

... I'll have to add the code I was talking about in the comment here because I couldn't add a picture in there... enter image description here

Screen shot for the parameter IsExtendedWarranty: enter image description here

1

There are 1 best solutions below

11
Jeremy Tammik On BEST ANSWER

You are calling the Element GetParameters method.

It returns a list of Parameter objects.

To check the value of a parameter, you need to add two more steps:

  • Pick one of the parameters from the list, e.g. by selecting the first element.
  • Retrieve its value. For instance, if it has a string data type, use AsString.