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

Programming CADdirect 2022

 

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

 

In CADdirect 2022, 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 CADdirect 2022 run-time libraries. Many AutoCAD third-party programs are compatible with CADdirect 2022.

 

Use the online Help.

 

For information about programming for CADdirect 2022, 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 CADdirect 2022.

 

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 CADdirect 2022 Help.

 

Using .NET applications

 

CADdirect 2022 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 CADdirect 2022.

 

To prepare a .NET custom application

 

In the .NET application, inherit the IICadPlugin interface that is defined in CADdirect 2022 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 CADdirect 2022.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 CADdirect 2022 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 CADdirect 2022.

 

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

 

CADdirect 2022 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 CADdirect 2022.

 

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 CADdirect 2022 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 CADdirect 2022. Simply recompile the source code using the SDS libraries provided on the CADdirect 2022 CD-ROM, or, if you use an AutoCAD program written by a third-party vendor, contact that vendor for the CADdirect 2022 version.

 

CADdirect 2022 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. CADdirect 2022 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 \CADdirect 2022\Api\Sds folder, which contains the SDS include, header, and library files.
  • See the \CADdirect 2022\Api\Dcl folder, which contains the core DCL files.

 

Using DDE applications

 

CADdirect 2022 supports the DDE API, which allows you to execute CADdirect 2022 commands at the command line from an external

application. CADdirect 2022 includes a sample command-line application that reads a script file and sends it to CADdirect 2022 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\CADdirect 2022\api\DDE\Samples

 

Run CADdirect 2022.

 

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

 

CADdirect 2022 shows the results.

 

Using DCL with CADdirect 2022 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 CADdirect 2022.

 

Using VBA and VSTA

 

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

 

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 CADdirect 2022 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 CADdirect 2022 Help menu.
  • Many publications are available that explain how to program in VBA and VSTA.

 

Using DIESEL with CADdirect 2022

 

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 CADdirect 2022 Help.

 

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

© Copyright 2021 BackToCAD Technolgies LLC . All rights reserved. Kazmierczak® is a registered trademark of Kazmierczak Software GmbH. CADdirect 2022 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.