I used the code below to update an interior elevation view. However, the view break updates according to the values shown in Image 1, whereas I want the view break to match the position shown in Image 2.
Below is the code I used to apply the view break.
If anyone has a solution or can review the code, please let me know where I’m making a mistake.
"
import clr
RevitNodes for Dynamo-Revit element conversion
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
RevitServices for document access and transaction management
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
Revit API
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
Document reference
doc = DocumentManager.Instance.CurrentDBDocument
— INPUT —
Unwrap the view input from Dynamo
view = UnwrapElement(IN[0])
Define split parameters
Each split is defined by (startParam, endParam)
split_top_val = [0.25, 0.625]
split_bot_val = [0.5, 0.75]
— PROCESS —
Begin transaction
TransactionManager.Instance.EnsureInTransaction(doc)
try:
# Get crop region shape manager
crop_manager = view.GetCropRegionShapeManager()
# Remove any existing vertical splits
crop_manager.RemoveSplit()
# Apply new vertical splits
for start_param, end_param in zip(split_top_val, split_bot_val):
# Always split region at index 0 (initial crop region)
crop_manager.SplitRegionVertically(0, start_param, end_param)
result = "Splits applied successfully."
except Exception as e:
result = f"Error: {str(e)}"
End transaction
TransactionManager.Instance.TransactionTaskDone()
— OUTPUT —
OUT = (view, result)
"

