welcome to creating a sheet in dynamo
using Python I've transitioned from
using the IDE from dynamo to using the
community version of visual Studios 2017
so the first thing we want to do is we
want to import the CLR and go ahead and
add our reference to the node and then
we want to import Revit the next part we
want to do here is bring in the
extension and bring all of the elements
that rabbit has we'll go ahead and add
another reference here and we'll import
the Revit service services which is the
document and we'll go ahead and import
rabbit services from the reference and
the next thing what we'll do is we'll
add the API and from Autodesk Revit and
we'll get the database and we'll import
star which means everything from
Autodesk and the very last thing is
we'll grab our systems from the Revit
service we want to get the persistent
and we want to import the document
manager and we also want to get the
Revit service transaction and we want to
import the transaction manager the next
thing we want to do is get the document
through document services which we got
through the document manager and we'll
go ahead and get the document it is the
instance of the current database
document and we'll send it to the do see
or the doc and this is what will be in
our node so we'll get an in and the
first end will be a zero
it'll be our sheet name we'll get a
second thing coming in and the second
item will be a one and that'll be easy
sheet number the next thing we'll do is
we'll get the family type which is an
element and we'll have to unwrap it in
order for your Python to do something
with it so we'll type in unwrap the
element and then inside the unwrap we
will put in the what's coming in which
will be e the second thing in our list
or the second thing in the Python script
we'll go ahead and create an empty sheet
list from a list and
we'll start our handshake with the Revit
to tell it what we want it to do which
is our transaction so we'll go into
transaction manager we'll get an
instance will ensure the instance and
then we'll send in our current document
so here's where we actually do the
action that we want so for every number
which will be the index number in the
range of the length so this is going to
iterate over our our list of sheet
numbers so we're iterating over and
we're grabbing the index number and then
we'll go ahead and get a new sheet and
we'll create a view she which is
actually the sheet itself and then we'll
create and we'll send it into this
current document we'll get the title
block and we need it the it needs an
element ID so it's a title block element
ID now the new sheet can actually get
its name
and we'll get the index number of the
first sheet name in the list that was
sent in from Dinamo same with the sheet
number we will get the first sheet
number from the index and then move to
the next one until it hits the length of
the user input of the sheet numbers in
that range
so I'll pend the list that I have and
add the new sheet to send out to through
my tiny Monod in case I want to do
additional thanks to the sheet the very
last thing that we need to do is close
off our transaction manager and we'll go
ahead and send the instance and then
we'll say that the transaction task is
done then we'll go ahead and send out
the sheet that we just generated in case
we'd like to add additional parameters
or do something else in dynamo I know
there's a note for this exact same
function in dynamo but it's important
for us who we're trying to learn to
understand how the API functions with
the Dynamo so I just copy and paste that
there I have my two lists my family type
and I go ahead and run it and generate
my two sheets anyways that's creating a
sheet with dynamo Python thank you for
watching