Get Section location

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

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

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

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

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.

Hi

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

I was able to get location of a view with a couple nodes from Rhythm package. But not sure if it always works…

1 Like