Hi! Im trying to create lenear dimension. But script fails to get reference from boundary of FilledRegion. Need some help, please:)
import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
import Autodeskimport clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)clr.AddReference(‘System’)
from System.Collections.Generic import Listclr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *def perpline(x):
p0 = XYZ(x,1,0)
p1 = XYZ(0,1,0)
ln = Autodesk.Revit.DB.Line.CreateUnbound(p0,p1)
return lndef lines(HP):
linesArray = ReferenceArray()
for n, l in enumerate(HP.GetBoundaries()[0]):
if n == 0:
linesArray.Append(l.Reference)
if n == 2:
linesArray.Append(l.Reference)
return linesArray
t =FR = UnwrapElement(IN[0])
doc = DocumentManager.Instance.CurrentDBDocumentTransactionManager.Instance.EnsureInTransaction(doc)
Perp = perpline(10)
View = doc.ActiveView
linesArray = lines(FR)dim = doc.Create.NewDimension(View, Perp, linesArray)
TransactionManager.Instance.TransactionTaskDone()
OUT = dim