Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parameter.Id use in FilteredElementCollector WhereElementIsNotElementType()

4 REPLIES 4
Reply
Message 1 of 5
gwkuhn
564 Views, 4 Replies

Parameter.Id use in FilteredElementCollector WhereElementIsNotElementType()

I am running Revit 2017. My tool (IExternalApplication) is intended to work on HostObjAttributes (Walls, Floors etc.) and their parameters. These parameters are of the Parameter Class - a class which does not inherit from the Element Class. Nevertheless we find a Parameter.Id property (of type ElementId), which makes me hope that I can use it to directly access a Parameter object without iterating over all ElementTypes (HostObjAttributes inherits from ElementType) and their GetParameters() methods.

So is there a way that a FilteredElementCollector(myDocument, someParameterOfAnHOA.Id) can find the Parameter object(s)? On first glance I expected FilteredElementCollector.WhereElementIsNotElementType() to be usefull in this scenario, but it looks like it is always used with ToElements() - returning an IList<Element> which in my understanding can't contain any Parameter object - so how do I use  WhereElementIsNotElementType() correctly? Or am I missing something fundamentally obvious?

4 REPLIES 4
Message 2 of 5
jeremytammik
in reply to: gwkuhn

I do not believe the parameter id refers to the individual Parameter.

 

The Parameter is basically just a value stored on each BIM element.

 

The parameter id probably refers to the parameter definition instead; its Revit API class name is Definition:

 

https://www.revitapidocs.com/2020/8fe04f37-04e1-9e93-ffdb-e3900908e42a.htm

 



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

Message 3 of 5
gwkuhn
in reply to: jeremytammik

Ok cool that would actually make some sense.

But does that mean for a given Parameter its Parameter.Id == Parameter.Definition.Id ?

Both Ids have the description "The id of the parameter. " in their respective documentation and are of type ElementId.

 

On the other hand, i can't really retrieve a definition, as it isn't an Element aswell. So is the bottom line seems to be that neither Id is of use for my current scenario, right?

Message 4 of 5
jeremytammik
in reply to: gwkuhn

I think it is probably of great use in filtering.

 

The Building Coder posted several recent discussions related to that, e.g.:

 

https://thebuildingcoder.typepad.com/blog/2019/10/get-project-parameter-id-and-prevent-updater-loop....

 



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

Message 5 of 5
gwkuhn
in reply to: jeremytammik

I have seen that post, but the solution to the 'related' question works with a ParameterELement. As far as I know I can't get the parameters of HostObjectAttributes as a ParameterElement, right?

 

Thanks by the way for your awesome blog in general and the fast responses here though, I hope my return questions are specific enough and aren't too annoying - I'm trying my best to get a deeper understanding of the Revit API.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community