Insert Legend in sheet


#41

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?


#42

Hi @PR_matthew.terry,

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


#43

Does anyone have a workflow for getting the XY of a legend placed on a sheet?


#44

A legend is categorized as a schedule.

schedule = UnwrapElement(IN[0])
point = schedule.Point

#45

Hi @Architecture_Faster,

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…

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. :wink:


#46

got it thanks


#47

@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.


#48

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). :slight_smile:

Cheers,
Dan


#49

Weird, I could not get the viewport of my legends earlier. Thanks @Daniel_Woodcock1 for clearing this up!


#51

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 :slight_smile:


#52

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


#53

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?


#54

Hello,

You can find attached our workflow, which we created with all of your helpful comments.


But we have the same issue as @simvas had. Dynamo automatically place every legend using the coordinates we are giving as the legend center coordinates.
Capture2
We are trying to insert some node so Dynamo can understand that the given coordinates are from the upper left corner from the legend (where the title is), but we can’t find such packages.

Thanks in advance!


#55

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,


#56

Hi Dan,
I was testing your definition and it’s okay…
is there a way of choosing the viewport type from the beginning?