Hello all!
So I am working on a Python script to batch create wall, floor, roof (etc) types in Revit. As I understand the simplest way (only way?) to create new types is to duplicate existing types and changing their parameters.
But I am stuck on the first step. I can seem to duplicate a wall type.
I get the error:
AttributeError: ‘WallType’ object has no attribute ‘Duplicate’
Python code:
import clr
# Import RevitAPI Classes
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
doc = DocumentManager.Instance.CurrentDBDocument
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits
# Place your code below this line
basicwall = IN[0]
new_type = []
TransactionManager.Instance.EnsureInTransaction(doc)
new_type = basicwall.Duplicate("TEST")
TransactionManager.Instance.TransactionTaskDone()
# Assign your output to the OUT variable.
OUT = new_type