Reputation: 69
I want to go over all elements in the document and set their "Room Bounding" attribute positive if they have a Room Bounding attribute.
Iterating the walls I can do this:
Parameter param = e.get_Parameter(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING).Set("Yes");
However how do I do that for Columns? Or any other element who have this attribute?
I've tried going over all elements and get their parameters using:
IList<Parameter> ps = e.GetOrderedParameters();
but which attribute do I look for? is it "Room Bounding"? Do I set it to "Yes" or any other thing?
Edit: I first started with this: https://thebuildingcoder.typepad.com/blog/2008/09/selecting-all-w.html adjusting the code to retrive the Room Bounding parameter.
Then changing my code to support all elements, as my question mentioned and using: https://thebuildingcoder.typepad.com/blog/2018/05/getting-all-parameter-values.html
And I've used it to print all parameters names and their value, however I can't find the Room Bounding parameter in columns. I could easily do it in walls.
I tried using https://forums.autodesk.com/t5/revit-api-forum/get-the-value-of-shared-a-parameter-of-a-structural-column/td-p/8249860 and using
mycolumnList[i].LookupParameter("Room Bounding").AsInteger() != 1)
but this also didn't work.
Should I look for "Room Bounding" in instance parameter or in type parameter?
Upvotes: 1
Views: 1737
Reputation: 69
Thought I'll post a solution to help others who had similar issue.
Given an column e the following code change the "Room Bounding" parameter to True. (Please notice this code do not handle exceptions)
FamilyInstance famInst = e as FamilyInstance;
Parameter family_bound_param = famInst.LookupParameter("Room Bounding");
if (family_bound_param.AsValueString() == "No")
{
using (Transaction t = new Transaction(doc, "param"))
{
t.Start();
family_bound_param.Set(1);
t.Commit();
}
}
Thanks Jeremy for the guidance!
Upvotes: 2
Reputation: 8294
Please follow the standard approach to research and solve a Revit API programming task:
RevitAPI.chm
installed locally or online at revitapidocs.com provides detailed info on classes, properties and methods.SDKSamples.sln
shows how Revit API objects work together to solve specific tasks.After you have exhausted those options, search the Internet for 'revit api' or 'thebuildingcoder' plus the Revit API names that you are interested in.
I very much hope that this addresses your question in full and does not only feed you for the moment, but also supports you in the process of being transformed into a competent future fisherman.
Upvotes: 0