Get Section location


#1

Hi

Is it possible to get the location, direction or bounding box of a section element through the API? I’m having problems with that.

Thomas


#2

Seems like the API call for the direction is “.ViewDirection”:

2014-11-27_184948

 

 

 

 

I’m not sure how to extract the the bounding box tho.

SectDir-test


#3

Ok, thanks. That is perfect. I’ll only need something to pinpoint the direction of the section. I tried .Location, .RightDirection and .BoundingBox, but none of them gave any geometry I could use as far as I could see.

Thomas


#4

Hi

Is it possible to do this with the “Select Element” node too? This node returns an Elements, but .ViewDirection is a property of the ViewSection class, not the Element class. Do I have to convert the Element object to a ViewSection object first? How do I do that? I can use a FilteredElementCollector to get all views and then filter out the view with the ID of the selected element, but is there a simpler/better method??

Thomas


#5

You can actually use a trick to derive the view ID. Because once you draw the section, the line that represents the section and the actual view are created in the same transaction, one after the other and therefore their IDs are assigned sequentially. So if you select the section line, read its ID and add 1, you can select the view like so:

2014-12-01_175620

 

 

 

I learned that trick from Julien.


#6

Hi

That’s a clever trick. Thank you very much.