Hi all, I manage to get all the footings in the current project. But I want to filter only isolated footing from the list. So for that I used gettype but giving me the out like
I want to filter only isolated footings. Please let me know how to do that ?
import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]
TransactionManager.Instance.EnsureInTransaction(doc)
# Get foundation
footing = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFoundation).ToElements()
footype = footing.GetType
TransactionManager.Instance.TransactionTaskDone()
OUT = footype
@shashank.baganeACM , hi
Maybe you can get it via visibleInCurrenedView Whats your critera for filtering you can also GetParameterByNameAndValue and filter your footings.
Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018
KR
Andreas
1 Like
@shashank.baganeACM try this:
footing = FilteredElementCollector(doc).OfClass(FamilyInstance).
OfCategory(BuiltInCategory.OST_StructuralFoundation).
WhereElementIsNotElementType().ToElements()
1 Like
import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]
TransactionManager.Instance.EnsureInTransaction(doc)
# Get foundation
footing = FilteredElementCollector(doc).OfClass(FamilyInstance).OfCategory(BuiltInCategory.OST_StructuralFoundation).WhereElementIsNotElementType().ToElements()
footype = footing.GetType
TransactionManager.Instance.TransactionTaskDone()
OUT = footype, footing
hmmm…
@Draxl_Andreas It works for me.
footings = FilteredElementCollector(doc).OfClass(FamilyInstance).OfCategory(BuiltInCategory.OST_StructuralFoundation).WhereElementIsNotElementType().ToElements()
OUT = footings
2 Likes
Hi @tradelie it works only if a single should be (instance) should be present in the active view. But if I want the loaded families(isolated footings) then ?
Let’s imagine I have not placed any of the footings (instances) in the active view. the how to get the loaded footings ?
@shashank.baganeACM if you want the family types, you can use the family symbol instead and where elements are types:
footing = FilteredElementCollector(doc).OfClass(FamilySymbol).
OfCategory(BuiltInCategory.OST_StructuralFoundation).
WhereElementIsElementType().ToElements()
2 Likes
Thanks Man @Elie.Trad It worked. So to get types we need to use familysymbol.
Thanks alot. I appreciate that.
1 Like