Hello Everyone,
I have been facing this problem constantly. I wonder if there is a more intelligent way to create a condition to extract a parameter just if:
- The parameter exists
- The parameter is of a certain storage type
I have been doing this with Try/except as well as with “is not None” (as shown bellow) but I don’t know if this is the right way and it is quite annoying anyways . When I code without try/except it gives me an error about NoneType not having such a parameter
Hello…you could try …parameter exist… from clockwork
Hello @sovitek
Thanks, I know this node… but I intend to put this information inside my python node because I’m filtering a lot of things and doing this with VPL would make my script as become a big spaghetti
1 Like
@Deniz_Maral I’m not sure what you mean with “are elements valid ones”
This is exactly what I’m trying to do… To identify if they:
- have the parameter
2.The parameter is of a certain storage type I asked for
before extracting the parameter values. In other words: I just want to extract values of one specific parameter if (and only if) the parameter exist and that a value for the parameter is the same storage type I’m asking for
another example:
Here I just want to collect Insulation in case the element is a possible host for insulation and it has a valuable ElementId for the Insulation:
It looks like a looping error. Can you delete spaces before those blocks?
Hello @Deniz_Maral
Sorry, so in this last case I sent I just changed that code to get the results with a list comprehension, cus it would be easier
But my doubt as a general question still remains… I mean, I wanted to find a more straightforward way to just extract parameters only for the elements that have that specific parameter with that specific storage type
if param and para.StorageType == "StorageType that you want":
If I get you correctly you want something like that?
Sorry for late answer @Deniz_Maral
Yes, this is what I was looking foward thanks
1 Like