Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Nov 17, 2022
1 parent 8edce2e commit e9fde94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
14 changes: 7 additions & 7 deletions revitron/__init__.py
Expand Up @@ -147,10 +147,10 @@ def _(element):
Returns:
mixed: A Revitron element instance
"""
category = Element(element).getParameter('Category').getValueString()

switcher = {'RVT Links': LinkRvt, 'Rooms': Room}

wrapper = switcher.get(category, Element)

return wrapper(element)
try:
category = Element(element).getParameter('Category').getValueString()
switcher = {'RVT Links': LinkRvt, 'Rooms': Room}
wrapper = switcher.get(category, Element)
return wrapper(element)
except:
return Element(element)
14 changes: 8 additions & 6 deletions revitron/create.py
Expand Up @@ -78,7 +78,7 @@ def familyExtrusion(
return extrusion

@staticmethod
def familyInstance(familySymbolId, location, structuralType=False):
def familyInstance(familySymbolId, location, structuralType=False, view=None):
"""
Creates a new family instance.
Expand All @@ -92,20 +92,22 @@ def familyInstance(familySymbolId, location, structuralType=False):
familySymbolId (object): A Revit API family symbol ID.
location (object): A Revit API ``XYZ`` point.
structuralType (object, optional): A Revit API structural type of False for ``NonStructural``. Defaults to False.
view (object, optional): A Revit view, Defaults to None. Note that ``structuralType`` and ``view`` can not be used together.
Returns:
object: The family instance.
"""
import revitron
from revitron import _
if not structuralType:
structuralType = revitron.DB.Structure.StructuralType.NonStructural
create = revitron.DOC.Create.NewFamilyInstance
familySymbol = _(familySymbolId).element
if not familySymbol.IsActive:
familySymbol.Activate()
return revitron.DOC.Create.NewFamilyInstance(
location, familySymbol, structuralType
)
if view:
return create(location, familySymbol, view)
if not structuralType:
structuralType = revitron.DB.Structure.StructuralType.NonStructural
return create(location, familySymbol, structuralType)

@staticmethod
def GridLineLinear(start, end, name):
Expand Down

0 comments on commit e9fde94

Please sign in to comment.