OpenDCL_Tutorial

3.0 2026-04-20 4 4 418.22KB 20 页 100龙币
侵权投诉
OpenDCL Tutorial: DCL Has Evolved!
Barry Ralphs
Introduction: I know what you’re thinking: "Why learn OpenDCL when there's VBA and .NET?" If you
haven’t already heard, VBA isn’t going to be around much longer and do you really want to port your
hundreds of Lisp routines to .NET? This tutorial will introduce you to the basics of OpenDCL and its abilities.
We’ll discuss how to easily design stunning GUIs (Graphical User Interfaces) for your Lisp routines, and we’ll
also cover advanced topics, such as securely embedding your UI into a VLX file for public distribution. You
should have general AutoCAD® and AutoLISP® knowledge.
About the Author:
Barry Ralphs is currently the CAD manager for Tipping Mar & Associates, a structural engineering firm in
Berkeley, CA. Prior to his current position, he spent nearly six years as the CAD manager for ARUP Los
Angeles. Barry has been customizing AutoCAD® with OpenDCL and its predecessor ObjectDCL, since its
introduction in 2001. He is the webmaster for OpenDCL.com, has written a number of the sample projects
that install with OpenDCL Studio. He is also one of the lead beta testers for the project. You can usually find
him in the OpenDCL support forums helping out other newcomers to the project under the username
"BazzaCAD".
barry.ralphs@gmail.com
OpenDCL Tutorial: DCL Has Evolved!
Getting started with OpenDCL
The first thing you’ll need to do is visit the OpenDCL.com website and click the “Download” link
on the sidebar of the page. You’ll then be taken to the download page on SourceForge.net for
the OpenDCL project. Under the list of Packages to download, select “OpenDCL Studio”. At
this point you won’t need to download the “Runtime” as it will be installed with the “Studio”. Now
under the list of Filenames, select your preferred language code to download, English (ENU),
German (DEU), Chinese (CHS), Spanish (ESM), and French (FRA). After the download is
complete, just run the MSI file and it will be installed in less than 1 minute.
You should now have an “OpenDCL Studio” icon on your desktop; double click it now
to launch it. See the image below for more information about the Studio workspace.
2
OpenDCL Tutorial: DCL Has Evolved!
Now is a good time to see what OpenDCL [ODCL] can do. The Studio installs a number of
samples that demonstrate its capabilities. Open Windows Explorer and browse to “C:\Program
Files\OpenDCL Studio\ENU\Samples”. This is the typical install location for the English version
of ODCL on a Windows 32 bit OS. Drag the “_MasterDemo.lsp” file into your AutoCAD drawing
window.
This will display a Docked Control Bar form
with a number of buttons. Each button will
launch a different example. Click through
each of the samples, to see what ODCL can
do. After exploring the sample projects,
you're ready to start your first project with
OpenDCL.
Basic Level 1: Creating your first “Hello World” project.
In OpenDCL Studio, pick “Add Modal Dialog” from the main toolbar or the “Project” pull-down.
A new form will appear in the editing area. The form's grid is provided as an aid to positioning
controls. You can set the spacing of the grid by selecting the Tools menu > Grid Spacing. You
can also choose not to display it at all by setting the spacing to 0.
3
OpenDCL Tutorial: DCL Has Evolved!
For this example resize the form by dragging the bottom right border, or by changing the
“Height” & “Width” in the Properties Panel to 80 & 250.
Now place a “Label” and a “Text Button” on the
form by clicking their buttons on the Control Panel
Toolbox, then dragging a rectangle out on the
form’s surface.
Change the “Caption” property of the button to
“OK”. The form should now look similar to this:
Save the project file as “HelloWorld.odcl” to an AutoCAD support directory or another directory
of your choice that is in AutoCAD's search path.
If AutoCAD isn’t already running, go ahead and launch it now and open the Visual LISP editor
(type VLIDE at the command line). Create a new LISP file and save it as “HelloWorld.lsp” in the
same location as the project file (in the AutoCAD search path). Type out or copy and paste the
code below into the new file.
; Ensure the appropriate OpenDCL ARX file is loaded
(command "OPENDCL")
(defun c:Hello ()
; call the method to load the HelloWorld.odcl file.
(dcl_Project_Load "HelloWorld" T)
; call the method to show the Hello World dialog box example
(dcl_Form_Show HelloWorld_Form1)
(princ)
)
Now save the LSP file and load it into AutoCAD by hitting CTRL+ALT+E. You can now run
your command by typing HELLO at the command line. The new dialog should pop open and
look the same as it did in the ODCL Studio. Note that nothing happens when you try to click on
the OK button. This is because the OK button hasn’t been assigned an Event yet. Also, note
that while this dialog is open, you can’t interact with AutoCAD. This is called a “Modal Dialog”,
as that’s the type of dialog we chose when we created it. To close the dialog, click the red X in
the upper right corner.
4
摘要:

OpenDCLTutorial:DCLHasEvolved!BarryRalphsIntroduction:Iknowwhatyou’rethinking:"WhylearnOpenDCLwhenthere'sVBAand.NET?"Ifyouhaven’talreadyheard,VBAisn’tgoingtobearoundmuchlongeranddoyoureallywanttoportyourhundredsofLisproutinesto.NET?ThistutorialwillintroduceyoutothebasicsofOpenDCLanditsabilities.We’l...

展开>> 收起<<
OpenDCL_Tutorial.pdf

共20页,预览4页

还剩页未读, 继续阅读

声明:本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击侵权投诉。
分类:实用文档 价格:100龙币 属性:20 页 大小:418.22KB 格式:PDF 时间:2026-04-20

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 20
客服
关注