Hello all,
I want to create a solid from a revit profile (it is just a rectangle). Every time that I run the script after the node ‘BoundingBox.ToCuboid’ Dynamo crashes.
The python script that I use in order to get the curves from the revit profile is the following :
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
Import ToDSType(bool) extension method
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
Import DocumentManager and TransactionManager
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
type = UnwrapElement(IN[0].Family.Name)
name = UnwrapElement(IN[0].Name)
family = UnwrapElement(IN[0]).Family
TransactionManager.Instance.ForceCloseTransaction()
famDoc = doc.EditFamily(family)
famCollector = FilteredElementCollector(famDoc)
sketch = famCollector.OfClass(Sketch)
for i in sketch:
cArray = list(i.Profile)
cArray[:] = [[Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(y, True ) for y in x] for x in cArray]
OUT = cArray
Any idea?
Thank you!