AU Class
AU Class
class - AU

Hands-on Introduction to VB.NET Add-Ins for AutoCAD

Share this class
Search for keywords in videos, presentation slides and handouts:

Description

Knowing how to write AutoCAD add-ins lets us create new AutoCAD commands that automate routine tasks, perform complex calculations, or integrate multiple systems to help us be more productive, more precise, and more effective. The use of Microsoft's free Visual Studio Community together with the information presented in this class will help anyone immediately begin creating AutoCAD add-ins with VB.NET.

Key Learnings

  • Learn how to create a new AutoCAD add-in in VB.NET
  • Learn how to create a new AutoCAD command in VB.NET
  • Learn the basics of drawing in AutoCAD through the .NET API
  • Learn how to extract block and attribute information through the .NET API

Speaker

  • Jerry Winters
    Jerry Winters has taught at nearly every U.S.-based Autodesk University over the past 17 years primarily on topics of AutoCAD software customization using Microsoft Visual Basic for Applications (VBA) and VB.NET. He brings a unique blend of education and entertainment as he tackles what would otherwise be a dry topic. And while he reserves the week before Thanksgiving for meeting with and enjoying the company of his Autodesk friends, the rest of the year is spent with his beautiful wife of 26 years and his 9 (yes, that's 9) children in rural Lake Point, Utah, where they are occasionally found singing at community events and senior centers.
Video Player is loading.
Current Time 0:00
Duration 1:30:35
Loaded: 0.18%
Stream Type LIVE
Remaining Time 1:30:35
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
Transcript

JERRY WINTERS: This session is being recorded. Please don't hesitate to ask questions if you have questions. Even though it's being recorded, I'll try to repeat the question to make sure everyone hears it. And we can get that on the recording as well. So just fair warning, anything you say can and will be used against you. All right?

There are seats available. If you want to drive and you're not driving right now, if you don't have an actual keyboard in front of you, you're welcome to come up here and use the presentation computer and I'll just kind of stand behind you and let you do it. If anyone would like to do that, that would be just fine. OK. All right, so we've got a couple here. So if you want to drive, there's a couple of people here that have laptops that they could actually do stuff on. So let one of the assistants know if you'd like to drive, and they can kind of curate that.

All right, I think it's time we get started here. Welcome to the hands on Introduction to VB.NET add-ins for AutoCAD SD 197926-L class. My name is Jerry Winters. I'm excited to be here. Glad to be here with you. My goal today is to have you leave and have you be able to go back to your homes, back to your offices, and create a brand new project from scratch. Get some code in there and make it work. That's my hope and my goal with this class.

And so we've got excellent assistants here to help you with that as well. We've got Carl, James, and [? Yuri ?] that will be assisting you with that. So if you have questions or problems, feel free to raise your hand. If you're watching this class online after the fact, let me give you the cell phone numbers of these guys and you can just call them directly, right? Maybe not. All right.

We're going to have four primary learning objectives today. First of all is how to create a new AutoCAD add-in with VB.NET. Next how to create a new command in VB.NET. And next, learning the basics of drawing in AutoCAD through the .NET API. And last, how to extract block and attribute information to the .NET API. In the handout, there's a little section called extra content. If we have time to do some more stuff, we will. And once again, please feel free to raise your hand or ask questions if you have any questions. Let's jump into it.

The first thing you need to know is that we'll be using the Visual Studio 2017 Community Edition. This is a free thing from Microsoft. You can go to their website. It's in the handout as how to get it. You can download it, install it. And everything we do in this class is based on that free version of Visual Studio. You don't have to go out and buy Visual Studio Professional or anything like that. It won't give you anything extra that you need that we're doing in the class today. So that's the first things first. In the lab here, though, those are already installed here.

All right, let's jump into it. How do we create a brand new AutoCAD add-in in VB.NET? First of all, we're using Visual Studio 2017 and AutoCAD 2019 is installed here. So Visual Studio should already be started for you on the left hand side of your screen. If you'll go to the Menu, go to File, and down to New, and then over to Project. File, New, Project. On the left hand side, you'll notice there are several different types of templates going on here. You want to pick Visual Basic. Pick Windows Desktop. We want class library .NET framework. Yes?

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Great question. The question was, how many versions back will this work? In other words, maybe you're not on-- you'll be just fine. You'll be just fine. So if you're in 2016, you can run through this as well. We'll just pick different DLLs than you'll pick on your laptop.

All right, so we're going to pick class library. Let's give this a project name called Program A. Now, you want to take note of the location. Mine says C users mainframe two source repos. That's what mine says. We want to keep note of that in our minds where that's at. There's little checkbox here that says Create Directory For Solution. We want that off. Just turn that checkbox off.

And lastly, we want to make sure that the .NET framework here is 4.7 or above. So we're at 4.7.2 on this particular machine. Now, this is for AutoCAD 2019. Prior versions of AutoCAD, you'd want to select probably a prior version of the .NET framework. So for 2016, you're gonna go to 4.5, 4.6 for that.

So let's see here. I've got Windows Desktop .NET framework class library. My name is Program A. I'm looking at the location. Got that. Framework 4.7. I've turned off my directory for solution. I'm going to click the OK button now on the keyboard. And I have a brand new blank project.

I'm gonna stop right there. Let's make sure that everyone is up to speed here. Does anyone need help getting to this point? Excellent.

All right, so first step is to create a new class library. Second, we're going to add some references. So go to the menu. Actually, that has to be third. We started Visual Studio. Third, we're gonna add the references here. So go up to Project and down to Add Reference. In the menu in Visual Studio, Project, Add Reference. We're going to go to browse on the left hand side here. And then we're gonna click on the Browse button at the bottom.

So what we're doing here is we're telling our project there are three DLLs that I want to be able to communicate with and understand. Three different DLLs. So we're going to browse for those. And I'm just going to go to C, Program Files, Autodesk, AutoCAD 2019.

Once I get to this point, you'll notice in really big letters in the handout, we're going to type in AC star MGD dot DLL and then hit Enter. AC star MGD dot DLL Enter. And then we're going to scroll down. The AutoCAD 2019 directory, as well as the 2018, 2017, et cetera, has a lot of files in there.

If we type in AC star MGD dot DLL and hit Enter, it will filter and only show us the files that meet that criteria. Makes it a lot easier to find those three DLLs that we're looking for. And they just happen to be the ones on the top here. AC core managed, ACDB managed, and AC managed dot DLL. Those are the three DLLs we want. Three DLLs. AC core, ACDB, and AC managed. All right.

Next thing we'll do is click on the Add button. And then we'll click on the OK button. And that's where we're at. Does anyone need help getting to this point? This is actually the most challenging part of the whole class, I promise you, is creating a new project. There are a number of steps. If we get them all, we're in great shape. If we miss one of them, then things aren't going to work right. So all right, let's move on.

We have our three DLLs referenced. The next thing we're going to do is we're going to set a property in the debug window. So File. Sorry, not File. Project. Down at the very bottom here, mind says Program A properties. If your program is named Program B, then it'll say Program B properties, Program C, whatever. So we'll click on Program A properties.

And then we'll click on the debug node over here. And we're gonna click on the Start External Program radio button here. What we're doing here is we're saying, when I start debugging my program, I want you to start AutoCAD. So Project, down to Properties, Debug, Start External Program. I'm just going to type it in, but you can browse for it if you wanted to.

We want the path to the acad.exe file. That's what we're looking for. The path to acad.exe. What we're saying is when you start the program, that's where we want to start. OK, we'll stop right there for one second. Is everyone good? Raise your hand if you're not to this point here.

All right. So if we'll just go ahead and go to the next page. We're now on page nine of the handout. So the fifth step in writing a VB.NET add-in here is to write amazing code. Now, we're not going to do that yet. What we are going to do is we're going to click on the Start button. At the very top of the screen here in Visual Studio, you see a button that says Start. So go ahead and click on that. And if things are all lined up correctly, what should happen is AutoCAD should start.

So what happens is when Visual Studio starts AutoCAD, there's a link between Visual Studio and AutoCAD. They're actually communicating with one another. And depending on which windows are showing in Visual Studio, you might see a bunch of debug messages from AutoCAD as well. So you can see here the AutoCAD is starting up.

Now, notice that it actually takes a little time for AutoCAD to start up. Takes a little time to get it going here. So we really don't want to have to do that every single time we're actually trying to change our code and work through our code. And we'll get to how we take care of that.

All right, next thing. Let's click on Start Drawing. We'll just start a blank AutoCAD drawing here. All right. Bring this back up here. So when we click the Start button in Visual Studio, here's what happens. The first thing is Visual Studio saves our project by default. So any changes we've made to our code, they get saved when we hit the start button. Visual Studio compiles our code into a DLL. And we added three DLLs as references, and so it brings those DLLs over as well into the project directory.

And it also brings any of the supporting DLLs that they may need. Then Visual Studio starts this external program. We told it to start AutoCAD for us. And that link is created. Once we're here now, what we want to use is the net load command. So we're on page 10 of the handout. So inside of AutoCAD here, I'll type net load. N-E-T L-O-A-D. And hit Enter.

Now, when we first started our project here, one of the directories was, what's the project directory? Where are we going to store this? And so that's what we need to browse to now. So I'm going to go to drop this down here and we're gonna pick on mainframe two. That's the name of the computer I've got here, or the user. Your user will be a little bit different probably. There's an easier way.

AUDIENCE: [INAUDIBLE] Go to File. Start screen. And it'll bring you up to your project. You can right click on your project [INAUDIBLE].

JERRY WINTERS: OK. So you're saying--

AUDIENCE: Go to File.

JERRY WINTERS: File.

AUDIENCE: Go to start page.

JERRY WINTERS: Start page.

AUDIENCE: Right click on your [INAUDIBLE].

JERRY WINTERS: OK. That works too. Good idea. Thank you for that. If you get lost on that, other options are you can also go to your Solution Explorer and look for a file there and look at the properties of that file and see what the path is of that, that kind of thing as well. There's the same path there. So several ways to get that.

So my user. There's a directory here called Source and then a directory called Repos and there's my Program A and Bin and Debug. Now, it's a lot of, so I'm just gonna open this window here leave it there. And if you have a hard time finding your project path, just raise your hand here if you need a hand getting to this. Yeah, debug bin. Right. Or bin debug, sorry. Bin debug. That's the path you want to be in.

And you look in there, you'll see a bunch of AC windows dot DLL, Autodesk AutoCAD interop common DLL. Bunch of DLLs in there. And what we want to look for is the DLL of our project. So if I pull this down just a little bit here, you'll see we've got this Program A at the very bottom down here. So pick your DLL, the DLL you just created, by starting the debug process. Once you get that, go ahead and click the Open button on that dialog.

Now I mention this is the most challenging part of the whole class, getting this project started. Once we get to this point and we get to where we can do this comfortably, getting the code in there is pretty easy to do. Anyone have any problems? Raise your hand if you have any issues.

So when you click on Open, you might get a dialog that says, do you want to load this application always, just once, et cetera. I haven't shown that on my screen yet here. You can click Always or Just Once. It won't really matter, because the next time you compile it, it will ask you that again. If you're tired of seeing that, you can set your secure load variable to 0 and that should disappear. Thank you.

OK, if you successfully were able to load your application. Let me finish the process here on the screen. So in my screen here, AutoCAD has loaded that application now.

Now, the question is, what can I do with my application? Nothing, right? We didn't add any code to it. What we did is we successfully created a new VB.NET add-in that does nothing. We're going to obviously do some things in a minute.

What I'd like you to do-- and this is going to seem kind of chaotic. It's OK. If you have a question, just raise your hand. I'd like you to close down AutoCAD and close down Visual Studio and go through that same process two or three more times. You should be able to get to the point and you can actually create a new add-in in like a minute. All right?

So take a second. I want you to go through the steps again several times. Get used to it. Get it to where you can feel comfortable doing that. So it's going to be a little noisy and a little chaotic, but go ahead and do that just two or three times. Create a new project. Call it Program B, Program C, Program D.

So a question was asked, is this the process we go through every time I create a new project, a new program or whatever, some kind of a template that I use? So in the Community Edition, this is what I do. There is a way to save a template, but it doesn't always get everything that you need settings wise in the template. So this is what I do. It takes less than a minute to get it set up. And then kind of go from there. Now, there are other ways we can get our code easy to access and drag and drop things into a project, and we'll kind of go through those too. Great question, thank you.

So I'll go through on my screen a few times the same process. I'll close down AutoCAD. Visual Studio closed down. The server will stop itself in just a second now that AutoCAD is closed. There we go. File, New Project. Window Desktop. Class library. I'm gonna call this project or Program B. That's where I'm saving this. .NET framework's good. I'm not creating a directory. I'll click OK. All right. That's good. Let's go back to the handout here. Make sure we follow our steps correctly.

All right, let's add our references here. Project. Add Reference. Now, you'll notice that now that we've added these DLLs before, they actually show up in our recent list. So we don't have to browse for it every time. I've got my three references there. That's good. Let's set AutoCAD as the start up project. Project Properties. Debug. Start External Program. Program Files. Autodesk. Be right with you.

AutoCAD 2019. acad.exe. That's what I want right there. All right. I hit the Start button on the Visual Studio. AutoCAD starts up. Let's start a new drawing. Net load. Catch us up here on that. And we're not in the Program A anymore. We want to skip over to Program B. Bin. Debug. And there's my DLL. Open. Always Load. And we're good to go.

OK, a question was asked about the DLLs. A couple of questions. So each version of AutoCAD has those same three DLLs, at least the last number of years, has those same three DLLs located in their paths. So if you're programming for AutoCAD 2017, then you'd browse to the AutoCAD 2017 directory and pick those same three DLLs.

Now, a question was asked about would it make sense to copy those to some other directory? If you go to Google and type in object ARX SDK, object ARX SDK, you can download the Software Development Kit, that's SDK, from Autodesk for current versions of AutoCAD as well as prior versions of AutoCAD. And in those downloads are the DLLs that you need. So even if you don't have AutoCAD 2017 on your computer, you can download the ARX, the object ARX SDK for 2017. You can pick the three DLLs out of that download and compile it.

So even without AutoCAD 2017 on your computer, you can compile against those DLLs and then distribute your DLL to people that have AutoCAD 2017. So that's preferable to actually copying and making your own little directories, because they have all the other supportive DLLs that they need. So that's the object ARX SDK.

How are we doing? Are we creating projects? Everyone good? You've created a couple, two or three maybe? All right, now seriously, that was the most challenging part of the whole thing. There are specific steps that have to be followed. If you follow the steps, you're going to be in great shape. We good?

All right, who's ready to write some code? Go ahead and shut down AutoCAD. Let's get back to Visual Studio. And let's create a new command in AutoCAD.

All right, our second learning objective here is how to create an AutoCAD command. Now, when you and I use the line command in AutoCAD or the circle command in AutoCAD-- I'm old school. I'm typing it at the command line. I don't know what you're doing. You might be hunting for the button. But I'm just typing it in. You might have little shortcuts to commands in that.

But the first thing you need to ask yourself is, what do I want to name this command? My guess is it would be a bad idea to create a new command called Line. We don't want to try to step on the toes of something that's already in AutoCAD. So we see here that we're gonna create a new command called Run Me. Now, I don't know if you've heard of Hello World. Who's heard of Hello World? Most of you that have done software kind of things. This is my version of Hello World. If you want to type Hello World instead of Run Me, that's fine. I'm just anti Hello World. So we're creating a new command.

What we're going to do is go to our project and go into the class of our project and type in the code we see here in the window. So Autodesk dot AutoCAD dot runtime. Now, if you watch my screen for one second, I typed in RU for runtime. And you'll notice runtime is selected. If I hit the Tab key on the keyboard, it fills it in for me. So once in a while, it might seem like I'm typing really fast. I'm actually just using the Tab key.

So we're creating a new command called Run Me. Very simple command. A message box that says I hope this works. I'm going to make my text a little bit larger here. That might be easier to read. That's a little better.

So when you use net load in AutoCAD, one of the things that happens behind the scenes is AutoCAD looks at your DLL and looks for any command methods that you may have created, because it needs to add those commands to its little stack of commands that you can run. So we're saying I've got a new command I'm creating called Run Me.

Go ahead and type it in. As you're typing, kind of keep your eye on the screen. See what's happening. Visual Studio is always trying to give you more information and give you feedback and give you helpful hints. So kind of keep your eye on the screen a little bit and see what's happening. See how Visual Studio is helping you.

OK, once you get your command written, go ahead and run the start button again. That will start the debugging process. It will start AutoCAD. You'll type net load. You'll pick your DLL, and then you can run the Run Me command. All right? After you successfully run the Run Me command, don't close down AutoCAD. Just leave it there for a minute, all right?

All right, does it work? Does anyone get a message box? I hope it works. I hope this works. Let me try running mine here. I'll click on the Start button. That will start AutoCAD for us here. It works. Good.

Now, I've got to tell you, as a instructor here at Autodesk University, now we've gotten through this, and I'm very impressed. In a half an hour, we've created a new program for AutoCAD and a new command in AutoCAD and it works and that's awesome. Most instructors at Autodesk University, if something doesn't work, there are a million things they can blame it on, right? It's got a bug in the software. The hardware has got problems.

Well, if it's a bug in the software, whose fault is it? It's ours now, right? So that's kind of the scary thing about this type of a class. But if we've gotten to this point, we're going to do awesome. We're going to be in great shape. We're half an hour in. We're already creating add-ins for AutoCAD. Yes, question over here?

All right. So we're going to talk about what just happened here kind of line by line in the handout, all right? I'll click on OK here. Let's talk about what's happening here. I'm gonna widen this up so we can see it's nice and big.

All right, first bit of code here. Autodesk, AutoCAD, AutoCAD. Sorry, Autodesk and AutoCAD runtime command method, Run Me. That line of code says, I want to create a new command that can be run inside of AutoCAD called Run Me. All right, that's all that's happening there.

It's always placed directly above a public sub statement. Public sub means I've got a procedure that I want to create now, and I want it to be able to be called from outside of the class that it's in right now. That may mean nothing to you at all right now, and that's OK if it doesn't. But that's what's happening. And then it also has a name, and I've named this Run Me. Now, does the AutoCAD command have to be named the exact same thing as the procedure command? It does not. But I don't know why you'd want to have them named differently. It's just easier to find things.

Next thing we have a message box. Message box. We're applying a parameter that says I hope this works. And then we have end sub. So everything between the sub and the end sup is what gets run when we run our command called Run Me. All right, very simple, very straightforward.

There's our command Run Me. We've gotten to that point. Here's we're right now. We're on page 14 of the handout if you're following along. What I'd like you to do is we're going to add a break point now. So hopefully AutoCAD is still running. Don't close down AutoCAD if you did, go ahead and start the debugging process again by clicking Start. We're going to go back to our code.

And in the gray column in our code, we're going to click right here. I'm going to kind of click it on and off here. We're going to add a break point. The break point says, as I'm debugging this, when you get to this line of code, stop. Don't actually execute this line of code. Just stop there for a minute. That's called a break point. And we're at the bottom of page 15 in the handout here. 14. I'm sorry, bottom of page 14. Sorry. Bottom of page 14.

Now, with that break point in place, go back into AutoCAD now and run your command again. Run Me. Hit Enter. What should happen-- remember when we start the debugging process, a link between AutoCAD and Visual Studio gets created. I type the Run Me command in AutoCAD and it sees a break point in Visual Studio. It jumps back to Visual Studio.

Now, you'll notice the whole line there is now highlighted in yellow. The yellow line means this is the line of code that is next in line to be executed. So it already ran the public sub line. Now we're going to do the message box. What I'd like you to do is look on the keyboard for the F11 key. F11.

If I hit the F11 key, what should happen is we should jump back into AutoCAD, because that one line of code, I basically said run one more line of code, F11. Jumps back to AutoCAD. Shows the message box. If I click on the OK button now in AutoCAD, it jumps back over to Visual Studio.

Now, you've seen that it takes a few minutes. Well, not a few minutes. I take that back. It takes a minute or so for AutoCAD to start every time we start debugging process, right? If you had to start AutoCAD, try it, close AutoCAD, make a change, start AutoCAD, try it. If you had to do that every time you made a change to your code, it would take forever to write code.

What I'd like you to do is change. Now, I'm back in Visual Studio here. Change from I hope this works to I'm glad this works. So change the text from I hope this works to I'm glad this works. So remember, AutoCAD is still running over here. Visual Studio is running over here. And we just changed our code without stopping AutoCAD, without stopping Visual Studio and recompiling. We just changed our code.

Now, big warning here. If you're working with prior versions of AutoCAD, this does not always work. There were issues with the edit and continue with some prior versions of AutoCAD in 64-bit environments. If you're running a 32-bit environment, it works fine. So just a big warning. If you're working in prior versions of AutoCAD, it might make sense, if you can't get this to work in prior versions of AutoCAD, it might make sense to run it as a 32-bit AutoCAD 32-bit Visual Studio and a 32-bit version of Windows. All right?

When this kind of came out and it didn't work for me, for my projects, it made sense to actually have a VM running, just a VMware machine running a 32-bit Windows with 32-bit AutoCAD, 32-bit Visual Studio in there. So I could write all my code in there, and it was writing code that was shared back to my 64-bit operating system. So just be aware that. If you go back and it doesn't work, that's why.

All right. What I want to do-- I just made a change to my message box, right? I want to sear this run again. Now, I could let the code finish and then just type Run Me again. But I don't want to do that. What I want to do is grab this arrow over here. Grab it, drag it, and drop it back up on line four.

Drag and drop the arrow back up on line four. What should happen is that line should now be highlighted in yellow. And now if I hit the F11 key again on the keyboard, I now get I'm glad this works in my message box. I say OK that. I'm back to my end sub now. Remember, end sub hasn't run yet. I'm still in my program. I'm still in my command called Run Me. I could change that message box again. I could write 2,000 more lines of code and then go back, drag and drop the yellow arrow.

Now, right now we have, what, one line of code, right? A message box. And dragging and dropping the little yellow arrow thing is not too bad right now. If you had a lot of code, though, it would become a little more difficult. Here's what I prefer to do with this. I prefer to come up on the line that I want, just kind of click on there, then do a right click and go to Set Next Statement. That's what I prefer to do, because that way I know I'm going to get it.

Sometimes when you're dragging and it's scrolling and stuff like that, things don't work terribly smoothly. I'd rather scroll to the line I want, right click, Set Next Statement. Set Next Statement. That's at the bottom of page 17. F11 on the keyboard. There's my message box again. Right click, Set Next Statement. F11 on the keyboard and OK.

All right, how are we doing? Is everyone up to speed here? Excellent. All right. Let's do a little more code then, shall we? Right now I'm in the debugging process. You'll notice up here it says debugging on Visual Studio. We're on the end sub. I've got some options. I can hit F11, and that'll go to the next line. Or I could hit F5 on the keyboard. F5 means just run it. So I'm just going to hit F5 on the keyboard and let it finish running that amazing command.

All right, let's go to page 18 in the handout. OK, showing a message box. Not the most amazing feat, I know. So let's talk about drawing inside of AutoCAD.

There was a time when our AutoCAD DWG files would get corrupted a lot. I don't know if any of you are old enough to remember when that kind of thing happened, but that seemed to happen quite often. Especially with AutoCAD version 13. Remember that? Interesting version of AutoCAD.

So in order to keep our drawing files from getting corrupted, what we do in our code is we do everything under the umbrella of a transaction. So a transaction is basically saying I'm going to start doing things to the database, and if there's something wrong inside of our transaction, then the thing that's wrong happens inside the transaction and doesn't affect the rest of our drawing. That's one way to describe a transaction. It's basically a way to make sure our drawing files don't get corrupted. Everything happens under this umbrella of a transaction. That's one thing you need to kind of understand. And we'll see this in a second.

We're going to take a look at some code here. Before we do that, let's do this. I want you to copy the code from the PDF file, the handout. Copy that. I need to close down AutoCAD here. Go ahead and close down AutoCAD. Let's get back to our project in Visual Studio. So copy the imports code. And this goes at the very top of the class, above the class.

AUDIENCE: Close AutoCAD?

JERRY WINTERS: Close AutoCAD, yeah. Go back to Visual Studio. And we're going to copy and paste the import statements. Now, our Run Me command is Autodesk dot AutoCAD dot runtime. That's called a namespace. If you have to type out all that stuff every time you use something in that namespace, your code is going to look really crazy. So what we're going to do to simplify things, we're going to import some namespaces so we don't have to type that over and over and over again. So copy and paste the import statements.

Next we're going to take a look at this code here. Here's my command method here. It says draw a line. What am I going to do? I think I'm going to draw a line. In our code, we get the current document. And then we get the database of that document. An AutoCAD DWG file is a database. It's a database like any other database you've seen or used or worked with or heard about. An AutoCAD DWG file is a database.

The AutoCAD program, the editor, is a graphical interface to the database. So databases have tables. Database tables have records inside those tables. So in AutoCAD, we have-- this is how we talk to our files. So we get the database of the active document, and then we get the editor of that document as well. The editor is the window that you and I work in when we're working with AutoCAD. If I want to draw a line at AutoCAD, I type line and I pick my two points, then I've got a line. So we're getting the editor, because we want to have some interaction with that.

And then we start this transaction thing. We start a transaction. And then we get the current space. Am I in model space? Am I in a paper space layout? Where am I? We get the current space, whatever that is. Now, in AutoCAD programming, we go to the object ID, and we get that object for either read or write.

In this case, we're just going to open that up for write. We want to add something to that line. So we're gonna open it for right. If some of this is totally going over your head, please don't get concerned. That's OK. So we're going to get a variable here named my BTR. It's a block table record. And we're getting the current space. This will be model space. That's what we'll do today.

The next thing we do is have a variable here. So [INAUDIBLE] means we've got a variable. Its name is start point. What kind of an object is it? It's a point 3D object. And I'm going to the editor. That variable is set up here. I'm going to the editor and saying, I want to get a point. And here's what we want to prompt the user to say. Select start point. I want to get the value of that get point.

The next thing we're going to get a prompt point option, because we want to have the same rubber band type effect when we pick our second point. Now, once again, if this is kind of you feel like it's going over your head, don't worry about it. Just kind of be patient with yourselves. So we want to create the rubber band effect when we pick the second point. We do that through something called a prompt point option, which is here.

And then we use that my PPO variable over here when we get that second point. So we get point again. Only instead of saying what the prompt is here, like we did up here, we use a prompt point option. We'll step through this code so you can see how it works. Then we create a new line based on the selected start point and end point. We append it to model space or paper space. We add it to the transaction, and then we commit the transaction.

Let's copy and paste this command from the handout into our project. Now, pay very careful attention. You don't want to copy it inside the sub that's already there. I'm just going to enter, make a big space here. It needs to be inside the class. So I'll copy and paste my code, and there it is. Once you get to this point, go ahead and start it. Start the debugging process. Try running your draw line command and then don't close down AutoCAD. Do not close down AutoCAD, please.

So the question was-- well, actually, I'll answer that question in a minute when we get back to the code. Let's go ahead and run the code. And if it works, we're in good shape. Is anyone drawing lines yet in AutoCAD? OK, who's drawing lines in AutoCAD? If you run it, it should ask you to pick two points. You should see the rubber band effect from the two points there.

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: No, this is called draw line. So let's net load this. And there's Program B. That's fine. Draw a line. There's my start point. There's my end point. OK, if I come back to model space, I'll run that command again. Start point, end point. [INAUDIBLE] start point, end point. Go ahead and come back into AutoCAD here. Or in Visual Studio, I'm sorry. And add a break point somewhere. Then go back AutoCAD and start the command again.

AUDIENCE: Anywhere?

JERRY WINTERS: Anywhere's fine, yeah. Anywhere's fine. Let's take a look at that. So I've got my break point here.

Now, someone asked a question about how do I find help about this certain thing? How do I find out about how this thing works for any object? So let's just talk about a couple of things that Visual Studio does for us here to help us out.

First of all, when you're in the debugging process, Visual Studio will tell you about stuff. If I hold my cursor over my editor and drop that down, it will tell me the properties of that editor. If I go to my DB and drop that down, we're gonna see a lot of properties. Ready? I'm scrolling through it here.

I can see my A units is set to 0 and my add mode is set to one. I can see my current colors by layer here, my line weight, my chamfer A, B, C, D. I can see-- what else can I see here? Dim vars. Who loves dim vars? There they all are, all my dim vars for this database. So lots of dimensioning variables there that I can look at.

So as I go through the debugging process, what hopefully is happening is I'm kind of seeing little things here. I'm learning about things. If I want to find out what the current dim scale is, I can come here to my database, and let's see if we got dim scale here. Is dim scale here? Is dim scale here? There's dim scale right there. My dim scale is set to one.

So let's do this. Let's step through this. Go here. Next line. My block table record. This is the current space. What is that? Let's go to my BTR. Let's see where we're at here. Does it have a name? Let's scroll down here and see if-- there's a name. The name is star model space. Path name. This is not an xref. Interesting things there in the block table record.

Let's go to the start point. I'll pick a point. Then it jumps back into Visual Studio. Let's come through here. Pick my end point. I'll go boom, pick that point there. I created my new line. Let's take a look at the line object. What's in here? The angle is 0.302. That's in radians. So I can see properties there.

Let's see what else I've got here. The deltas for the X, Y, and Z deltas. That's pretty interesting there. I've got a-- I think I might have a length down here somewhere. There's my length right there. Line type. Line weight. So as you're debugging through your code, take time to look and see what kind of properties you have available to you on those different objects. OK. Yes?

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Yeah, so if you always want your start point to be a certain coordinate, you can hard code that in. Watch, you'll see an example of that in one second. Yes?

All right. Let's keep going. Let's get some more code in here, shall we? Go ahead and stop AutoCAD. Stop Visual Studio. Stop, stop, stop it. And let's get some more code in place here. So that's just some kind of hints as to get things going here on your debugging your application. Let's come down here and go to the next bit of code here called draw grid.

Now, someone asked a question about if I already know what points I want, what do I do? And this draw grid actually has that kind of an example here where we're actually got points we're specifying. We've got a loop here from 0 to 10 on the x and a loop from 0 to 10 on the y, and we're stepping in half unit increments. Half unit increments.

And then we're seeing-- I'm gonna use the x here for the start point and the x here for the end point and 0 for the y and 10 for the y on this line. And then we come down here and we say we're gonna use 0 for the x, 10 for the x, and then the y variables. So if we run this command here, what we'll get is a grid here. So let me try running this one. So this particular example uses a couple of loops. It uses a loop inside of a loop.

Start a new drawing. Net load. There's my program. I'm gonna go back to model space here. You can do it in paper space. I'm gonna go to model space. And as a matter of fact, let's see here. Are we drawing specifically in model space? No, current space. OK. So we're gonna type in draw grid. Hit Enter, and there's my grid. I'll do an erase all.

And let's come back into the grid here and put a break point there. And then run the command again. Draw a grid. Let's try taking the step on the x at a 0.25 and see what happens. I could step through line by line with the F11 key, but that'll take a while. So I'll just hit the F5 key on the keyboard. And now on the x, we're stepping at 0.25 and the y, we're stepping at one still. Or sorry, 0.5 in the y. What was that?

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Yeah. So add a break point somewhere in the code. And then make a change somewhere. You can change the step. You can go from 0 to 100 instead of from 0 to 10. Add a break point. Make a change. Hit the F5 key on the keyboard. Remember, you need to start the command in AutoCAD first. So we'll try draw a grid. Hit Enter. I'm gonna change that back to 0.5. And let's try 100 on the x. Run it. And there's 100 on the x.

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Did you start the command?

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Yes. Yeah, start the command first, and then hit the break point, and then you can change the code when you're hitting the break point. So you might want to be able to create a program that does some drawing inside of AutoCAD. That might be your thing. If that's the case, you could write code many, many times to draw a line in AutoCAD. You could do that. Or you could create a function that does it for you, that draws the line for you.

So what I'd like to do is close down AutoCAD here. In the handout, let's go over to page now 20. And notice we've got two things here. We've got a draw line function and a draw line test. I'm going to copy both those and paste it into my project here. And let's just take a look at what this draw line function is doing.

The draw line function is if you give me a starting x point and a starting y point-- those are variables I came up with. You can come up with your own variable names. And a starting z point and an ending x and an ending y and an ending z, or "zed" for those of you that use z's.

I'm going to go through and here's all the code I need to draw the line. I've got my document. I get the database from the document. I start the transaction. I get the current space, and then I draw my lines from the start x, y, z to the end x, y, z. So this code should look very familiar.

The great thing is, though, if we have a function like draw line function, then what I want to actually draw, we just say draw line function x, y, z, and x, y, z, and it draws a line. So write the code once and then reuse it over and over and over again. Carl? So write the code once and then reuse it over and over and over again.

Now, this is not in the handout. So if you'll watch my screen for one second, I'm gonna give you a little bit of a tip here. In my code, I'm going to open my toolbox. And you'll notice it says-- let me open that and pin it here. There we go. It says there are no usable controls in this group. Drag an item onto this text. Add it to the tool box.

So here's what I'm going to do. Let's pretend for a moment I've created this function called draw line function. I might want to use it in a bunch of different projects. If I highlight that and drag it and drop it over here, look what happens. It's there. Now in my project when I create a new project, all I do is drag and drop that in. There's my draw line function. So as you write code, create your own library of functions and procedures in that to do this stuff for you.

Now, the same could also be done with the import statements. If you have a bunch of import statements that you use regularly, take these, drag them and drop them over here. That way the next time you're creating a project, just drag and drop them over here, and you're done. OK, yes?

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Yeah, yeah. So the question was I've shown you how to drag and drop code over to this toolbox. Could I just create something where I'd put all my code in this class or in this module or whatever and call it from there? So I don't want to take away too much from the class, but let me just show you quickly how to do that and go back and watch the recording if you're interested, OK?

If I go to my project, I can come over here and add a module. I'll just call this module one. I come over here in module one. Sorry. Module one. And I can bring my function over here in module one. Then in my class, I'm gonna get rid of it in my class here. And so you could actually have a module that has all your stuff in it.

And now when I get to draw line function, it will jump over to the module and it'll actually run this code here. So you can have a module that just has all your code in it, and you have a module for drawing stuff and a module for interrogating a file and a module for Excel stuff and a module for writing to databases in the cloud stuff. So that's another way you could do that.

Now, here's how you-- let me just show you quickly on the screen how you would do that if you have a module like that, you don't want to copy that module into a project when you create a new project. What you want to do is save this. I'm going to go into a project. Add existing item. Let's pretend that this module is in a different project. Of course, it's already in this project. You pick on it. Then you come down to the Add button and you hit Add As Link. If you just pick Add, it's going to copy that whole file into your project.

So now instead of having one library with all these great functions in it, you have that same library in every single project. So if you have a single library with code in it, you can keep refining it and debugging it in one place instead of having to go to every single project if you find a bug and change it in a bunch of different projects. That's Add As Link. Little off side from the class here, but that's a great question.

And you'll notice this stuff turned red. Why did it turn red? Because I didn't have my import statements into the module. If I drag and drop that in, now they're no longer red.

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: Visual Studio can be used for tons of things. Obviously right now we're focusing on VB.NET, but it can be used for C#, F#, Python, all that stuff. All right, let's get back to the program here. Let's pull this back out of this and come back into the class. And there we go.

All right, so I highly recommend you think about, when you're writing your code, think about, could I use this again later? Would it make sense to make a function out of this? So drawing a grid, for example. You can have a grid function where you give it a starting x point and a y point and how many columns and how many rows and what's the width of the row and what's the height of the column-- height the rows and width of the columns. You can do that kind of thing for yourself, make your own libraries. All right.

OK, let's move on. I really want to get to blocks here. Page 21 in the handout. Remember we talked about how a DWG file is just a database. It has tables and it has table records. Blocks are interesting. Once you get into blocks, you have to understand even more how this database thing works. Model space is actually a block. Paper space layouts are actually blocks. That's really what they are in the database.

So in the AutoCAD DWG database, we have this thing called a block table. And inside the block table are block table records. And the first block table record in every single AutoCAD database is asterisk, star, model space. That's the first block in everything. So that's called a block table record. Layer's the same way. You got layer tables and layer table records. You have text style tables and text style table records.

Let's look at this function together here. Get all block table records. We're going to get the working database. A little bit different code than you've seen before. The working database is another way to get at the database of the current file that's open in AutoCAD. A working database. And what I'm doing here is I'm starting a transaction, because I want to read from the database. I get the block table. If you wanted to look for all the layers in a file, you would get the layer table instead of the block table. You'd copy this code, paste it, make a couple of minor changes, and you'd be getting information out of it. Then I'm going to get each object in the block table. And that comes out as an object ID. It doesn't matter if that makes any sense to you or not. That's OK for now.

And then we get that as a block table record. And then we add the name of that object to a list. What we're doing is creating a list in this function that we're gonna return. Get the database. Create a new list. A list is just a list. Think about it as a little sticky note we're gonna add items to. Start the transaction. Open the block table for read. Look at each object inside of that, and get out the list.

Let's just see what we get when we run that. Here's what we get when we actually use that and look at each object that's inside that block table records. We get star model space, star paper space, star paper space 0 if you run this code.

Now, if you go in and actually create a dimension inside of AutoCAD's model space or paper space and you run this same thing again, you're going to see star model space, star paper space, star paper space 0, then you're gonna see star D1. A dimension is a block. In a database, a dimension is a block. Anytime you have a compound type of object, it's usually a block in the database. Now, as users of AutoCAD, if we just draw lines, circles all day long, we don't think about that. We don't even have to worry about that. But that's really what's happening behind the scenes.

You'll notice the asterisk in front of the D1. Star D1, star model space, star paper space. The star means it's called an anonymous block. An anonymous block. If I go into AutoCAD and I type insert, I'm not going to see star model space in there. I might see door or window, but I won't see star model space. That's an anonymous block. Anonymous blocks can't be inserted by using the insert command. Just something to be aware of.

All right. What I'd like for you to do-- let's do this. Let's get down to some code that we can actually use here. Go down to the page 23 in the handout. We're gonna copy the get block references in model space code. Let me zoom out a little bit here so you can see the whole page. Copy that code. And we're going to paste that inside of our class here. Get block reference IDs in model space.

Now, this is an introductory class. We have 90 minutes to do some things. And what I've chosen to do this year is instead of trying to be super explanatory with everything, I'm trying to give you some code that you can actually go back and mess with and play with and work with. What this function does is gives us all of the blocks in model space with their names and object IDs to all the block references. That's what it does. Let's see here.

Now let's get the write blocked out code as well on page 24. Same thing. We'll grab that code and copy and paste that into our class here. So we've got write blocks out. And we have get block reference in-- so I get all-- sorry. Get block references in model space and write blocks out.

Start the debugging process. In a second, I'm gonna have you open a file that's on your system. So I need you to watch the screen as I do that. So start the debugging process. We're going to open a file. And in the handout, you can see that URL to a page from Autodesk where you can get sample DWG files. And this is one of those files.

So we're going to go to open a file. And here's where it is. C, Data Sets, then the data set for this class, which is the bottom directory here, SD 197926, et cetera. Then AU all code directory. There should be a DWG file there called blocks and tables imperial. That's the path. So open that file inside of AutoCAD. If you've got serious issues with the imperial system of units, then you can download the metric version from the sample files.

All right. Click on Open. That's what you should get. Let's net load our program. Pick it out of the list there. And before you run the command, go back to AutoCAD and let's add a break point right here. Mine says line 116. It's the for each my KVP line of code.

Add a break point there. And then go back into AutoCAD and run the command called write blocks out. Back in AutoCAD. Write blocks out. Hit Enter and get back there. OK, is anyone lost right now?

Now, if we will go over to the my blocks variable and drop that down, you're going to see block names. And if you expand that out, you're going to see object IDs and the value. So I've got five columns in this file. Lighting fixtures. I've got 29 of those. Receptacles. 45 receptacles. 20 switches. Two bathtubs. One refrigerator. One range. Four sinks.

Go ahead and hit F5 on the keyboard. Let it run, and then browse to your desktop. And there should be a file there called windows.txt. If you open that up, what you'll see is the extraction you just did. Now, if you step through that code line by line, you'll see it's pulling out the name of the block. It's getting the x, y, and z location. It's getting the scale factor. It's getting the rotation of the block. Anyone getting that?

Now, if you look at the code and you're not quite sure how it's working but it is working, you can step through the code line by line and look at it. One of the reasons I like the VB, the Visual Basic language, is for me I can just kind of read it line by line and kind of read what it says and kind of figure it out in the flow. For me the syntax is easier to read than your C#s and your C++ and that.

So back to the code here. If that's working for you, go ahead and stop that. Let's bring in some more code now.

AUDIENCE: [INAUDIBLE]

JERRY WINTERS: To the desktop. You have to minimize your applications. And on your desktop, you should see a link there for windows.txt. All right. Let's go back to the handout here.

And now we're going to add a little bit more code to our project here. And the code is on page 25. Is one, two, three, four, five lines of code. And with those five lines of code, in addition to getting the blocks, we're now going to get the attributes out as well. Page 26 of the handout has the code to copy and paste. This is called write blocks and attributes out. So select it. Right click. Copy into our project. After AutoCAD has stopped. Make sure you don't copy inside of an existing sub. Make sure it's inside the class. And you can paste that in there.

So go to C, Data Sets, and then the name of the class. Yep. C, Data Sets. The bottom one. Good. And the top folder. There it is. Yeah. Good. So we try running this particular code, write blocks and attributes out. A new file called windowsat.txt will be added to your desktop.

OK, we've got three minutes left before they're gonna kick us out here. So if I could have your attention for one second. I'm just going to quickly add in another piece of code. This is some extra content here. I'm going to come in here and copy this code and paste it into my project, and I'm going to run it. I'm going to pick that same blocks and tables file, just because it's convenient.

And what this code is going to do is it's going to, instead of writing to a text file, it's going to write to Microsoft Excel. Open a file. There it is. We'll net load. Pick our program. Write blocks and attributes out to Excel. I'm gonna run that. Here's Excel. There's my block and attributes for the window block. There we go.

Now, I want to mention one more thing to you before we close up here. If you'll look at this code right here on the screen, get block references and model space, you'll notice that it says DB in as database. DB in as database. If you go through the rest of the extra content, what you'll find is you can actually use this code on a DWG file that's not open in AutoCAD.

So the code in the handout, you can copy paste it, you can type it in, will allow you to select thousands of DWG files all at once. Click the button, and it will go through every single one of those and open them up in memory, not in the editor. That's critical, because it takes time to open a drawing in the editor. It lets you open it inside memory. It'll pull out all the blocks and attributes into Excel. Then it'll go to the next file. Pull out all the blocks and attributes. Go to the next file. Pull out all the blocks and attributes. The code's there. It works. I promise.

My email's at the very last page of this. If you have questions or problems, feel free to ask me. Who can start a new project in Visual Studio to create a new [INAUDIBLE] in AutoCAD? How many of you can do that now? Hopefully most of you, all of you. OK, good. You can do that, right? You can create new commands. You can find code. You can copy and paste. All right, class is over. Thank you so much, guys. Have a great Autodesk University.

______
icon-svg-close-thick

Cookie preferences

Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

May we collect and use your data?

Learn more about the Third Party Services we use and our Privacy Statement.

Strictly necessary – required for our site to work and to provide services to you

These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

Improve your experience – allows us to show you what is relevant to you

These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

Customize your advertising – permits us to offer targeted advertising to you

These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

icon-svg-close-thick

THIRD PARTY SERVICES

Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

icon-svg-hide-thick

icon-svg-show-thick

Strictly necessary – required for our site to work and to provide services to you

Qualtrics
We use Qualtrics to let you give us feedback via surveys or online forms. You may be randomly selected to participate in a survey, or you can actively decide to give us feedback. We collect data to better understand what actions you took before filling out a survey. This helps us troubleshoot issues you may have experienced. Qualtrics Privacy Policy
Akamai mPulse
We use Akamai mPulse to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Akamai mPulse Privacy Policy
Digital River
We use Digital River to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Digital River Privacy Policy
Dynatrace
We use Dynatrace to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Dynatrace Privacy Policy
Khoros
We use Khoros to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Khoros Privacy Policy
Launch Darkly
We use Launch Darkly to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Launch Darkly Privacy Policy
New Relic
We use New Relic to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. New Relic Privacy Policy
Salesforce Live Agent
We use Salesforce Live Agent to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Salesforce Live Agent Privacy Policy
Wistia
We use Wistia to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Wistia Privacy Policy
Tealium
We use Tealium to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Tealium Privacy Policy
Upsellit
We use Upsellit to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Upsellit Privacy Policy
CJ Affiliates
We use CJ Affiliates to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. CJ Affiliates Privacy Policy
Commission Factory
We use Commission Factory to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Commission Factory Privacy Policy
Google Analytics (Strictly Necessary)
We use Google Analytics (Strictly Necessary) to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Google Analytics (Strictly Necessary) Privacy Policy
Typepad Stats
We use Typepad Stats to collect data about your behaviour on our sites. This may include pages you’ve visited. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our platform to provide the most relevant content. This allows us to enhance your overall user experience. Typepad Stats Privacy Policy
Geo Targetly
We use Geo Targetly to direct website visitors to the most appropriate web page and/or serve tailored content based on their location. Geo Targetly uses the IP address of a website visitor to determine the approximate location of the visitor’s device. This helps ensure that the visitor views content in their (most likely) local language.Geo Targetly Privacy Policy
SpeedCurve
We use SpeedCurve to monitor and measure the performance of your website experience by measuring web page load times as well as the responsiveness of subsequent elements such as images, scripts, and text.SpeedCurve Privacy Policy
Qualified
Qualified is the Autodesk Live Chat agent platform. This platform provides services to allow our customers to communicate in real-time with Autodesk support. We may collect unique ID for specific browser sessions during a chat. Qualified Privacy Policy

icon-svg-hide-thick

icon-svg-show-thick

Improve your experience – allows us to show you what is relevant to you

Google Optimize
We use Google Optimize to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Google Optimize Privacy Policy
ClickTale
We use ClickTale to better understand where you may encounter difficulties with our sites. We use session recording to help us see how you interact with our sites, including any elements on our pages. Your Personally Identifiable Information is masked and is not collected. ClickTale Privacy Policy
OneSignal
We use OneSignal to deploy digital advertising on sites supported by OneSignal. Ads are based on both OneSignal data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that OneSignal has collected from you. We use the data that we provide to OneSignal to better customize your digital advertising experience and present you with more relevant ads. OneSignal Privacy Policy
Optimizely
We use Optimizely to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Optimizely Privacy Policy
Amplitude
We use Amplitude to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Amplitude Privacy Policy
Snowplow
We use Snowplow to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Snowplow Privacy Policy
UserVoice
We use UserVoice to collect data about your behaviour on our sites. This may include pages you’ve visited. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our platform to provide the most relevant content. This allows us to enhance your overall user experience. UserVoice Privacy Policy
Clearbit
Clearbit allows real-time data enrichment to provide a personalized and relevant experience to our customers. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID.Clearbit Privacy Policy
YouTube
YouTube is a video sharing platform which allows users to view and share embedded videos on our websites. YouTube provides viewership metrics on video performance. YouTube Privacy Policy

icon-svg-hide-thick

icon-svg-show-thick

Customize your advertising – permits us to offer targeted advertising to you

Adobe Analytics
We use Adobe Analytics to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Adobe Analytics Privacy Policy
Google Analytics (Web Analytics)
We use Google Analytics (Web Analytics) to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Google Analytics (Web Analytics) Privacy Policy
AdWords
We use AdWords to deploy digital advertising on sites supported by AdWords. Ads are based on both AdWords data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that AdWords has collected from you. We use the data that we provide to AdWords to better customize your digital advertising experience and present you with more relevant ads. AdWords Privacy Policy
Marketo
We use Marketo to send you more timely and relevant email content. To do this, we collect data about your online behavior and your interaction with the emails we send. Data collected may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, email open rates, links clicked, and others. We may combine this data with data collected from other sources to offer you improved sales or customer service experiences, as well as more relevant content based on advanced analytics processing. Marketo Privacy Policy
Doubleclick
We use Doubleclick to deploy digital advertising on sites supported by Doubleclick. Ads are based on both Doubleclick data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Doubleclick has collected from you. We use the data that we provide to Doubleclick to better customize your digital advertising experience and present you with more relevant ads. Doubleclick Privacy Policy
HubSpot
We use HubSpot to send you more timely and relevant email content. To do this, we collect data about your online behavior and your interaction with the emails we send. Data collected may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, email open rates, links clicked, and others. HubSpot Privacy Policy
Twitter
We use Twitter to deploy digital advertising on sites supported by Twitter. Ads are based on both Twitter data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Twitter has collected from you. We use the data that we provide to Twitter to better customize your digital advertising experience and present you with more relevant ads. Twitter Privacy Policy
Facebook
We use Facebook to deploy digital advertising on sites supported by Facebook. Ads are based on both Facebook data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Facebook has collected from you. We use the data that we provide to Facebook to better customize your digital advertising experience and present you with more relevant ads. Facebook Privacy Policy
LinkedIn
We use LinkedIn to deploy digital advertising on sites supported by LinkedIn. Ads are based on both LinkedIn data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that LinkedIn has collected from you. We use the data that we provide to LinkedIn to better customize your digital advertising experience and present you with more relevant ads. LinkedIn Privacy Policy
Yahoo! Japan
We use Yahoo! Japan to deploy digital advertising on sites supported by Yahoo! Japan. Ads are based on both Yahoo! Japan data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Yahoo! Japan has collected from you. We use the data that we provide to Yahoo! Japan to better customize your digital advertising experience and present you with more relevant ads. Yahoo! Japan Privacy Policy
Naver
We use Naver to deploy digital advertising on sites supported by Naver. Ads are based on both Naver data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Naver has collected from you. We use the data that we provide to Naver to better customize your digital advertising experience and present you with more relevant ads. Naver Privacy Policy
Quantcast
We use Quantcast to deploy digital advertising on sites supported by Quantcast. Ads are based on both Quantcast data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Quantcast has collected from you. We use the data that we provide to Quantcast to better customize your digital advertising experience and present you with more relevant ads. Quantcast Privacy Policy
Call Tracking
We use Call Tracking to provide customized phone numbers for our campaigns. This gives you faster access to our agents and helps us more accurately evaluate our performance. We may collect data about your behavior on our sites based on the phone number provided. Call Tracking Privacy Policy
Wunderkind
We use Wunderkind to deploy digital advertising on sites supported by Wunderkind. Ads are based on both Wunderkind data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Wunderkind has collected from you. We use the data that we provide to Wunderkind to better customize your digital advertising experience and present you with more relevant ads. Wunderkind Privacy Policy
ADC Media
We use ADC Media to deploy digital advertising on sites supported by ADC Media. Ads are based on both ADC Media data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that ADC Media has collected from you. We use the data that we provide to ADC Media to better customize your digital advertising experience and present you with more relevant ads. ADC Media Privacy Policy
AgrantSEM
We use AgrantSEM to deploy digital advertising on sites supported by AgrantSEM. Ads are based on both AgrantSEM data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that AgrantSEM has collected from you. We use the data that we provide to AgrantSEM to better customize your digital advertising experience and present you with more relevant ads. AgrantSEM Privacy Policy
Bidtellect
We use Bidtellect to deploy digital advertising on sites supported by Bidtellect. Ads are based on both Bidtellect data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Bidtellect has collected from you. We use the data that we provide to Bidtellect to better customize your digital advertising experience and present you with more relevant ads. Bidtellect Privacy Policy
Bing
We use Bing to deploy digital advertising on sites supported by Bing. Ads are based on both Bing data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Bing has collected from you. We use the data that we provide to Bing to better customize your digital advertising experience and present you with more relevant ads. Bing Privacy Policy
G2Crowd
We use G2Crowd to deploy digital advertising on sites supported by G2Crowd. Ads are based on both G2Crowd data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that G2Crowd has collected from you. We use the data that we provide to G2Crowd to better customize your digital advertising experience and present you with more relevant ads. G2Crowd Privacy Policy
NMPI Display
We use NMPI Display to deploy digital advertising on sites supported by NMPI Display. Ads are based on both NMPI Display data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that NMPI Display has collected from you. We use the data that we provide to NMPI Display to better customize your digital advertising experience and present you with more relevant ads. NMPI Display Privacy Policy
VK
We use VK to deploy digital advertising on sites supported by VK. Ads are based on both VK data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that VK has collected from you. We use the data that we provide to VK to better customize your digital advertising experience and present you with more relevant ads. VK Privacy Policy
Adobe Target
We use Adobe Target to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Adobe Target Privacy Policy
Google Analytics (Advertising)
We use Google Analytics (Advertising) to deploy digital advertising on sites supported by Google Analytics (Advertising). Ads are based on both Google Analytics (Advertising) data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Google Analytics (Advertising) has collected from you. We use the data that we provide to Google Analytics (Advertising) to better customize your digital advertising experience and present you with more relevant ads. Google Analytics (Advertising) Privacy Policy
Trendkite
We use Trendkite to deploy digital advertising on sites supported by Trendkite. Ads are based on both Trendkite data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Trendkite has collected from you. We use the data that we provide to Trendkite to better customize your digital advertising experience and present you with more relevant ads. Trendkite Privacy Policy
Hotjar
We use Hotjar to deploy digital advertising on sites supported by Hotjar. Ads are based on both Hotjar data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Hotjar has collected from you. We use the data that we provide to Hotjar to better customize your digital advertising experience and present you with more relevant ads. Hotjar Privacy Policy
6 Sense
We use 6 Sense to deploy digital advertising on sites supported by 6 Sense. Ads are based on both 6 Sense data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that 6 Sense has collected from you. We use the data that we provide to 6 Sense to better customize your digital advertising experience and present you with more relevant ads. 6 Sense Privacy Policy
Terminus
We use Terminus to deploy digital advertising on sites supported by Terminus. Ads are based on both Terminus data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Terminus has collected from you. We use the data that we provide to Terminus to better customize your digital advertising experience and present you with more relevant ads. Terminus Privacy Policy
StackAdapt
We use StackAdapt to deploy digital advertising on sites supported by StackAdapt. Ads are based on both StackAdapt data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that StackAdapt has collected from you. We use the data that we provide to StackAdapt to better customize your digital advertising experience and present you with more relevant ads. StackAdapt Privacy Policy
The Trade Desk
We use The Trade Desk to deploy digital advertising on sites supported by The Trade Desk. Ads are based on both The Trade Desk data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that The Trade Desk has collected from you. We use the data that we provide to The Trade Desk to better customize your digital advertising experience and present you with more relevant ads. The Trade Desk Privacy Policy
RollWorks
We use RollWorks to deploy digital advertising on sites supported by RollWorks. Ads are based on both RollWorks data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that RollWorks has collected from you. We use the data that we provide to RollWorks to better customize your digital advertising experience and present you with more relevant ads. RollWorks Privacy Policy

Are you sure you want a less customized experience?

We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

Your experience. Your choice.

We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

May we collect and use your data to tailor your experience?

Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.