Dear members,
I’ve been having a problem with NewRoom() and NewArea() methods, although I’m being able to find the location points from a surface in Dynamo, and I’m converting the point to a Revit XYZ, selecting the X and the Y coordinate to create a new UV(x, y) coordinate doesn`t work because it says it is called with a <class ‘float’> and not as stated in the constructor with UV(double, double). this is my code:
# Load the Python Standard and DesignScript Libraries
import clr
import struct
import cmath
clr.AddReference('RevitAPI')
#from Autodesk.Revit.DB.Visual
from Autodesk.Revit.DB import *
import Autodesk
from Autodesk.Revit.DB.Architecture import*
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
#from Autodesk.Revit.Utility
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import*
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
# The inputs to this node will be stored as a list in the IN variables.
phase = UnwrapElement(IN[0])
surf = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])
room = UnwrapElement(IN[3])
boundingBoxes = UnwrapElement(IN[4])
out = []
uvs = []
# Place your code below this line
loc = room.Location.Point
out.append(type(loc))
out.append(loc.X)
out.append(loc.Y)
#uvRevit = UV(loc.X, loc.Y)
TransactionManager.Instance.EnsureInTransaction(doc)
#newRoom = doc.Create.NewRoom(phase)
for i in range(len(surf)):
bb = surf[i].get_BoundingBox()
#bbDyn = ByGeometry(surf[i])
bbRevit = bb.ToRevitType()
max = bbRevit.Max
min = bbRevit.Min
#bounds = bbRevit.Bounds
pt = Surface.PointAtParameter(surf[i], 0.5, 0.5) #point in dynamo
uv = Surface.UVParameterAtPoint(surf[i], pt) #uv in dynamo
out.append(max)
out.append(min)
xyz = pt.ToRevitType() #convert to XYZ in Revit
out.append(xyz)
out.append(type(xyz.X))
uvRevit = UV(xyz.X, xyz.Y)
newRoom = doc.Create.NewRoom(level, uv)
out.append(newRoom)
TransactionManager.Instance.TransactionTaskDone()
# Assign your output to the OUT variable.
OUT = out
I’ll appreciate very much your help,
Paula