revitpythonshell provides 2 similar methods load family.
loadfamily(self: document, filename:str) -> (bool, family) loadfamily(self: document, filename:str) -> bool so seems return values different. have tried calling in several different ways:
(success, newfamily) = doc.loadfamily(path) success, newfamily = doc.loadfamily(path) o = doc.loadfamily(path) but bool back. want family too.
you can @ overload looking this:
import clr family = clr.reference[family]() # family object reference (not set instance of object!) success = doc.loadfamily(path, family) # explicitly choose overload # family revit family object , can used wish this works creating object reference pass function , method overload resultion thingy knows 1 for.
working under assumption list of overloads shown in rps same order appear - think pretty safe assumption make, can this:
success, family = doc.loadfamily.overloads.functions[0](path) and will, indeed, return tuple (bool, autodesk.revit.db.family).
note, has happen inside transaction, complete example might be:
t = transaction(doc, 'loadfamily') t.start() try: success, family = doc.loadfamily.overloads.functions[0](path) # stuff family t.commit() except: t.rollback()
Comments
Post a Comment