Clicky Id for Revit item in pop up

It’s looking to pull a ,net property “Name”, not a parameter value. While there is a “Name” property in the API, they don’t always return a valid value.

Is there a list somewhere of what contains what?

How would I know without just getting errors?

Why don’t they all have names?

Too many questions?

dir(thing) will tell yuo waht is available, but it won’t always express that there is a problem.

Getting an error is a good thing here, but you can try passing a list containing one of every element type that you want to support into the input and identifying which are causing issues, and handle the exception issues accordingly.

Not necessarily, but most do; Similarly not everything has a location… Edge cases will always exist, which is why we have “try / except” statements (which shouldn’t be blindly used for error suppression but error handling).

Nope. Not enough. :slight_smile:

1 Like

try to replace

item1 = System.Windows.Forms.ListViewItem(elem.Name)

by

item1 = System.Windows.Forms.ListViewItem(Element.Name.GetValue(elem))

or with

item1 = System.Windows.Forms.ListViewItem(elem.ToDSType(False).Name)

As it’s specifically for areas and numbers seemed to work I went with numbers…

Have put some error catching in tho (see above).

Aaand it works. :smiley:

image
(company logo skilfully scribbled out, yea, I could have actually just commented it out but…)

It’s a calculator for Approved Document O in the UK.

So I’ve called it CalcOlator… which no one seems to find funny :frowning: Someone please laugh at my joke :grin:

Thank you all! :grinning:

4 Likes

I did chuckle… Personally I would have gone with cal-O-lator, but your subtlety is likely better…

3 Likes