1 / 22

CP305-3 C# .NET Command School

CP305-3 C# .NET Command School. Doug Goforth Software Development: National MultiTech LTD, CadPLUS Products. Doug Goforth - Real code examples you can use - Prompting the Autodesk way - Getxxx functions in .NET - Setting and getting keyword responses Creating LISP Function in .NET

raheem
Download Presentation

CP305-3 C# .NET Command School

An Image/Link below is provided (as is) to download presentation Download 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


  1. CP305-3 C# .NET Command School Doug Goforth Software Development: National MultiTech LTD, CadPLUS Products

  2. Doug Goforth - Real code examples you can use - Prompting the Autodesk way - Getxxx functions in .NET - Setting and getting keyword responses Creating LISP Function in .NET Deployment .NET Command School

  3. Please quiet your cell phones and pagers. If your have to leave, please do so quietly. Please hold questions until the end. If your eat candy with noisy wrappers please share with those around you Before We Start…

  4. About Doug and the Stuff He Does Over 20 years of CAD solution experience for Facilities. Member of Autodesk Developer Network Developer/Programmer for CadPLUS Products written in .NET for AutoCAD 2005/2006/2007/2008/2009/2010… Developed client software, strategy, and procedures for200 million sf FM solution including MapGuide deployment. Developer for a plethora of programs in AutoLISP, VB6, .NET, MapGuide, WebSphere, Java, ASP, JSP (and a smattering of ObjectARX)

  5. About You and the Stuff You Do VB programmers? C# programmers? AutoLISP programmers? Programmed in ObjectARX? Only job is programming for AutoCAD? New to .NET programming for AutoCAD? Have written installation programs for AutoCAD apps?

  6. Giving Your Command Some Style • Why Emulate the AutoCAD Style? • AutoCAD is consistent in their presentation of command prompts • Users are already familiar with the AutoCAD Style • Familiar prompting will promote user-friendliness • User-friendly programmers are loved and adored by all

  7. Prompts We Know and Love • Select objects: • Specify a point: • Specify first point: • Specify height <0.200>: • Specify base point or [Displacement] <Displacement>: • Enter block name or [?]: • Enter an option [Next/Previous/Go/eXit] <N>:

  8. All Prompts are Created Equal Command: MYCOMMAND Please do something now [First/Second]<F>:

  9. User Responses Type something, text/keyword Select something Press ENTER Press ESC

  10. COM Pros • Can be used to interact with AutoCAD from a standalone exe Cons • Prompt strings must be constructed entirely by the programmer Managed Pros • Can be compiled in an AutoCAD aware assembly • Programming for prompts can use methods and intellisense provided in the API Cons • Vast API for prompting cannot be accessed through COM COM vs. Managed Code

  11. Basic Project Setup COMNot necessary for managed .NET code, but useful for accessing AutoCAD from other Windows executables. • AutoCAD 2010 Type Library (AutoCAD) • AutoCAD/ObjectDBX Common 18.0 Type Library (AXDBLib) Managed DLLs (referenced from your ACAD folder) • acdbmgd.dll (autocad-database-managed) • acmgd.dll (autocad-managed)

  12. Managed Code Essentials Namespaces • Autodesk.AutoCAD.Runtime • Autodesk.AutoCAD.EditorInput • Autodesk.AutoCAD.ApplicationServices • Autodesk.AutoCAD.DatabaseServices • DbTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager • Autodesk.AutoCAD.Geometry

  13. Managed Code Essentials Defining a Command Autodesk.AutoCAD.Runtime.CommandMethod • Used to make your command visible to AutoCAD • Compile to a dll • Load into ACAD with the NETLOAD command • May also be demandloaded in the registry

  14. Managed Code Essentials Writing to the Command: Line MdiActiveDocument.Editor • Gives you a way to interact with the AutoCAD Editor • Used to write your prompt to the Command: line

  15. Managed Code Essentials Prompt Classes and Methods Prompt OptionAutodesk.AutoCAD.EditorInput.PromptxxxOptions • Gives you a way to compose the prompt Prompt ResultAutodesk.AutoCAD.EditorInput.PromptxxxResult • Tells you how the user responded to your prompt

  16. Managed Code for Prompting

  17. Uses [LispFunction] Class attribute Arguments are passed as a ResultBuffer object Argument order can be determined by casting the ResultBuffer to an Array object Argument types can be determined by testing the type of the value property of the TypedValue object in the ResultBuffer .NET LISP Functions

  18. Demandloading Your Application Registry Making AutoCAD “aware” of your application What is it called? What is the assembly file name? Where is it located? How should it be loaded? On startup, on object load, etc? Specified as managed code? What is the command name?

  19. REG File ComSchool.reg Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Applications\AUNetLoad] "DESCRIPTION"="AU 2010 Demandload Example" "LOADER"="C:\\Program Files\\AU2009\\ComSchool.dll" "LOADCTRLS"=dword:00000002 "MANAGED"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Applications\AUNetLoad\Commands] "AUNetLoad"="AUText" [HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Applications\AUNetLoad\Groups] "AUNetMan"="AUNetMan"

  20. Product ID Registry Keys AutoCAD 2010 [HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Applications\AUNetLoad] ..\R18.0\ACAD-8001:409 = AutoCAD ..\R18.0\ACAD-8002:409 = Map ..\R18.0\ACAD-8003:409 = Mechanical Desktop for AIS ..\R18.0\ACAD-8004:409 = Architectural Desktop ..\R18.0\ACAD-8005:409 = AutoCAD Mechanical ..\R18.0\ACAD-8006:409 = Building Systems ..\R18.0\ACAD-8007:409 = AutoCAD Electrical ..\R18.0\ACAD-8008:409 = Land Desktop ..\R18.0\ACAD-8009:409 = AutoCAD LT ..\R18.0\AOEM-8001:409 = AutoCAD OEM ..\R18.0\ACAD-8013:409 = Mechanical Desktop for AIP ..\R18.0\ACAD-8022:409 = Autodesk Utility Design ..\R18.0\ACAD-8000:409 = Autodesk Civil 3D ..\R18.0\ACAD-8012:409 = Architectural Desktop w/Raster Design Product Name Product ID ACAD Version Language------------ 409=English 407=German 404=Chinese Etc. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_61df.asp

  21. MSI Installation

  22. CP314-3 C# .NET Command School Doug Goforth doug.goforth@nationalmultitech.com Have a great AU! Thank You!

More Related