AutoCAD APIs The Right Tools for the Job. Fenton Webb Senior Developer Evangelist. About the Presenter. Fenton Webb Developer Technical Services Americas Autodesk, Inc http ://twitter.com/fentonwebb
An Image/Link below is provided (as is) to download presentationDownload Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only. Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
E N D
Presentation Transcript
AutoCAD APIsThe Right Tools for the Job Fenton Webb Senior Developer Evangelist
About the Presenter Fenton WebbDeveloper Technical ServicesAmericasAutodesk, Inc http://twitter.com/fentonwebb Fenton has been a member of the Autodesk DevTech team since 2000. Originally a member of our EMEA team, he has recently relocated to California to work for DevTech Americas. Fenton is an expert in all the AutoCAD APIs, AutoCAD OEM, RealDWG and Revit. He particularly enjoys travelling to evangelise the APIs he support at our annual Developer Days conferences. Before joining Autodesk, Fenton worked for an ADN partner developing ObjectARX applications in the Civil and Structural Engineering domain.
Autodesk Developer Network Access to almost all Autodesk software and SDK’s Including early access to Beta software Members-only website with 1000s of technical articles Unlimited technical support Product direction through conferences Marketing benefits Exposure on autodesk.com Promotional opportunities 1 to 3 free API training classes Based on user level www.autodesk.com/joinadn
DevLab San Francisco, USA Feb 1-5, 2010 Farnborough, UK Feb 8-12, 2010 Munich, Germany June 7-11, 2010 Other countries TBD www.autodesk.com/apitraining > Schedule stephen.preston@autodesk.com
What’s this seminar all about? The Purpose Provide some background information that will help inform your decision on which API you should learn. Lets keep it informal!! Lets talk! It’s a Beginner Course, but feel free to make it Advanced We won’t be learning to program
Agenda AutoCAD Customization Explained What API’s Have We Got? Cost of Start-up Development API Learning Curves API Flexibility API Security API Performance Questions
AutoCAD Customization Explained AutoCAD is great at drawing anything! You can draw anything in AutoCAD Boats, Cars, Planes, Trains Bridges, Houses, Computers, Chairs, Walls, Pipes Cabling, Circuit boards Etc But only made up of primitives Lines, Circles, Arcs
AutoCAD Customization Explained Why would we Customize AutoCAD? Make it easier to use To speed up your work (repetitive tasks). Instead of drawing 6 lines to draw a window, enter a length, height and type To create a better model. Make a line represent a pipe or wire Link entities in an intelligent framework Automatically update parts lists
AutoCAD Customization Explained How can we customize AutoCAD? Via the Product Menus and Toolbars Action Recorder Via the Product “Customization Interfaces” Macros Extended Entity Data Custom objects/entities UI …
AutoCAD Customization Explained Customization Interfaces A customization interface is also called an Application Programming Interface (API). AutoCAD has four APIs AutoLISP/Visual LISP ActiveX (VB/VBA) ObjectARX .NET
AutoCAD Customization Explained AutoCAD API History Release 2.17 Introduced AutoLISP Release 11 ADS – C programming SDK Captured the imagination of the very large C programming community. Release 12 DCL (Dialog control language) allowed for more sophisticated UI. Release 13 ObjectARX first introduced, C++ API harnessing Object Oriented programming techniques. MFC support. Release 14/14.01 Extensions to ObjectARX. VBA – Visual basic for applications. VB6 Support also Release 2000/2000i/2002 Extensions to ObjectARX. MDI – multiple document interface. Release 2004,2005 ObjectARX greatly enhanced, including all new UI capabilities. Release 2006 .NET API first version built on top of ObjectARX Release 2007, 2008, 2009 Greatly enhanced .NET API’s further extending the possibilities and power of .NET.
AutoCAD Customization Explained API’s and DE’s or IDE’s To access each API, you must use a Development Environment Allows you to create an application using a particular programming language. API DE/IDE Language ObjectARX/.NET Visual Studio C++/VB.NET/C# VBAIDE VBA Visual Basic Visual Basic ActiveX etc … etc … LISP VLIDE LISP
What API’s Have We Got? Let’s Consider the Pros and Cons of Each API
What API’s Have We Got? AutoLISP/Visual LISP
What API’s Have We Got? VBA – In Process
What API’s Have We Got? VB6 – Out of Process
What API’s Have We Got? ObjectARX
What API’s Have We Got? .NET
What APIs have we got? Recap
Cost of Startup Development For small scale customization, you might prefer not to buy any extra software. VBA and LISP are included in AutoCAD. Integrated Development Environments VB and ObjectARX and .NETrequire extra software. VB – Visual Basic 6 ObjectARX 2007/2008/2009 – Visual Studio 2005 .NET – Visual Studio 2005/2008
Learning Curve A big investment in your customization work is the time it takes you to learn the API. Your choice of API will depend on how easy it is for you to learn and what your customisation requirements are.
Learning Curve - LISP To use LISP, you must understand DXF codes. LISP keywords are not 'obvious', and can be difficult for beginners to remember. What does ‘car’, 'cdr' or ‘setq’ mean to you? Unlike C++/.NET and ActiveX, LISP is not commonplace.
Learning Curve - ActiveX The easiest programming language to use with ActiveX is VB(A). VB(A) is a high level language. It is designed specifically for 'ActiveX automation'. You can quickly write powerful applications using very little code. You have to try very hard to crash AutoCAD using VB(A).
Learning Curve - ObjectARX You must already be familiar with Visual C++. User Interface features require a knowledge of MFC (another large C++ API). C++ is a low-level programming language. You have to write and maintain a lot of code compared to higher level languages. If you don’t know what you’re doing, you can easily crash AutoCAD.
Learning Curve - .NET Advantage of High level programming language syntax (Vb.net) User Interface features very easy and powerful. Wraps ObjectARX… If you don’t know what you’re doing, you can easily crash AutoCAD.
Learning Curve
Flexibility AutoCAD's ActiveX interface is extensive, but not exhaustive. LISP can access some functionality not available to ActiveX. ObjectARX/.NET can do much more and can be used to create extra ActiveX and LISP functionality. ObjectARX ActiveX LISP .NET
Security How safe is your source code from prying eyes? You might not want someone else to be able to read and modify your code. Nothing is completely safe if someone really wants to get at it. But some code is easier to break into than others.
Security Uncompiled LISP is insecure You can read and edit it using 'notepad'. VBA is insecure You can download software from the internet that breaks VBA's password protection system. VB, Compiled LISP, and ObjectARX are much more secure It is difficult for someone to decompile or modify your application. .NET *can be* insecure Be careful.
Performance
Performance “Storing Data in AutoCAD” Global Data Store Application specific settings Parts Lists, Schedule Data, basic Product Data Object Interconnectivity Details/Maps Object Specific Data Extra Data related to the Object Entity Specific Data Extra Data related to the Entity Can Transform a standard Entity (Line) into something (Pipe) External Database reference Id’s
Performance - Storing Data in AutoCAD Difference Programming Techniques API Support
Performance - Storing Data in AutoCAD Performance Results Data Container Performance Chart – 1 million cycles Time in seconds
Performance - Storing Data in AutoCAD Performance Results Data Container Performance Chart – 1 million cycles Time in seconds
Performance - Storing Data in AutoCAD Performance Results Data Container Performance Chart – 1 million cycles Time in seconds
Performance - Storing Data in AutoCAD Maximum Data Storage Data Container Limits (32bit OS)
Performance - Storing Data in AutoCAD Security
Discussion…
Conclusion Use ActiveX if you want to do something simple quickly, or to access AutoCAD from an external application. Use ObjectARX if you need speed, or you want to use functionality not provided elsewhere. Don't start learning LISP unless you have to maintain legacy code. Use and learn .NET. It’s as powerful as ObjectARX and as easy to write as VBA – it’s the language of the future.
Additional Resources Online help SDK samples Developer Center www.autodesk.com/developautocad DevTV Discussion Groups http://discussion.autodesk.com autodesk.inventor.customization API Training Classes www.autodesk.com/apitraining Autodesk Developer Network www.autodesk.com/joinadn
Free training!!! Attend an ADN API training class in 2008 for free Normally costs up to $1500 Schedule listed on www.autodesk.com/apitraining Leave your business card during the seminar