Switching between 2d and 3d extent (Levels, Grid)

Is it possible to switch grid extent from 2d to 3d and vice versa in revit through dynamo? I am not sure the Revit API allows that but i want to confirm.

Thanks

Kia ora,

With the help of Python and only if you’re using Revit 2016 or higher… Try changing the category to Grids - I got this to work with levels extents and believe they work the same way (ViewSpecific=2D and Model=3D).

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

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

a = UnwrapElement(IN[0])
v = UnwrapElement(IN[1])
TransactionManager.Instance.EnsureInTransaction(doc)
for i in a:
#    i.SetDatumExtentType(DatumEnds.End0,v, DatumExtentType.Model)
    i.SetDatumExtentType(DatumEnds.End0,v, DatumExtentType.ViewSpecific)
#    i.SetDatumExtentType(DatumEnds.End1,v, DatumExtentType.Model)
    i.SetDatumExtentType(DatumEnds.End1,v, DatumExtentType.ViewSpecific)
TransactionManager.Instance.TransactionTaskDone()

OUT = v
7 Likes

This is excelent wired_wrong!!!

confirmed working for GRID on floor plan drawings.

But why doesn’t it work on elevation / section drawing?

The python node generate this error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
Exception: The datum plane cannot be visible in the view.
Parameter name: view

1 Like

Do you still get this error

This might be as a result of your view settings. Something is being hidden that uses the datumplane.

I get the same error

Exception: The datum plane cannot be visible in the view

Any help?

I think if any grid / level is outside of the view, then you will get the aforementioned error.