Home Tour! Products Download Purchase Support Company Contacts   Version française

Guided tour for ObjectDCL technology

Development Cycle     In Action Samples

ObjectDCL in Action

This section walks-through the entire development cycle with a concrete example of a project.

1) Identify an opportunity

Sometimes, the opportunity lies in some scripted application use by a handful of designers and drafters.

For this discussion, we will look at how Geo-Referenced Image came to existence.

Civil engineering sometimes requires building large infrastructure. In order to place the buildings in context, a map can be laid out on a drawing. The drawing also contains the buildings. By overlaying the two, a clear picture emerges.

Geographic or topological maps are tied to precise geographic coordinates. By combining the pictures with the geographic information, it is possible to import these images into a drawing and position them precisely with respect to one another and to the drawing.

Images exist in various formats and the geographic information can be defined in many ways. All of which can be dealt manually, but automation is always better. For instance, there is less risk of making a mistake and less training is required to achieve the same job.

2) Design a solution

We first need to figure out the commands in AutoCAD® to achieve the job manually. For example, we have the following snippet:

(initdia 1)
(command "_.-image"
     "_A"   DWG_imgFILE   (strcat geo_ULX "," geo_LRY)
     ""   ""
)

;;[...]
;; Some measurements
;;[...]

(command "_.scale"
     (entlast)   ""   (strcat geo_ULX "," geo_LRY)
     final_ScaleValue
)

Now that we know how to do the job, we can take a look at what capability is desirable. For instance:

  • Batch insertion
  • Support for frequently used image formats
  • Support for frequently used geographic information formats
  • Some browsing capability

3) Implement the solution

We use the ObjectDCL Dialog Editor to design the dialogs that are needed to build the application.

Design of Geo-Referenced Image

Next, we create an AutoLISP® file and we put the code necessary for inserting images as well as other pieces. For instance, the most important snippet to add ensures that the ObjectDCL Runtime Extension for AutoCAD® (ARX) is properly loaded.

(defun OdclARXLoad (/ acadver1 odclInstallDir)
 (setq acadver1 (substr (getvar "ACADVER") 1 2))
 (if
  (setq odclInstallDir
   (vl-registry-read
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\DuctiSoft\\ObjectDCL ARX\\"
    "InstallDir"
   )
  )
  ;; ObjectDCL ARX is installed
  (if (not (member (strcat "objectdcl." acadver1 ".arx") (arx)))
    ;; Load ObjectDCL ARX
    (arxload
      (strcat odclInstallDir "objectdcl." acadver1 ".arx")
      "ObjectDCL ARX not found."
    )
    ;; ObjectDCL ARX is already loaded
    (strcat odclInstallDir "objectdcl." acadver1 ".arx")
  )
  ;; ObjectDCL ARX NOT is installed
  "ObjectDCL ARX not installed."
 )
)

Then we add some event handlers as suited, for example for the help button:

(defun c:MainForm_HelpButton_OnClicked ()
 ;; Note: Oversimplified with no error checking
 (startapp (strcat (getenv "ProgramFiles")
   "/Ductisoft/GRi2008/Gri2008_HELP.exe") )
 (princ)
)

Eventually, the application is ready to be tested.

4) Test the implementation

We iterate by testing the application with various input images and geographic information. We make necessary changes as we go along.

5) Deliver the solution

The first step for delivery is to sign the project using the ObjectDCL Distribution Kit. The command to execute is similar to this one:

SignDistribution.exe
   "C:\MyProject\bin\MyUsefulApp.kds"
   "C:\MyProject\dependencies\ObjectDCLARX.gor"
   "My Useful App"
   -p "C:\MyProject\odcl\MyProject1.odc"
   -p "C:\MyProject\odcl\MyProject2.odc"

Also, delivering typically implies writing an installation script. The script has to do the following:

This section covered the major steps of the process for building a typical scripted application using ObjectDCL technology.

Home Products Download Purchase Support Company Contacts