Hello everyone,
I'm a Revit API newbie. How can I get base and top level of a selected column? The following codes don't work:
UIDocument uidoc = new UIDocument(Document); Document doc = uidoc.Document; ElementSet col = uidoc.Selection.Elements; foreach(Element e in col) { Parameter pB = e.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM); Parameter pT = e.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM); TaskDialog.Show("Column Levels", pB.AsString()+" & "+pT.AsString()); }
I'm using Revit One Box 2013. Thank for any help!
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear annp_mth,
As a newbie, I would recommend installing and using RevitLookup before you try anthing else at all.
If you do not know how, please work through the getting started materials before that:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Once you have RevitLookup up and running, you can insert a column manually through the user interface and explore its parameters in RevitLookup to answer this question and the unending list of other questions that arise on a daily , hourly or even per-minute basis during any add-in development.
For a more powerful approach still, install an interactive interpreted programming shell for deeper and more intimate database exploration, e.g. like this:
Good luck, and have fun!
Best regards,
Jeremy
Hello Jeremy,
Your blog at TheBuildingCoder is one of my favourite blogs about Revit API. The 2 built in parameters in my codes were found out by using Snoop Current Selection. After reading your reply, I've studied deeper and found out why I were wrong. My new code doesn't look professionally but it worked (C# is not my field):
UIDocument uidoc = new UIDocument(Document); Document doc = uidoc.Document; ElementSet colcot = uidoc.Selection.Elements; foreach(Element e in colcot) { Parameter pB = e.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM); Element mB = doc.GetElement(pB.AsElementId()); Parameter pT = e.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM); Element mT = doc.GetElement(pT.AsElementId()); TaskDialog.Show("aaa",mB.Name+"&"+mT.Name); }
Thank you very much! 🙂
Can't find what you're looking for? Ask the community or share your knowledge.