Under Construction   Visual Basic  Under Construction

  Site Map

Index Index
   AutoCAD LT
AutoCAD LT
   Visual Basic
Visual Basic
        Tips & Tricks
DDE and AutoCAD LT
   Resources
Resources on the Net
   Resources
Active Projects
   Contact BigByte
Contact BigByte
 

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

LinkTopic

AutoCAD LT Release 1*
AutoCAD LT Release 2
AutoCAD LT for Windows '95
AutoCAD LT for Windows '98
AutoCAD LT.DDE|system
AutoCAD LT 2000 Please advise
AutoCAD R12 for Windows AutoCAD.DDE|system
AutoCAD R13 for Windows AutoCAD.R13.DDE|system
AutoCAD R14 AutoCAD.R14.DDE|system
AutoCAD 2000 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----------------------

Private Sub Command1_Click()  
Text1.LinkMode = 0 '0 = reset
Text1.LinkTopic = "AutoCAD LT.DDE|system" 'establish DDE link
Text1.LinkMode = 2 '2 = manual connection
Text1.LinkExecute "_filedia" & Chr(13) & "0" & Chr(13)  
Text1.LinkExecute "_plot" & Chr(13)  
Text1.LinkExecute "L" & Chr(13) & "N" & Chr(13)  
Text1.LinkExecute "_filedia" & Chr(13) & "1" & Chr(13)  
End Sub  

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

DDEDemo is small application that demonstartes how the principals discribed above can be used. The source code, written in VB4 is available here.

Download ddedemo.zip (3.59KB, last modified 06/07/97)


Screen Shot

 


Copyright © 1998 by BigByte Drafting.
All rights reserved.
Revised: 30 Dec 1999 20:37.