Get a selected set of parameter values

Get a selected set of parameter values

jaboone
Advocate Advocate
905 Views
3 Replies
Message 1 of 4

Get a selected set of parameter values

jaboone
Advocate
Advocate

 

I can collected some elements in revit easily enough, but how can I filter those objects to determine a specifc parameter in a selected id object?  Specificly a electrical outlet.

 

      Double ls = 0;

      ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();
      ICollection<ElementId> selectedElecIds = new List<ElementId>();
      foreach (ElementId id in selectedIds)
      {
         Element elements = uidoc.Document.GetElement(id);
         if (elements is )  //THIS IS WHERE PROBLEM IS:  what is filter name to get a specific family member and/or a specific parameter name
         {
            selectedIds.Add(id);  //selectedWallIds.Add(id);
            ls = Convert.ToDouble(elements.GetParameters("Watts"));
         }
      }

 

Thanks in advance for any help.

 

Learning as I go
0 Likes
906 Views
3 Replies
Replies (3)
Message 2 of 4

Moustafa_K
Collaborator
Collaborator

it can be through different ways, but you can try this to match your code sequence

                if (elements.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME) != "XxX") continue;

let us know more if this is not what you need. as well as if it works.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 3 of 4

rosalesduquej
Alumni
Alumni

Hi James,

 

Since you are learning with the Development of Revit I will refer you to read a bit more about Parameters in the API. http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-E0F304BC-07B8-461E-8FB2-234106951B0A

 

In there you will find also code in order to get the selected element parameters 

http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-D003803E-9FA0-4B2B-AB62-7DCC3A503644

 

Hope this helps,

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 4 of 4

jaboone
Advocate
Advocate

Sorry have not had time to follow up since I had to jump back on some paying jobs.

Learning as I go
0 Likes