Daniel,
I am trying to use your node to place different schedules/legends in different locations on different sheets all at once based on our company’s standard sheet layout, but it is not working. Is there something that I am missing?
Daniel,
I am trying to use your node to place different schedules/legends in different locations on different sheets all at once based on our company’s standard sheet layout, but it is not working. Is there something that I am missing?
Apologies for the delay in response, I was on holiday and miles away from technology. From observation I believe the sheets should be a single list rather than a nested list as you currently have it, however, I have also updated the code some and the new updates can be found in this thread…
Place multiple views on multiple sheets by coordinates
This should be able to place pretty much any View Type and you can visualise them pre-placement (if you want).
Let me know how you get on.
Cheers,
Dan
Does anyone have a workflow for getting the XY of a legend placed on a sheet?
A legend is categorized as a schedule.
schedule = UnwrapElement(IN[0])
point = schedule.Point
I assume you are making a legend copier. Legends on sheet are a viewport element. There are probably a few packages out there that have something like a viewport.centre node. I have one somewhere, but lack a pc right now.
Alternatively, you could do something like this…
https://forum.dynamobim.com/t/viewports-cropbox/10800/3?u=daniel_woodcock1
And get the centre from the polygon, or average the endpoints etc etc…
This however is a question in its own right, so you should really start a new thread.
got it thanks
@Architecture_Faster
Schedules and legends don’t actually have viewports, at least none that I could find. The code I posted above is a quick and easy way to get their location on a sheet.
Hi @Nick_Boyts,
Schedules on sheet are part of the ScheduleSheetInstance class, whereas, Legends are viewport based View Elements. So, you are correct in what you say with Schedules, but not with Legends. Observe the following…
ViewPort.GetBoxCenter (Py)
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]
vps = tolist(UnwrapElement(IN[0]))
outList = []
for vp in vps:
outList.append(vp.GetBoxCenter().ToPoint())
OUT = outList
ScheduleSheetInstance.Point (Py)
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]
vps = tolist(UnwrapElement(IN[0]))
outList = []
for vp in vps:
outList.append(vp.Point.ToPoint())
OUT = outList
Legends however, as with drafting views, do not have a crop region like most other view type Elements. But both are viewport based when on sheet which means we can treat them like any other view type when placed on sheet (except for schedules and keynotes).
Cheers,
Dan
Weird, I could not get the viewport of my legends earlier. Thanks @Daniel_Woodcock1 for clearing this up!
Hi everyone. I´m new in Dynamo, i need to know te coordinates of the legend. I need to place it on a specific place on my sheet but i don´t know wich number i should put on the coordinates. I hope someone could help me.
Bless from México. Tank u
Hi @AntonioRojasR,
You can do this by do the placing one where you want on a sheet and using the Viewport.GetBoxCentre (Py) code supplied in this post above…
Just copy the pyrhon code into a fresh and clean python node and plug in your legend viewport.
Or you can use the place multiple views on sheet node found in this thread and use sliders to place one where you want it.
Hope this helps.
Cheers,
Dan
Hi, got this to work for a selected range of sheets by sheet number. Just curious why i get so many failed sheets? Is there a better format i should have?
Hello,
You can find attached our workflow, which we created with all of your helpful comments.
Thanks in advance!
Hi,
I am new to dynamo,
do you think I can use the same way to add family to sheet?
I have the following script copied:
import clr
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIDocument
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
dataEnteringNode = IN
family = UnwrapElement(IN[0])
sheets = IN[1]
loc = XYZ(IN[2].X, IN[2].Y, IN[2].Z)
viewports =
failed =
for vs in sheets:
sheet = UnwrapElement(vs)
canAddToSht = canAddToSht = Viewport.CanAddViewToSheet(doc, sheet.Id, family.Id)
if canAddToSht:
try:
TransactionManager.Instance.EnsureInTransaction(doc)
viewport = Viewport.Create(doc, sheet.Id, family.Id, loc)
TransactionManager.Instance.TransactionTaskDone()
viewports.Add([viewport,sheet])
except:
failed.Add([“Failed”,sheet])
else:
failed.Add([“Failed”,sheet])
OUT = [viewports, failed]
Unfortunately it didn’t do what I was looking for.
here is a screenshot of what I got,
Hi Dan,
I was testing your definition and it’s okay…
is there a way of choosing the viewport type from the beginning?
That error looks like you aren’t iterating over the list to get single instances. Would you post the code in the node? Also, may have been better to create a new post since this one is set eral years old.
Also, see this topic for reference. Schedule location is different than Legend location.
It is your lists. You are tring to place multiple Schedules on one sheet and most likely the Place Views On Sheet node isn’t set up to do that. Test it with one schedule and see if that works. If so, you may need to rework the node or do them one by one.
Thanks Sean, going to try the legend placer.