BIM World
A Professional BIM Learning Platform


Transforming Family Dynamics Through Dynamo Change

As of Dynamo version 1.3.3, there are no built-in nodes available to change the family type directly. To address this, a Python node was created specifically to change the family type of elements.

The approach is straightforward: it uses the Revit API’s Element.ChangeTypeId() method to update the element’s type. Additionally, a custom function was implemented to ensure that the output data structure matches the input structure, maintaining consistency.

Here is the core Python code:

object = UnwrapElement(IN[0])
type = UnwrapElement(IN[1])

def ChangeType(obj):
    TransactionManager.Instance.EnsureInTransaction(doc)
    if isinstance(obj, Element):
        obj.ChangeTypeId(type.Id)
        r = obj
    else:
        r = []
        for e in obj:
            if isinstance(e, Element):
                e.ChangeTypeId(type.Id)
                r.append(e)
            else:
                r.append(ChangeType(e))
    TransactionManager.Instance.TransactionTaskDone()
    return r

OUT = ChangeType(object)
xuebim
Follow the latest BIM developments in the architecture industry, explore innovative building technologies, and discover cutting-edge industry insights.
← Scan with WeChat
Like(0) 打赏
BIM WORLD » Transforming Family Dynamics Through Dynamo Change

Comment Get first!

Must log in before commenting!

 

BIM World, A Professional BIM Learning Platform

Stay updated on the latest architecture trends and share new building technologies.

Contact UsAbout Us

觉得文章有用就打赏一下小编吧

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

Account Login

By signing in, you agree toUser Agreement

Sign Up