Hi All,
Just a WIP incase anyone has a free Sunday and fancies a play with it! Otherwise I’ll get back on it on Monday…
Following the amazing work here:
I want a graph which will create individual dimensions (so I can check them against brick dimensions) and automatically create the dimension location lines.
So far I’ve got here… It’s nearly there, but rather than create a dim per ‘reference’ it’s creating a dim per line… It’s also doing something weird with the view… The created dims are in Revit but not appearing until I change their type.
Any assistance appreciated!
Cheers,
Mark
auto dim walls-14.dyn (38.9 KB)
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#create a for loop to go through every index
b = IN[0]
elements = IN[1]
dim = 0
a = []
for x in range (0, len(b)):
line = UnwrapElement(b[x]).GeometryCurve
elementsRef = ReferenceArray()
opt = Options()
opt.ComputeReferences = True
opt.IncludeNonVisibleObjects = True
opt.View = doc.ActiveView
for element in elements:
elementsRef.Append(element)
TransactionManager.Instance.EnsureInTransaction(doc)
dim = doc.Create.NewDimension(doc.ActiveView, line, elementsRef).ToDSType(True)
TransactionManager.Instance.TransactionTaskDone()
d = dim
a.extend ([d])
OUT = a