Performing action in current view ONLY

Hi,
I am trying to perform an action, in this case disallow the curtain wall join ends, but I want this action to be performed in the current view only as it would take a very long time to do it in the full project file and someone might be working in other areas of the building and will need (most likely) need to sync every time a run the script.


#Start of generic stuff imports

import clr

#import Revit API
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

#import Revit Elements
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

#import DocumentManager and TransactionManager
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#get current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

#End of generic stuff imports

#Unwrap input
inputs = UnwrapElement( IN[0] )
curtainWalls =
#Initiate counter
n = 0

#Get only curtain walls from input
for e in inputs:
try:
elementType = doc.GetElement(e.GetTypeId())
if elementType.Kind == WallKind.Curtain:
curtainWalls.append(e)
n = n + 1
except:
print(“not curtain wall”)

#Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for e in curtainWalls:
Autodesk.Revit.DB.WallUtils.DisallowWallJoinAtEnd(e, 0)
Autodesk.Revit.DB.WallUtils.DisallowWallJoinAtEnd(e, 1)

#End Transaction
TransactionManager.Instance.TransactionTaskDone()

#Wrap results
OUT = ["Disallowed joins on walls: " + str(n), curtainWalls]

Is there a way to do this?
PS: the whole script is from https://www.engipedia.com/disallow-joins-on-curtain-walls-with-dynamo/
Thanks in advance

Instead of all elements of category, try all elements in view and filter to the relevant category.

1 Like

@jacob.small thanks for the quick replay. That is exactly what I needed

1 Like