Friday
Autocad, DCL, Download, Visual LISPVisual LISP: Programming user interfaces with OpenDCL
Hi all,
Having started to my first article about DCL, I am just thinking how I can teach you easy and fast user interface programming technique. This is why I am going to make some explanations about OpenDCL package, also known as OpenSource Software which is very popular nowadays. Open DCL is a open source coded plug-in of AutoCAD which was developed for designing DCL interfaces much easier when you are programming with Visual Lisp.
I have tested the programme marketed by Object DSL before but I decided not to use it since there were a lot of errors. Owen Wengerd, David Robinson and their friends who are the project managers of Open DCL, has perfected the package. By means of this article, I thank these people.
The Runtime and Studio versions have to be downloaded to use the programme. The Runtime version includes the ARX programmes “OpenDCL.16.arx” and “OpenDCL.17.arx” that are necessary for AutoCAD. There is also the “OpenDCL.x64.17.arx” file that is necessary for the AutoCAD 2008 64-bit version. The Runtime package which is also known as “OpenDCL.Runtime.ENU.4.0.3.1.msi” is used for displaying the personal interfaces like the box in Figure 1. The Open DCL Studio is the necessary programme for interface design. This should be familiar to Visual Basic™ or Microsoft Studio™ .Net users.
The main page of the programme (www.opendcl.com) has a link for download. (P.S.: If the install packages in the SourceForge web site do not show up, the port no.443 may be closed. You have to keep it open.)
Let us deal with the Visual Lisp version of the primitive application of Find-Replace coded by Orhan Toker
. You may consider this as a simple application of the Find command which is found in the shortcut menu when you click the right mouse button. The point is to teach you the AutoLisp language in a simple way. For instance how can we use the Selection Set? We present the sub-functions that requires some experience particularly in Visual Lisp language. The rest is depends on your resolution
.
![]() |
| Fig.1 – Interface design |
The events that was selected for control objects constitute the name of the functions as templates. The part below written in red can be easily copied and added to Autolisp Code. (Figure 2)
![]() |
| Fig.2 – TextBox için gerekli olan Event – EditChanged |
I want to make further explanations about the subject by making a table that describes the control objects used in the form and which Autolisp functions are user related in which events (Figure 3). There are three different objects in the Find-Replace form.
- (Command Button)
- (Text Box)
- (Label)
![]() |
| Fig.3 – Methods founded in FR.ODCL |
As can be seen below, “LoadRuntime” function is presented by loading “_OpenDCLUtils.lsp” programme (Figure 4). By means of LoadRuntime, the necessary ARX file is automatically ready to be used and we can use Open DCL functions with no errors.
It is possible to see the “OpenDCLUtils.lsp” programme in the \Program Files\Open DCLStudio\Examples folder. (P.S.: I have added the “_” character. It is useful to differ it from other files.)
![]() |
Fig.4 – Main function “C:FR_ODCL” or “C:X“ |
You have to input the necessary data for variables before the interface screen shows up in Autocad. The Initialize method that is necessary for the form is for this issue. (Figure 5)
![]() |
Fig.5 – Sub function “C:FR_frmFndRep_OnInitialize“ |
“EditChanged” is used when the data in the Text Box is changed. (Figure 6)
![]() |
Fig.6 – Sub function “C:FR_frmFndRep_txtRep_OnEditChanged“ |
The sub-function presented when you click the “OK” button. (Figure 7)
![]() |
Fig.7 – Sub function “C:FR_frmFndRep_cmdOK_OnClicked“ |
The onClicked event assigned to the “Cancel” button. (Figure
![]() |
Fig.8 – Sub function “C:FR_frmFndRep_cmdCancel_OnClicked“ |
“C:FR_LispExe” function filters the whole TEXT objects and exchange them. It will print a numerical value (the number of exchanged objects) if the process is succeed.
![]() |
| Fig.9 – Sub function “C:FR_LispExe” |
Sometimes it is useless to use interface and it is better to use the command line. For instance, there will be something common between the “C:FR” command (Figure 10) and “C:FR_ODCL” command if you have a automatic AutoCAD Script. Both of them uses the sub-function “C:FR_LispExe”. It is possible to check the system variable FILEDIA and guide the programme whether you want to use the command line or interface. (1 for interface and 0 for command line)
![]() |
| Fig.10 – Main function “C:FR” |
A similar sub-function called “UTL:GET:STRING” to “getstring” founded in AutoCAD is adapted as Visual Lisp. (Figure 11)
![]() |
Fig.11 – Sub function “UTL:GET:STRING“ |
The sub-functions of the programme “C:DelPtX” that I wrote before this one can be seen below. We will use “UTL:ADD:SELECTIONSET” (Figure 12) and “UTL:SEL:SET-FILTER” (Figure 13) again.
![]() |
Fig.12 – Sub function “UTL:ADD-SELECTIONSET“ |
![]() |
Fig.13 – Sub function “UTL:SEL:SET-FILTER“ |
Visual LISP functions used in programme:
vl-catch-all-error-p,vl-catch-all-applyvlax-for,vla-Add,vla-itemvlax-Select,vla-SelectOnScreen,vla-Highlightvlax-SafeArray-Fill,vlax-Make-SafeArray
May it be easy to you,
odcl-FindReplace.rar (24.2 KiB, 199 hits)
You need to be a registered user to download this file.
Post Tags: AutoLISP, Download, ODCL
Related Posts
Popular
- Hip tip: Increasing view resolution with VIEWRES system variable
07/03/2009 04:39 am
7 Comments - Sirince – IZMIR
07/02/2009 11:02 am
1 Comment - Visual LISP: Programming user interfaces with OpenDCL
07/01/2009 10:15 pm
10 Comments - 3D Modeling 7: EXTRUDE
06/30/2009 02:14 pm
10 Comments - Ask DailyAutoCAD: Which Notebook to Buy?
06/30/2009 12:17 pm
1 Comment
Featured Articles
- AutoCAD 2009 Update 3 Released
- Speed Up As AutoCAD 2009 Ribbon Menu Helps You!
- MEP Analysis Extension for AutoCAD MEP extended to March 31, 2009
- Recap of AutoCAD-related technologies on Autodesk Labs
- Technology Preview of MEP Analysis Extension extended to 12/31/08
- Autodesk Labs: Forward and Backward utility for AutoCAD
|















Nov 28, 2007
Reply
thx for the great how-to.
Nov 29, 2007
Reply
Hi Mr. Ralphs,
I am very pleased to read that, thx …
Dec 1, 2007
Reply
Thanks for the OpenDCL post! I am currently at Autodesk University in Las Vegas, where every year thousands of AutoCAD users gather to learn about new ways to help them use AutoCAD more effectively. It would be great to see an OpenDCL class at next year’s AU. I hope you will consider proposing such a class when AU organizers request proposals in a few months!
Here are some comments about the code in this article:
1) Instead of using the (LoadRuntime) function in _OpenDclUtils.lsp, I recommend to just use (command “_.OPENDCL”). This is much simpler for less skilled AutoLISP programmers to understand. Although this method can fail if the DEMANDLOAD system variable is not set to enable demandloading, I would argue that in cases where DEMANDLOAD is disabled, the user does not *want* additional applications to load (e.g. to rule out third party code while debugging some problem).
2) The call to (DCL_FORM_CLOSE) in your main function is not necessary, because the form will already be closed when (DCL_FORM_SHOW) returns.
3) Instead of using global variables to save the values of the text box fields, you could simply read those values when cmdOk_OnClicked is handled, thus eliminating the need for the global variables and the two text box event handlers.
4) This project would be an ideal candidate for using a modeless dialog. Try doing *that* with plain old DCL!
Thanks for your excellent work!
Dec 2, 2007
Reply
Dear Mr. Wengerd,
Many thanks for your suggestion. Your comments is very important for me! other DCL projects will follow …
Dec 22, 2007
Reply
Hi:
please ,guid me how I can make ready a dialog box with help of auto lisp/visual lisp cad program to look on the my camputer same as OPEN same as autcad “open” icon .
thanks
Dec 24, 2007
Reply
Hi majid,
see your Help File
AutoLISP Reference Guide > AutoLISP Functions > G-Functions >
(getfiled title default ext flags)
Prompts the user for a file name with the standard AutoCAD file dialog box, and returns that file name.
example:
(getfiled “Select a Lisp File” “c:\\” “lsp”
May 30, 2008
Reply
i need opendcl.17.arx,64x.17arx.
my acad2008 needs this program
would you like send it to me ?
thks.
Sep 17, 2008
Reply
autocad is worthless, they come out with new versions without fixing old mistakes
Sep 17, 2008
Reply
They took out the helix command out of atocad 2008, fools
Jul 1, 2009
Reply
hai please send me the lisp of auto close the polyline. i.e first i draw the closed polyline after that i draw a line 2d snapping to the above polygon or polyline.i want the lisp of auto close this polyline and that polygon is 2d snap to the each internal corner of the first polygon or polygon.
That means All polyline should be closed and 2d snap to each other.
If You had the lisp or vb program of above inputs please send me please.