Convert Model Lines to Detail lines

python
dynamo
api

#1

Hi All,

I’m trying to convert model lines to detail lines using the following method:

image

http://www.revitapidocs.com/2017/5566ffcf-1724-589b-15a1-6e829a986ec2.htm

image

I found this topic:

I get this error:

this is the code:

import clr

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

ModelLines=UnwrapElement(IN[0])
CurrentView=UnwrapElement(IN[1])

dl = CurveArray()

for ml in ModelLines:
    dl.Append(ml.GeometryCurve)
    
TransactionManager.Instance.EnsureInTransaction(doc)

CurveArray = [ModelCurveArray](ModelCurveArray() ) #line 26

DetailLines = Autodesk.Revit.DB.Document.ConvertModelToDetailCurves(doc,CurrentView,CurveArray)

TransactionManager.Instance.TransactionTaskDone()

OUT = DetailLines

#2

Hi @salvatoredragotta

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
 
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

 
array = ModelCurveArray()

inn=IN[0]
if not isinstance(IN[0], list):
    inn=[]
    inn.append(IN[0])
for i in inn:
    array.Append(UnwrapElement(i))
view=UnwrapElement(IN[1])
 
TransactionManager.Instance.EnsureInTransaction(doc)
DetailLines = doc.ConvertModelToDetailCurves(view,array)

TransactionManager.Instance.TransactionTaskDone()

OUT = DetailLines

#3

Thanks @Kulkul! That was easier than I thought!