Hi everybody
I’m working on a function for duplicate wall and flip it. But I have one problem with corners. When I run the function the walls dont join. Curiosly, the same function, but writting on c sharp works perfectly. Any suggestions? I share the code and one Photo.
Regards
#Imports
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
t= Transaction(doc, "Copy Wall")
#Select elements from revit.
multi_sel = [doc.GetElement(x) for x in uidoc.Selection.GetElementIds()]
#Get Wall/s
walls = list()
if isinstance(multi_sel, list):
walls = multi_sel
else:
walls.append(multi_sel)
#Append new walls here.
new_walls = list()
ids = list()
wall_types = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements()
#Start Transaction
t.Start()
for wall in walls:
#For copy Walls.
direction = XYZ(0,0,0)
id = ElementTransformUtils.CopyElement(doc,wall.Id,direction)
new_wall = doc.GetElement(id[0])
new_wall.Flip()
new_walls.append(wall)
wall_wallType = new_wall.WallType
walltype_finish= wall_wallType.LookupParameter("Description").AsString()
#For get WallType Finish
for w in wall_types:
type_name = w.LookupParameter("Type Name").AsString()
if walltype_finish == type_name:
new_wall.WallType = w
t.Commit()