Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andydandy74 committed Oct 24, 2024
1 parent c6d7ab2 commit dea668a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nodes/3.x/python/Category.Type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
clr.ImportExtensions(Revit.Elements)

def GetCategoryType(cat):
if hasattr(cat, "CategoryType"): return cat.CategoryType.ToString()
if hasattr(cat, "CategoryType"): return System.Enum.GetName(CategoryType, cat.CategoryType)
else: return None

cats = UnwrapElement(IN[0])
Expand Down
10 changes: 3 additions & 7 deletions nodes/3.x/python/Door.Rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
def GetRooms(item, phase):
if hasattr(item, "FromRoom") and str(phase.GetType()) == "Autodesk.Revit.DB.Phase":
exits = 0
# Need to wrap this in try/except for doors/windows that don't exist in the given phase
try:
if item.FromRoom[phase]: exits += 1
if item.ToRoom[phase]: exits += 1
return item.FromRoom[phase], item.ToRoom[phase], exits
except:
return None, None, 0
if item.get_FromRoom(phase): exits += 1
if item.get_ToRoom(phase): exits += 1
return item.get_FromRoom(phase), item.get_ToRoom(phase), exits
else: return None, None, 0

items = UnwrapElement(IN[0])
Expand Down
16 changes: 11 additions & 5 deletions nodes/3.x/python/Room.AtPointInPhase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
points = IN[0]
phase = UnwrapElement(IN[1])
roomlist = list()
for pt in points:
roomlist.append(doc.GetRoomAtPoint(pt.ToXyz(),phase))
OUT = roomlist
inputdoc = UnwrapElement(IN[2])
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.RevitLinkInstance":
doc = inputdoc.GetLinkDocument()
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.Document":
doc = inputdoc
else: doc = None

if isinstance(IN[0], list): OUT = [doc.GetRoomAtPoint(x.ToXyz(),phase) for x in points]
else: OUT = doc.GetRoomAtPoint(points.ToXyz(),phase)
3 changes: 2 additions & 1 deletion nodes/3.x/python/Schema.Properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import clr
import System
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

Expand All @@ -11,7 +12,7 @@

def SchemaProperties(schema):
if hasattr(schema, "SchemaName"):
return schema.SchemaName, schema.VendorId, schema.GUID, schema.Documentation, schema.ApplicationGUID, str(schema.ReadAccessLevel), str(schema.WriteAccessLevel)
return schema.SchemaName, schema.VendorId, schema.GUID, schema.Documentation, schema.ApplicationGUID, System.Enum.GetName(ExtensibleStorage.AccessLevel, schema.ReadAccessLevel), System.Enum.GetName(ExtensibleStorage.AccessLevel, schema.WriteAccessLevel)
else: return None, None, None, None, None, None, None

if isinstance(IN[0], list): OUT = map(list, zip(*[SchemaProperties(x) for x in schemas]))
Expand Down

0 comments on commit dea668a

Please sign in to comment.