# Spatial Element Calculation Location - Revit Settings

**URL:** <https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907>\
**Category:** Revit\
**Tags:** revit, areas, api\
**Created:** [January 19, 2019, 2:56am UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907 "2019-01-19T02:56:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [January 19, 2019, 2:56am UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/1 "2019-01-19T02:56:08Z")

</div>

I am trying to set the “default” for the Room Area Computation Location, and I thought I was getting the correct thing, but it appears that when I change the setting, it is not actually changing Revit. It seems like I am missing a call to “set” the options once they have been defined, but I must be missing something. Any help here would be appreciated.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/1/010afdac205965a35451998463a2f6213b709f73.png)

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
results = []

TransactionManager.Instance.EnsureInTransaction(doc)

try:
	spEB = SpatialElementBoundaryOptions()
	spEB.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish
	results.append(spEB.SpatialElementBoundaryLocation)
except:
	results.append(False)

TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = results
```

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 19, 2019, 4:22pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/2 "2019-01-19T16:22:38Z")

</div>

Not sure, but I think you need to start with a constructor first. This code snippet from @Gui_Talarico might shed some light for you though.

> <https://github.com/gtalarico/ironpython-stubs/blob/master/release/stubs.min/Autodesk/Revit/DB/ __init___ parts/SpatialElementBoundaryOptions.py>

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [January 19, 2019, 4:32pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/3 "2019-01-19T16:32:21Z")

</div>

Thanks @jacob.small, I think what I am seeing is that this line:

Options that can be passed to a SpatialElementBoundaryCalculator to influence the results of the calculation.

makes me think these are only options when specifically using a BoundaryCalculator in the code and not for actually changing the (radio) setting within the Revit environment. That is what I would like to be able to do, but not sure that is exposed. I have managed to set Area / Volume settings and thought this would be similar.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 19, 2019, 4:39pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/4 "2019-01-19T16:39:15Z")

</div>

Might be worth a post to the Autodesk Development Network forum for Revit if you don’t get guidance this weekend.

---

<div class="post-metadata">

**Author:** ![Gui\_Talarico](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gui_talarico/32/10887_2.png) [@Gui\_Talarico](https://forum.dynamobim.com/u/Gui_Talarico)\
**Post date:** [January 23, 2019, 7:37pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/5 "2019-01-23T19:37:40Z")

</div>

@SeanP

> it is not actually changing Revit

You are creating an Options object but you are not doing anything with it.  
The options object _needs to be used_ by making a call to a function that uses it, for example, to get the boundary elements of a given room:

### Example

```python
# ...
# Create Options object
options = SpatialElementBoundaryOptions()
options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Center

# Use Options object 
room_boundaries = some_room.GetBoundarySegments(options)
# `room_boundaries` variables now has the geometric boundaries of `some_room`, 
# extracted using the "Center" location approach of its bounding elements (center of wall)

```

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [January 23, 2019, 8:00pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/6 "2019-01-23T20:00:23Z")

</div>

Thanks @Gui_Talarico. I think is what I understood was happening, but not really what I am looking for. As I mentioned above, I want to change the project default setting, not provide options to a boundary calculator. From what I am seeing, I don’t think this is exposed and/or I don’t know how to access it. I have accessed the Volume Computations, and thought this would be similar. Thoughts if any?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/5/25e151a466d5516be525ee4d328b6354828309ad.png)

---

<div class="post-metadata">

**Author:** ![Gui\_Talarico](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gui_talarico/32/10887_2.png) [@Gui\_Talarico](https://forum.dynamobim.com/u/Gui_Talarico)\
**Post date:** [January 23, 2019, 9:42pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/7 "2019-01-23T21:42:57Z")

</div>

Sorry I misunderstood your original question.  
My brain went straight into your code and I obviously did not read the question 🙃

You need to use `AreaVolumeSettings Class` and `SetSpatialElementBoundaryLocation Method`

The code below will Change the “Room Area Computation” Option in the “Area and Volumes Computations” dialog. You can remove the transaction stuff in Dynamo

```python
from Autodesk.Revit.DB import (
    AreaVolumeSettings,
    SpatialElementBoundaryLocation,
    SpatialElementType,
    Transaction
)

# Get `doc` handler
# ...
t = Transaction(doc)
t.Start('Changes Room Computation option to Center')
settings = AreaVolumeSettings.GetAreaVolumeSettings(doc)
settings.SetSpatialElementBoundaryLocation(SpatialElementBoundaryLocation.Center, SpatialElementType.Room)
﻿t.Commit()

```

[http://www.revitapidocs.com/2015/3accb536-c914-3581-bb80-1244b1522230.htm](http://www.revitapidocs.com/2015/3accb536-c914-3581-bb80-1244b1522230.htm)  
[http://www.revitapidocs.com/2015/d1d395b6-7cb4-358a-3838-68c619c22385.htm](http://www.revitapidocs.com/2015/d1d395b6-7cb4-358a-3838-68c619c22385.htm)

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [January 23, 2019, 10:56pm UTC](https://forum.dynamobim.com/t/spatial-element-calculation-location-revit-settings/30907/8 "2019-01-23T22:56:58Z")

</div>

Brilliant, thanks!
