Sei sulla pagina 1di 2

DDE and AutoCAD LT

When Autodesk decided to remove the AutoLISP programming language from AutoCAD LT just prior to release many people wrote AutoCAD LT off as a novelty CAD application for only the basic CAD requirements. However, simply by running in the Microsoft Windows multitasking environment, AutoCAD opens itself to arguably a easier and more flexiable programming language - Visual Basic Dynamic data echange, or DDE is a feature provided by the Microsoft Windows operating system which allows two applications to "talk" to each other. Examples of DDE at work are the cut and paste commands found in most Windows applications and the launching of the appropiate program when a file is doubleclicked in File Manager, or Explorer. To establish a DDE link with AutoCAD we need to set the LinkMode and LinkTopic properties for the contol that will supply the commands to AutoCAD. Contols that support these properties are: Form Label MDIForm PictureBox TextBox I find a TextBox contol the easiest to use. The LinkTopic property varies for different versions: Version AutoCAD LT Release 1* AutoCAD LT Release 2 AutoCAD LT for Windows '95 AutoCAD LT for Windows '98 AutoCAD LT 2000 AutoCAD R12 for Windows AutoCAD R13 for Windows AutoCAD R14 AutoCAD 2000 LinkTopic

AutoCAD LT.DDE|system

Please advise AutoCAD.DDE|system AutoCAD.R13.DDE|system AutoCAD.R14.DDE|system AutoCAD.R15.DDE|system

* I have not tested a DDE link with AutoCAD LT Release 1, and have read that there may be some problems. If you are still using R1 do yourself a favour and upgrade. The pipe symbol [ | ], or ASCII charactor code 124, is found above the backslash on standard keyboards.

The following code establishes a DDE link with AutoCAD LT and sends the commands to plot a drawing by limits. To use paste into the Declarations section of a form that contains a TextBox and a CommandButton. Note that as there is no error trapping AutoCAD LT must be running before you run the code. -------------------------Start of Code---------------------P r i v a t eS u bC o m m a n d 1 _ C l i c k ( ) T e x t 1 . L i n k M o d e=0 T e x t 1 . L i n k T o p i c=" A u t o C A DL T . D D E | s y s t e m " T e x t 1 . L i n k M o d e=2 T e x t 1 . L i n k E x e c u t e" _ f i l e d i a "&C h r ( 1 3 )&" 0 "&C h r ( 1 3 ) T e x t 1 . L i n k E x e c u t e" _ p l o t "&C h r ( 1 3 ) T e x t 1 . L i n k E x e c u t e" L "&C h r ( 1 3 )&" N "&C h r ( 1 3 ) T e x t 1 . L i n k E x e c u t e" _ f i l e d i a "&C h r ( 1 3 )&" 1 "&C h r ( 1 3 ) E n dS u b

' 0=r e s e t ' e s t a b l i s hD D El i n k ' 2=m a n u a lc o n n e c t i o n

-------------------------End of Code----------------------

Potrebbero piacerti anche