Welcome to CADVANTAGE’s No Nonsense, Quick Start, Step by Step tutorial for Visual DCL.

This tutorial is part of the CAD-CAM @ Home scheme currently available in the city of Aurangabad in India.

The tutorial is a Goodwill Gesture for all computer users who take pains to go out of way and learn new things.

To learn more about computers in general and CAD CAM CAE in particular as detailed below, you may enroll for the
CAD++ [ CAD @ Home ] program at :

CADVANTAGE ( where AutoCAD is taught FREE )
C 2 - 6, N 7, CIDCO,
Opp. Onkar Gas, Behind Swamikripa STD,
Aurangabad 431003
India
Ph : 0240 - 480767
Email : CadGuruCool@yahoo.com
Webpage : www.geocities.com/CadGuruCool



Visual DCL Tutorial

Step 1

It is assumed that you are familiar with the basics of some version higher of AutoCAD 12.

The code that we will undertake is tested in AutoCAD 2002 only, although it should work with versions down to R12.

The tutorial assumes prior experience with DCL and proper knowledge of AutoLISP is a must.

It is strongly recommended that you complete the AutoLISP tutorial first.

To avail the AutoLISP tutorial, go to :

www.geocities.com/CadGuruCool

and click Tutorials 4U
Step 2

This tutorial assumes that you have completed the AutoLISP tutorial as stated in Step 1.

At this stage , you know how to write a program in AutoLISP that will draw the milled slot as shown in figure.

The program asks for :

1) CT = Cutter Traverse,
2) CD = Cutter Diameter, and
3) P1 = Cutter Start Point.

Step 3

In the AutoLISP program, input parameters appeared at the command prompt.

We want a dialog box as shown in figure besides which will take the user input.

To create a dialog box, we write a program in DCL ie. Dalog Control Language.

The program is stored in a seperate file with a .dcl extension.

The AutoLISP file makes a call to the .dcl file and reads the information in it.

Using this inforamtion, the .lsp file displays the dialog box in AutoCAD.
Step 4

We don't want to learn the DCL language, so we will use VisualDCL, a program that creates dcl files without having to type all the code.

Download VisualDCL from
www.autolispresources.com

Hint : Whenever I create a utility in VB or VC++, I use an ini file in the working folder for example C:\Program Files\InstallDir\Settings, to store imortant information about my program for example last used interface settings or expiry date for my program.

Intelligent users of my utility may copy the ini to a safe location eg. C:\My Documents\Top Secret\filename.ini

This must be done before they start using my utility even for the first time.

Once the program expires, they can copy the ini file from the safe location back into the working folder and overwrite the ini file present there.

This way they can continue using my program forever.
Step 5

Fire up Visual DCL and click on Try as shown in the figure besides.
Step 6

The VisualDCL interface is shown in the figure besides and is self-explanatory.

To begin with, Click File > New from the menubar.

The Save as dialog box will appear.

Locate a pre-created folder MyDCL or create a new one while in this dialog.

Type Tutorial as name for the dcl file we want to create.

Then click on Save
Step 7

Observe the DCL Tiles tab in the right part of the screen.

This part displays a tree view of the various tiles of a dialog box. By starting a new file, an entry newdialog (dialog) will appear.

Select the entry .
Click the Insert image tool from the toolbar.

An image tile is added under the dialog box as shown in figure on the right.



Step 8

We want the two edit boxes inside a frame as shown in figure on the right. The label for the frame is Input Parameters.

Click the Insert boxed_column tool from the toolbar.

A boxed column is added under the dialog box as shown in figure on the right (below).

We willl apply the label and other properties later in this tutorial.



.
Step 9

To add OK, Cancel, and Help buttons, click the Insert ok_cancel_help tool from the toolbar.

Entry for the 3 button set is added under the dialog box as shown in figure on the right.

Step 10

We want the two edit boxes to be inside the boxed column.

Select the boxed_column entry in the tree view and click the Insert edit_box tool from the toolbar, twice.

Two edit boxes will be added under boxed_column as shown in figure on the right.

Step 11

Next, we will define properties ie. attributes for the tiles.

To do this, click the first edit box and select the Attributes tab as shown in figure besides (top).

Two columns will be displayed as shown in figure besides (middle).

Click key in the list and type ct as the key value as shown in figure besides (bottom).

Similarly, specify the following attributes :

alignment = centered
edit_limit = 20
edit_width = 10
fixed_width = true
label = Cutter Traverse
mnemonic = T
width = 10

For the second edit box, specify key atrribute as cd, label as Cutter Diameter and mnemonic attribute as D.
The other attributes are same as those for the earlier edit box and you must specify them as well.






.
Step 12

Click the image entry in the tree and specify the following attributes :

alignment = centered
color = dialog_background
height = 10
width = 10
key = imgslot

For the boxed_column, change the label attribute to Input Parameters.

Click Build > Build DCL from the menu bar.

A DCL file Tutorial.dcl and a LSP file Preview.lsp will be created in the MyDCL folder.

You may want to view the contents of these files in your favourite text editor or notepad.

Step 13

Open the MyDCL folder and double click the Preview.lsp file.

Add the red lines as shown on the right.

The red lines display a slide file in the image tile defined in Visual DCL.

Save the .lsp file in notepad and exit.

To create a .sld file, prepare the drawing you want to display in the image tile area in the dialog box.
Zoom extents the drawing and type mslide at the Command: prompt.

The File Save as dialog box will appear.

Type the name slot for the slide file and save the sld file in the MyDCL folder.

Also save your drawing in the MyDCL folder.
(defun c:tutorial()
(setq dcl_id (load_dialog "tutorial.dcl"))
 (if (not (new_dialog "tutorial" dcl_id))
(exit))
(start_image "imgslot")
(setq x (dimx_tile "imgslot"))
(setq y (dimy_tile "imgslot"))
(slide_image 0 0 x y "slot.sld")
(end_image) 
(start_dialog)
(unload_dialog dcl_id)
(princ)
) ;; end defun c:tutorial
Step 14

With your current drawing saved in the MyDCL folder, type appload at the Command: prompt and browse to the MyDCL folder.

Select the Preview.lsp file and click Load.

A message saying Preview.lsp successfully loaded. will appear at the Command: prompt.

Type tutorial at the Command: prompt. Your dialog box will appear in all its glory on the screen.

Step 15

Want to dig deeper
into DCL ?

Call CADVANTAGE Now !!! Ph : 0240 - 480767 in Aurangabad.


Dig deep till you get to the other side of the globe - Only at CADVANTAGE

The full course covers
Each & Everything
in AutoLISP and DCL

Its a challenge.