BackToCAD Technologies LLC, Clearwater, USA |  Artificial Intelligence and Software Developing  |  Atlanta, USA; Stuttgart, Germany |  Kazmierczak®  Company

Programming CAD.direct 2019

 

Another way you can customize CAD.direct 2019 is to add custom programs written in any of  several programming languages that run within CAD.direct 2019, including the following: TX, .NET, LISP, SDS, DCL, VBA and VSTA, and DIESEL.

 

In CAD.direct 2019, you can run many programs originally created for use with AutoCAD. Specifically, you can use programs written entirely in AutoLISP with no modification. In addition, you can run many ADS programs originally written for use with AutoCAD after first recompiling them using the CAD.direct 2019 run-time libraries. Many AutoCAD third-party programs are compatible with CAD.direct 2019.

 

Use the online Help.

 

For information about programming for CAD.direct 2019, see the online Help for the IntelliCAD Developer’s Reference.

 

Using TX

 

The TX interface is available for developers to create custom entities and applications.

 

To load a TX/IRX custom application Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load Application (in Applications).
  • On the menu, choose Tools > Load Application.
  • Type appload and then press Enter.
  • Drag and drop the TX or IRX file into CAD.direct 2019.

 

In the Load Application Files dialog box, click Add File.

 

Select the TX or IRX file that you want to load, and then click Open.

 

Click OK.

 

To run a TX/IRX custom application

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load Application (in Applications).
  • On the menu, choose Tools > Load Application.
  • Type appload and then press Enter.

 

In the Load Application Files dialog box, choose the routine you want to run (make sure that it is the only one selected), and then click Load.

 

For more information

 

See the sample TX and IRX applications.

 

Read the online documentation for TX and IRX, available in the Developer Reference of CAD.direct 2019 Help.

 

Using .NET applications

 

CAD.direct 2019 supports the .NET programming language in two ways:

 

  • .NET Classic — More closely matches the .NET interface used by AutoCAD.
  • .NET based on COM — Initial .NET interface supported by CAD.direct 2019.

 

To prepare a .NET custom application

 

In the .NET application, inherit the IICadPlugin interface that is defined in CAD.direct 2019 as:

 

public interface IIcadPlugin

{

void PluginLoaded(object sender, EventArgs e);

void PluginUnLoading(object sender, EventArgs e);

}

 

Where PluginLoaded is called on plug-in load, the sender argument is a COM Interop model class CAD.direct 2019.Application for working with (storing it as a class member), and PluginUnLoading is called right before the plug-in is unloaded.

 

To load a .NET Classic custom application

 

Do one of the following:

 

  • On the menu, choose Tools > Load Classic .NET Application.
  • Type netloadclassic and then press Enter.

 

In the Open an Assembly dialog box, select the .NET .dll file that you want to load, and then click Open.

 

To automatically load a .NET Classic custom application when CAD.direct 2019 Starts

 

Create an ASCII file named ICAD.NET that contains the path to a .NET plug-in file on each line of the file.

 

Place ICAD.NET in the same folder as ICAD.EXE.

 

Run CAD.direct 2019.

 

To load a .NET custom application based on COM

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load .NET Application (in Applications).
  • On the menu, choose Tools > Load Classic .NET Application.
  • Type netload and then press Enter.

 

Select the .NET .dll file that you want to load, and then click Open.

 

Click OK.

 

Using LISP routines

 

CAD.direct 2019 supports the LISP programming language and is compatible with AutoLISP, the implementation of the LISP language in AutoCAD. This means that you can load and run any AutoLISP program written for use with AutoCAD.

 

To load a LISP routine

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load Application (in Applications).
  • On the menu, choose Tools > Load Application.
  • Type appload and then press Enter.
  • Drag and drop the LISP file into CAD.direct 2019.

 

In the Load Application Files dialog box, click Add File.

 

Select the LISP file that you want to load, and then click Open.

 

Click OK.

 

Load LISP routines from the command bar.

 

In the command bar, type (load “d:/path/routine.lsp”), making sure to include the parentheses and the quotation marks, where d:/path is the drive and path where the LISP routine is located on your computer, and routine.lsp is the LISP routine file name.

 

To run a LISP routine

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load Application (in Applications).
  • On the menu, choose Tools > Load Application.
  • Type appload and then press Enter.

 

In the Load Application Files dialog box, choose the routine you want to run (make sure that it is the only one selected), and then click Load.

 

Some LISP routines are created in such a way that you can run them by simply typing the name of the routine, or by typing a keyword, directly in the command bar. If nothing happens when you attempt to run the LISP routine from within the Load Application Files dialog box, turn on the display of the command bar or Prompt History window by choosing View > Display > Command Bar or View > Display > Prompt History Window, and look for an entry that is similar to the following:

 

Loading D:\path\routine.lsp

 

C:KEYWORD

 

where D:\path\routine.lsp is the complete drive, path, and file name of the LISP routine. You may need to scroll back several lines in the command bar or Prompt History window to find the lines indicating where the LISP routine was loaded. You can run the LISP routine by typing the name of the routine or keyword appearing after the C drive designation.

 

For example, if you loaded a LISP routine named drawbox.lsp and see the designation C:DRAWBOX in the command bar or Prompt History window, you can run the LISP routine by typing drawbox in the command bar.

 

Using SDS applications

 

To write AutoCAD applications in C or C++, Autodesk® uses the ADS (AutoCAD Development System). This is an API (applications programming interface) that pro-vides a library to access AutoCAD-specific functions and drawing data.

 

The equivalent in CAD.direct 2019 is called SDS™, the Solutions Development System™. SDS is a C/C++ language interface compatible with the ADS interface in AutoCAD. Like scripts and AutoLISP, you can run your existing ADS applications in CAD.direct 2019. Simply recompile the source code using the SDS libraries provided on the CAD.direct 2019 CD-ROM, or, if you use an AutoCAD program written by a third-party vendor, contact that vendor for the CAD.direct 2019 version.

 

CAD.direct 2019 provides the Sds.H file, which redefines ADS function names to their SDS equivalents. SDS supports the AutoCAD dialog control language (DCL), which is used by ADS to define the look of a dialog box. You can use all DCL files unmodified within SDS.

 

Understanding SDS compatibility

 

The primary difference between ADS and SDS is that all SDS functions have an sds_ prefix, and ADS functions have a variety of prefixes, such as ads_, acad_, and acrx_. The exception is dialog-related SDS functions, which have a dlg_ prefix. CAD.direct 2019 accepts either prefix. Other differences include the additional SDS functions listed in the following table.

Some ADS functions are not supported in SDS, including: ads_arxload, ads_arxloaded, ads_arxunload, ads_ssgetx, ads_ssGetKwordCallbackPtr, ads_ssGetOtherCallbackPtr, adsw_acadMainWnd, and adsw_acadDocWnd.

 

For more information

 

  • Read the online documentation for SDS functions.
  • See the \CAD.direct 2019\Api\Sds folder, which contains the SDS include, header, and library files.
  • See the \CAD.direct 2019\Api\Dcl folder, which contains the core DCL files.

 

Using DDE applications

 

CAD.direct 2019 supports the DDE API, which allows you to execute CAD.direct 2019 commands at the command line from an external

application. CAD.direct 2019 includes a sample command-line application that reads a script file and sends it to CAD.direct 2019 for step-by-step execution.

 

To see a sample of DDE script execution

 

Compile the source code of the DDESample project. The sample application is Source\CAD.direct 2019\api\DDE\Samples

 

Run CAD.direct 2019.

 

Run the DDESample application with the sample script file that is included in the VC project.

 

CAD.direct 2019 shows the results.

 

Using DCL with CAD.direct 2019 completely supports the AutoCAD DCL (dialog control language). DCL is used by AutoLISP functions to define the look of dialog boxes. You can use all DCL files unmodified within CAD.direct 2019.

 

Using VBA and VSTA

 

CAD.direct 2019 can be customized using Visual Basic for Applications (VBA) and Visual Tools for Applications (VSTA) through an integrated interface, available from the CAD.direct 2019 Tools menu. CAD.direct 2019 features a broad range of objects, giving you the power to write your own custom applications that can run within CAD.direct 2019.

 

To load a VBA project

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Load VBA Project (in Applications).
  • On the menu, choose Tools > Visual Basic > Load VBA Project.
  • Type vbiload and then press Enter.

 

Locate and select the Visual Basic project file (.vbi file) to load, then click Open.

 

To run a VBA macro

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Macros (in Applications).
  • On the menu, choose Tools > Visual Basic > Macros.
  • Type vbarun and then press Enter.

 

In the Run CAD.direct 2019 VBA Macro dialog box, enter the name of an existing VBmacro, and then click Run.

 

You can also create, delete, and edit VBA macros from this dialog box.

 

To edit a VBA macro

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > Visual Basic Editor (in Applications).
  • On the menu, choose Tools > Visual Basic > Visual Basic Editor.
  • Type vba and then press Enter.

 

Use the Visual Basic Editor to write or debug VBA macros.

 

To load a VSTA project

 

Advanced experience level

 

Do one of the following:

 

  • On the ribbon, choose Tools > VSTA Add-In Manager (in Applications).
  • On the menu, choose Tools > Visual Studio Tools for Applications > VSTA Add-In Manager.
  • Type vstaload and then press Enter.

 

Click Add.

 

Locate and select the VSTA application (.dll file) to load, then click Open.

 

To run a VSTA method

 

Advanced experience level

 

Type -vstarun and then press Enter.

 

Enter the name of the method to run, for example: C:\App.dll!MyMacro.

 

The macro name uses the following format:

 

<file_name>[!<macro_name>]

 

where:

 

<file_name> is the path to an external dll.

 

<macro_name> is the name of the dll method to run.

 

To run a .NET application

 

Advanced experience level

 

Do one of the following:

 

  • Choose Tools > Load Classic .NET Application.
  • Type netload and then press Enter.

 

Locate and select the .NET .dll file, then click Open.

 

Unload a .NET application.

 

Type netunload and specify the .NET DLL application filename to unload, for example, c:\App.dll.

 

For more information

 

  • Read the online documentation for VBA and VSTA, available both from the editor Help menu and from the CAD.direct 2019 Help menu.
  • Many publications are available that explain how to program in VBA and VSTA.

 

Using DIESEL with CAD.direct 2019

 

supports AutoCAD DIESEL (Direct Interactively Evaluated String Expression Language). DIESEL is a separate interpretive programming language that allows you to customize the following:

 

  • Status bar
  • Menus
  • LISP functions

 

For more information

 

Read the online documentation for DIESEL, available from the CAD.direct 2019 Help.

 

Several publications and tutorials are available online that explain how to use DIESEL.

© Copyright 2017 Expert Robotics Inc. USA . All rights reserved. Kazmierczak® is a registered trademark of Kazmierczak Software GmbH. CAD.direct 2019 is a trademark of Expert Robotics Inc. Print2CAD and CAD2Print are Trademarks of BackToCAD Technologies LLC. DWG is the name of Autodesk’s proprietary file format and technology used in AutoCAD® software and related products. Autodesk, the Autodesk logo, AutoCAD, DWG are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. This website is independent of Autodesk, Inc., and is not authorized by, endorsed by, sponsored by, affiliated with, or otherwise approved by Autodesk, Inc. The material and software have been placed on this Internet site under the authority of the copyright owner for the sole purpose of viewing of the materials by users of this site. Users, press, or journalists are not authorized to reproduce any of the materials in any form or by any means, electronic or mechanical, including data storage and retrieval systems, recording, printing or photocopying.