Creating area boundaries from floor boundaries

Hello everybody,

I’m getting the boundaries of the floors using a Springs Node:

image

But the problem I have is creating the area boundaries, because it says “expected Curve, got Line”. In principle I’m getting curves… Anyway I’m trying to convert the Lines to Curves but the different solutions I found in the forum don’t work in my script made with python (I’m using Revit 2019). This is my code:

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

view = uidoc.ActiveGraphicalView
test = []

linesList = UnwrapElement(IN[0])
lines = [item for sublist in linesList for subsublist in sublist for item in subsublist]

TransactionManager.Instance.EnsureInTransaction(doc)

levelView = view.GenLevel
plane = SketchPlane.Create(doc, levelView.Id)

for line in lines:
	areaBoundary = doc.Create.NewAreaBoundaryLine(plane, line, view)
	test.append(areaBoundary)

TransactionManager.Instance.TransactionTaskDone()

OUT = lines

Any idea? Thanks in advance.

Now I’m trying to create Curves from those (supposed) Lines and I get the following error: ‘Line’ object has no attribute ‘GetEndPoint’. That’s not true:

https://www.revitapidocs.com/2019/154b23e2-9f1f-813b-df56-e7c1bb347711.htm

I’m completely lost this time… The “curves” from Springs Node are not curves, are not lines… what are they?

You are using a Revit API method to create the boundary. And from Dynamo you are getting Dynamo objects, not Revit API objects (they are different).

You have to convert them. Probably by using line.ToRevitType() method.

Note that you should also import conversions module:

import clr

clr.AddReference("RevitNodes")
import Revit

# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
1 Like

Thanks a lot! line.ToRevitType() was the solution. I don’t use revit nodes since a few months ago for avoiding problems between versions so usually I write the full code in python and I forgot it (I’m silly): You are using a Revit API method to create the boundary. And from Dynamo you are getting Dynamo objects, not Revit API objects (they are different).

Thanks again!