Hello forum,
I’m prototyping something and I’m having difficulties.
What I’m trying to achieve:
A script that modifies the 2d extends of levels in a given view.
My problem:
I am trying to call the DatumPlane method SetCurveInView() from the level, but the view
parameter wishes for a View
and not a SectionView
or a FloorPlanView
. Also SetCurveInView()
should be called with a DatumPlane
and not a Level
.
I know View
and DatumPlane
are parent objects, but how do I get them from the current view and a selected level?
Why I’m trying to do it:
I’ve had complains that moving the 2d extends of a view is time consuming (slow model, slow operation, 30 sec to 1 min between view refreshing each time the cursor is moved). So I’m trying to see if it can possibly make the operation faster. Working from a blank file, it seems that the amount of time needed to refresh the view during the dragging of the 2d level extend is directly proportional to the amount of objects hosted on it. Which is peculiar; it’s a 2d representation, I don’t understand the link between them.
Thank you!
Screen Capture:
Python script:
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
view = IN[0]
curve = IN[1]
level = UnwrapElement(IN[2])
level.SetCurveInView(DatumExtentType(1),view,curve)
Dynamo file
Level2dExtend.dyn (10.4 KB)
Blank Revit file (version 2021) with a single elevation, a curve exist over the top-most level:
Level2dExtend.rvt (1.5 MB)