0:02 hi everybody Welcome to the third lesson
0:05 of learn rid API course in the previous
0:07 lesson we've created our own custom par
0:09 extension and now I want to go over it
0:11 and explain you the basics and all the
0:13 free resources that you got with my
0:15 starter kit there's really a lot of them
0:17 and they will be very beneficial to any
0:20 ravit API developer and now let's just
0:22 dive straight into this and have a look
0:24 right here I have my learn R API
0:26 extension open which I've just created
0:27 and you can see a bunch of different
0:30 buttons first of all you get your about
0:31 page where I'm going to congratulate you
0:34 on creating your own P RIT extension and
0:35 this is where you can leave a
0:38 testimonial for the starter G then in
0:40 here you will find the resources and
0:41 then you have different placeholders and
0:43 Dev panel we're going to get to this in
0:44 a moment first I want to focus on
0:46 resources because I believe this is
0:49 where the True Value comes from first of
0:51 all I provided here a lot of links to
0:52 all the common documentation that you
0:54 need you'll be able to find here par RIT
0:56 developer documentation ravit API
0:58 documentation ravit developers guide
1:00 from Autodesk and this is actually a
1:02 very interesting guide it's going to be
1:04 for the C users but still you can take
1:06 any c code and translate it to python
1:09 which chbt but in here I found that it's
1:10 actually very good for the advanced
1:12 topics and for example if I'm going to
1:14 have a look here and maybe let's say
1:16 that I click here on Dynamic model
1:19 updator there is a updator and you find
1:20 a lot of different information code
1:22 samples and so on it just depends on
1:24 what kind of topic you want to learn
1:26 from then in here you find links to my
1:27 ebooks there's going to be beginner's
1:29 guide to ravit API and filtered element
1:31 collector guide how to master getting
1:32 your elements where you're going to find
1:34 a lot of cold Snippets and
1:36 explanations then you're going to find
1:38 here templates this is a template form
1:40 Dynamo primer and it's for python notes
1:42 in Dynamo and then here is the py
1:45 template and py minimum template this
1:46 one is exaggerated version because
1:48 there's going to be literally everything
1:49 there's going to be a lot of comments
1:51 and so on and this is more like for
1:53 Education purpose but in reality you
1:55 would mostly use this pyate minimum
1:58 version where you get a few regular
2:00 Imports a few variables and then you you
2:01 just can start coding this is what I
2:03 would normally copy and paste into new
2:05 buttons and start creating tools but
2:06 we're going to cover it in one of the
2:08 next lessons where I'm going to explain
2:09 you par
2:11 Anatomy now we're going to go to more
2:12 interesting things now we're going to
2:14 look at the resources in here you will
2:17 find different links to the forums SDK
2:19 stabs also link to my website to the
2:21 free lessons which you already watch
2:22 it's going to be this first module of
2:24 the course and then in here you're going
2:28 to find Autodesk University rid API this
2:29 is just going to take you to Autodesk
2:31 University with a filter for Ravid API
2:33 sessions and you can scroll through and
2:34 see and maybe you're going to find
2:36 something that really interesting to you
2:37 but also keep in mind that many of this
2:39 presentation is going to be quite
2:41 outdated all right now we're moving to
2:43 more interesting resources and I'm going
2:45 to start with the code samples first of
2:46 all you can go to the GitHub and search
2:49 for pyit there is a link right here and
2:50 when you search for pyit you're going to
2:54 find 243 results of other pyit extension
2:56 and it means that you can just scroll in
2:58 here maybe click on other extension and
2:59 have a look inside and you're going to
3:01 find like hundreds if not thousands of
3:03 different code examples for example this
3:05 is extension of my tutorials for YouTube
3:08 and you can find here different examples
3:10 example here's element parameter filter
3:11 how does it work I click here and here's
3:14 the code and another thing if you're
3:16 going to replace this github.com to
3:18 GitHub Dev you're going to open the same
3:20 repository but in the online version of
3:22 Visual Studio code and it's going to be
3:24 much easier for you to navigate and find
3:26 whatever you want from this
3:30 extension now let's close that let's
3:32 have a look more then also in here you
3:34 find learn rate API python Snippets this
3:36 is going to be on my website where I
3:38 just drop a bunch of different Snippets
3:39 I don't have any search implemented yet
3:40 but if you scroll through you're going
3:42 to find lots of different examples
3:44 here's how you create a beam there's
3:46 going to be a code snippet here is how
3:48 to create a room then how to find key
3:50 parameter items how to get crop box and
3:51 so on so on so on you can see there's
3:53 really a lot of them and now we're going
3:54 to have a look at the most valuable part
3:56 of the starter kit and this is the code
3:59 samples I didn't just create you a
4:00 extension with the folder structure also
4:03 included here a lot of code samples
4:04 let's say that you want to know more
4:06 about RAV API selection I'm just going
4:08 to left click on this button and it's
4:10 going to open this file in the py charm
4:12 it's also going to open the folder with
4:14 all my samples and templates right here
4:16 which you can explore but in here you
4:18 find a lot of value for example for the
4:20 selection here's an example how to get
4:22 selected elements how to select elements
4:24 with rectangle how to pick an object how
4:26 to pick multiple objects pick Point pick
4:28 box set selection in RIT UI and so on so
4:30 on so on let's say that you want to
4:32 learn something about parameters I'm
4:34 going to click here on code samples
4:35 parameters here's how to select an
4:37 object to work with then how to get
4:39 instance parameters type parameters how
4:41 to read the values how to get built-in
4:43 parameters shared parameters and all all
4:47 of that and many many more this is where
4:49 the True Value comes I strongly
4:51 recommend you to just explore here and
4:52 have a look inside here is how to select
4:54 different elements how to create a wall
4:57 create line create room text beam field
5:00 region how to copy elements and so on so
5:02 on so on I try to include as much as I
5:05 could but also keep it very beginner
5:07 friendly and then for more intermediate
5:09 users you will also notice that there's
5:12 vpf form sample and custom UI in ravit
5:14 is a big topic but I'm going to make
5:15 like a mini course maybe even the whole
5:18 course soon and here's an example in
5:20 here we can write maybe some text
5:22 examples text one text two then click on
5:25 checkboxes select something here I also
5:28 have it right here we can click on it
5:30 submit and then going to get all of this
5:33 inputs printed out and if you want to
5:35 know how it works you would just come
5:37 here hold alt on your keyboard and click
5:39 on any of these buttons and you're going
5:41 to open the folder where this button is
5:43 located and when you deal with vpf you
5:45 will learn that you need the examl file
5:47 for the front end and then script that
5:49 Pi file for the back end and this is
5:50 going to be a really good example for
5:53 people starting out with a custom UI but
5:55 this is not a beginner friendly topic I
5:58 have to warn you about that all right
5:59 and this is pretty much all about Cod
6:01 examples you'll find here a lot this one
6:03 is also nice translate C in here I try
6:05 to include here's how you do this in C
6:07 here's how you do this in Python but if
6:09 you inside my P course there's going to
6:10 be a whole lesson where I'm going to
6:11 break it down all the differences
6:13 between C and python I think it's going
6:16 to be in the second module lastly this P
6:18 RIT starterkit also includes EF ravit
6:20 API tutorials you can click here it's
6:22 going to also open my custom UI and
6:24 there's going to be linked to my YouTube
6:26 videos and there's quite a lot you can
6:28 find interesting you can find how to
6:31 read RPI documentation RPI resources my
6:33 road map hooks how to automate sections
6:35 and so on so on so on let's just close
6:38 it and that's it about the code samples
6:39 and Rit API
6:41 tutorials and again right here is the
6:43 button to leave a review for the starter
6:45 kit and I hope you're going to like it
6:46 and you're going to share your
6:48 experience on the bottom you also get
6:50 links to my blog my newsletter if you
6:52 want to read something else there's
6:54 really a lot of information that I cover
6:56 about ravit API and here if you scroll
6:57 through you will see for example how to
6:59 purge view templates how to create view
7:01 field filers and just various topics
7:03 that I share in my newsletter we can
7:04 scroll through and you can see there's
7:06 lots of text lots of images cuz I try to
7:08 send this kind of mini tutorials to your
7:10 inbox but this specific case it's
7:12 actually not that many but it was very
7:14 useful to many
7:16 people now let's have a look at the
7:18 placeholder panel and Dev
7:20 panel this is just kind of to show you
7:22 the structure of pabit because if you're
7:24 going to look at this image right here
7:26 py RIT is just all about creating the
7:28 right folder structure and pyit knows
7:31 how to display it so every button in our
7:33 extension in py RIT extension or others
7:35 like EF tools extension it's just based
7:37 on the folder structure and you can hold
7:40 alt and click on any buttons let's say
7:41 that I want to come here to view filters
7:43 and have a look how do I create a
7:45 legend when you're going to click it's
7:47 going to open a folder but sometimes it
7:49 opens the folders in the background but
7:51 I can see it right here I can open it
7:54 scroll through and see how other people
7:56 create their code in this case this is
7:58 not a simple example because there's a
8:00 lot involved there's custom UI and so on
8:01 but you're also going to find a lot of
8:04 simple examples for example let's have a
8:05 look here how do we unhide all elements
8:08 in the active view we're going to open
8:09 this up and you'll see this is a very
8:11 simple tool just going to Grapple
8:13 elements and then create a list and then
8:16 unhide it very simple for any beginner
8:17 but what it means for your extension is
8:20 that it's very easy to modify let's just
8:21 hold out and click on one of these
8:23 buttons and you'll see that we're going
8:25 to open the folder then when I'm going
8:27 to go outside to the dev panel for
8:28 example you'll notice I have my Dev
8:31 button one two three and same is here I
8:32 have my Dev panel and then there is
8:34 button one two and three when I'm going
8:36 to go out to the tab it refers to learn
8:39 R API Tab and in here I have all the
8:41 panels my about panel which you can see
8:44 right here then the resources panel
8:45 which I can see right here then
8:47 placeholder panel which is this one and
8:49 so on so it's very easy to understand
8:51 how everything is working by looking at
8:53 the folder structure which you have here
8:54 and then see what do you actually get
8:57 inside of ravit for example I can see
8:59 right here is my push button my URL
9:01 button which is this one and this one
9:03 then they have this kind of Stack menu
9:04 where we can place three different items
9:06 and it's going to be this stack example
9:08 and after that we have our pull down
9:10 example we can also put the pull down
9:11 menus inside of the stacks so we can put
9:14 even more tools it's very simple and
9:16 occasionally you also going to see the
9:18 bundle. yaml file inside of this file
9:20 you will see that we can control the
9:22 layout of our extension if you want to
9:25 change the order of things because for
9:26 example you can see that in here I have
9:28 a bunch of different folders and this is
9:30 how they look but in here I want to make
9:32 sure that the push button is the first
9:34 one then we have URL button then we have
9:35 the stack panel and then we have pull
9:38 down menu and it follows along all of
9:40 this and now if you would want to create
9:42 new buttons you would just come here
9:43 copy one of the push buttons for example
9:45 and we would rename it I would call here new
9:47 new
9:49 button what's important is that you
9:51 leave this that push button in the end
9:53 this is what really matters here let's
9:56 open it up I'm going to open the script
9:57 make sure you also rename it here I'm
10:00 going to call it new button inside there
10:02 is my regular template and you'll notice
10:03 that you have to automate your boring
10:05 work here and you need to delete this
10:08 part right here because by default all
10:09 these buttons are made that when you
10:11 click on them it's just going to open
10:13 this menu and say button one was clicked
10:15 and you can hold out and click to open
10:17 the source code of this button I'm going
10:18 to click on this push button it's going
10:20 to say push button was clicked the same
10:22 description and listen I'm going to talk
10:24 about this in just a moment but first I
10:26 just created a copy of my push button
10:29 and I don't see this this because I have
10:30 to go to to py Revit and click right
10:33 here to reload this way py Revit will
10:34 look again at our folder structure and
10:36 sees if there are any changes and if
10:38 there are changes then it's going to add
10:40 buttons or remove them depending on what
10:42 you do so when we're going to go back
10:45 you see that I still have nothing and
10:47 this is correct because again if I'm
10:49 going to go to this folder structure go
10:52 to the panel I have my bundle that yaml
10:54 file right here I need controls what is
10:57 shown and what is not shown so in case
10:58 you use ordering you would need to copy
11:01 the name of your button open the bundle
11:03 and say okay I want to see it in the end
11:05 we don't need that push button here just
11:07 the first part of the name and then save
11:10 it and then it's going to be shown or we
11:12 can delete this bundle yaml completely
11:13 and then it's going to show all the
11:15 buttons inside of it but they going to
11:17 have the same order as they have inside
11:18 of this folder structure so this is
11:20 going to be the first second third and
11:22 so on I'll bring back because I think I
11:25 want to have my own order I'm going to
11:26 reload P RIT again so we can see this
11:29 new button so whenever you're going to
11:31 create new buttons in pyit and you don't
11:33 see them usually there are a few reasons
11:34 first you might have misspelled one of
11:36 these endings because that extension
11:38 that tab that panel that push button
11:40 they have to be all lowercase exactly
11:42 like this and I had people reach out to
11:44 me saying that they did something wrong
11:46 it doesn't show then we notice that that
11:48 that push button had free T instead of
11:51 two for some reason it just happens just
11:53 be aware of that or as I just showed you
11:56 it's because of this bundle. yaml file
11:57 which controls the order and if you
11:59 haven't included your button then you
12:00 know going to see this and now have a
12:03 look right here there is my new button
12:05 so I just duplicated one of the folders
12:08 and I have this new button right here
12:09 also as I've mentioned when you click on
12:11 any of these buttons you're going to
12:13 have the same message over and over and
12:14 it's all about reusing the code I'm
12:16 going to explain it in more details in
12:19 one of the next lessons but for now I
12:20 just want to point your attention that
12:21 when you're going to go to learn rate
12:24 api. extension or however you called
12:26 your extension you're also going to
12:29 notice there's a library folder and
12:31 there is hooks hooks are very special
12:33 things it's like event triggers in py
12:35 rit in there you can subscribe to
12:36 certain events and then you can trigger
12:39 some code for example in here I left the
12:41 code but if I'm going to comment out all
12:44 of that and then reload py RIT then this
12:46 hook will start working and I'm maybe
12:47 going to explain hooks by the end of
12:49 this course because this is a very
12:50 Advanced topic and I think beginners
12:53 should avoid it at all cost but I going
12:55 to show you that when I'm going to do
12:57 that then I'm going to go to insert Tab
12:59 and click on import cat
13:01 and this is the event that I subscribe
13:03 to and whenever I do this I'm going to
13:05 get this message import CAD is not
13:08 allowed use CAD link instead you can do
13:09 whatever you want in there and also I
13:11 provided here something for the password
13:13 on the users with password can import
13:16 cat honestly I don't remember the
13:18 password it's somewhere here uh it's
13:19 learn ri.com
13:22 so if I would put it here click on okay
13:25 then I would be able to import cats
13:26 again this is not a topic for the
13:28 beginners hooks are really for the
13:29 intermediate and advanced users because
13:31 you have to make your code very
13:33 efficient because it will be executed
13:35 every time event happens in this case
13:37 it's not a problem but if you're going
13:38 to make an event for for example
13:40 checking one of the parameters it's
13:41 going to be executed every time and it
13:44 has to be very efficient that's it about
13:46 Hooks and then library in library
13:47 there's going to be a whole tutorial in
13:49 this first module where I'm going to
13:51 show you how you can reuse your
13:54 code so instead of copy pasting the same
13:56 function I just wrote it once right here
13:58 which is called kid button clicked and
14:00 then in inside all of my new buttons and
14:02 stuff here on the bottom from Snippets
14:04 custom print I import this kit button
14:06 clicked and then I execute it this way I
14:08 have one place where this function is
14:10 located I can update it here and it's
14:11 going to be applied to all the places
14:14 where it's used because you know good
14:16 programmers code but great programmers
14:18 they reuse code and this is why you
14:19 should start reusing your code as soon
14:21 as possible but we're going to have a
14:22 whole lesson about it in a moment don't
14:24 stress it right now all right I hope
14:25 that you get a really good understanding
14:28 about pyit folder structure and how you
14:29 can change anything to to make more
14:31 buttons less buttons and control their
14:33 order we're getting closer to actually
14:36 start coding with RAV API but before
14:37 we're going to do that we need to set up
14:39 your development environment and that's
14:40 what we're going to do in the next
14:41 lesson so you definitely don't want to
14:44 miss it out as well we'll download a few
14:46 ravit plugins we'll install pie charm
14:48 and visual studio code ID and set up R
14:50 API autocomplete so it's much easier for
14:52 you to code and reference the dock
14:54 strings and now I'm going to leave you a
14:56 little homework I want you to go to your
14:58 extension and clean it up remove what
15:00 you don't want maybe you don't want to
15:02 see this learn R API panel then you're
15:04 going to hold out click on it just go
15:06 out to the learn R API panel and delete
15:09 it right then when you go to Revit and
15:11 reload with P Revit it's going to be
15:13 gone so just organize it the way you
15:15 want it maybe prepare some buttons that
15:17 you want and I strongly recommend you to
15:19 leave the dev panel this def panel is
15:21 very often used for unfinished tools
15:23 this is where you create new tools you
15:25 work on them and once they ready you're
15:27 going to move them to any other panel
15:29 and now parit has finished reloading and
15:31 you can see this panel is gone and the
15:33 same way you can add more panels remove
15:35 panels and so on so I hope you enjoyed
15:37 this lesson and I want to wish you happy
15:38 coding and I'll see you in the next
15:40 lesson where we're going to set up your