def mike1d_quantities(): """ Returns all predefined Mike1D quantities. Useful for knowing what quantity string to query. """ return [ quantity for quantity in Enum.GetNames(clr.GetClrType(PredefinedQuantity)) ]
import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import BuiltInParameter from System import Enum key = 'FAMILY_HOSTING_BEHAVIOR' names = Enum.GetNames(BuiltInParameter) values = Enum.GetValues(BuiltInParameter) bip_dict = dict(zip(names, values)) # Returns a BuiltInParameter given its name (key) bip = bip_dict[key] # For above solution # See: https://forum.dynamobim.com/t/setting-built-in-parameter-by-using-a-variable-value/49466 # Get the Plumbing Fixtures from the model. pfs = (FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_PlumbingFixtures) .WhereElementIsNotElementType() .ToList() ) # Loop through them and check the BuiltInParameter for Hosting Behaviour # Looking for Floor Hosted families only i = 0 for pf in pfs: i += 1
class ConsoleColorMgr(object): def __init__(self, foreground=None, background=None): self.foreground = foreground self.background = background def __enter__(self): self._tempFG = _Console.ForegroundColor self._tempBG = _Console.BackgroundColor if self.foreground: _Console.ForegroundColor = self.foreground if self.background: _Console.BackgroundColor = self.background def __exit__(self, t, v, tr): _Console.ForegroundColor = self._tempFG _Console.BackgroundColor = self._tempBG import sys _curmodule = sys.modules[__name__] from System import ConsoleColor, Enum for n in Enum.GetNames(ConsoleColor): setattr(_curmodule, n, ConsoleColorMgr(Enum.Parse(ConsoleColor, n))) del ConsoleColor del Enum del sys del _curmodule del n