Learn AutoCAD Programming using VB.NET - Hands On! | Arnold H. | Skillshare

Learn AutoCAD Programming using VB.NET - Hands On!

Arnold H., Sr. Software Developer, MCSD, MCAD

Learn AutoCAD Programming using VB.NET - Hands On!

Arnold H., Sr. Software Developer, MCSD, MCAD

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
105 Lessons (11h 58m)
    • 1. Landing Page

      2:04
    • 2. Course Outline

      5:00
    • 3. Section 1 - Course Overview

      0:42
    • 4. Section 1 - Who is this course for?

      0:49
    • 5. Section 1 - What will I learn from this course?

      1:00
    • 6. Section 1 - What is VB.NET?

      1:06
    • 7. Section 1 - What is AutoCAD .NET API?

      0:50
    • 8. Section 1 - What are the advantages of using .NET API?

      1:15
    • 9. Section 1 - Hands On Projects - Overview

      5:57
    • 10. Section 2 - AutoCAD .NET APIs Overview

      0:44
    • 11. Section 2 - Exploring AutoCAD .NET APIs

      1:56
    • 12. Section 2 - .NET API Object Hierarchy

      2:33
    • 13. Section 2 - Exploring Application Object

      2:23
    • 14. Section 2 - Exploring Document Object

      1:36
    • 15. Section 2 - Exploring Database Object

      3:52
    • 16. Section 3 - Topics Overview

      3:51
    • 17. Section 3 - Installing Visual Studio 2019

      5:19
    • 18. Section 3 - Configuring Integrated Development Environment (IDE)

      4:19
    • 19. Section 3 - Creating First Plugin

      11:51
    • 20. Section 3 - ShowAlert Message

      3:40
    • 21. Section 3 - Configuring VS2019 Platform

      9:59
    • 22. Section 4 - Creating AutoCAD Objects Overview

      0:40
    • 23. Section 4 - Creating DrawObjects Project

      4:06
    • 24. Section 4 - Creating DrawLine Method

      14:51
    • 25. Section 4 - Creating DrawMText Method

      11:30
    • 26. Section 4 - Creating DrawCircle Method

      9:22
    • 27. Section 4 - Creating DrawArc Method

      6:34
    • 28. Section 4 - Creating DrawPline Method

      8:14
    • 29. Section 4 - Creating DrawCirclesVert Method

      8:34
    • 30. Section 4 - Creating DrawCirclesHor Method

      5:24
    • 31. Section 5 - Manipulating AutocAD Objects Overview

      1:15
    • 32. Section 5 - Creating the Project

      4:17
    • 33. Section 5 - Creating Singlecopy Method

      13:12
    • 34. Section 5 - Creating Multiplecopy Method

      11:17
    • 35. Section 6 - Creating Eraseobject Method

      12:14
    • 36. Section 5 - Creating Moveobject Method

      6:56
    • 37. Section 5 - Creating Mirrorobject Method

      9:31
    • 38. Section 5 - Creating Rotateobject Method

      6:58
    • 39. Section 5 - Creating Scaleobject Method

      4:59
    • 40. Section 5 - Creating Offsetobject Method

      4:51
    • 41. Section 6 - Object Dictionaries Overview

      2:05
    • 42. Section 6 - Create New Project

      5:39
    • 43. Section 6 - Creating ListLayers Method

      10:47
    • 44. Section 6 - Creating CreateLayer Method

      9:41
    • 45. Section 6 - Creating UpdateLayer Method

      12:24
    • 46. Section 6 - Creating LayerOnOff Method

      7:57
    • 47. Section 6 - Creating LayerFrozenThaw Method

      4:16
    • 48. Section 6 - Creating DeleteLayer Method

      4:34
    • 49. Section 6 - Creating LayerLockUnlock Method

      3:41
    • 50. Section 6 - Creating SetLayeToObject Method

      8:06
    • 51. Section 6 - Creating ListineTypes Method

      9:21
    • 52. Section 6 - Creating LoadLineType Method

      7:04
    • 53. Section 6 - Creating SetLinetypeCurrent Method

      5:18
    • 54. Section 6 - Creating DeleteLinetype Method

      8:43
    • 55. Section 6 - Creating SetLinetypeToObject Method

      4:55
    • 56. Section 6 - Textstyle Overview

      0:54
    • 57. Section 6 - Creating ListStyles Method

      8:14
    • 58. Section 6 - Creating UpdateCurrentTextstylefont Method

      11:30
    • 59. Section 6 - Creating SetCurrentTextstyle Method

      8:28
    • 60. Section 6 - Creating SetTextStyleToObject Method

      8:14
    • 61. Section 7 - User Interactions Topic Overview

      1:52
    • 62. Section 7 - Creating the Project

      3:14
    • 63. Section 7 - Creating the GetName Method

      11:14
    • 64. Section 7 - Creating the SetLayer Method

      12:17
    • 65. Section 7 - Creating the CreateLineUsingGetPoint Method

      11:27
    • 66. Section 7 - Creating the CalculateDefinedArea Method

      17:02
    • 67. Section 7 - Creating the DrawObjectsUsingGetkeywords Method

      13:58
    • 68. Section 7 - Creating the GetDistanceBetweenTwoPoints Method

      4:54
    • 69. Section 7 - Creating the CountObjects Method

      14:40
    • 70. Section 8 - Selection Sets Overview

      13:00
    • 71. Section 8 - Creating the Project

      4:34
    • 72. Section 8 - Creating the SelectAllAndChangeLayer Method

      11:45
    • 73. Section 8 - Creating the SelectObjectOnScreen Method

      8:12
    • 74. Section 8 - Creating the SelectWindowAndChangeColor Method

      5:44
    • 75. Section 8 - Creating the SelectCrossingAndDelete Method

      5:19
    • 76. Section8 - Creating the SelectFenceAndChangeLayer Method

      5:54
    • 77. Section 8 - Using the PickFirstSelection

      7:17
    • 78. Section 8 - Creating the SelectLines Method

      12:36
    • 79. Section 8 - Creating the SelectMTexts Method

      4:42
    • 80. Section 8 - Creating the SelectPolyline Method

      4:00
    • 81. Section 8 - Creating the SelectWalls Method

      6:51
    • 82. Section 8 - Creating the SelectStairs Method

      3:16
    • 83. Section 8 - Creating the FrenchDoors Method

      4:08
    • 84. Section 8 - Creating the BifoldDoors Method

      2:34
    • 85. Section 8 - Creating the Receptacles Method

      4:18
    • 86. Section 8 - Creating the LightingFixtures Method

      9:31
    • 87. Section 9 - Hands On Projects Overview

      1:55
    • 88. Section 9 - Project Demo

      3:11
    • 89. Section 9 - Creating the Project

      3:41
    • 90. Section 9 - Creating the CountBlocksToTableMethod

      8:25
    • 91. Section 9 - Creating the CreatePromptUser Function

      7:54
    • 92. Section 9 - Creating the GatherBlocks

      11:31
    • 93. Section 9 - Creating the DrawTable Method

      17:06
    • 94. Section 9 - Debugging the BlockCounter Part 1

      15:18
    • 95. Section 9 - Debugging the BlockCounter Part 2

      11:16
    • 96. Section 9 - Debugging the BlockCounter Part 3

      0:53
    • 97. Section 9 - Creating the ObjectExtractor Project

      3:33
    • 98. Section 9 - Creating the CreateExtractObjects Method

      7:09
    • 99. Section 9 - Creating the ExtractLineMethod

      16:25
    • 100. Section 9 - Running the ExtractLine Method

      4:59
    • 101. Section 9 - Creating the ExtractCircle Method

      10:54
    • 102. Section 9 - Creating the the ExtractMtext Method

      13:20
    • 103. Section 9 - Creating the ExtractPoyline Method

      18:49
    • 104. Section 9 - Creating the ExtractBlock Method

      10:24
    • 105. Section 10 - Conclusion

      0:13
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

33

Students

--

Projects

About This Class

This is an intensive course about VB.NET Programming in AutoCAD. There are lots of coding that will walk you through from creating a Project using Visual Studio 2019 to running your finished Plugin in AutoCAD.

You will learn how to use VB.NET very quickly by following all the videos or by coding along with every single method being developed.

By the end of the Course, you will have the confidence to create your own AutoCAD Plugin using VB.NET.

A simple and step-by-step way style of teaching in this course will be very helpful to absorb every concept of VB.NET Programming in AutoCAD.

Meet Your Teacher

Teacher Profile Image

Arnold H.

Sr. Software Developer, MCSD, MCAD

Teacher

Hello, I'm Arnold.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Landing Page: Hi. Welcome to the scores. Learn AutoCAD programming using BB that net hands on. Have you ever thought of creating your own AutoCAD commands or extend AutoCAD beyond its current functionalities or even automate tasks are just learned A programming language that will give you the needed skill to accomplish whatever you can think up in your design or day to day out of Could work, then discourses for you learning baby. That net is so much fun and straightforward with its English like coding syntax, it won't take long before you can fully understand how the language works. You will have a solid foundation and good understanding on how to work with AutoCAD definite a p I from creating entities to manipulating objects through code. This is an intensive Hansen course in discourse. I will walk you through every step in creating a baby definite project for AutoCAD. We will explore about a definite a p I and how to use them in Libby that net using visual Studio 2019. By the end of this course, you should be able to start developing your own AutoCAD plug ins to give you a good head start. We will develop to plug ins that you can use us a rifle list to your own projects or enhance and modified them accordingly to your requirements. This is now the best time to further improve your AutoCAD skill. Set knowledge of baby dotnet programming will put you in a different level from the rest. So don't wait any longer. My name is Arnold. Hey, Grit and I will be your instructor Syrian site. 2. Course Outline: welcome to these scores. Outline. We start with the introduction in this section, we will discuss and learn who is discourse for. What will you learn from the scores? What is baby? That Net programming language. What is up God, that Mitt A P I whether the advantages off using will be definite a p I for AutoCAD And at the end of the section, I will give you overview of the project that we will develop hands on in section nine. In section two, we will explore AutoCAD definite a p I and get to know the components that will be referenced in the visual studio project to access our tour guide assemblies. We will also learn the relationship off different AP I objects like the application object database object and the document object. Next in section three, we will develop our very first plug in and see how to connect baby definite to AutoCAD and communicate with the yusor through a different mode, for example, at the command prompt and alert dialogue. But before that, we will first set up our development environment by going through the downloading and installation process off Visual Studio 2019 Community Edition in Section four. We will now formally start developing methods that will create different AutoCAD objects, like lying in text Circle arc and lightweight Polly Line. Then, in Section five, we're going to develop separate methods that will copy arrays, move mirror, irritate scale and offset an object. You learned several functionalities throughout this entire section. Upon completion of this section, you will be comfortable creating your own methods or plug in. In Section six, I will walk you through how to use layers, land types and styles. In the program. We would explore several functions for the layers like listing, creating, updating, turning on and off freezing, towing the leaving and setting layer to objects. As for the line types, you learn how to least load, said current, believing and setting layer to object for the styles. You will also learn how to least update, said the textile current, and said textile to an object. You will create a method for each of these functionalities. In Section seven, you learn about user input functions where we prompt users to respond to our program and process those inputs. We will use the get string, get point, get distance and get keywords functions in our programs. Next in Section eight, we will explore selection sets and filters. He will develop lots of methods by applying different selections, functions and using selection sets and filters. You learn how to use select all select on screen, Select Window, select Crossing, Select Fence, big First Selection method and different selection, said Filters. And finally, in Section nine, we will apply whatever we've learned in the previous topics and develop two projects. The first project is the block counter plugging. This plug in will be used to counter blocks in the drawing and display in a table. The second project is objects extractor plugging, where we will export different objects properties into a text file. We will extract the information from the line in text circle, poorly line and blocks. This projects will be provided in the scores. Feel free to use it on your own projects by updating accordingly to your specific requirements, and then they will conclude this course. There's so much to learn, so let's get started. I'll see you in the introduction section 3. Section 1 - Course Overview: welcome to introduction section of the scores in this section. We are going to identify who is discourse for you list out what you will learn from the scores. You will also learn what is really definite programming language, and we will explore what is a definite a P I. You will also identify what are the advantages off using that a p I for auto and we will have overview of the hands on project that we're going to develop in section nine. I'm seeing the next video. 4. Section 1 - Who is this course for?: So who is this course for? The scores is intended for all outward users who have a decided to create their own AutoCAD commands or plug ins and extend AutoCAD functionalities to the next level and learn new languages and skills. These courses also for those who are interested in computer programming and wanted to learn how AutoCAD and Baby doesn't work together, and Leslie for a police BB, a C plus plus and she sharp programmers who wanted to learn vb dot net and maybe migrate their code to be that that in the future I'd see you in the next video. 5. Section 1 - What will I learn from this course?: What did you learn from this course? You will learn and understand fundamentals of VB definite programming. He will also learn how to use visual studio I d 2019. This is the latest version so far for a beach for the studio. You will also understand how AutoCAD ethnic aapi ie is structured and you will learn how to create your own AutoCAD plug ins or extend out the cloud functionalities. You will also learn how to create not what objects using maybe that net. You learn how to manipulate hard objects and how to use selection sets and filters. By the end of this course, you should be comfortable developing your own plugging and other quite commands. I'll see you in the next video. 6. Section 1 - What is VB.NET?: what This will be. Definite programming language. Visual basic, that Net or baby That net is a multi paradigm, object oriented programming language implemented on the dotnet framework. Microsoft launched maybe that net in 2002 as the successor to each original visual basic language. It evolved from the B six to Mitt on increasing need for E. C. Web services and Web development, along with visual c. Sharp it It's one of the two main language just targeting the darkness framework. Maybe that it was designed to take advantage of the Darknet framework based glasses and runtime environment. It was re engineered by Microsoft as part of its definite product group, Baby Definite Supports, Obstruction, Inheritance and Polly More Peace in. 7. Section 1 - What is AutoCAD .NET API?: what this auto cut that the A P I. The other one definite A p I is a set off libraries, or DLL files. The 11th stands for dynamic link libraries That allows you to automate tasks such as creating and modifying objects stored in the database off a drawing file. The other cadet that AP I enables you to manipulate application and drawing piles programmatically with the assemblies or libraries that are exposed. And with this object exposed, they can be accessed by many different programming languages and environments, and one of them is baby that. 8. Section 1 - What are the advantages of using .NET API?: What are the advantages that net A p i for up cut? One of the advantages is programmatic. Access to drawings is open up to more programming environments before the definite A P I developers who were limited to other leas C plus plus with object. They are X and Activex automation long we just that support or that supported component, object model or come such speedy six. Another advantage is integrating with other Windows based applications such as Microsoft, Excel and Word. It's made dramatic of the easier by using an applications native definite AP I are exposed Activex, a slash com library, and the definite framework is designed for both 32 bit and 64 bit operating systems. And lastly, it allows access to advance programming interfaces with a lower learning curb than those for more traditional programming languages. Such a C plus plus 9. Section 1 - Hands On Projects - Overview: let me give you an overview of the hands on projects that we're going to develop in section nine. The first project is the blocks counter plugging project. This plug in will be used to count the blocks in the drawing and safe and display them in the table. There are two options in this plugging as's follows. It can automatically select all the blocks in the drawing in the other one is it allows the user to select certain area from the drawing and count the blocks from the selected objects . The other project that we're going to develop is the objects extractor plugging project. This plug in will allow the user to extract AutoCAD objects into a text file. And these are the objects that we're going to extract line and text circle poly lines and blocks. So let us see how it works. In AutoCAD, we opened up my toe cut here. So the first Blufgan is the ah blocks counter project. I call that Ah, plugging as CBT for blocks to table. So this the good thing you can create your own command and then we are prompted here with ah two options. Like please choose option for block selection in the drawing. The first is all the other one is selected. So if we select all, it will select all the blocks in this drawing and then you are prompted to pick insertion point off the table. So let's speak somewhere here And there you go. This is our table. So it extracts all the blocks and then displayed number of count, including the anonymous blocks. And here are the actual blocks. Here were different. The numbers for the toilet we have to for the switch three of 14 and Salon and the other option is to select only a certain area. So if we run the CBT plug in again and we select the select option here and now, we can select window, for example in this area only and enter Now we are prompted to pick insertion point of the table. You can pick anywhere you want. Let's say you want me here and this is O. R. Results based on the when those selection that we have. So we had the bath tub. We just do. We have the lighting fixture, the receptacle and sink and switch in the toilet, and we will go through all of these coding step by step in section nine from identifying the requirements to actually developing the methods. The other project that we're going to create is the objects extractor. I call that as e o extract object. And now we're prompted to select different objects to be exported. So once we choose any one of these, it will actually create a text file and the story in the temp folder. So let me just minimize this so we can see both on screen. So now if I select the line, for example, let me read it again. So e o let us select the line. And there you go. Here is our lane. In this text file, we have extracted the co ordinates the X and Y both They start and and we extracted the layer in the color and the line type and the length. So here, if you have some requirements to kind of do some analysis in the saying Excel file, you can export this in Excel pile. No, let's try one more time and extract the the block. It's been here. There you go. We have the block here and in this block, we extracted the insertion point the X and Y layer color and the black name. So these are the information from destroying. Okay, so that's just some pew functionalities and same Samos, the blocks counter. We're going through this step by step process off developing the methods. Okay, I'll see you in the next section. 10. Section 2 - AutoCAD .NET APIs Overview: welcome to section two of the scores in this section. We're going to explore up God That net AP I components So for definite AP I assemblies, we have three files three DLL files, a CMG a CDB mgt and a Psi Corps mgt. These files should be reference in our projects so that we can communicate without cut. Also, we're going to discuss the AutoCAD object hierarchy from the application object to document object into database object. See you in the next video. 11. Section 2 - Exploring AutoCAD .NET APIs: let us know explore more on AutoCAD definite 80 i assemblies. So these are all our deal files a c m g d that dll This is used when working with the AutoCAD application example is the application services. Other one is the a c D b M g d. This is used when working with AutoCAD objects in a drawing file like database services and geometries. In the 3rd 1 is a Psi Corps mjd that dll file This issues when working with AutoCAD document libraries and runtime functionalities like documents and common methods. Runtime is the assembly that you use when you are defining your own command methods like the one that you've seen when I name my command or plugging a CBT or E O for extract objects. So those are the command methods that's using the runtime assemblies and all of these files . You can find it in your AutoCAD installation folder. In my case, I have it installed at program files at the desk and Otto 2019 folder, and these are all the files. So, depending on the version of AutoCAD on your PC, you just have to locate it and you should be able to find history files. Okay, so that's it for a high level off this three assemblies and see you in the next video. 12. Section 2 - .NET API Object Hierarchy: let us know understand AutoCAD object hierarchy to use the AutoCAD definite AP I. Effectively, you should be familiar with the AutoCAD entities, objects and features related to the tasks that you want to automate. The greater your knowledge of objects graphical and none graphical properties, the easier it is for you to manipulate them through the Ottawa Detonate a p I. So what is an object? An object is the main building block off the AutoCAD definite a P I. Each exposed object represents a precise part off AutoCAD. There are many different types of objects in the hard at Mitt a P I. Some of the objects represented in the autumn a definite a p i r wrap graphical objects such as lines, arcs, text and dimensions style settings such as layers line types and dimension styles. Organizationally structures such as layers, groups and blocks. The drawing display such as view and view ports, and even the drawing in the outward application. The objects are structured in a hierarchy hierarchical fashion with ah AutoCAD application object at the root, these hierarchical instruct Aries often referred to us the object model, this one here. This illustration here shows the basic relationship between the application object and an entity that is in the block table record, such as modern space. So these are just a high level off the object hierarchy. In our after code, you will see how we derive each off the objects from one another. When we start creating our code in the next video, we're going to explore more on the application object. I'll see you there. 13. Section 2 - Exploring Application Object: let us know. Learn more about the application object. The application object is the root object of the Atocha. Detonate a P I. From the application object, you can access the main window as well as any open drawing. Once you have a drawing, then you can access the objects in the drawing. For example, the application object has a document manager property that returns the document collection object. This object provides access to the drawings that are currently open in jihad and allows you to create, save and open drawing files. Other properties of the application object provides access to the application specific data , such as info center, the main window and the status bar. The main window property allows access to the application name, size, location and visibility, and going back to the document money. Your object. While the application is the root object in the AutoCAD, doesn't a P I. You commonly will be working with the database of the current drawing. The document manager Property after application object allows you to access the current document with the MD I active document property from the document object returned by the M . D. I. The active document property you can access its database with the database property. So this this is just the high level of information of each of these objects. When we start coding, you can see how it works when we start. Instead, she ating each of these objects. So you have a better understanding In the next video. We're going to explore more on the document. Object. I'll see you there. 14. Section 2 - Exploring Document Object: let us know explore more on the document. Object. So what is the document? Object? It is actually an AutoCAD drawing and it is part of the document collection object. A document object provides access to the database object, which contains all the graphical in most of the non graphic. A lot of hard objects along with the database object. The document object provides access to the status bar the window. The document is opened in the editor in the transaction manager Objects. The editor object provides access to functions used to update input from the user in the form off a point or on entered string or numeric value. The transaction manager the transaction money. Your object is used to access multiple database objects. Under a single operation known as a transaction. You're sections can be nested, and when you are done with a transaction object, you can either commit or aboard the changes made in the next video. We're going to learn more about the database subject. See you there 15. Section 2 - Exploring Database Object: let us now learn more about the database object. The database object contains all of the graphical and most off the non graphical out about objects. Some of the objects containing the database are entities, symbol tables and name dictionaries. Entities in the database, 3% graphical objects within a drawing, so graphical objects these are also known as M pp's are the visible objects such as lines, circles, rester, images and so forth that make up a drawing. While the nun graphical objects are the invisible or informational objects that are part up a drawing such a slayer's line types. I mentioned stylist table styles in support. Symbol tables and dictionary objects provide access to none. Graphical objects such as blocks, layers, line types, layouts and so forth. Each drawing contains a set off nine fixed symbol tables. Example of symbol tables are the layer table, which contains layer table records, and the block table, which contains block table records. All graphical entities such a sline circles, arts and so forth are owned by a block table record by default. Every drawing contains pretty fine block table records for model and paper space, and each paper space layout has its own block table record. A dictionary is a container. It's a container object, which can contain any AutoCAD object or on X record. Dictionaries are start either in the database under the name Object dictionary or as an extension dictionary up a table record or graphical entity. The named object dictionary is the the mustard table for all of the dictionaries. Associate ID. With a database like symbol table records, new dictionaries can be created and added to the named object dictionary. And, by the way, you access the database. Object for the current document by the document objects database member property so that this is a very high level of the database object. You will understand more once we start creating the database object in our code. By instant, she ating, and it's starting into a viable. So familiarize yourself. We'd, uh, hierarchical structure of the database object. So when we start coding, you can easily recall or understand where we derive it from. Okay, so that's all about the section to exploring AutoCAD that net ap I components. Hopefully, you have no a good understanding on on those components, and I had Syrian. The next section 16. Section 3 - Topics Overview: Welcome to Section three of these scores. Hello, AutoCAD from BB Death Net. In this section, we will be downloading and installing Visual Studio 2019 community addition. We're going to also set up our I. D or integrated development environment. There are a few options to set up the I. D. You can choose between this four, the blue or blue extra contrast, the dark and the light. So in our case, we will pick the dark one. But it's all up to you to choose whichever Golar theme you like you prefer. And also we'll be creating our first plugging to connect VB that that program to AutoCAD. And with these we're going to create two methods. It's just a very, very simple method just to show you how to communicate and send message to the user through ah, different mode, like into the command prompt or using the prompt, I mean the message box or the application alert show alert method. So those are the topics that we're going to. They're in in this section three of this course, So the 1st 1 is we're going to download the Visual Studio 2019. Let's do it now So if you go to this website here visually studio that Microsoft that com slash ves he should see this page on my screen. This is so far the page during this recording. So choose on these. Drop down here just the community 2019 days free but deep. You want to try the professional and enterprise There is, I think, a 30 day trial period. But for this course we will be using the community edition. So click on this and then download. In my case, I have already actually download it, but I would just like to show you You can do it too. So once you have these, just click on open run. Click on Yes, yes. Click on Continue. It takes probably about 20 to 30 minutes for the entire installation. All right, so in the next video, we will continue with the installation where we will pick it up from where we left off from this video. I just have already installed it. So it's so prompting me to update. But in the next video, it will walk you through the entire installation process. I'll see you there 17. Section 3 - Installing Visual Studio 2019: All right, let's install the visual studio 2019. So when you click on the download link, this will be the the prompt. So let's continue. Takes a little bit of time. But let's be patient. So that's click on install. It's at the that this step in the development. Let's click on these four points, explained 14.7. Just click on this one as well. Okay, this might take a little bit of time so that we just passed the video and come back when it's done. Still ongoing. Fewer minutes Almost done. All right, it's done. No, it's lunching. Okay, so we're prompted to sign signing. But let's just click on this one here. Not know, maybe later. So we're to choose which caller theme we want to use. So I'll choose the dark version. The development settings just select generally for now and start to be sure. The studio All right now we're prompted with the different options. One is to clone or check out code from get hub, open a project. Our solution. Open a local folder or great, a new project. Let's just, uh, choose this one here. Great. The new project. It has different in their face compared to the swells to Utah in the 17. That's just the two special basic and let's select the class library that net framework. Next, let's specify the project name. Just call this one test and is the location. Just put it a temp. We're not doing anything. We're just opening the visual studio with the new project and choose the Net Net framework 4.7 point two. Check this check box here to place a solution and project in the same directory. Then create. And that's it is our new project. So we have installed visual studio and open up a new project. It's not that complicated. Just follow along with the options and takes roughly about 20 to 30 minutes for installation, depending on the speed of your computer. But these now the interface that we have and we're ready to program so I would see you in the next video 18. Section 3 - Configuring Integrated Development Environment (IDE): Hello and welcome back in this lesson, we're just going to set up our visual studio 2019 i d, er Integrated development environment. So depending on your prevalence, we can have a dark background or a white background or light or blue or extra blue contrast . So let's great a new project. Currently, we are in the dark theme. Let's just select any any project here. That's a I select the or you can search console application, for example. Let's select these. Console up that net framework and choose visual basic and click next. So any file name or wherever you want to store it doesn't matter. We're just set up our environment for now. Okay, so this is currently in dark color theme. So to change the background, you can just go to tools menu and then select option. And under the environment we have here, the general and then under the color theme, dropped down. You can either select light blue are extra contrast blue, so let's try the light first. These are all white, so it's it's really bright. If you prefer these settings, then you can stick with this. Let's have a look on the blue contrast. Okay, Then you might notice that we have here on our out there borders. It's highlighted in blue and some of the code here are also in blue. Okay, lets tried. Ah, extra contrast. Do it's what Here. So there is an extra caller in some of these ah windows. These are the four different settings off the I. D. So you can piquant, depending on your preferred background. In my case, I prefer the dark one. So I will be using the dark color theme here and click OK, and this will be my i d. So with all these is set up, we can Now we start developing our programs, so we'll get started in the next video and see you there. 19. Section 3 - Creating First Plugin: All right, welcome back. So in this video, we're going to create our very first AutoCAD plugging using BB that net. Open up your visual studio 2019 and great. A new project here in the language menu. Select Visual Basic and from the search text box. Here, we can search for library. We need the class library. Definite framework. Okay, select that one and click on next. And this time we're going to specify the correct or the appropriate project name. In this case, let's just call. This s que lo autocad and the location. I will put it in my decide folder were used in this case. I'm using the AutoCAD BB that Net projects here. Select folder. And then, if you prefer, you can check on this check box to place the solution and project in the same directory. Or you can just leave, leave it on check and just accept the default dot net framework 4.7 point two and click on Create. Basically, in this first project, we are going to set up our environment to link to the autocad assemblies so that we can communicate with not quite application The very first thing we should do is to add those assemblies from AutoCAD in our references. So if you right click on the references here and then click on add reference, I have already referenced those three assemblies that we need, but I would show you how we're to get that. So click on browse Search for your ah autocad installation. In my case, I have here from the program files at the desk and AutoCAD 2019 Then I can select from here the those three deal else that we need one is the A C Corps mgt. A C D B M pd. So click on control so that you can select multiple and then the other one is a C mjd this one here. So we have three a c m g a, C D B, m G d and A C corps mgt. Click on add button here so we have three and then make sure that all of them are checked. Okay, there you go. Next we need to change some of the settings on these three assemblies. But before this is the one that we need to change the copy local, the default is set to true for all of these three and also the a c m p d. If we if we build this solution, I will show you the effect between the A copy, local true settings and the copy. Local false settings. So currently, it is building now, and we have here one succeeded. Okay, So if we go to our project and we examined, uh, the folder, what's in the hour being folder? See all of these deal else. We don't need all of these what we care about. It's basically only the the Hello article. Dll. This is what we need. So if I change now, the settings of the copy local too falls for all of these three assemblies. Then we do another rebuild. Okay, one succeeded, and we go back to our debug folder. We only have this one here. All right, so that's the purpose of changing the copy local to falls because the autocad already have all those assemblies, so we don't need to include them. It might just cost some conflict without God. Today is just what we need. All right. So for every project that you create, always make sure that you said it to false. Okay, so now that we have all these three, we can start. Ah, importing. How are library? So in this case for VB that net, we use imports. No. We have access to the other desk assemblies, HUD and application services. We also need the A database services. We also need ah runtime library and also the editor editor Input leathery. Okay, I know that we have import all the libraries that we need to communicate to AutoCAD application. We can no start creating our methods. So public sub Let me call this. Hello, AutoCAD. And then we can start to retrieve the document object the database and the editor object. So to do that, we need to deem or dimension or kind of declare variable. That's called that dim, dark US document equals application. That document manager that MD I active document other one is the database. So we deem DB US database that would be coming from the document, which is our drawing and then database. Then we need to declare a variable for our editor. So let's let's call that as e. D. T. As editor editor is basically used to write a message to the console so that you can communicate with the user equals. Ah, Doc, That editor. All right, So now that we have all these, we can send the message to the user already to the AutoCAD console, window 83 that write a message. Hello? Oh, God. From BB That in it. There you go. We now have our first method. However, there is one more thing that we need to do before we can see these method in AutoCAD. Once we load our plugging and that is the command method, this will be basically the command that you need to type in AutoCAD command window. So I just put here Hello? We have here the method. Hello, AutoCAD. But I just wanted to type in hello in our Todd prompt. So this will be what we are going to see once we load our plug in. So now that save our project and do another build. All right, now we're ready to look to load it in AutoCAD. So open up your autocad and then type in net load, and then we select our plugging. So locate your file. Your DLL file. It's in this folder. Go to the bin folder, the bug, and then this is our plug in. Okay, So basically, you can copy these over and send it to, uh, anyone in your officer colleague, and then they congest reference thes and use it in their program in Art Academy. So open it, click on Always load. And then now we should see the Hello Command. Here you go. So is one here? Click on that. And this is our message. Okay. All right. So that's how a straight forward it is. Give this a try and see how it goes. In the next video, we will be creating another program, another method based on this project to this play using on alert dialogue, So I'll see you there. 20. Section 3 - ShowAlert Message: Hi. Welcome back. I hope you gave this one a try and you were able to display the message in the cloud command prompt. In this video, we're going to learn another way to communicate to the user. But this time we're going to show in alert dialogue. So let's get started. Let's create a new method. Let's go that say hi. But this time we won't be needing any of these variables like the document database or the editor, because the show other dialogue can easily be invoked from the application object that show alert dialogue. Then we type in our message to the user. Hi there from BB Definite. That's it. It's just a one liner. But let us not forget to create our common method. And let's gold is say, hi Samos, the method name, since it's just a very short method name, so we can Yes, we can just use the same and basically that's it. Let's save our project and do a rebuild. All right, so we have here one succeeded that's tried these in type in that load, and we load our code. It's in the debug folder, just the one here, so basically Hello, AutoCAD and then being debugged and this is our plug in select are very slowed. We should now have a new method called Say hi. Let's give it a try. There you go. Yet So it is now our message. Let's check the previous method that we've created. Okay, so we have it here, so that's about it. So we learn two ways how to communicate with the use of the 1st 1 is using the command prompt and the other one is to show other dialogue. So depending on your requirements or whatever you want to communicate to the user, you can choose between these two. Okay, So that this hour two methods in the next video, I would like to discuss about this warning message here. Although we have one succeeded when we when we do a build. But we are getting some of this warning in the next video. We are going to fix this warning and make sure that it doesn't show up again. Okay, so I'll see you there 21. Section 3 - Configuring VS2019 Platform: Hi, there will come back. It's good that we have these two methods working, and we were able to build successfully. However, we are seeing these warning message here. This may not be on air, but it's still not pleasing to the eye when we keep on seeing these wining message. So in this video we're going to find a way to fix this message here. So let's check on the warning message. Here's it was saying that there was a mismatch between the processor architecture of the project being built. A missile means Microsoft Intermediate language. So it has a mismatch between a missile and the processor architecture of these three assemblies that we reference from AutoCAD and at the last, then part of the message here it was. It was suggesting to consider changing the target processor architecture of your project through the configuration manager so us to align the processor architecture between your project and the references. So let's do that To go to the configuration manager, we have to click on the build meant menu and then configuration manager here. So currently the platform is using any CPU to fix that, depending on your system in my case. I am using the 64 bit. So I will be selecting the 60 poor here. X 60 poor I mean and so is the A platform here for debug and release. Okay. And close this window. Now we can build this project successfully without seeing this warning messages again. So let's do that. There you go. No, we have here once succeeded without any warning message. So it is good. Now we can load our dll our plug in into AutoCAD. Let's do that. However, this time we will be using the 64 bit. Let me just open these 1,000,000 Explorer here. So if we drill down from our project folder, we have here the hello AutoCAD and the bin folder in here we have the debug and release. However, we also have a another folder for the 64 bit in the X 86 b 32 bit. So if we look at the original code from the previous one, this was created at 3 15 PM However, in the X 60 poor, this was 3 20 which means that after we update our platform to 64 we know have this. Ah, this is now the latest plugging that we will be using. Okay, so let's select that from here. And this is doing on way slowed. So now let's type in our a method. Yep, it's there about the previous one that we created. It's also working as expected. Okay, No, let's say we do some changes here. Let me just add a few characters and saved this project and do a rebuild without closing AutoCAD. So currently AutoCAD is running with our plug in loaded. So let's see the behavior. If we do a rebuild on our project while the well auto body is still open, let's see what message we get here. It's taking a little bit of time to build. Let's wait and see. There you go. So we have some error it says could not copy to this despoil to this folder. Access is denied because currently our plugging is active in autocad. So to fix this problem, we should exit AutoCAD first and do another build. Okay, so let me exit out God close this month and let's do a rebuild. Nice. See, we don't have the problem anymore. So you might encounter this problem as you keep developing your plug ins, so just just make a note of that and make sure to exit AutoCAD before you do another build . So now I opened. Took it again and let us load our plugging. Yep. In the 60 poor and run our method Say high. We should be seeing extra characters. Here you go, XXXIX. Okay, so that's how it works. Make sure to exit AutoCAD if he did some changes on your code before you do a build just to avoid the previous area that we have because AutoCAD lock the dll so visual studio cannot deleted. Let me just show you the behavior when we do a rebuild, we just Reese ice this window here. Okay, so we are in the 64 x 64 folder and debug. If I do let me just okay. I mean, let's do a rebuild. We should be getting the air again because our God is still active. When you do a rebuild, it actually deletes all this file and create a new one. See it? It only deleted the PDB, the project database, but the DLL in the XML, we're not deleted. It's because our takagi still using it. It's being loved by others. So if I close autocad and then we do another rebuild, this one should be cleared, and then a new one will be created. So let's observe the behavior. There you go. Now it's the latest coat without any problem here. Okay, so those are the things you should make? No, A shoe. Keep developing plug ins just to avoid those minor issues that symptoms quite annoying. And it's just a waste of time. Okay, so that's it for these a section know that we have I learned how to communicate with AutoCAD how to reference the necessary assemblies and libraries and how to import in our project. We have also created two methods and also fix the issue on Miss Much as well as the the air that we encountered when we do a build while authorities still running. Okay, so in the next section, we will be creating or learning how to create our new objects using the baby detonate. Okay. Thank you for watching this video, and I'll see you there by 22. Section 4 - Creating AutoCAD Objects Overview: Hello and welcome to section four of this course creating AutoCAD objects. In this section, we will learn how to create a line on an text, a circle, a narc and a lightweight Polly line. We will be creating a new project called dro Objects, and we will have a separate method for each of these objects. So in the next video, we will create our new project and see you there. 23. Section 4 - Creating DrawObjects Project: All right, so in this video, we're going to create our new project. So open up your visual studio 2019 and it will create Ah, new project. We will call this project as draw objects. So from the language, select visual basic. And then from these projects, the templates. Here we are going to select the dot net framework. Last library. So that has searched for library is the one that you're going to use. Class library dotnet framework. Click on next and let us provide the proper location and use this one here. And let's call our project. Name us. Draw objects and select the default. 14.7 point two. Pick on. Great. All right, so we now have our project created. So based on what we've learned from the previous section, we need to reference all those are Takada assemblies. So right, click on these reference and odd reference. So you have to search for these three particular DLL files there, all installed in in the AutoCAD 2019 or whatever version of AutoCAD you may have so just searched for it. A C corps mgt a CMG and a CD BMG and click on OK, Next we need to set the copy local for each of these three. Two false so that all of the other assemblies will not be compiled. I mean, it will be included in the in the package. Okay, so those are the basic said things that we need next we need to import Oh, are including our project file. Those name is basis. The 1st 1 is the Autodesk that autocad application services. The other one is the database services. Another one is the quite a run time, and that's just import a swell The editor object. Okay, so now we have, uh, the project set up. We are now ready to create our new ah method. So we will continue in the next video. I'd see you there. 24. Section 4 - Creating DrawLine Method: all right. Now that we have our project set up, we cannot start creating our new methods. So the first method that we're going to create is called dro line method. Let's create the method now, public sub draw a line method. Okay? And we need to provide the common method here so that it will be recognised in AutoCAD common method. Let's just call this oneness, draw a line as well. Okay, So what are the first things that we need to declare? We need to get hold of the document object. So to do that, we have to declare a variable called duck as document equals application. That document manager, the M D I active document next one is we need to get hold off the database object. Let's call that us DB then bebe as database and this can be derived from the document object. The document object is actually the drawing object. And then let's also get hold off a the editor. So let us declare a TT as editor and this can be the right from the document that editor object. Okay, Next. For every object creation, it should always be wrapped in a transaction object. So that is what we're going to do. Using it runs these our variable name for the transaction as transaction. That would be equals two. Db that for a section manager and we should start the transaction. Okay, so in this code black here, we're going to create our ah called to draw a line. But also a good practice is to ah, put them in a try catch block, just in case we encounter some error so we can have a good handle of the error message we can trapped there. And we can provide the user with the the message, just in case we encounter one. So to do that you're typing, try and just hit Enter and it should Great. Do these. Ah, try cuts block automatically. Okay, so in the try, this is where we're going to create our go to draw a line. And if there is an error, it will go into these catch block here and these where we provide their message to the user . So let us create the try. Catch the catch code first. So we need to basically provide the user with a message. So all we have to do is E D T. The right message air encountered. And then we will display what is the error message. And then we have to abort the transaction. All right, so now that the air is handled properly, we cannot focus on creating the code to create the line. So the first thing that we need to do is to create a a variable for the block table object . So we do that by declaring a variable like let's call that Bt as block table. And then it should be BT should be coming from the turn suction and then get object and then from the parameter should be from the the ideas object i. D. This is where the database love people. I d comes in and the mode should be for Reid. So up in mode that before for apps for read, we're only reading the block table. OK, next we need to create a block table record based upon the block table. So to do that, we need to declare Let's call that as BTR block table record and it should be derived from the trance from the transaction is red and get object and it should be coming from the BT with the string of more than the space it should be block table record that more than the space. That is where we're going to create our line. And the mode should be open mode should before, right, because we are writing in in a database. Next, let us just provide another information to the user that basically lever growing in line. Object. Oh, are they can use their BB lying feed our Gary Gary's return in line feed so that this place on its own line Okay, so now that we have the block table record, we can start creating our points that determines the line object. So to do that, we have to declare the starting point in the end point. So let's just call this starting point as 0.0.1 us 0.3 D. So we don't have the 0.3 d, which means that we need to add into the imports, the geometry. So when we are creating objects, this name space should be added. Okay, So deem PT one as 0.3 d. There you go. It was new 0.3 D and the point location, the x and Y Gordon. It's so let's just start from 00 for the X y Z and then the MP 0.2 or the endpoint US 0.3 d waas new 0.3 d. Let's start from, let's say, 25 1 50 for the UAE and zero for the set. Know that we have these two points. We can now create a line, but before we do that, we should declare a line variable. Deem. Let's call the variable us Ln us line equals new light and the parameters are 0.1 and 0.2. So PT one pt two That is now our line. Now that we have these Ellen variable, we can set the properties for that. So by just typing and l end that and you can set the color index, for example, equals one has read. And then all we need to do is to append into the block table record. So, BTR that a pen NTT and the parameter should be What entity do we have to append to the block table record? It should be the our line object. All right, then we have to add the line into the transaction so it runs that a newly created DB object that is our line and the other parameter is at as bullion, which is either true or false. So it has to be true. And of course, we have to commit the transaction and that's it. This will be our method to draw a line. Okay. Quite straightforward. So I suggest that you do it yourself, try it and get a glimpse off how to create all of these variable and what particular methods or properties. Each of these variable has and and give you the try. So now let us save our project and do a building. All right, so we have one succeeded. But we have a warning here. This is B this warning waas already encountered in our previews a project. So to fix that, we just have to go to build click on configuration manager and click on Ah x 64 if you are using assist them, uh, 64. If you're using the 64 bit operating system like windows seven and up and click on. Ok, All right, close this form and do another rebuild. Okay, so the warning message is gone, and we have succeeded to build the code. So we are ready to try these in AutoCAD. Let's do that. Now. Open up your autocrat and type in the net load and select your project. It is in we be net project after objects in the bin folder. Look for these X 64 okay and debug. And this is the dll that we need. These our plugging Always load. Then Now we should have a method called Draw a line. Let us see. There you go. Enter. Nice. So this is our line. If we check the co ordinates this i d from here. This is our 00 and I d. From this end point, we have 25 1 50 Perfect. Okay, So these our first ah draw object method in the next video where continue We will continue to build upon this project by creating other methods for an text art, Paulie line and other objects. I didn't see you there 25. Section 4 - Creating DrawMText Method: Okay, Welcome back in this video, we're going to draw on em text. So we're going to create a method for that. Let's get started. Let us call these method draw and text. And of course, we have to create the common method called dro and text the same thing. Us. What we've done for the line object will do the same thing as declaring all the variables we need. So deemed off as document equals application. The document My lawyer that MD I active document the MDB as database Qualls stopped the database The A t T. As editor equals the editor. And of course, we have two great the transaction using Trance Aziz transaction because DVD transaction manager and started the transaction. And also we need to create, try, catch, block, provide the error, the air handling message, right message air encountered. Or you can provide any message that you like, and then display the message encountered based on these air variable here. And then, of course, you have to aboard the transaction since we encounter some issues. Okay? Now we can write the code to draw on an text. If you know this when you are drawing an object. It's always the same code black or template. If you want, you can remove the try, but I suggest that you included because it's it's always safe to have these try catch block to handle their issues. Otherwise, if you are debugging especially if you're cold becomes complex, it's quite hard. So I said yes, you just leave the try cuts block here and then proceeded with your coding. So once you get used to all these declaring of variables creating the transaction, it becomes second nature to you. When you develop more methods must be go along in this course. But I suggest that you always type in because the every time you type it in comes like a a second nature, as I said, which means that you can remember easily how to what are what are the variables that you need, rather than just got being from here and then pasting it here. You can do that once you get all very familiar with the way how to create those methods. So in the meantime, I recommend that you always type in yourself this one here until you have this kind off, uh, memory, all right. So now let us provide the user with the message just to let the user know that we are drawing and text. So it is just a nim text exercise, and they provide to be BBC RLF line feed. And then, as usual, we have to create a block table, viable hopes this block table, and then bt would be equals two trance that get object debated block table I D. And the open mode would be for Reid s. So we need to declare a block table record. Kohli does BTR and the BTR would be from the trance object, get object. And then we get hold of our bt and we need the block table record that model space that this hour string and then the open mode would be open mode for right. Okay. Next week can now declare a variable to hold the antics that we're going to create. Let me just call that as txt. I mean, let's just great first this string as a string and let's go that as hello, provide the information here from VB Death net at this hour, string variable. And now what are the requirements to draw on em text. We need an insertion point and we already have the text string here. So that's those are just the two components that we need. So let us create the variable for our insertion point. Let's call that as in Speedy and that would be point three d close new 0.3 D. Let's say from 35 60 0 that these x 35 y 60 and said zero And now we can create on an text . So another good practice is to use the using, let's say empty X as our variable for the unfixed us and text. Because new EMP text you might notice Every time you use these using keyword, it automatically adds thes and using same us when we did for the transaction. Okay, It's basically what means what it means by it is is that once we create these empty X variable and it exceeds this using block, it automatically clears the memory reference in Durham okay, in the hip. So we don't need to to clear that up, So this is very efficient. Next that we have these empty X variable, we can now provide the contents. What is the contents that would be our txt, which is this one here. And another property that we need to provide is the the location, which is our insertion point here, the instruction point and that's it. And all we need to do now is to add into our or to upend into our block table record empty X as well as adding into the transaction empty X and true. And of course, after that, we have to commit the transaction. Otherwise it won't be saved in the drawing. So that's it for this empty X ah method Draw an empty X method in a save our project and then do another rebuild. Okay, so we are now ready to try it in AutoCAD. Let's go into autocad. And I've seen that load for our updated DLL. So this is the one that we created. Okay. From this folder, click on. Always load. Now we should have two methods. The 1st 1 is dro lined. Other ones draw am text. So let's try the draw and text. There you go. Yep, this is our text. And it released this card. This string our insertion point is 35 60 in the Texas Hill a article from Baby That net? No. Let us check our droll line. Is it still there? Yep. It's still there. There you go. Okay. So now we have two methods in our draw objects plugging. Okay, so give this a try and see the results. You can experiment on changing the insertion point or changing the text string and even provide some color on the text and see the outcome. Okay, so we'll continue building on this project with other other object types, and I'll see you there. 26. Section 4 - Creating DrawCircle Method: welcome back. So now we have created two methods in our project. One is drawn line. The other one is drawing and text. In this video, we're going to create a circle. So let s great the method. Name that school. Jesus, draw circle. Let's provide, uh, command method. And this Let's just call this is draw a circle as well. Okay, so as same as before. We need to have a document db an editor. Object and transaction and try catch block. So let's do that very quickly deemed up as document it waas application. That document, man. A year that m d I. A document deem D. B s database requires dealt with database deem editor does and it r equals. Don't that editor and then next is to create the transaction using transfers, Transaction equals Do you be the transaction manager that start conception? Okay. And then with the try, catch block a t t. That right message error encountered, plus the message of their and abort the transaction. Okay, so let us provide a yusor a message in the command prompt ID et the right message. We are drawing a circle, okay? And of course, we need. Ah, the table and BT should be equals to Dorantes that get object from the database that block table i. D. And the open mode is for Reid. Also, we need ah, block table record and the BTR should be we direct from the transaction. Get object Bt Duck table record that model space open mode that for right. Next. So we specified a circles parameter. So let's just provide here a comment. Specify the circus parameters. You remember the comments, right? Just type in the single coat are apostrophe here, and then this will be treated this comment. So what are the parameters of the circle? The 1st 1 is the center point. Another one is the radius, so those are the two that we need to create. So let's create the center point first so that let us call this a center PT. That's also a 0.3 d. What's new 0.3 D. Let's just put that in X 100 why 100 is it is your and next we need to determined the radius. So let's call that US circle rod, and that should be double. That's just, uh, Make the Radius is 100 and using the using construct using C IR. This will be our valuable for the Circle US circle. Because new circuit, we can provide here the parameters. But we can also declare it in here like the C i r. That radios equals a circle Rudd's and the C i R da that center or the center point Itwas our center Petey here. Okay, And then same drill. We have to offend into our bluff table record the circle of variable and, of course, add into the transaction at nearly the be created object and the circle variable and true. And then we have to commit it. That's it. So I hope by now it's you'd already be. Ah, very common to you. These are the building blocks off creating any I took other objects declared needed variables, document database and editor for messaging. And, of course, the block table and the block table record. Then for the specific object that you want to create, identify what are the parameters and just declared them and apply accordingly. They don't forget to upend into the block table record and add into the transaction. All right, so let us save our code and then do another rebuild. Okay, We encounter some error here in the rebuild. We've seen this before. Their recent behind is Was that our autocad is still open. We should close this. Ah, God. First, before we can do a rebuild Because the the previous deal l that we've created is already loaded in AutoCAD and we have modified it. So it's how it can be, uh, loaded anymore in AutoCAD. It has to be cleared first and load a new a compiled version. Okay, so let's do a rebuild. Hey, go. No more error. And now we can open our out quite here. Okay, so now we can load our plugging net load. This is the plug in that we just built open and click on. Always slowed. So we should now have a method called draw circle. Let us see. There you go. Yet here is our message drawing. It's trickle. Let's zoom extents to see the circuit. There is this. And let's also try the draw A line from the first method that we've created. It's still there and draw and text. Yep. Okay, so this is just very simple. Now it's becoming more repetitive already. But you get the point. We almost have similar gold structure. The only thing that changes is basically in here. This one here. This is specific to the objects that we are creating. But the rest almost insane. Of course. The message I have to change, respectively. Okay, so in the next video, we're going to draw another object type. I'll see you there. 27. Section 4 - Creating DrawArc Method: Okay, so we have created the line object, then text in the circle. In this video, we're going to create an art by now. He should already be familiar, or you have already be accustomed to the way how to create the how to form or established the court blocks. So I have created it already. We don't need to keep typing in the game and the game. We will try to reduce the number of typing now. The important thing is you should have already being very familiar with the way that we are coding from these three different objects. So let's let's no focused on the actual code chase where we are doing the creation off the object. But I still left out. The BT later only will also be creating that prior to as developing our coat. So for now, that's just leave it here. So probably need to do now is Bt declared the block table, and that should be coming from the trance that get object and from the database block Table I D. And with the open mode that for real and next, it's the love table record as bluffed table record and the BTR should be trance that get object bt Look table record that more than space open mode that for right. All right, next to rehab too. Create, uh, our subject. So what are the needed parameters to create a narc object? First twenties, we need the center point. We also need radius. We also need a start anger and the end angle. So we have four. Let us start with the center point. So let's call these center PT as 0.3 D Quest New point that three d That's great. That one from then 10 and zero x equals 10. Wake, while standing said equals here and now the radius of the Ark. Let's call that as art rod as double equals 20. And let's define the angle. Start angle as double in radiance, just one. And that also lets also great and and anger also as double because a tree. And now that we have all these off parameters, we can create the ark object now. So let us called our variable US art as art equals new arc and we supply the parameters we have here the center point Centrepoint radios start and end angle. So centerpoint then next is the radius. Our variable is called art Brod and start angle and anger. Okay. And next one is we have to append this art objects into our block table record. So, BTR, that a pen entity, the ark object And as usual, we need to add into the reception, okay? And we have to commit the perception. Okay, so that's about it for the ark. Just do some clean up here and a save our project. So before we do a build, you have to make sure that we close auto cut first. Otherwise, you will get the same error again. Okay? And now do a rebuild. All right, and let's open AutoCAD. Okay, it has slowed our plug in type in the net. Loud Command, select this DLL file. Click on. Always load. So we we type in. We now have our arc here. So altogether, we're 1234 These are all our methods. So that's tried to draw art. There you go. Let's zoom extents yet These our art. All right, so give this a try. Play around with the radios, the angle in the center point and see how it goes in the next video. We're going to create a party line object. I'll see you there 28. Section 4 - Creating DrawPline Method: welcome back. So we have already a method to create a land object in Text Circle and Arc. In this video, we're going to great a method called Drop the Line. This will draw a pollen object to the Portland object, so that's get started. I shoes. Well, we have to define the dark as document quasars application Document manager MD I Active Document DVS database. Because Dr Database, the editor editor Equality is adopted. A editor. Next, we need to a great A transaction using drones as transaction close DVD transaction manager . That's start to inception. Okay, Next, we need to create a try touch block and this one here we can just copy over. All right, so that's great. Now the the code to create a new P Line or new two D Poland. But first, that's just provide a message to the user throwing a to the party line, and now we create our block table. It's called that Aziz Bt that should be equal to trance that get object, be the block table I d open mode that for read. We also define a love table record BTR, and that should be equal to after and suction to get object and Bt the table record that modern space open mode. Poor right. All right, Now that we have all the needed variables, we can start now to create the pollen object. That's just provide here a comment. So the P line requires coordinates. But before we can do that, let us create a new variable called pl as New Poli line. And now we can start adding a vertex by the by using the advert vertex at method. So different parameters are required here. The 1st 1 is the index, which is the the starting point of the coordinates in the point if you have a barge and started with the double So depending on the with off the portal in that you want to create in our case, we just make it all zero before zero. No, we no thickness. So it's just the plain pollen. So peel that at Vertex at it should be start from zero and then new 0.2 d. And you should specify in accordance for the point for the Vertex, I mean and then gets put right here. A zero for the bugs. Zero for that will start with zero for the end. Well, okay, Next. Next. Vertex. So these two second Vertex new 0.2 d. Let's say this time let's make it a 10 10 zero 00 So we can just copy it is over. That's great. Maybe five more Vertex. This will be the 2nd 1 The third a mean And let's make this at 45. And the white is 80 and this is the fourth. Vertex hopes that the fort, But since you start from zero so used to Ford Let's make these 65 and 30 in the fifth Vertex, let's say were raised it to 1 25 and 100 in the last. Vertex it's a 1 40 to 50. And that is that is all we need for the poly line. And of course, you have to add or to upend into our black people record and add into our construction and , of course, commit the transaction. Okay, so that's basically it for our Poland. Let me save the project and do a building Rebid. Okay, One succeeded. Now we can try running it in. AutoCAD Let me open up. Got here. Okay. Let us load our project. Our plug in. We can always load. Now. We should see the drop. P lain common. There you go. Here is our text. And let's zoom extents There is our pollen. Okay, so that's about it for the pollen object. Give this a try. Do some different coordinates for the Vergis is and see how it goes. All right, I'll see you in the next video. 29. Section 4 - Creating DrawCirclesVert Method: Hi. Sometimes there are cases where you need to create multiple objects. If you remember the way the area command in Autocad behaves. So if you have one object, then you do an array either vertically or horizontally. So in this video I'm going to show you how to create multiple objects, like doing an area vertically. We will use thes draw circle command. He will use this code here, and we're only going to do some tweaking on the code to do exactly how to create a numeric type off method. Well, let me just copied is over and right at the bottom. Basted at us, renamed these to draw circles vert for vertical. Okay, so the changes that we will be doing is in this particular code block here, since we are doing a vertical are a or multiple copy of objects vertically, we need to make the white co ordinate as a variable. So that is what we need. And then us we and looked through the the 44 loop that we're going to create. It will just be implemented every time. So let me just comment this out here, and we need to create a viable the white cord in it. That's just demon y as into gear. Let's start from 100 the same us, the court in it. Here, we'll keep the radios as 100. Also, you could put the zero as double and then we also need to create a counter variable. So let me just ah, dim I as integer This will serve as our counter and then we can create a four look. So in VB that net all you have to do is type in four. I equals one to the range, the maximum range that you want to create. So in our case, that's just the draw 10 circles and it closes with the next statement here. And then we will put this over inside the four look. Okay, so basically what we're doing here is we are looping from one toe pen and we will draw a circle every time we look. So this particular Centrepoint line of code here should be inside in the for loop because this is where we're going to change the co ordinate every time. So now that we have created a why variable as our a replacement to the fixed 100 here. So that is what we're going to use. Our X coordinate stays the same, but the Wiley will be incremental. Every time we look, we do a loop. So which means that the first iteration we prayed Centrepoint as 0.3 d from 100 to the initial value is also 100. So it was great our first circuit and as usual, we provided the circle radios which is still the same US 100 center point is the center point here. And then we added into the block table record we upended and adding to the transaction and next would be to increments the value. Why? So let's say re increment 50 every time we did look the increment 50 and we we process again. So initially we have y as 100. Now the wife becomes 1 50 So our next Centrepoint now would be from 101 50 and so on in support until we reached the 10. Which means that until we draw 10 circles, then it will exit the look okay. And then, of course, we have here the transaction commit, so that is all good. So that's about it. Let me just do something up here and now we can try these in AutoCAD. Let me save our project. We just close this God first. Before we do a build. No, we can do a rebuild. Okay, let's open. AutoCAD. All right, let us load our plug in now. Net load. Then select our plugging. Click on Always slowed. Now we should have the draw circles vert method draw. Let's let's start first with the draw circle. The 1st 1 that we created earlier. Yeah, these our circle. All right, now let's run our draw Circle Draw circles. Bert. So observed the behaviour. There you go. See that? So this is how it works. Every time we do the loop it it increments the value. Why? By 50. That's why the center point here from the first circle that we created to the next one, it increments by 50 until it reached the the 10th circular. So that's how easy it is to create multiple objects. Just, ah, enclosed the the code to create in a four loop and then make the the Y or X coordinate variable and increments every time you do a look. Okay? Give this a try and see how it goes. In the next video, we're going to draw a circles horizontal. So instead, off going up will go to the right by just doing a minor tweak on this coat. And we have a different function altogether. Okay? And see you in the next video. 30. Section 4 - Creating DrawCirclesHor Method: Okay, so now let us great another method. Let's go. Let's copy this method here and then just paste paste it down below. So the method that they were going to create is to draw circles multiple circles horizontally to the right. So let us change these method name Teoh. Let's just say horror por horizontal. So you probably no already were to change. The only the only thing that needs to be changed here is the X coordinate. So instead of making the y s the variable that we increment every time we do on a loop iteration, it is the extent meaning to change. So to do that, we have to change the variable white to the X. Okay. And which means that we will keep the 100 for the white cord in it. And this is where we do the increments every time we do an inauguration. So which means that we change this white two x, So that's about it Now. We can just changed the text here droving horizontal circles and that's it. Now we have a new method that draws a circle to the right that the save our project and do a rebuild. Let's open up! AutoCAD! And now we can load our plugging. Okay, so draw circles. Horizontal. This one here. There you go, Zoom extents. There it is. Let's try our draw circles. Vertical. Yeah. So let me show you one more thing. Let's say we want to change the color of the circle every time it draws a new one. Let me just close these over. So what we can do is let's just great another variable here. Let's say I call her us into your also. Let's initialize it to one. And then we chased the color c ir that color index. It was eye color. So the first circle will be red in color because off our initialization value here, which is one and then every iteration we have to also increment the I collar equals I call her plus one. So the next run it will be too, which is yellow. The next iteration would be three, which is green and so on and so forth. So let us save our project and do another rebuild destroyed at in the sky. Okay, lets better slowed our plug in. Okay, let's try now the let's just try toe vertical circles first. So these our circles No, let's do the draw. Circles. Horizontal. There you go. Okay, So that's it for our, uh, draw. Stryker methods play around with this method here, are greater own and try doing some other properties and up served the outcome. Okay, that's it. And as here in the next video, 31. Section 5 - Manipulating AutocAD Objects Overview: Hello and welcome to section five of these course manipulating AutoCAD objects. In this section, we will learn how to program the common editing God commands that we use every day. Using BB definite, we will create a method about copying an object For these particular function. We will create two methods. One is for copying a single object and another one is copying multiple objects. We will also create a method to erase an object. He will create the separate method to move an object who will also create a method for mirroring an object as well as grating a method to retain on object and to scale and object . And lastly, we learned how to offset on object. So brace yourself up and let's grade our first copy method in the next video. I'll see you there. 32. Section 5 - Creating the Project: All right. So let us now create a project to manipulate AutoCAD objects. Open up your visual studio 2019 and select the Create a new project from these templates and select the language. Visual Basic at the bottom and search for blessed library. This is what we need. Class Library that net Framework Week on next. Let's let's call these as manipulate objects. This is our father location. Choose Death net framework 4.7 point two and click on. Great. Okay, So here is our new project manipulate objects. The very first thing that we should do is to reference the AutoCAD assemblies directly gone references here and select on ad reference and browse poor those three autocad. That net assemblies is the 1st 1 here A, c, d, B and D and A C Corps mgt. So, as usual, this is these are all located in the AutoCAD installation folder. So whatever version you have just searched for it in this particular education and searched these three d identifies. Okay. Next, we should change this. Properties said things off. Copy local. Too false. That should apply to all the three of them. Good. Next One A's. We need to import the different name, it's basis or libraries. So the 1st 1 is off the desk that autocad that application services. Next, we will be needing the database services and also the Dio mystery as well as the Autodesk that run time. This is for messaging. All right, So I know that we have our project set up. We can start creating our methods. So in the next video, we will start creating our first copy method, so and see you there. 33. Section 5 - Creating Singlecopy Method: All right, let us know. Create our first method. So let's call our method single copy. In this method, we will basically create a new object, a circle object. Then we will copy that object and change some of its properties, like the radios and the color. So let's get going. It s called The command. Mattered as a single copy. Also same thing. So I I hope that you still recall from the previous videos the variables that we need. So the 1st 1 is the document objects so deem dark. US document equals application. That document manager that M v I active documents. We also need the database objects, so deem db US database equals derive it from the document. Object the database. Okay, so next we need to create a transaction. So using drones as Terence section you can. This is just our variable for the transaction. So you can change this name however you want. Okay. And that should be coming from the database transaction manager and we start the procession . All right, so what is the next ah, step that we should do, like with the air handling? Ah, construct. So we need to great a try catch block, although on that mandatory, but just reiterating that it is a good practice to have these Try catch, block a shoe developed complex applications. This will be very, very useful. So let us first handle the exception if we encounter some error. So to do that, we can just use the document object and the editor Then write message that just say air encountered. You can create your own message here and then give the yusor the error that be encountered . What is that? Error? And then we have to roll back the transaction. Part two aboard. Okay. All right. So we're good at this exception handling. Now we can focus on creating our method to go ahead with our single copy. But first, what is the variable that we need to have? We need to have access to the block table. So let's call that as BT has blocked table and BT should be equals to the transaction that get object and from the database object, it should be the block table I d and ah, mode for open mode that for reading next, we need to have a handle for the block table record so dim. BTR US block table record and that should be equal to the transaction that gets object in our parameters. Cereal be the block table with a string up the table record that modern space. Since we're doing this in the model space and this time, the open mode would be for writing. Okay, so now that we have these block, table and block table record, we can now create a our object. So let's create a circle. Let me just put a comment here. Great. A circle that keys at the 23 These the center point of the circuit with the radios off 4.25 . So you still do you still recall how to create a stricken? Were they using construct? They just use the using, and then this school is a circle us new circle. So now that we have declared a circle variable as a new circle weekend, I we specify the properties of these circles. So let as specified, district the circles CenterPoint that would be center because new point A. Three D, that could be at 23 right to three zeros hours. That and then the radius would be the quality is too poor. 0.25. That's what we specified here. Okay, so do you snow our circle object. We can then upend that object into our the table record. And of course, now we should add into the transaction. Okay. Mixed. This is now where the copy command comes in. So, basically, we just created our first circle, and we will copy the circle into a new circle object. Let's just create a comment here. Great. A copy of the circle and change is, uh, radios and color. So how can we copy a circular? We need to declare a new variable that will store the new object or the new circle that we're going to copy. So let us call this as see I alone or circle clone a sneer circuit. No, we can change the property of the Now we can clone the previous object here. This the Oregon A circle that we created. Okay, so the C I clone would be equal to circle that clone to this. So now the Serie A clone and the circle has the same properties. Also at two and three. Center point and with a radius of 4.25 but we're going to change the radios in the color of this newly created circuit. So all we have to do is see, I cloned that radius, Let's say changed it to one and changed the caller to read. That's it. And of course, we have to add to the transaction in append into the dark table record to see I clone Trance that, uh, new created object, see, like blown and then true. Okay. And of course, make sure that you don't forget to commit the transaction. Otherwise it will be graded. Okay, so let's review our code and we can trade in other goods. So we created a method called single copy with the same command method, a single copy as well, and then declare our document variables in the database. We created our transaction. That's where less our try catch block for any air that we might encounter. We can handle it here. Then it s a usual ah process. We have to declare a table record and also the block table. And then we created our circle objects. Then after that, we cloned it to a new circle and change the properties of the new circuit and re committed our transaction. So let us save our project. And before I forget in In the Build menu, check on configuration manager. African bees. A peep solution platform dropped down. Released the X 64 If you have a 64 bit operating system for Windows seven to hire version Windows 10 that's uses X 64. OK, so we don't encounter the error during the build. So let's do a build. All right, the build succeeded. So now we can load this in AutoCAD. It's open about the clad and type in that load so we can load our plugging that this browse for our project. So this is the project that we created. It should be in the bin folder X 60 poor. And this is the deal that we want. Click on, Always slowed. All right, so we should know, Have a command called single copy. Very. Go enter that the zoom extents. All right, So these are our Oregon in circle with a radios off. 4.5. Yet 4.25. And the center point is a tooth three. And this is our clone. Copy with the radios off one Centrepoint. Same us. The Redina circle in the calories red. All right, so that's how you do a copy. You seem to be that. So give this a try. Do some changes on the co ordinates radius on some of the properties and see how it goes. Okay. In the next video, we will create another version off copy, but it will be copying multiple objects. I'll see you there. 34. Section 5 - Creating Multiplecopy Method: let us continue building our methods in our manipulate objects project. So in this lesson, we're going to great a method that copies multiple objects so we can make use of these existing method that we have here. We just do some changes on some part of the code specifically is somewhere in this area. So let's do a copy of this code block here, then based it that the bottom. Now, let's change these method name too. Most people copy if you can reuse some of the existing methods, it can save you lots of time, so make the most of it. All right, so the objective is to copy multiple objects. Now that we have already created a circle here, we will do our changes in this section of the code. So let me just rename this variable Teoh. I see one and then change this existing viable to see one. At this time, we're going to start from the 00 Assauer. CenterPoint, let's get rid of these comment here. So whatever variable changes that we've done, it has to be applied to all the occurrence of this variable. Okay, let us increase the radius to five and now we have our first circuit. Next let us also create another circuit. So let me just closed this one here. Good treat of these just to make the code more cleaner. Now we That's great that the next circle also doing the they're using construct. So see to us, Circo, it was near a circuit. Now let's ah provide some of the seat to properties. The center would be new 0.3 d. We'll do the same radio Centrepoint at 00 and then the radius. That's Ah create a bigger circle this time. And now we can a pent and add into the transaction the seat to and see. Okay, Next, we're going to create a collection object. Then we will add the C one and C two into that collection. Then once we have the collection, we're going to look through in that collection and create a new object out of those objects from the collection. So to do that, we have to declare a variable as DB object collection. So that's Dimension or B J. Let me call that call s collection. They be object collection. It's one here Waas new baby object collection. So Now that we have the call, all we have to do is called the ad method and then add the objects, the Stryker. So we added the 1st 1 that's at the second circuit. Okay, so now we have this collection object. So how can we, uh, look through the this collection object? So, for for us to iterate in the collection, we need a a function called for each. Let's call that a C and for AutoCAD entity as entity in collection. So, basically, for each object in this collection, we're going to copy the object. So to do that, we need a variable that can store those new objects that they were going to create. So we have to declare an entity as empathy. And then our end would be a C and that clone. Basically, we're cloning this object into the A C into the anti mean, But there is a function in visual basic too. Make sure that you are casting it the correct data type. So it is cold us a tri cast. Then we just have to custody into an entity object. Something like that. Okay, so now that we have a new entity we cannot change the the properties of these entity. That's a change. The color to read. Then we need to move a little bit to the right just to make sure that we see what we have copied rather than on the same CenterPoint. So we can do that by using the transform by method. It's also built in in the entity object transformed by then, this time we're going to use the Matrix three D that there is a method called displacement . And then we specified a new location or the new victor location. So in this method there, there are four overloads. We're going to use the these four overload with the X and Y and Zed Gordon. So we basically just moved 20 units to the right. So the white still zero and the set still zero, and that's it. So all we need to do now is to add or a pen into the block table, record this entity. And then, of course, we had to add into the procession. Okay, then we have committed here the transaction. All right, so that's about it. We can build our code and then tried in. Otherwise, let me save our project and then do another build. Okay, we have here succeeded. So let us now allowed in AutoCAD net load. These are plug in. We can always load now. We should have a new method called multiple copy. Here you go. Zoom extents. Yep. So these are our two circles. Then we copied. We added the two circles in a collection object. Then we we looked through the collection, and then we copy each object and then move it 20 units to the right and then change the color to red. All right, so this is no the results. So in this lesson, we learned how to make use of existing method and then just do some ah, tricking or changes on the code. But preserving the boiler plates. And then we come up with, Ah, these results here by copying those two objects from within the collection. All right, so give this a try, do some changes on the displacement or the location, and that's where the US maybe add more objects from the India collection and then look through the collection. Object. Okay, so I'll see you in the next video. 35. Section 6 - Creating Eraseobject Method: welcome back in this video, we're going to create another method called erase Object. So the objective is basically we're going to create one Pollan object and then at the same time, we're going to erased the object. So let's create our new method. It's called that as raise objects, especially by our command method here as a raise object this well next, let's just go through the same 13 create the application object. Then let's create our database. Let's start our two inception. That should be be be the transaction manager than start concession. And then let's create our try catch block. It's copies over here. All right, now let us great the black people record. I'm in the block people and then bothered by duck table record later on, get object db that luck table I d open mode that for Faried. Then let us create our block table record. That should be that should be equals Two trance that get the object. Then we derived from the table. Create the model space open mode that for writing. Okay, now let us create a Polin object. You seeing pl az Polly line Quest New Polly line. It's ah start adding, the Vergis is advert text, let's say from the movies, the first verdict. So should be Index zero. And then it's new 00.2 D that's just used the lightweight poorly Line two and four and then the budget. Zero start with zero and zero. Then you can just copy these multiple times. It's just great. A three Vertex Polly Lane and this is the second veritext say for two and then 64 Okay, And then, of course, we have to upend into the block table record and add into the reception. Now I would like to introduce one command that's coming from our document object. It's basically sending a command and AutoCAD command into the command prompt. So that is called the that send string to execute. And let's use the zoom. This death here in the underscore means that we're going to use the native AutoCAD command so regardless whether it's ah, redefine to behave as a different function, when will always be getting the same behavior for the zoom. So zoom extents and then space here and then the coat. Then that's just ah, especially if I These are all Boolean parameters. It's just all specify a sports false and false, and then let's do a region that region. Okay, so now we have added the pollen object. This is the object that we're going to erase. So the the method to do that is basically just pl that it is, and that's it. However, before we do the erase, let's just provide the use or some kind of message so we can use the application that show other dialogue l a saying the newly added Polly late. So this will show us a dialog box. I would like to introduce to you as well another way up providing message to the user using the, uh that that message box functionality the baby that that message box nationality. And then, let's say just copy it's over. And the good thing with using the message boxes that we can provide some extra icon like baby, that's a critical because this is believing on object. And then we can add a bottom. Let's say you can choose between baby OK or OK, cancel or just okay only, and then you can provide Ah, the dialogue or the alert box with a title. Let's just provide here object. Okay, so that's about it. We can now build this code and run it in AutoCAD. But before we do that, we don't have to forget committing the transaction. Otherwise, even though we we erase it here if we don't commit, it won't get erased. Okay, But before I do that, let us see first, what is the the polling that we have drawn and as well as see this message is here. So let us comment out these rays first let the save our project and do a rebuild. All right? Successful. So let us load in AutoCAD Where is O R? Ah, Polly line? Yeah, we haven't actually run our methods, so let me do that now A raise object. So these our message This is the 1st 1 click on. OK, and this is the message box. See these critical icon here and there? VB okay on Lee and the title, this looks much better. And you know this the send command here send string to execute Zoom in. I mean, zoom extents these our poli line. Okay, let me erase these and let's do it again One more time. Today's object and there it is Now, I would like to un comment these line up good here and then let us save. But before I build, let me just close AutoCAD. Then do another rebuild. Okay? And let's open about a crowd again. All right, let's slowed the updated code. So this time, if we execute the erase object, expected results would be the pollen that we just created will not be existing because we already deleted it. Okay, there you go. So we zoom extents, and there's nothing because this line of code already executed and we committed a transaction, and that's it. All right, so that's about for the erase object you might be asking, Why is that? We're only, ah, playing with the object that we're creating and not selecting objects from from the existing drawing. We will actually do that when we reach the selection, said a section we will have lots off methods there and play around with all those, uh, functionalities. So that thing object and doing many, uh, functions out of those selected objects. Okay, so in the next video, we're going to create a method to move an object. I'll see you there 36. Section 5 - Creating Moveobject Method: let us now create a new method called move object. Public sub move objects. Common method would be the same. All right, so now let us just copy these over starting from the documents object Teoh here and then just clean up the code. Let us get freed up this part here. All right, so, no, we have, uh, the boilerplate code next weekend. Create our object. So let's say we create a circle. Then we will move that circle using a vector to to another location. So that's start doing it. Now let's say we create a circle again, a circuit that's called that a C one course near circle. And let's specify the center point new 0.3 D at, Let's say two, two and zero, then our radios. It's just 0.5 small one. Then we are going to create a new location or a new displacement where we want to move our circle into so we will create a start point. That's call that as start point, this 0.3 D, that would serve as our start point when you move an object in the Togadia to click on the start point, and then the location. So new 0.3 D that started from 00 Then we defined Ah, destination the vector. So that's call that as desk vector as vector three D. So we can derive from the starting point that we created. And then we use the method as they get vector to, which is a new 0.3 d. It's just moving too. 200 And then we can now use the built in method from the circle object Many scholars transformed by. And then we can use the Matrix Treaty glass that has this displacement method. And then we specified, Ah, destination vector. This one here and that's it. And now we add into re offend into the table record, see one and then add into the to a session. Okay, but then we have already the commit here, so we're good, and that's about it. That a save our project. And let me just close AutoCAD first before we do a rebuild. Okay? And let us now reopen back. AutoCAD let us load our plugging. Okay, so now we should have a new method called move. Object. Okay, zoom extents do a region. So let us check the center point we know have X equals four. And why it was too the reason for that. Waas, our code we have started. I mean, we draw our circle in this. Scored in eight here in the center point from two and the wise to. And then we moved two units to the right. That's why it became four. And then the why we just move also to we did not incriminate the why so which means that it stays at the white location. So these now becomes 4 to 0. That is the center of the circuit port two and zero. Okay, So when you are doing a movie, use these Ah, method here the displacement by defining the vector first in reference to the starting point that you create. All right, give this a try and see how it goes. Play around with the co ordinates. Even with this circle properties and see in the next video, we're going to great a method to mirror a Poland so and see you there 37. Section 5 - Creating Mirrorobject Method: moving on in this video, we're going to create a new method called mirror Object. So the objective of our method is to create a holy line. Then we really mirror that Polly line in certain plane or direction, and then we will transform. We will use the transform by method and using the Matrix Treaty that mirroring function. So let's get started. Let me just copy this over. And then he would just modify the code within it. Let me call this s meter object. And then that's removed. Just go that we don't need. And now we have here the the boilerplate or the needed variables with the transaction and try catch bluff. Okay, so let us create our poli line. So we do that using pl as Polly line. It was new politics. Now we can start adding vertex uh, Vertex ad. So these the first Vertex. It starts with zero index and then new point two D. Let's start from coordinate 11 and then balls zero start treaty zero and end with zero and we need to create a few more Vertex s. So let's just cos over, okay, Maybe too much. All right, so the second Vertex we have is but the location off three and zero when the third Vertex will be. Ah, location 51 And the fourth. Vertex should be the location. Five to the fifth. Vertex would be at the location for two. And the sixth Vertex or the seven hopes we missed here. Therefore. So this is the sixth Vertex would be at, to to and our last Vertex would be one to No, let's create a bulge in this party line by using the set bulge at method. Let's create a bulge at the fifth Vertex with the ball size as negative one. And then we close our party line used the pier that closed. This one here equals true. Okay, next Shoo, shoo! All we need to upend into our block table record and add into the transaction. So that is our, uh, pollen that serves us our original object to be mirrored. Next, let us create a new Polly line That will be the mirrored Poland based on on this. What do you get the point of that? Here, let me call that a spear mirror. As Polly line equals, what do we need to do to copy their object. It is the clone method, right? So we cloned this poll align, and it started in the peel mirror. Let me just change the color of these two two blue so that we can identify easily. Next. We need to defined the the point where we need to to Assad reference for our mirror line. So let me call that as point from thus, 0.3 d equals new 0.3 D. Let's do it from 03 and zero and then let's create the to, from and to two point as a 2.0.3 d equals. Can you 0.3 d? And it should be at 53 and zero. No, we need to draw a line based on these two points. So to do that, let us deem Ln as line three d equals new line three D, that would be these two points so point from two point to Okay, next. This is where we're going to do the mirror. So pl mirror Uh, excuse me. That transformed by using the matrix three d that meter mirroring method and that our line will be this line here, the one that we defined based on these two points, okay? And of course, we had to add into our block table record the pl mirror and adding through our reception. All right? And we have here to commit, so we're good, and that's about it for our mirror object method. Okay, so let's see how these works. Let me just save our project and do a build. Okay? Succeeded. Now, let us open our God. It does no load our plugging. We can always slowed. Now we have We should have a new method called mirror object. There you go. It's the CEO. It goes zoom extents. Yet now these our object. So this is the original object. Then we have a line from somewhere here to here that we mirrored this object to here, and then we change the color. Okay, so that is how mirroring work. So give this a try. Play around with the coordinates and as well as the the line that's being used to mirror the objects and see what's the result would be games. All right. So in the next video, we're going to create a method to rotate on object. I'll see you there 38. Section 5 - Creating Rotateobject Method: welcome back. Know that we have created quite a number of methods. There are a few more that we need to add. So in this video, we're going to great a method called rotate object. So we will be using the same poll. Align us what we've done here for the mirror objects. Let me just copied is called luck here and based it at the bottom. Let me rename this to irritates object and we will use the same very DSS for the poly line . Except that I would like to make one minor change. Here we will create the bulge at the Vertex number five, which is this one here so that the bugs will be at the meeting and this cold black we won't be needing. So let's get through the bees. And now this is where we're going to create our goat for me. Uh, rotating an object. So the first thing that we need to do is great. A variable Assume it s a matrix treaty that will serve as our, uh, current UCS. So let's let's call that as a team current UCS matrix as matrix three d, It was dark. That addict are the current you see s coordinate system. Now let us create a variable for our coordinate system. Three D That's cool that as deem current UCS co ordinate system three D, that would be quest to the current UCS matrix here that coordinate system three D And now we can use the the transformed by in the pl a method. So pl that transformed by we will use the matrix three d that rotation method. And then we specified the angle double, which is the angle here is in radiance. So we're going to rotate this Polly line 90 degrees positive 90 degrees. So the equivalent for 90 degrees in radiance is 1.5 708 and then the access will be our current juiciest that is that access and then the center as 0.3 d will be new 0.3 d one one and zero. So basically, this is that our reference these our reference time. When we do a rotate, we select this object and you click on the base point of rotation in the direction. Then we have added or upended into the block table record and added into the transaction, and we committed the transaction object. Okay, so I think these snow done, and we can give it a try. Let me just save our project and do a rebuild then So let us load our plugging in. AutoCAD, This is our plug in. We should now have a method called birthdate object. Okay, go. That the zoom extents yet? So these our object Originally, when we created this object, the position is let me extradited back to the original position. We used these, these our starting point. So let us rotated back to, uh to 70 degrees. Basically, we are reversing the rotation that we've done earlier. So these our regional object and then we used the the transformed by from this point basically really rotated 90 degrees is the point of reference. This this is 11? Yes, that's the co ordinate. So from here, we rotate 90 degrees, so irritate this object. And then I picked this one is our irritation point and drug. 90 degrees. That is the results. Okay, so try this one out, do some changes on the rotation and also the base point, and see how the rotation goes. All right, so in the next video, we're going to create another method called scale object. So see you there 39. Section 5 - Creating Scaleobject Method: in this video, we're going to create a new method called scale object. So the objective of this method is to basically ah, great a poli line and then scale that Pauline into have a size based on the reference point . So to do that, we will make use off these existing method here because we will need this pollen object. So let us copies good over. Put it at the bottom. Let's just rename this one too. Scale object. And we all need this part of the code. Except this one here. Okay, so now we have the police line. All that needs to be done here is one single line of code. So to do that, we are going to use the transformed by method on the Pollan object. And then based on the matrix three d class, there is a method called scaling down here. And then we just have to specify the parameters. So the scale that we're going to do is to reduce the size to its half a size, so we need to provide his 0.5 and then the reference point where we're doing, we're doing this scaling. So that would be from the the 00 That is our base reference point. And that's it. So we checked the code here we have all the same. Ah, boilerplate code document database transaction and try catch block. Black people and black people record we have our existing poorly line here. And then all we need to do is provide this single lined up code, and that should be good. That a save our project and do a do a rebuild. Okay, succeeded. Now let us load in autocad and see how it goes. Net load. There are plug in and then click on. Always slowed. Now we should have a method called scale object. There you go, zoom extents. This is our object. Okay, so you might know these that let us just check this one first. They should be now 0.5 point five. Based on our code, it is from 11 is our co ordinates. And then our second court. And it is Theis one here, 30 And now it should be 1.5 and zero. And this one here the third Vertex reaches 51 If we know I d that point, we have 2.5 point five, so everything was reduced into half. Okay, so that's how straightforward is the skating method works. All you have to do is specify the size and then the reference point, and that's it. So give this a try. Play around with the Vertex is as well as the the scaling factor and the reference point and see how it goes. All right, so there is one more method that we're going to create. We would be creating a upset object method and see you in the next video. 40. Section 5 - Creating Offsetobject Method: Okay. Welcome back in this video, we're going to create our last method for these section the method that we're going to create. It's called Offset Object. So let's get started. It will still be using the same poll. Align us. What reviews from the previous methods. So that may just capitalise could over and renamed the method to offset object. Okay, let us get read off these line of code here to do the scaling. And now we have a good base. We have a good code base to work on. So the next thing we should do is to upset the Poly line a given distance. How we should do that. We need to create a collection. So let me just call that as called the B collection object. So we've used this before and we are going to use the get offset curbs method and we specify here the officer distance. Let's just use the 0.25. Okay? And now all we need to do is basically loop through our step through the new objects created in the collection. So we used that using the four. Which statement? As NPP in collection. Okay. No. All we need to do is add the the entity into oh are love table record and also had into the reception on. We can also change the color off the nearly opposite ID object. It's just change the color index to yellow so that we can see the the difference from based on the original objects, the object and nearly upstate object. So this is it for the upset object method that is to a bill. Mercedes went first and let us open. Let us know load our plugging now we should have a method called offset Object This one here, zoom extents. Here you go. So this is our original object and this is the opposite. That object. It's just the a few lines of code that we've added and we have a new object created based on this method. Get upset curves. All right, so give this a try, play around with the the upset value here, and chase the properties and see how it goes. So this is the last method for this section. Congratulations for reaching this far, but we still have a lot of topics to covered to be covered. So I'll see you in the next section 41. Section 6 - Object Dictionaries Overview: Hello and welcome to Section six of these course. In this section, we will be exploring layers, line types and Texas styles. So for the layers, we will be creating a method to list all the drawings. I mean, list all the layers in the drawing. We will create a method too great a new layer. Also, we will create a method to update an existing layer. You will also have a separate method for turning the layer on and off, as well as freezing in throwing the layer and also a separate method for deleting layer and setting a layer to object for the line. Types will basically be doing the same thing for the layers, like listing all the line types that are active in the drawing. We lost to load a new line type. We will create a the method to set the current line type, and also I will create a method to delete a land type as well as, ah, a new method for setting a anti land type to an object and for the text styles, we will also be doing the same thing. We will extract all the text styles in the drawing and leased to the user. We will create a method to update the current the Textile Fund. You will also have a method for setting a textile, Karen, and a separate method to set the textile to an object. So in the next video, we're going to start exploring the layers. I'd see you there. 42. Section 6 - Create New Project: all right, We'll come back in this video. We're going to create a new project for the layers land types and textiles. So open up your visual studio 2019 and let's create a new project. Let us choose the language as visual basic and search for library and choose the class library that net framework next. So these our project location, you can choose any folder locations you want. And let's call this project. Name us the years nine types and styles and then create. All right now, the first thing that we should do us, Samos, the previous projects that we have created, we need to reference the AutoCAD deals. So right, click on the references and right for this, and let a search for I mean let us brows. So depending on your autocad installation, you can find these three files under the program file five smolder at the desk and AutoCAD 2019. In my case, if you have ah, deeper integration, then you can just search for that for their location and searched for a CDB and beauty and a CMG as well as a Psi corps mgt. Make Okay, So now we have those three references here. And the next thing that we should do is change the copy Local attribute from true two. False. So we don't need to copy all of these libraries when we compile our code. All right, now that we have all the required references, we can now import into our project application services. Other one is database services. Another one, if you recall, is the the runtime services. We will also be needing the geometry, so that's also important geometry. And another one is the the colors. We will be needing this when we create a layer and we can specify the colors off the layer . So these air all the the name spaces that we need Now we can start creating a new project. I mean, ah, new classes. So let me just great a new class board layer. It's called Jesus Layers glass. And this will be our class for all the methods for the layers. We don't need the class one B b, but I need all these imports here. So let's just copied is over and based basted in our based in our layer of plus. Okay, so let me just delete this class one. All right, So now we were ready to great our new methods for the layers. So now that we have our project, we will be using this project to create all the methods for layers, land types and styles. So in the next video, we'll start creating our first layer method called list layers. I'll see you there. 43. Section 6 - Creating ListLayers Method: welcome back. So now let us great our first layer method. Let's call these least layers that has specified that command method ast least layers as well. Okay, so the first thing that we should do is to have a hold off the document object. So to do that, we need t create a variable using the Dean Kamen deem dark as document equals application. That document manager that MD I active document. And the next thing we should do is get hold off the database object so we can do that by declaring another variable called DB as later base that would be equal to the document object. That database okay, next is to create a transaction so we can do that by using the using statement. So using trance assed reception that would be equal two db dot to a section manager, then start intersection next. Since we are, uh, extracting the layers. So we need to declare a layer table of variable so we'll do that by declaring a new variable. Let's just call this US Elway tub for layer table, so that would be equal to layer table, which we can get from the transaction object get the object and the object idea would be coming from the database that layer table I D. And the second parameter is the mode would be open mode before reading. Since we're just reading the layers. Okay, so with with this variable that we have, we can have extract all the layers in the drawing so we can do that by creating a for each loop. So for each Ah, let's call this L A y i d as object I d in the layer table. So this simply means that for for each object i d which we specify us l Y i d in the layer table in here, we're going to extract the layers. So to do that Samos the block table, we have to create a leered layer table record like in the block table. We create the block table record. So that is the same concept as the layer table record. So we can do that by creating a new variable. That's just call. This is L A Y d r for layer table record US layer table record, and that would be equal to the intrasection that get object and our object. I D Now would be this L A y i d. In the open mode would be for reading this Well, so now that we have this ah, layer table record in our l y t are variable, we can access all the properties and methods of the layer table record. But all we need to do is to display or list all the layers in the command prompt. So we can do that by using the editor object that will be coming from the dock. So basically, Doctor, that editor, that right message and we can create here BB line feed, and we specified a layer name that would be equal to the l Y t r. Despite able here that name and that's it. And we can just commit the transaction. In our previous methods, we created a try catch block to capture whatever ever that we might encounter. So I leave it up to you to create it when you are doing this project. Okay. So let as save our glass and let's do a build. All right. The build is complete, but we have these ah, warning message again. So remember fixing this, we just have to go to the build menu here, click on configuration manager and select for the active solution platform. Click on New. We will be using the the 64 Bit. Okay. And Lincoln. Okay, here. Now we have all the ah, 64 bit in the platform so we can close this and we can do another rebuild. All those whining messages should now disappear. All right, one succeeded. So now we can load our plugging into autocad That's open about the hot here. That step in and that load. So let the search for our DLL file. So these our folder location, their slant types and styles and being folder select the X 64 the bug and these our plugging. Okay, you should know. Have a least the layer. Hollande. I think there is an error here. Unable to load. Okay, let me check this one. Okay. I found the problem. It was an issue with the auto part that was currently open, so I just close it and I'll open a new one again. Then we can load our plugging. So this is our our plug in from this folder location. Now we should have a method called list layers with us tried at. There you go. So these are all the layers in this drawing. They're zero d view in those text lighting and power and all this. So if we double check if you're typing layer, these are all the layers. Okay, So with our code, we were able to extract all the layers. All we need to do is get a hold off the layer table, then create a layer table record. And then we looked through the collection off the layer table and assigned to the l Y T are variable. And with this variable name way have access to all these l Y T R properties. You can even try and list out some of the layer properties like the anything that you want to display. Okay, so I leave it to you to play around with this one. So that's about it for this video. In the next video, it will be creating a method to create a layer. I'd see you there 44. Section 6 - Creating CreateLayer Method: welcome back in our next video tutorial, we're going to create a method to create a new layer. So let's get started. Let's call this method as create layer. And so the command method is so great player. So we would be using the same, uh, something. That's what we've done for the least. Layer, we need to have this BB object discovered that over. We also need to great a John suction. So that's copied is over. And then just the lead, the code that we don't need. So now we have the the scaffolding for our new method. No. Again, I start creating the logic for these method name here. So the objective is to create a new layer that doesn't exist yet in the out to God layer database. The layer that we're going to create is we just put the comment here great and new player called Ah misc for miscellaneous. So the very first thing that we should do is to validate if this layer already exists. So you remember this one here. We need to have a hold off the layer table so we can do that by using an if statement. So if from L. White Tab has the layer misc then. Well, basically, just inform the user that the layer already exists. So we can do that by using the dock. That editor, the right message. This a layer already exist, and then we abort the transaction. All right? So, however, if the layer doesn't exist yet, we can put here an else statement. These is no. We read the code to create a new layer so we can do that by first opening up the layer table to upgrade open this one here because we are changing the database were basically adding a new ah layer table a new layer table record. So no, we need to create a viable that will hold layer table records So we can do that by let's say lt are their table record us at white tr Samos the previous one here as, uh, layer PayPal record equals new layer table record case? No, we can specify the name off the layer, so l Y t r that name. That would be equal to misc because these the layer name that we're going to create and then it can specify the color. So these where we can use the color name is space here. We can do that by typing in caller that from that's just the from color index. Then call our method that by layer. And then we specify the color index number, which is the red We just one okay. And now we need to add the slayer table record into the layer table. So we do that by typing in l Y tab the ad and white T r. And of course, we had to add also in the just suction that is the newly created DB object. And we have to make sure that you add in the transaction. Otherwise it wouldn't be effective. No, we can set the new layer as the current layer. So we can do that by using the db object that C layer, which is the current layer that would be coming from the all white tub, the misc, and then we can advice or informed a user Dad, the new layer waas created successfully. So layer that say and why tr that name Waas created successfully. And then, of course, we have the commission section here. Okay, so it's quite straightforward. All we need to do basically is open up the layer table and great a new variable for the layer table record and specified a layer. Properties like the name, the color and you can try some other properties here like land type and then added into the layer table and at in the transaction and said to be the current layer and displayed a message to due to the user. So let us save our project and do a rebuild succeeded. Now let us load in. Uppercut. Make sure that you have a new instance of AutoCAD you close the previous month and open a new one so that your latest code will be loaded properly. So let load and select the plug in. Always load. Now we should have to layer methods that we created. The 1st 1 is the least layers, and now the 2nd 1 is great layer. But before I execute that, let's first check if there is a Miss Claire already. So there is no miss clear. So once we run our plugging, we should see another layer called MISC. In here it's close. These and ah, great layer. There you go. So great layer layer, Miss squads grated successfully. So we checked. Now the layer we have the misc which is no the current layer with the color off red. Okay, so play around with this. Tried to specify some other properties and see how it goes in the next video. We're going to create another method to update the existing layer and see you, Dick. 45. Section 6 - Creating UpdateLayer Method: Okay. Welcome back. Let us continue building methods for our layers class. In this video, we're going to create a method called update layer. So the objective is basically to update the layer that we created from this method. We will be changing the color from the red two yellow, and it will also be changing the line type from continues to hidden. So let us start building our method. Let us call this as update layer. Our common method should be the same date layer as well. So let us copy it is over. It's just the same variable declaration that we need and also the transaction and of course , the end of the transaction. Okay, Now, I would like to introduce here again the try catch black because we will be changing the layer properties. So when you are doing some modification, it is always good practice to provide a try. Cuts blocked just in case you encounter some error. So at least you see what's Ah, what's their message? So if there's an exception or there's an error, we just ah, displayed to the user, uh, care of us encountered, and we displayed the message of the air and then we abort the transaction. Okay? Next, we need to create a variable for our layer table, which means that we can just copy this one here, or I suggest you type it yourself so that you can be more accustomed to typing the code. So know that we have the variable for our layer table. We need to find ah, layer misc. And once we find it once, once we found ah miss player than we can changed the properties. So to do that, we have to luke through the layer collection. So we will be using the for each l a y i d. As object i d. This is the same thing that we've done for the list layer in in the white tab. And then, of course, we need to create a variable for the layer table record. So deem l white you are us layer table record that would be quizzed the transaction that get object, get object and our object Heidi would be the l. Why I d this one here. And then that would be open mode for reading. All right. Know that we have the layer table record. We cannot find the name based on on these variable here. So if l a Y t r that name equals misc then really changed the misc layer properties, so the color and line type else. So since we are doing a looping for all the layers in the table in the layer table. So in our else statement, it's not a layer misc. Then we'll just basically ah, just great that on editor here and disputed the Yusor. Let's put the baby baby line feed first, and that's just escaping lier. It's just all about the user information, so at least that user knows what's happening while the program is running and that's it. So now if we find ah, if we found the layer misc what we need to do so since you are doing the upgrade, so we have to upgrade that open upgrade open, okay, and then now we can change the color, which we use the same thing for the color that from color index and then the color method by layer and the color would be yellow, which is to next. Since we are also changing the line type, we need to get hold off the line type table. So to do that same thing as the layer table, we can declare a variable to hold the line type. Let's call that lt tab because line type table that would be coming from the transaction object and then get object. And then the object i d would be the database, then the line type table I d in the open mode for Reid. Okay, So since we are interested in the hidden line type, we also need to validate the land type. So if ah lt tab that has he didn it was true. Then we can now apply the the new line type. So l a y t r that line pipe object, i d It would be equal to lt tab. He didn't. Okay, so that's just basically no, we have to, of course, commits the transaction. And we can ah display a message to the user that the dating out players compete. So completed. Updating layer L A Y t r. That name. Basically, we're saying here that we're done completing the I mean, we're done updating the layer name MISC Hope spending error here. Okay, so let's just do something clean up here. Let's get rid off all these extra spaces. Okay, So now we have three methods that the save our code and I'll have to close this AutoCAD first. Otherwise, it won't build our code. So let's do a rebuild. Okay, One succeeded. Let me open up to quit again very quickly. Okay? So let us load our plugging net load. These are plugging, so let's check the layer. There's no miss player. So before we execute our update layer command, we should create the layer first. So great layer. Nice. We should see the layer. Miss. Care already. Okay. No, we're changing the color from red to yellow and the land type from continues to hidden. Okay, so our command is called update layer. There you go. Let us see the messages. So s keeping layer is keeping layer than know that we found a misc. We've provided a message here. Completed abating. The layer misc No, Let's check the layer if it completes the update. Nice. So the layer now is yellow and the land type is hidden. So our code work. All right, so there is one more thing that I forgot here we can just add the exit for loop because if let's say we have lots of players, so all we need to find is the MISC. So once we found it, we applied these change of land type and color. Then we commit, and then we exit the loop already. We don't need to continue looping through the layer, although it's very fast. But still, we don't need to do extra processing for that. So that's about it. For updating a layer, just get hold of the layer table. And depending on which property you like to update in our case here, we have updated the line type. So we need to get the hold off the land type table as well. Okay, give this a try and see how it goes. I'll see you in the next video. 46. Section 6 - Creating LayerOnOff Method: Hello And welcome back in this video, we're going to create another method. This time we're going to set the layer on off. So I mean, the method that we're going to create is to set the layer off. So let's ah, get started. We can actually used this existing method here because all the line, of course that we will be needing are already here. So let me just copies over and then change the the method name accordingly. So this time let me just call these s said layer on off and that's a play the same for the method name. And we have the document object, the database, the transaction these air all needed. So this time of gold here, basically these where we need to change the property. So let me just get rid off all these. So now we have the this coupled ing or the template for the method that we need for turning on or turning off the layer. So we're looping to the layer collection here and once we find the misc layer, this is this the layer that we're going to to turn off. But if the MISC layer is current you can turn it off. So the first thing that we should do once we get the layer table here we should set the let's say, the layers here as the current layer that we can change the misc layers setting for on her off. So you remember to make the layers current that will be coming from the database object, then see layer, then in white tub would be there. Zero. So layer zero now is our current layer and now we are free to update any configuration for the layer misc. So the same thing We looked through the layer tub collection and we created a layer table record and we validate the layer name it's missed. Then we have to upgrade open, execute the upgrade, open methods so that we can modified properties of this layer. So all we need to do actually is l Y t R. That he's off. This one here equals true and that's it we need to do is commit the transaction and then, of course, changed these a message here. So let's say layer layer name has bean apps has being turned off and then we accept the for loop and for the else statement if we didn't found are we can make use of these or we can just maybe right here That layer not found. You can provide any message you want here. That in this case it would just display layer that found there and that found until it find the layer misc. Then this real been displayed. Anyway, just leave me that. See us this one here. So the only chase that we made on this method after these, this time of code here to set the layers heroes, the current layer. Then we execute the line of code to turn off the layer and chased the messages, sir. And that's it. Let me save our project and then do another hopes to be this close. This apricot do another rebuild. Okay. And then open up. Took out again. Okay, so net load select our plug in. So first let us check the layer. We don't have the layer misc so that that's great. The layer first by running the great layer method. Okay. You know, we have one here. Then we cannot turn it off. So you noticed that it is the current layer here, so by the time we run our new method of set layer on off the layers here will be the current and this one will be off. Okay, so let's do that Said layer on off. So the message is that we have here layer and that found and then MISC has been turned off to provide here some spacing enemy. So if we check on the layer now, the layers here is the current layer and the MISC player is now turned off. Okay, so that's how the the code works. All you have to do is provide this line of code here is off, equals true or is on equal strip. You want to turn it on? Is observers that I mean that is up equals false? If you want to turn it on, if you want to turn it up, then just sit too true. And that's the only chance that you need to do. Okay, So play around with this method. Give this a try and see how it goes in the next video. We're going to great and method to freeze the or thought a layer. Okay, I'll see you there 47. Section 6 - Creating LayerFrozenThaw Method: Okay, So in this video, we're going to create a method called set layer, frozen or thawed. Know that we have created a method here for turning off the layer. It actually behaves very similar, and all we need to do is one line of code. So let US copies method here and changed the common method named to set layer frozen for though, and then replace the sub name here and all we need all a code that we need are in this code block, but we have to change. Is this property here this method here, So instead off is off. Now it's called East Frozen and by changing to true or false, if it's true, then the layer will be frozen. If it's false, then the layers, though, so it's the same thing. Before we can make any changes to a specific player, it should not be the current layer. So we said that layers here here is the current and all we have to change here is the messaging has bean frozen, for example, because we are setting the it's frozen toe true here. So the message has to be frozen, and that's it. So once you have, Ah, single method. You can reuse the particular method and just change whatever the properties that you need to change here. Okay. So we can know Save our project. And we have ah, new method. Let's do a rebuild and we have one succeeded. Let us open up. Took it again. Okay, so that slowed our plugging. Same thing. We don't have the misc layer yet, so let us run and create layer there This yet. Okay, so we now have the layer here. So once we run our new method the set layer frozen or thaw. This, uh this there should be frozen here and the current layer should be zero. So let's try that said layer on off other said layer of frozen or thought This one here layer MISC has been frozen, so let us see layer zeros, the current layer and the misc no is frozen. All right, so that's how is it is to change the play around with the layer. I mean, chase the properties off the layer, so give these a try and maybe you can play around with the other layer names and see if they got frozen. You can try for multiple layers and see how it goes. All right, so in the next video, we're going to create another method to delete layer and and see a day. 48. Section 6 - Creating DeleteLayer Method: Hello and welcome back in this video, we're going to create another method called the Letelier. So the objective of this method is to deliver on existing layer. So I have already created here method with same command metal here. And then we can again make use off these existing code here. So that s copies over and based in our new method. And all we need to change is basically this line of code here. So the layer that we're going to delete is the layer MISC the one that we created from the previews, a method that we brun so same concept. We have to make sure that the layer to be deleted it's not the current layer. That's why we set the layers, the current layer 20 and then the same thing. We looked through the layer collection and then validate If the layer name is MISC, then we will do the deal it here. So to do that, it's just another one line of code. So l y t r dot and race, and that's it. And of course we have to change the messaging here. So that say, we have successfully deleted layer and why tr that name Just close that Brockett here and that's it. Okay, so by now you should already be very familiar. With how, how to ah, explore the layer help to extract the layer and how to modify or change the properties of the layer. And in this method, how to erase the layer so that I save our project and do a rebuild and able to delete the bother. Let's just do another rebuild. I think the autocad was not close properly but now it just worked. So let us open apart. But again, let's load our plug in and then that's great Our a layer misc first. So now we check it out We have the layer misc So once we run the delete layer command this layer MISC should be gone. Okay, so let's give it a try. Our common method is the delete layer. Okay, successfully deleted layer misc Let us see. Yep, there's Here is the current layer and layer MISC is gone so that's about it for deleting a layer. Once you have identified the layer name, then all you have to do is run this race method and that's it. Okay, in the next video, we're going to create another method called luck and unlock earlier. So I'll see you there 49. Section 6 - Creating LayerLockUnlock Method: Hello. I hope by now you are already very familiar with the layer methods. In this video, we're going to create another one called Locked On Lovelier. So we can make use off these existing code here and then just changed the name to luck. Uh, unloved layer. You might have already guessed. Where is the line? Of course, that needs to be changed. Yeah. So this time, of course, has to be changed. All we have to do now is ah find the method is locked and then changed to true or false. So which means that if it's true, then if we lock the layer, if it's supposed that it will unlock the layer and that's it. And chase the messaging. Of course, layer, your name has being look and that's it. So same same thing, same process. Great. All these documents, the variables created transaction great. A layer table and looked through the layer collection. And then find the layer name that you want to lock or unlock and then specified Ah, properties here. In our case, it's locked and that's it. That save our coat and do another build. Okay, so let us load our plug in. All right. So before we execute our new method to lock or unlock the layer, that's great. First layer. Yeah. Now we have the Miss Player. So once we run the luck on luck, layer, this Miss Claire will be locked here. So let's do that. The commander, we created its luck Unlock layer. So layer MISC has been luck. Let us see if it's really lucky. A go tip. So that's it. Play around with this gold and see if you can lock some layer. So in the next video, this will. That will be our final video for the layer. We're going to create another method to set the layer to an object, so I'll see you there. 50. Section 6 - Creating SetLayeToObject Method: hello and welcome back in this final method that we're going to create for the layer, we will be creating another method called set layer to object. So the objective is to basically assign a layer to a newly created land objects. So let's get started. That's just great. A new method called, said player to object. You really use the same common method. Name. Okay, This time, let's try to type again everything so you can just go along with me. The first thing is deem we have to declare a variable for a document object this document equals it's coming from the application. The document manicured that MD I active document and let's great another variable for the database that should be derived from the document, that database and they create the transaction. I hope by now you're already very accustomed to the sequence of commands. Once you are very, very familiar with the steps, it would be easier for the next methods that will be creating for the styles and land pipes . So now let us create another variable for the block table. It would be coming from the trance that get off, get the black idea will be from the database Black People I D and the open mode for Reid, the VTR as a block table record with equal to trance that get object. Our object idea is Bt and block table record that more than space and open mode for right? Yes, we're creating a new land object. Okay, so we need to create a points two points, start and end points for our line. Let me just call this a speedy one. This 10.3 D that's just to start from 00 Skopje's over and then chased the point to Let's make this to 101 100. And then we create a new line Object line equals new life from 0.12 point two, and that's it. Know that we have the line object here. All we need to do is great. A layer I mean, a sign of layer to the object. So l ended layer. That's a any layer from the existing object cabin three, for example, and then we need to do is append to the block table, record our newly created line object and add to the intersection. Then, of course, we need to commit the transaction and provide user a message saying that new line has been created. Object was added and a sign a cabinetry layer. And that's all about it for our method. So we just created a new line object and then we just assigned the layer. By typing these, I'll end that layer and that's all that that save our project and do a rebuild that we just close this out to cut first and open anyone. Okay, so if we check the layer, we have the cabinetry layer here, let us load our plug in so that then that the location is somewhere in this ah area. It's just from 00 to one hundreds. It should be drowning in this area here. So let us run the plug in, or the method that we use created said layer to a non object. There you go. Yep. Do you stay in here? So it's start from 00 to 100 for X and 100 for y. So as assignment to you, our practice for you, you can just basically, maybe at on a statement here to validate if the layer is existing or not, then provide some validation or conditions and check the results. So that's about it. For creating an object and assigning the layer to an object. In the next videos, we will be exploring the line types, so I'd see you there. 51. Section 6 - Creating ListineTypes Method: in the next upcoming videos, we will be creating methods for the line types. I would like to advice year that the way the method is created for the line types is very, very similar with the layer objects, so hopefully it's still a very fresh to you. The previous videos that we we've done for the layers manipulating layers. So in this ah, subsection off these section six, we will be grating a methods for exploring the line pipes. The 1st 1 is just listing all the land. Perhaps in the drawing in the 2nd 1 is we will be loading a new line type into our drawing . Then they will set a land type current. And then we'll us delete a land type with greater method to delete the land type and the real of so great another method to set land typed on object. So let's get started. Our first method is to least the line types, and we are going to create a new class, so that's great. A new class right click on the the Project file and add class. Let's just call this as line type, find types class, and in that class we're going to create our methods. So asi usual, we need to imports the application. I mean, the auto disc name spaces, that application services imports off the desk that AutoCAD that database services, the run time, the geometry and that's it for now and then we can start creating our methods. So let's start with the public sub list Land types. Our command method would be just the same as the method. Name this Glenn types. All right, so what's the first thing we need to do? Great. A valuable for the document objects. So to do that dim dark as document equals application, the document manager that M D I active documents the MDB as database equals dup the database and then we are going to create a transaction. So you might notice this is very, very typical toe all the methods that we have created. So by typing it over and over again, it gives us kind of muscle memory that becomes very, very easy for us to great the method. And now, since we're dealing with line types, you remember in the layer we used the layer table in this land type, we're going to create a variable to hold the land type table. So let me just call it a lt tab. Thus, line type people equals trends that get object. So our object I d would be coming from the db object and it should be the line type table i d. So that's just the difference between the layer for the layer we used the layer table I d and the mode open mode for reading for Reid. Okay, so now that we have the table for the land type, all we need to do is look through the collection of the line types. Do you recall What's the statement that we're going to use? It is the for each loop. So for each line, type I d as object I d in the line type tab collection, plant type collection, which is we have here as lt tub. Then we can create a line type table record. So deem LTTE are ah light I table record here that would be equals two trance that get object. So our object i d this time is the L. P A. T here and open mode that for reading because we're just displaying the the Atlanta to the user. We're not modifying it. So all we need to do is read it and then displayed to the user. Doc, that editor. The right message Be land type, and then land type Name equals LTT are that name. Then you could make the transition. This one should be baby line feet. So these our very first method for the land types let us save our project and do a rebuild . No, we can open AutoCAD when succeeded. So let's ah okay, let us load our plugging. This is still the same. A plug in that we created earlier. We just basically added a new class. So now we should have a method called leased line types. Leased line types. There you go. Yes. These are all our land types by blocked by layer continues, dashed to and hidden. These are the land types. OK, so that's how easy it is to extract or to read to the line type table and displayed ah, land type named to the user. Okay, give this a try. Play around with it, tried to display some other land type properties and see how it goes in the next video. We're going to great and method to load a new line type that will be coming from the A cut that ally and file. That's the text file that's shipped with the product where all the land types are defined, So I would see you there. 52. Section 6 - Creating LoadLineType Method: in this lesson, we're going to create a method called load line type. So the objective of these method is to load a new line type into the drawing the land tap that will be loaded. It's coming from the acre that L I and file that is where the only land types definition that is shipped with the other. AutoCAD. So let's start creating our method public sub load flying time and let us call these as load land type as well and great the document object. It's kind from the application that document manager that nd I active document. Then you find the database, the database, and now we're going to create a new variable that will hold the land type name that we're going to create. So let's just call that US l type name string, and that would be the centre land type. Okay, And then we do. The using transaction equals db the transaction manager and start the train section. Okay, so now we need to I have a variable that will hold the line type table. Let's call that lt tab as land type table becoming room from the transaction that get object db that line type table I d open moored for Reid. Okay, Now let us create a validation or an if statement just to check if this line type name already exists. So if the land type table has land type name, then we just displayed to the user that the land type already exist. My type already exists, and then that's aborts the transaction. Otherwise, or else we're going to load the land type off the line type based on the acres ally and file. So we can do that from the database object D B. That there is a method called load line type file and it requires two parameters. The 1st 1 is the land type name, which is we have here a center. So let's do that l type name in the second parameter is the The file name is the file name of the A. Cut that L i n Okay. And that's it. Well, we need to do now is just message the user and that line Time center or type name waas grated successfully. And of course, you have to commit the transaction. There you go. So let me show you where we can find this acre that ally and file. So because that one varies depending on your autocad installation so we can do that. You can check that by typing in line type and click on this load button here. So currently, these air are these air All our land types, we only have five. We don't have the center, so that's the one that we're going to load. So click on this load button here and this the acres ally and file and click on the file button. This will give you the full path saying in my installation these where it's being installed . So you might have a different part from this one? Definitely. Okay, so it's in the support files and this is the file here. All right, so and these are all the line types that's contained in this file, and we are only interested in this centre land type. Okay, now that we have created our method and we have also built rebuild it. There you go. And now let us load our plugging. So now we should have a new method called load line type. Here you go. Nice land type centre was grated successfully, so Now let us validate or verify. Yep, we have in here. Okay, so that's about it. For creating a land type and or for loading Atlanta. That's coming from this l i n. So, in the future, if you have some requirements to load different fan types, just follow these method and modified this name accordingly. And that's it. Okay, so I'll see you in the next video. 53. Section 6 - Creating SetLinetypeCurrent Method: Hello. And welcome back in this video, we're going to great a new method called set current line type. The objective of this method is to define a land type that we're going to make us the current line type in the drawing. All right, so let's make use of these method here. We can use most of the coding here, and then we just modify some of the lions. Or maybe remove some. So 1st 1 I would like to Let's chase the method name first. Let us call this as, said, current line type. Let us check the drawing. The card during what plan touch do we have here? So these are the line types we have. He didn't dash to continues by blocking by layer. And the current land type right now is by layer. I would like to make the dash to us the current land time. Okay, So once we run our code, it should replace this by layer with this dust too. Okay, so let's chase this center to dash to. Really? We need this transaction line. We need the lt tab for the layer land type table definition, and we also need this validation just to make sure that the land type exist. And that's it. So let me remove these part of the code here except the commit, of course. And we get treated DeBord. You know that that s removed this part here and this. We don't do that. Okay, So if the dash to land type exist if it if the lt tab has the dash to, then we will set the land type of the current line time. So how do we do that from the DB Object database? Object. There is a method called C E l type this one here, which means that make the land type and current land type and that would be the lt tab and l type name reaches this one here. Okay, And then let's just update the message. So line type a dash to it's now the current land type, and that's it. So see the changes from this code here? It's just basically sparked here. We just added this line, and that's just a major chase that we've done and up just of course, up did the message, and that's it. So let us save our project and do a rebuild and successful That has slowed our plugging. It's what? So now let us check one more time. The current land type is by layer. No. If we run our new methods said current land type land type dash to is now the current line type. They're the same. Validate. Here you go. This one here. Okay, so that's how easy it is to make the line type as the current lamb type. So from now on, every line or polly line that you draw will have these dashed to line type. Okay, So play around with this and see the results. Maybe changed the land type name that you want to make current and try it out. So, in the next lesson, we're going to create another method to delete the line type. I'll see you there. 54. Section 6 - Creating DeleteLinetype Method: in this lesson, we're going to create another method called delete line type. So the objective is to delete an existing land type from the drawing and validate the results. So when you are deleting a line type Samos with deleting a layer, you have to make sure that the line type that you're going to delete is not the current line type. So otherwise it will even get some error. So let us, ah, copies method. So we don't need to keep typing. Let me just call this as the live line type and that we just get treed all this. Good. All right, so now we have basically the scaffolding. You're veteran section, we have the layer, Todd, I'm in the land type tab or land type table. But in this case, since we are doing a delete, I would like to add a try Catch block. I help you still remember using the try catch. So typing, try and then enter. So this line here should be inside a trick block. And if we encounter an error than we can just, uh, message to you, sir, that the error has spend encountered display What type of error is it from the message and of course, aboard the transaction. Okay, so in the tribe block, we need to make sure that the land type, as I've said earlier, should not be the current land that the land up that we're going to delete. So let us make the by layer as the the current line type di be da c l type that is the command to make ah lan type current. So, lt Tab and we need to type in here the by layer. So we are going to delete the the dash to line type. OK, so the way to do that is to look through the lt tab table and then we will be basically checking every single land type in the loop. And if it's the dash to line type, then we're going to delete it. So how do we do that? We used the four each statement for each length. I i d as object I d in lt tab. We need to create a variable that will hold the line type table record so dim LTTE are as line tie table record that should be derived from the transition object. Get object I d get object. And then the l t i d. Open mode that for read. Okay, so now we're going to check if the name of the land type is dashed to. So we do that by creating another If statement here, if LTTE are that name equals dashed to, then we do the delete. So before we do the delete, what should we do? We have to make sure that the land top table record is open for upgrade. So we do that by typing it up, uh, upgrade open. And now we can execute the A race common and that's it. So we need to do now is commits the transaction and then, of course, misses the user that the land type has been deleted successfully. This is BB L f all right, and we have to exit the Ford. You can oh, meet this line, but it's always good two included. Let's say we have hundreds or thousands of plant types loaded once we found the length of that we are interested in. Then we just accept the four look right away. We don't need to go through the rest of the other land types because we are not interested in them anymore. So that's about it. It's to another rebuild ups. We encounter a problem here. I forgot to close my autocad that we just close this. Do another rebuild that should fix it and let me open quite very quickly. Okay, Let as load our plugging. But before we execute our method, let us first validate one more time. So we're going to delete this. Dashed to learn time. Once we run our code, this dust, you should disappear from the list. All right, let's do that. Now. The live lying? Yep. They need land type. Line type was deleted successfully. There. This validate? Yep. That too is gone to this about it for creating the I mean for deleting the line type. Make sure that if it's not the current layer, so set up the buy layer as the current layer and then specify here the land type that you want to delete. Okay. So in the next video, we're going to create our last method for the line types. He will set the land type to an object. So I had to see you there 55. Section 6 - Creating SetLinetypeToObject Method: welcome back. So this will be our last method for the line type. We're going to set a land type to an object. What we can do here is basically the same us what we've done for the layer when we set a layer to an object. But this time we just set the line type. So to do that, all we need to do is do the same thing for the layer method we can just copy is over and go back to our land, type Fleiss and then paste it here and changed the method name set, land type to object. And maybe you can already guess what needs to be changed. Yet it's just the one line of code. So instead, up layer, we just used the light type. And that's a, uh we're going to change the land type two hidden and that's it. And, of course, chased this method. Oh, you know what? Let's just get rid of these, and that's about it. So we have our document object. The database created transaction. We get hold up the block table in the block table record, and we create a new line by creating the starting in the end point at 101 100. And then we just set the land time up, the newly created line to hidden and independent to the block table record and add into the transaction and commit. So that's it. Let us save our project and then do a rebuild. All right, so let us load our plugging. Let us check first. What are the line types loaded. We don't have a he didn't here. So let me just close these autocad and let's open the new I mean, the problem with the usual test drawing that we used. Okay, so let me give Zoom into where the line will be drawn. It is somewhere in this area and that that slowed our plug in. All right, so now we should have a new method called set line type to object. But first, let us just verify the line type. So we have here the hidden. Okay, so now let us run the metal said lying type to object. There you go. Yeah. So this is now our line, but is it the heat in line? Yes, it is. It's just that I think our land type of scale is very small. So if we make these stent, for example, there you go. So that's how easy it is to set a land type done object. Okay, give me that tray and see how it goes. So in the next series of videos, we're going to create methods for the text styles. See you there. 56. Section 6 - Textstyle Overview: Now that we're done creating the methods for the layers and land types in these subsections of section six, we're going to explore the Texas styles. So we will be creating for different methods the 1st 1 these two least all their text styles in the drawing. The second method is to update the current Texas style sponte, and the third method is to make the textile current in the drawing in The last one is to set a textile tone object. So in the next video, we're going to create a new class that will, ah, store all of our methods. So I'll see you in the next video. 57. Section 6 - Creating ListStyles Method: OK in this video, we're going to create a new class for our Texas styles. So click on right click on the project and add. Plus, let's call these steaks styles class. Okay, so let me just copy over the imports from these land types. We will be needing these imports here. Okay? And there's one more I would like to introduce in this video. That's Ah meant for grading the Texas style. So let us imports off the best that autocad that the graphics in their face. We will be needing this when we create a new fund. Okay, so now that we have a class, we can start grating our first method. So let's great our first metal letters cold it as list style Samos. What we've done for both the layers and the land types that that's called these as said styles, I mean list styles. Same thing we need to create the document object. It's from the application that document manager and MD I active document and deemed a DB as database. Let's be derived from the document object. And now, as usual, we need to create a transaction this transaction de Vita transaction Manager that start concession. Okay, so I know that we have Oh, are variables defined? So what do we need to do next? Do you recall in the layers and land types, what table do we need to use? We need to use the Texas style table. So let us great a variable ste tab for style table as a text style table that this similar for the line type table and layer table. So that will be from the transaction that get object. That would be from D B, the text style table I d in open mode for Reid. Okay, so now that we have a variable for the Texas style table collection, what should we do next? The objective of this method is to just list all the style. So we need to basically look through the the style table collection we'll be using that using before h statement. It's the i D as object I d in style table. Okay, so now we can get hold of the style table record. So deems still table record. This will be the Texas style table record, so Texas style table record as text style. It's about here that will be coming from the transaction that get object and our object i d here would be these style as the i d misty I. D and open mode for reading. And now we can display the style name to the user using the dock. That editor, the right message, the style name is Oops. This one would be BB 11. Okay. And complete the transaction. So that's it. Once we have the the variable for the Texas style table collection. We just looked to each up these Texas style table record, and now we have the We have access to the properties of these Texas cell table record. All right, let us save our project and do a building. Well, it's building. Let me just open up. AutoCAD build succeeded that there's no open that had the growing for testing and load our plugging. Okay, so it protects our styles in the drawing. We have these five defined or loaded starts architect 80 tr logo to standard and title block. So let us run our method. It's called least styles ago. Yep, they have it. Here we have the standard logo to title Bluff architect and 80 tr. Okay, so that's how straightforward it is to list all the styles. You only need to get hold off the Texas style table, similar to the layer table and the line type table. Then you looked through the table collection and create a table style. I'm in Texas style table record, and now you have access to all the properties and methods of thes Texas style table record . So play with this code and then explore some of these properties that you want to display and see how it goes. All right. In the next video, we're going to create another method to update the current Texas style phone. See you there. 58. Section 6 - Creating UpdateCurrentTextstylefont Method: welcome back. So let us now create our second method for the text style, the method that we were going to create. It's called Update current Texas style fun. So let's start creating it now. Update current Texas style fun. That's great. The Method Common Method name which is also the Samos These sub method name. Okay, so the objective of these method is to update the existing font style off the the text or in tax in the drawing. Later, I will explain to you what would be the changes when we run our code. But let us continue developing our method first. So we need to get hold off the document and the database object which we have here already . So that's just copied it over. Based of here, you also need the transaction and of course, the using and abusing. Next, we need to get hold off the text style table records. So that does define that variable now game text style table record. It would be equals to the transaction that get object that would be coming from the database that text this style and open mode for this time. It would before writing, because we're updating the front. And now let us declare another variable that will be the front descriptor. So deem this. Just let's just call this us upon us for the descriptor. And that will be equal to tst. Are that Funt from the Texas style table record and fun. So these ah particular I appeared the front descriptor. That one comes from these graphics interface. So let's say we put it here at the desk that autocad that graphics interface that font descriptor. Okay, but since you already declared it here, we don't need to repeat the same name space again. So that's why is good, too. Just put it into imports rather than ah put here when you are declaring a variable because the method or I mean the line of court will just be very, very long. So in this case, all we need to do is just provide the the method name or the property. Once we have already import in this, uh, import section here that never space. Okay, Now we are going to create a new fund. Let's call that as New Front as fun descriptor. And now we can define the properties of the new fund new fund would be because the new font descriptor and there are quite a number off parameter studies required in here. One of the method overload has four parameters, and that is the one that you're going to use. So the 1st 1 is the type face we're going to use the the aerial block and the next parameter is the bold as bullion so fun, that bold The next one is a talic as bullion, So front that metallic than the pitch in family. That would be fun, that peach and family that that is the grouping of the front properties of the fun. All right, Next, we are now going to assigned these new point to these point variable that we have here. I mean, to the tables Texas style table record that we have here. So t str that fund is now our new fund. Okay, overload failed because new point equals It's complaining. Here it looks like we're missing one parameter here. So we have the type face we have the front that bold we had we have the front that italics and we are missing The characters integer the 5th 1 this one here So let's add, let's add that the parameter that would be that front, that character said. And we should be good. And now we're going to excuse me. So basically, no. We have already updated the current Texas style table record with our new fund here, which means that whatever is the whatever, it's the front that is currently defined in the drawing. It will be updated with this new ah, front face and let us do a region so that it will take effect immediately. And then we have to commit the transaction and that's it. So let me open up off the card. Let me just dio rebuild for this one here. Okay, Succeeded. So let's check this style in our current drawing. So the current Texas style is the title block. Let me just check this text here. This stylish standard. Okay, so let us make this thunder is the current Texas style so that once we run the code, all of these labour's here, which is the standard Texas style, will be updated into the new front face that we specified, which is the area the block. So let's, uh, set this standard right click and set current. So currently it is set to Romans. Okay, It shall be updated to the aerial block, which we specified us. Then you font descriptor here. So our code is basically grating a Texas style table record in getting the current fun off the in the drawing. Then we replaced this old front with our new fund that we have a specified here, and then we just regenerate the drawing. So let us load our plugging. Okay? No. Observe all of these in text here, So update current Texas style front. Yep. See, now they're all changed from the standard S H X style to Ariel Block. See this stand now? It used to be, ah, romance. Now it's area black. All right, so that's how it issue You changed the current phone, uh, description. I mean, the definition of the front. Just define your own front descriptor and provide the style that you want in here and replace the current texas style table record with your new fund, and you should see the effect right away. Okay, So in the next video, we're going to create another method to set the current Texas style. See you there 59. Section 6 - Creating SetCurrentTextstyle Method: Okay. Welcome back. In this video, we're going to create another method called Set Current Texas style. So basically, we go to Autocad and we check the current light current style we have here the title block . So in our code, we're going to make these architect as the the current Texas style. Okay, so let's create our method. Let's just call these said current next study, okay? No, we need to Good. Let me just cos over and just remove whatever we don't need. But at least we now have the document object. We have the database object. We have the transaction. We have that the texas style they will record. Let me just get treat up these goods here. This one, we don't need us. Well, this one we need, but let's just get rid for Get rid of that for now. Okay? So the first thing that we should do know that we have these gold block here is to get the style table, the Texas style table. So to do that, let's create a new variable to hold that, uh, Texas style table value a stick tab, uh, text style table that would be close to the transaction that get object The object idea would be coming from the DB the text style table I d in the open mode that for read. Okay, so now that we have the Texas style table, we can now look through this collection and find ah, architect Texas style. And once we found it, we will make it as the currently current Texas style. So how are we going to look through these Texas style table collection as usual? Every time we have a collection, we're going to use the for each loop. So for each ste I d style idea, let's go that it's the i d as object i d in s the tab table collection. Now we can declare the Texas style table record, uh, text style table, the record that would be equals to the transaction that get object. Our object i d will be these SD 80 here and ah mode will be open mode that for read. Okay, now we can check based on these Texas style table record. So if a tst art that name equals architect, then we're going to make these. We're going to make this architect as the current Texas style. So how do we do that? We're going to use the the application that set system variable. So application that said sistan variable. That would be the text style. And the value is architect, and that's it. Now we can just message the user, be VLF and it's a style name. PSD are that name. It's now the default Texas style. And of course, you have to commit and and we can exit the portal. Okay, we just get treated off all these extra spaces here. This commit we don't need because we have it here already. Okay, so this will be our code to said the current text style in the drawing. We have the document and the database object B of the transaction, and we get hold of the text style table. Then we look to this ah, table collection and we get the Texas style table record, and then we just validate If the name is equal to architect. Then we set this system variable to architect. Using the Texas style here is basically making use of the AutoCAD functionality. So let's save our project and do a rebuild. Okay, so let's double check one more time. Currently, the the current Texas style is titled Block. So after we run our code, the architect should be now the current Texas style. So let us run our code set current, but we haven't loaded our code yet. Net load. Okay, so sit current. Texas style. Yep. Style name architect is now the default Texas style. So let us verify. Yep. Current text are these architect? Okay, so that's how you do the setting off the car in Texas style. Just make use off this application. That system set system variable. And that's a give you that. Try and see how it goes. In our final video. We're going to create one more method, and we were going to call it a set text style to object. I'll see you there. 60. Section 6 - Creating SetTextStyleToObject Method: OK, in this video, we're going to create our last method in this section. The method is called set text style to objects. So let's start creating our method. But public sub said text style to object and our command method is also set texts stealth project. Okay, so we need let me just copies over because it has all the the land of go that we need except for these. So now we have our court Look in the document object. We have the database and we have the transaction. So the objective of this method is to create a new and text object and assigned Texas style into the newly created text object. So the year recall how to create an an text before we can even start grating on object. We need to get hold of the block table and the block table record. So let's start doing it now. Deem BT as block table equals, it comes from the transaction. Get object. The the block. Uh, I d I mean, the object i d will be coming from the database that love table I d and open mode that for breed next, we need to get the block table record so dim. BTR, US blocked table record equals trance that get object and our object i d. Will be the block table, the block table record that modern space. And that would be open mode for right because we are adding a new object and we will be a pending the new object into the block table record. So now let's create a new and text. We will use the using statement MPX, as in text equals new context. And what are the the properties upon antics that are required? The 1st 1 is the contents. That means the text, the Texas string and also the location, which is the insertion point and also the text height and finally, the Texas style i D. So let us define the point. The insertion point them in speedy as 0.3 d waas new 0.3 D, that's just inserted in 00 And now let's define the content. Let's just say here and now let's define the text height next tide. Let's give it a nine, and our location would be our insertion point here and and finally the Texas style I d. So empty X that Texas style I d. That would be whatever is in the current database, a Texas style, whatever is active in the drawing. And now, of course, we need to upend this newly created in tax into our block table record. So BTR, that upend entity Oh, are empty. It's And of course, we need to add into the transaction the newly created in text and commit the procession. So that should be all for our code. Have created a document. Object The database, the transaction, the block table in the block table record. Then you created and text specified all the required properties and values and then appended to Dr Will record and added into the transaction and then commit transaction. Let us save our project. And do you rebuild? Oops. Let's do another rebuild. Okay, Now let us open. AutoCAD. All right, let the slowed our plugging. Let me get zoom in this area because these were going to write the new I mean create the new and text. So let us run our new method Set text style to object. Here you go, Halo. Autocad that this leased out this text we have the study which is titled block in all the properties that we specified the height with nine and the insertion, But at 00 And, of course, the Texas string. Hello? AutoCAD. Yep. So let's say the architect is the current the style. Just get rid of these, and we run our method again. Here you go. So that completes our section. So in this section, we have explored the layers, the line types and the Texas styles go through each of the methods that we have developed and you test them out, be familiar with all the the specific line of code that is ah, specific. To reach method, familiarize yourself how we manipulate the objects for each of these layers the land types and the Texas styles. Okay, so this concludes this section in our next section, we will be exploring the user input functions. I'll see you there. 61. Section 7 - User Interactions Topic Overview: Hello and welcome to Section seven of the scores user input functions. This section is all about user interactions. When you are developing programs, there is always a big likelihood that you will be needing input from the users or you will be providing users with options to choose from. In this section, we will be using different user input functions as follows. We will explore how to use the get string function and develop a couple of methods based on that. Next, you'll also develop to more methods using get point function. The 1st 1 ease to draw a line based on the points provided by the user and the other one is to calculate the area based on the points picked by the user. Then we will use the get distance function and see how easy it is to determine the distance between two points in C sharp. Next, we will develop to more methods using the get keywords function, where we will draw either align a circle or on an text based on the selected option by the user, and lastly, a method to count all objects in the drawing in either model space or papers. Space view using keywords and give you a glimpse up how to you. Some off selection sets function a shoo shoo. All of these section is full of hands on coding. So let's get started and create our new projects in the next video. I'll see you there. 62. Section 7 - Creating the Project: All right, let us know. Create new project for our user interactions section. So open up your visual studio 2019 and great. A new project and this drop down here select visual basic and search for less library. Choose the class library dotnet framework and click on next. Let us Goldie's Azaz Yusor interactions. Or you can choose a different solution name except to you and click on. Great. Okay, So shoes Well, we have to provide a references or add references for those three up a cot ap eyes. So select on a CD BMG a C D B or a CMG and a sick or mgt. So you can find all of these three in your AutoCAD installation folder. Click on OK, All right. So we have it here, so make sure that the copy local attribute here is set to false for each of the three AP ice. Okay, so now let's just get rid of this class one that BB and we are going to create Oh, our own a new class right click on the project and add glass. And that's called is ah, user interaction class. All right. No, uh, we need to import those names. Spaces. So the 1st 1 is imports off the desk. That God, that application services. Another one is to this AutoCAD the database services. Next one is the runtime. It's let's also import the editor input. And since we will be droving, are creating a another cut objects. So we will be needing the geometry. Okay, so this is where these air all the name spaces that we need. So we should be ready to create our first method. So in the next video, we're going to start developing our methods. I'll see you there. 63. Section 7 - Creating the GetName Method: Welcome back. Let us know. Create our very first method In this section, we will call this method as get name using Get string. This is just a very simple method, but it will give us an idea on how to use the get string functions. And we will display the that whatever the name that the user enters into the command prompt or in an alert dialogue or in the message box. So that's get started creating our new method. This method will be called us. Get name using get string for the command method. Let's just call this s get name short 3rd 1 then a shoo shoo already to get hold off the document object So dim, dark as document equals application. The document manager that MD I active document And we don't need a database this time because we're not using any function from that assembly or library. But we need an editor object so that we just declare a new variable called E. D. T. As editor and that would be equal to the document object that editor next. So when we are using a get string, we need to have a prompt and that prompt would be a prompt string options because we're we are expecting, ah, string input. So let's do that dim trump us from string options That would be new, prompt string options then, especially if I hear our message. Enter your name, for example. And now there are properties in this Ah, a type that is called allow a spaces so basically prompt that allows spaces equals true or false. Say it through, which means that you can type in a string with the spaces. If it's false, then every time you hit the space bar it will be interpreted. That's a return or enter. So let's allow spaces. Next, we need to get the result off the user input. So let's declare another valuable to hold that value that we just call this s result as from result. And that would be coming from the editor object that get string then the parameter is the trump string options, which is our prompt here. All right, so now we have very southern ready. How can we validate that if there is an input or if there is a string that the user entered so we can do that by checking the result that status if if resulted status is from status that okay, which means that there is any string or the user entered something. Then we can start in the variable. So being, let's say name as a string it was a result this one here that a string of soap. So now we have the name already So whatever the user and third in here then we captured it in here already. So it's now up to us how to use that value. So let's let me give you three ways to display this message to the user to the 1st 1 Is using the command prompt us. We've been using this many times already, so you can just type in and maybe concocted something. Hello there. Name another way to display a message to the user is using the application that show alert dialogue. We've been this also before, so show alert dialogue. You can type in whatever message you went here your name is and then name in other ways. Using the message box for the message box. We have more options to ah, the sign, our message like, let's say hey, low there Name and we can put some icon like, let's say vb exclamation plus vb Okay, only. And then we can provide a title on the alert dialog box. Okay, so that is when we have a result. If, for example, the yusor Press the escape key when we are prompting with this front here. So that's just providing an else statement. Oops, This close. This one here. So else ADP that the right message no name entered and are also application that show alert dialogue, Yes, do the same thing. No name and third and for the message box. That's just that being something, please enter your name then Maybe let's say this story provide critical does baby Okay, only. So it's the good thing with message box, you can tailor the the icon depending on the message that you want 2% to the user. Okay, so that's about it, for it is the first method. So the key ah idea here is that we need to create a prompt string options and then said the allow space that true or false, depending on your program requirement and we use the editor function, get string and displayed a prompt and get the result, the prompter salt, and it's stored the value in the in a variable. He was in their result that string result. All right, so let's give this a try Lit that. Save our project and do a building. We have a warning message. Studies that miss much. So you can We can just fix that using the configuration manager. Here, man. Choose the 64 bit. Do another bill. Okay, It has slowed in AutoCAD. Now, this is this is our plug in here 64. Okay, so now we should have a first method called get name. Yep. Enter your name. Let's say John Doe, see that you can provide a space here. So we have here. Your name is John Dodi's. The application that show other dialog box. This is the default, the title of the dialogue and there's no icon. And this is the message box. See, we have the titles. Greetings. We have the icon and they have the okay only. And also we have here displayed for the right message. You know, their gender. Oh, so let's try running it again. And this time we are pressing this escape key. Okay, so it triggers the else statement. No name entered this. Enter your name. See the icon greatly got like on and also the okay on the bottom. No name entered, so that's about it. For our first method, play with this method who's do some changes on the prompt and also familiarize yourself with the message box because it's very, very useful in in in your program the way you convey the message to the user. It's very important using the combination off icons in the buttons. All right, so in the next video, we're going to create another method for using the gets string function. I was here there. 64. Section 7 - Creating the SetLayer Method: Our next method is called set layer using gets string. So the objective of these method is to prompt the user to enter a layer name. Then we will make that layer. That's the current layer if it exist in the layer table. So let's get started to create our new method. Let's call this set layer you seem get strength and our command method will be just the same as the method name. Okay, Next, we need to have a document object as usual document. And that would be application. That document manager that Andy I active document. And this time we will be needing the database, object them, give years database, since we would be yeah, creating or retrieving the layer from the table. So we need a database object because Dr Database And also, let's, uh, have the ether. No good editor. Okay, so now that we are using, I mean that we're going to retrieve the layer. We need to have a transaction. So we do that as using trance as transaction equal to adopt that reception money eager that start construction. So how do we create? How do we re treat the layer table if you remember from the previous video in the the dictionaries, layers, land types and textiles. We need to get the layer table. So let's call that as a white, top us there table, and that would be equal to transaction that get object and the object. I deice the DB that the year table I D and open mode is for Faried. Okay, and next, we need to prompt the user to enter the layer named to make current. So we do that by creating a variable prompt US trump string options. Because new prompt string options inter layer to make current And this time we're not going to allow a space so prompt that allows spaces equals false, because players should just be it. One word nurse the spaces in between and next we need to get hold of the value that's being entered in here. So that would be the result us from result. And that would be equal to the editor object that gets string and, uh, the prompt. What's the parameter? All right, so now that we have the result, we need to validate if the user and turtle layer and we can do that by checking the result . That status, if it's equal to prompt status, that okay, then we were going to get the layer name. So to do that, we need to create another table. I mean, another variable string. And that would be storing the value from the results that Stringer salt here. So whatever we have here, whatever the end the user entered, we will capture it in the layer name Variable. Now, the next verification that we need to do is to make sure that whatever the yusor entered in here is the valued layer. So we can do that by checking from the layer table if layer table that has this particular layer name, then we make it s current. We said it s current, so that will be from the database object. Let's see layer pick waas a white table and then the layer name. And then, of course, we need to just commit intersection and that's it. Assuring that the mayor is valued. However, if it's not valid else, we'll use the message box. From now on, we will be using message box so that we have more flexibility. So the layer, their name you entered does not exist and we will provide here the VB this time the information. Plus we'll be OK only and our title will be inter layer. Good. So now we have a complete code validation here. However, this one if, let's say the user pressed the escape key when we were prompting with the this entered to make clear current and they just say no message box, no layer entered in this time that's used to be critical. Okay, only, and Apple is and her layer Okay, so that's about it. For this method, let's do a quick review. You get all the variables we need for the document database and editor. We started the transaction and then we get the layer table and he prompted a user to enter the layer. There is no space is allowed this time, and we started result in the result variable. They get by using to get string from the editor object and the validated. If there is a value entered in the prompt. If there is, then continue restore the layer name very three. Being from this string results and next we validated if the layer name exists. If the yusor entered the validly earning otherwise on the layer that's not exist. If it existed, we made it as currently er so let us save our code and do a rebuild. Be open about the card. Okay, Let us load our plug in that load. User interactions. So now we should have the command said layer using get string method. So that's tried at helps before we do that that this first check the layer these air all our layers. So let me try running that method again. No, they're entered. I just pressed the escape key. What is the current layer first? Currently Zero. So let us make the power as the layer to make layer Current set Layer flower. Yep, power knows the current layer. So let's say we type in a layer that doesn't exist. So sit layer. That's a kitchen. No lyric. Can you enter? Does not exist. See the new icon here? It's information. So we tried the exclamation. We tried the critical. And now this is the information. That's the good thing with message box. Okay, so we captured all the three scenarios. The 1st 1 is I pressed the escape key and you get this message here. Then we tried the positive results. We type in the power and it executed here. And then the 3rd 1 we type in the kitchen layer, which does not exist. And we got this message here. So that's about it. Forties method. Joshua tried this out and do some changes. Maybe you cannot hear. Another message was the The layer is already current. And try something else. Play around with these the validations. Maybe you can, uh, whatever. Set the layer to something else. Okay, So these becoming very common now the way we are prompting the user with the string get string method, although Avis, the prompt string options. And we need to get hold of the layer table or lying type table or string our textile table depending on what we wanted to get from the user and always do some validation the values that the user entered. Okay, so that's about it. And and see you in the next video 65. Section 7 - Creating the CreateLineUsingGetPoint Method: hello and welcome to this lesson In this video tutorial, we're going to create another method using the get point function. So the objective is basically to prompt the user to pick the start and endpoint, and based on those two points were going to draw a line object. All right, so let's get started. Let us call our method as great line. You seeing good point. Let us also called these same common method. You can name it whatever you want, but for this tutorial, that's just father the same. That's the common method. So first off, we need to get the document database and the editor objects. We can just actually copy it from here next, Really? To create a transaction, you can also make use of this. Okay, so now we have the building blocks off our method. We can start prompting the user, so let's start with the starting point. Let's prompt the user with the to pick a start point, so let me call these as p p. O. For from point options. That would be quote to new prompt options. Let's provide the line feed and from the user to pick start point next we need to get the results, so that would be from the prompt point result. So let's have a variable PPR as from point result. This one here equals that would be coming from the editor objects that get point and the parameter is the prompt point options. So that would be the P p. O variable that we have Next. We need to create a variable to store the point value. Let's call that a Z start point as 0.3 d. That would be quote the PPR, that value and next we need to prompt for the end point so we can make use of these a prompt point options variable here. Then let's just change the the prompt to pick the endpoint. But we don't need to create another Deem will just make yourself the existing viable. Since we already declared it here, we don't need to read eclair again. Otherwise, well, get a compiler air. So I just used the variable, which means that we will not be getting a new value. So because the start point we already started in the start point variable here Now we're prompting for the endpoint so we can provide the user with the guide or a robber bun type of effect by providing the base point setting it true. I mean, this one would be used based point, and then the base point would be how are we starting point? So once the user click on the start point, we're going to the end point. It has kind of a guide. Next, we need to get the we need to get the point by issuing the DDT to get get a point and, uh, from point options and then really restore that in the variable. Let's call that as endpoint this 0.3 D that would be equal to the PPR that value same us this money. So now we have the start point and we have the endpoint. Before we draw a line, let us do a validation just to make sure that the start point an endpoint are none of them are not. Otherwise, if we create a line out of those null values, we're going to have some exception or error. So to do the validation, just create an if statement apes start point that equals to baby no or endpoint that equals to be be none. Then just display a message to the user invalid point, for example. And then we return. We don't need to continue processing. Otherwise, If both the start point or endpoint has of added value, then we can go. I had to add into our drawing. So if you recall when we are adding a new object to the drawing, we need to get hold of the block table and the block table record. Always remember that. So let's create a variable for the block table as bps block table. That would be coming from the transaction object that get object and the the the object idea would be from the database block Table I D and the open mode for read. Next, we need to get the block table record. So let's create another viable BTR US block table record. It's S o comes from the trance that get object and our object idea would be the Bt and the table record model space Open load for right because we're a pending the new line object and then we need to create a variable to store the line object So dim. L n as line Dick waas New line and we need to specify they start an endpoint, which we already have the start point and the end point. Okay, Now all we need to do is a pen to the black table. Record the newly created line. So, BTR, that a pen, a pendulum, an object and then, of course, add to the transaction true. And then commit the transaction. Maybe you can notes to provide the use or a message that that's just provided line feed. And New lion has bean created successfully. And that's it. So these very familiar already to you? We've been using all these objects in the past videos in the transaction as well. And the prompt options we've also created I mean, abuses from for the past two videos earlier. And that's about it. So let me save our project and do a rebuild Rebuild. Successful. Let me just open up. AutoCAD. Let the slowed our plugging now. Okay, so we should have a new method called create line using. Good point. Let's try that. There you go. So we're prompted to pick the start point pick anywhere here, see the rubber band effect If used the base line or the base point option, and then we are not prompt to pick the endpoint. And then we have hear our message. New line has been created successfully, so that's it. Give this a try and maybe changed the prom and change the line properties after after you draw it and see how it goes. So in the next video, we're going to create another method to calculate the defined area based on the points picked by the user. I'll see you there. 66. Section 7 - Creating the CalculateDefinedArea Method: Hi. Let us continue building our of plugging. So in this video we're going to create another method. We call that US calculate defined area. The objective of this method is to allowing the user to pick four points, and then, based on those points, you're going to calculate the area dynamically. We're not going to draw a visible porcelain objects, but instead we just, ah, calculate the area based on the points picked by the user. Okay, so let's get started. Let us create the method and call it as calculate defined area. It is called a common method as the same. It's a sub name and, as usual, we need the doc document object? No. So we need the database object and let's declare the editor as well. You know what? We may not need a database since you're in a drawing the the Polin. Anyways, it's just a reference. Okay, so next we have to prompt the user to pick the first point. So to do that, we need to declare the prompt point options So Dean p. P. O. US. From point options. New trump put options and let's provide the message. Pick the first point next we need to have a viable to retrieve the results or to start the results. So we call that as PPR for the prompt point result. And that would be quest to the editor object that get point and the parameters the pram point option. Next, we need to have a valuable to store. The Virtus is so we need a 0.2 d collection. To do that, we need to declare the variable as let's called it a speedy call or point collection as a point to the collection and that would be equal to point to the collection. Oops, we miss here The empty string that's just fixed. That one. OK, and now that we prompted a user for the first point, we can already entered or we can add the points into our collection object. So PT that pity collection, that ad that would be a new point two d and that would be equal to the prompt point result that value that X, that is the X coordinate. And for the white court in it, that would be value that why, Okay, so now we have the first point. Next, we need to have a loop that will prompt the user to continually pick up to the fourth point . So to do that, we need to create a while look, but before that really need to have a variable as a counter to control the flow of the loop . So D my counter as integer and let's initialize the value toe one. And now we can create a while. Look, that's a while, I counter it's less than or equal to three, less than or equal to three. Then we keep prompting the yusor, too. Pick a point. But this times, let's create a a case, a select case statement. Select case, I counter The purpose of this is to just identify which point the user is already picking so we can send the proper message. So case one. If, let's say the country's one, he would just provide the message for our ah, from point options that would be equal to a big second point and break. No, we don't need a break there, So that's four c sharp. So case, too, the P P o message would be the third point. Then for a case three, this will be the do fourth point that the user has to pick. All right, So, no, we have all the messages that we need, so the user will pick the first point than the second point third and fourth. However, for every point that's being picked, we need to provide the base point so at least the user has a guide on during the picking of the point. So let's do that. P P O that use based point because true and PPL does that base point equals PPR that value . So whatever the value we get from here will be the will serve us our base point. And then we need to get the point using the editor object and provide the message. So now we have the point. All we need to do now is to add, Did the collection again? The X and the Y coordinate again to the collection and that's it. However, let's say the use air decided to press the escape key during the peak point. We can also provide here a validation if the A prompt point results status equals from point results from status that cancer, then we just have to return. No need to continue the processing However, if the user keeps going and keeps picking up to the fourth point, all we need to do now is to increments the counter. You can do that using the plastic walls, one which means that every iteration we have, we we need to incriminate the counter until it reaches the number three. If it reaches the four, then it will accept the wild up already. So this will be our code inside the while loop, which means that we gather all the points we need. Next, we can now draw the poly line. So using the using statement peel as Polly line, That would be quest, the new party line. Then we can insert or add Vertex to this pollen based on our point collection here. So to do that pl that ad Vertex at so the first Vertex will be zero. And then that will be our first point. Which means that from the point collection, that would be the first entry. And then we just specify zero for the body 04 to start with and zero for the end with here . Okay, so we just have to copy this line of code and change the index. This now will be one. And of course, this will be the second element from the point collection. Okay, this now will be to which is the third Vertex. This will be the fourth protects all right. And then we need to close the pollen. And now that we have the Poland, we can get the area and message the user. So let's say message books the area off the selected. It's a boundary, for example. He's then we can put here the PL groups pl that area that to string. Then let's just provide some icon BB information. That's BB okay only and whatever the title of the dialogue boxes, and that's it. So let's just quickly review our coat. So we declared the document object the editor object, and then the prompt point options. You get the first point and store in our point collection. Then we have a wild look to allow the user to pick up to a maximum off Ah, four points, and then they provided a base point for every points that being picked. And then we continually added into the collection object, and he's just the validation. If the user decided to cancel. If not, then we increment the counter and continue with the the prompt. Too big, the third and the fourth point. And once we all have, the Vergis is collected. Then we just draw the poly line and closer and provide the area. This one here, let's save our project and do a rebuild. And let me just open the hood here very quickly. Okay, let us load our plugging. You're just doing here. So now we should have a function or a method called calculate defined area. That's straight at Yes, There you go. Let's say clicking here. See the rubber band? Let me just make it an Ortho on so we can see the see in the area of the boundary is this much. So how can we validate if it's correct? Let's just, for example, draw a line from here are pull your line from here two at 190 degrees at 100 0 at 100. Negative 90 or to 70 and close it. So let us least this party line. The area is 10,000 So if we apply our methods of calculate defined area and let's say that we just set the mode to There are snap mode to end point. So calculate the fine area. Start from this point to here to here we have 10,000. Good. So that is our calculate defined area method. Give these a try, play around with the function and maybe ADM or very thesis, this dysfunction is actually very good in estimation. If you're just doing some estimation on your site plan, then you can quickly use this functionality. Okay. Okay. I'll see you in the next video. 67. Section 7 - Creating the DrawObjectsUsingGetkeywords Method: Okay, So let us create another method. This time we will be using the get keywords function. So I have here already pre created the method name with the same command method. Name here. Draw, object using keywords. Get keywords. The objective of this method is to provide the user with options to select what they would like to draw. We have three options oneness line, object circle and M text. So those are the options for our keyboard. So they choose to select line and you will draw a line and so on. All right, so let's get started. We have already the document and the database object. Now let us create the prompt keyword options. So these another new function, let me call the variable a speak. A was the abbreviation for the trump for the prompt keyword options, and that would be new, prompt, cured options. And we need to provide the message. It's basically the message that the user will see. What would you I like to draw? And then we will provide the options so the 1st 1 is lying. So basically, we're adding key words that add to our trump cured options type in here line. The next one is circle and the last one is temp text. And there is another method or property to allow none, which is either false or true. In this case, we won't allow an empty input, so the user has to pick or select any of these three options. Now we need to have a variable too. Store the front result. We've used this before, so let's call our our viable us rest for results us from the result. And that would be coming from the weekend directly. Get from the document that editor object that get keywords and the parameter the prompt keyword options will be our PK. Oh, here And then now that we have the result, we need to retrieve the value inside the result. But what was selected so let me just called were able as answer as string equals result that string salt. Okay, so let us do a validation that say, if answer in v b that net there's this. It's not nothing. Which means that there is a value now we can use the you can start the transaction. So using trends a C section, because David Atriss, section manager that starter section. Okay, so first thing that we need to get hold off is the block table records, since we are creating an object. So let's create a black people. Us. Block table equals trends that get object That would be DVD, that block table I D. Open mode four read, and the next one is the block Papal Records. So we need a block People record. It should be coming from the transaction of Jack as well. Our object i d would be block table record that more than space. And this time this will be open mode poor writing since we're creating on the objects and now we need to create a select statement. So select case answer. So case line. If let's say the user selected a land object, let's so let's great line. So, in our case, just create from 00 to 101 100. So deemed PT one 0.3 d was new by three d from 00 and point to US 0.0.3 d, new 0.3 d to 100 100 said the zero, and we create the line object because New Line read those two points and Of course, we have to a pen into the block table record and add to the transaction object. Okay, so these our first case, which is a line next. If, let's say, the user selected a circle. So case circa, we need to create a circle objects. So what are the other the proper disappear? Circle object. We need a center point so deem Ah syn pt ASUs 0.3 d new 0.3. Let's just put it at 00 and then let's create a new circle. Bien Sur Aziz Circle equals new circuits. No, that that's specified. A center point that would be sent pity and then radius that's just created that 10. And let's change the color, too Read and that's it for our circle. So that's just bent into the block table record and add into our just section. There you go. So we now have two cases. Ah, created next is the EMP, ext. So let's create the in text. So same thing with the circle. We need the insertion point. So let me call that in Speedy this point three d new 0.3 d. Same thing. Let's make it. Is there zero and then that's great. And Inpex? It would be in new and fixed up. Then we specify all the properties of the antics. 1st 1 is the contents or the Texas string that will be the contents equals. That's just say, hello world. And then the location would be our is insp ity. It's been here. Next, let's specified. Ah, next height. It's just put it a 10 and the color. Let's make that a Z yellow and upend into our table record and add into our perception. Okay, Next, let us just great here and else just 200 for whatever the selection or anything that the user type that none of these three. So let's just put a I mean from the user editor the right message. No option selected. And then we commit the transaction. Okay, so that's all about for our code. Let's just do a quick review we have here the documented database. We prompted the user using the prompt keyword options. We have added the keywords, these air those choices and then we capture the results in the answer variable and then validated it. Dancer is not nothing or it's not now. And we started the transaction. We checked the option using the select cases statement and then draw the correct, uh, NDP. And then we committed the transaction and provided an option here for anything other than these three choices. So that a save our project and do a rebuild, I think, just quickly open at the club. All right, let us load our plugging. And now we should have a method called draw object using get cured. Throw object using get cured. There you go. All right. So what would you like to draw here? Our options. Lying circle and M text. Let's start with the line. Okay. Let me just ism all zoom extents there ago. These our line the 00 and 100. 100. Let