Message 1 of 6
Python documentation and preferred way for setting/getting the Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm new to this forum, Revit and Revit API. I've seen that there are equivalent ways to perform operations, thus, this situation is giving me some doubts regarding the design of code.
For example, when using Python, the following approaches to get the family type are equivalent:
elem = doc.GetElement(DB.ElementId(ids[0]))
ftype_id = elem.GetTypeId()
family_type = doc.GetElement(ftype_id)
family_type = elem.Symbol
And for setting the type,
elem.Symbol = doc.GetElement(ftype_id)
elem.ChangeTypeId(ftype_id) # TypeError: No method matches given arguments for ChangeTypeId
I've been looking at https://www.revitapidocs.com/2024/7f875907-d138-999a-a8fb-83717ed07680.htm and https://www.revitapidocs.com/2023/c2c4b46d-52f4-2b1d-ce33-433fd0905d81.htm.
The symbol property seems to be deprecated, but it works. However, Get/ChangeTypeId seems to be the preferred way but it's not working.
I want to develop clean code with a stable version and long term support. Any help will be appreciated.