How To Ask If An Element Can Have a Shared Parameter Applied To It?

How To Ask If An Element Can Have a Shared Parameter Applied To It?

0001des
Enthusiast Enthusiast
650 Views
8 Replies
Message 1 of 9

How To Ask If An Element Can Have a Shared Parameter Applied To It?

0001des
Enthusiast
Enthusiast

Hi,

Is there a function or method that tells me if an element can have a shared parameter applied to it?  Something like "CanAddParameters" or "IsParameterable" ?

 

I know I can use a Try-Catch, but I want something a little faster.

0 Likes
651 Views
8 Replies
Replies (8)
Message 2 of 9

dante.van.wettum
Advocate
Advocate

I dont think you there is a methode implemented for that, but someone else should be able to answer that.

 

If its only elements that exist in the model (geometry-wise) you are after you could check for some other properties like element.Category.HasMaterialQuantities or element.HasPhases.

 

if its another specific purpose, it might help to explain your case a bit more

0 Likes
Message 3 of 9

0001des
Enthusiast
Enthusiast

I'm trying to put parameters on objects in my model.  For the most part, 99.999% of the geometry allows for application of parameters to the object.  However, a client sent me a model that had a weird wall, that had all the parameters greyed out in the UI, and when I put the parameter on the object with the API's, it crashes the script.  I can't use try-catch on every object otherwise it takes extraordinarily long for the loop to run.  I was hoping for a clean way to check if the object allows parameters, with a simple Boolean to return the accessibility of the object's parameters collection.  

0 Likes
Message 4 of 9

dante.van.wettum
Advocate
Advocate

Post edited:

i was thinking you were maybe dealing with an infill element. This could be a wall with everything grayed out and revit crates because of different phases in voids and hosts.

I was testing it earlier, but i was able to add a shared parameter to this element...

I cant think of any wall that is visible in 3D would be incapable to add a parameter to (so excluding any walltype elements and such elements). As far as my revit knowledge goes, any wall type should be able to have new shared parameters

 

0 Likes
Message 5 of 9

0001des
Enthusiast
Enthusiast

I know what you are saying.  I haven't been able to create a wall (in the UI or API's) that has this same dysfunctionality.  

 

But the client somehow did.  And as far as I can tell, there isn't any rhyme or reason why this wall doesn't allow for appended parameters.  I've been trying to find a workaround for this for a day and nothing seems to work.  I'll keep plugging away at this, in the hopes I don't have to resort to try-catch on every object in the loop.

0 Likes
Message 6 of 9

dante.van.wettum
Advocate
Advocate

Anything remarkable you can find on the wall when using Revit lookup?

just select the wall and check "snoop selection" to see if there is anything special in the DB properties compared to a normal wall.

https://github.com/jeremytammik/RevitLookup 

 

 

0 Likes
Message 7 of 9

0001des
Enthusiast
Enthusiast

Nothing out of the ordinary.  I wasn't using RevitLookup, but I was using a simple loop in Visual Studio and using the Watch Sidebar to peruse the attributes of the objects, and it didn't show anything extraordinary compared to a typical wall object.  (One thing to note, this is regarding Wall Equipment, I should have mentioned.)

0 Likes
Message 8 of 9

jeremytammik
Autodesk
Autodesk

Depending on your use case, extensible storage may be a better choice than a shared parameter:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.23

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 9

0001des
Enthusiast
Enthusiast

Is there a way to "schedule" the contents of something stored in Extensible Storage?  

0 Likes