Get base and top level of a selected column.

Anonymous

Get base and top level of a selected column.

Anonymous
Not applicable

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!

0 Likes
Reply
Accepted solutions (1)
2,910 Views
3 Replies
Replies (3)

jeremytammik
Autodesk
Autodesk
Accepted 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:

 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

Good luck, and have fun!

 

Best regards,

 

Jeremy



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

0 Likes

Anonymous
Not applicable

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! 🙂

0 Likes

jeremytammik
Autodesk
Autodesk

Dear annp_mth,

 

Great!

 

Thank you very much for the appreciation!

 

I am glad you find the blog useful, and are using RevitLookup.

 

Your code looks perfectly fine to me.

 

Congratulations on solving it!

 

Cheers,

 

Jeremy

 



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

0 Likes