Performing action in current view ONLY

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
import Autodesk
from Autodesk.Revit.DB import *

#import Revit Elements
import Revit

#import DocumentManager and TransactionManager
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:
elementType = doc.GetElement(e.GetTypeId())
if elementType.Kind == WallKind.Curtain:
n = n + 1
print(“not curtain wall”)

#Start Transaction

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

#End Transaction

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

Is there a way to do this?
PS: the whole script is from
Thanks in advance

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

1 Like

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

1 Like