I have found this great topic on automatic dimensioning in Dynamo, see: Quick Dimension Question.
I am trying to use the script provided by @Einar_Raknes in post 5, and @truevis in post 14/16, which, given a detail line, places a dimension on the given detail line.
So far it works really well when I provide 1 detail line at a time. BUT I cant get it to work on multiple detail lines…
I have tried chopping up the list of detail lines into sublists but to no effect.
Can anyone think of a way to get this workflow working on multiple detail lines at once?
I suspect that it has to do with the python script build, but to me this is still a bit too much to grasp.
Have you tried setting the lacing of the custom node that you created to Longest?
Otherwise you could use a for loop in Python:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
if isinstance(IN[0], list):
lines = []
for i in IN[0]:
lines.append(UnwrapElement(i))
else:
lines = [UnwrapElement(IN[0])]
crvs = []
for line in lines:
crvs.append(line.GeometryCurve)
TransactionManager.Instance.EnsureInTransaction(doc)
for crv in crvs:
ref = ReferenceArray()
ref.Append(crv.GetEndPointReference(0))
ref.Append(crv.GetEndPointReference(1))
dim = doc.Create.NewDimension(doc.ActiveView, crv, ref)
TransactionManager.Instance.TransactionTaskDone()
OUT = dim
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
if isinstance(IN[0], list):
lines = []
for i in IN[0]:
lines.append(UnwrapElement(i))
else:
lines = [UnwrapElement(IN[0])]
crvs = []
for line in lines:
crvs.append(line.GeometryCurve)
if isinstance(IN[1], list):
linea = []
for i in IN[1]:
linea.append(UnwrapElement(i).ToRevitType())
else:
linea = [UnwrapElement(IN[1]).ToRevitType()]
TransactionManager.Instance.EnsureInTransaction(doc)
for i in range (0,len(linea)):
ref = ReferenceArray()
ref.Append(crvs[i].GetEndPointReference(0))
ref.Append(crvs[i].GetEndPointReference(1))
dim = doc.Create.NewDimension(doc.ActiveView, linea[i], ref)
TransactionManager.Instance.TransactionTaskDone()
OUT = linea
Thank you all very much for your replies! Sadly I didn’t find the time yet to continue on this great quest deadlines at the office, you know the drill. But again, very grateful for the help and I’ll surely come back on it.
@Giovanni_Brogiolo
Very thank you you have well well! my life would like to ask you about the solution to make dim from lines in a family detail line.Please see Picture!
The line in IN[0] is where the dimension will be drawn (I used the lines end points + 500mm offset) while the lines in IN[1] are the dimension references.
In order to convert a line (or a grid line) to a reference we need to extract its geometry first (line 27) and then store its reference in a ReferenceArray() (line 18).
The NewDimension method is going to change the Revit project so it must be included in a Transaction.
Please note the code will work also with structural framings as you can extract a Reference from them too.
@Giovanni_Brogiolo Very thanks for your reply soon
The thing I want is not the Grid but the lines in it (Line in family detail line)
I created this family for cutting steel beams!
And I hope to be able to dim it
Please see .rvt Test Dim family detail line.rvt (2.0 MB)
Hi @Yna_Db
Since there are many topics, but still not resolved, so I think here people are ideas so I want to ask, it also does not diferen this topic
Thanks
I think this is just due to users not properly following up with the solution to their posts, as I certainly have seen solutions to this before… As seen here, one of the users on this thread above you created a new post and found a solution: Get DetailCurve From detail line family - #6 by awilliams
Dimensioning rebar is an entirely different topic than dimensioning detail lines, so this is a different topic. Follow @Yna_Db 's suggestion and create a new post! Many people are very willing to help