In 1993, ISICAD
introduced CADVANCE for Windows, which ran on the Microsoft Windows 3.X
operating system. CADVANCE version 5.0 was the first Windows based
CAD system to be introduced with a full set of ubiquitous features which
included Multiple Document Interface (MDI), common application
interface, clipboard and OLE compatibility. Also included
was a newly designed macro programming interface called CADVANCE
Developer Interface (CDI) and CADVANCE Basic Language (CBL) as its macro
language. CDI provided a fully Microsoft Windows compatible
interface for most professional programming environments like C that
could write a Dynamic Link Library (DLL). Many of the features
introduced in this ground breaking product were not fully matched by
CADVANCE's main competition for many years.
Invoked from the
CADVANCE utility menu, CBL provides customization and automation
functions right out of the box. CBL, CADVANCE's default macro
language, similar in syntax to Microsoft Visual Basic is also fully
Windows compatible. Direct calls to the Windows API as well as
custom DDL's and Active-X objects are well within the scope of its
capabilities.
Over the years,
CADVANCE users have discovered the benefits of using CBL for creating
custom macros that make repetitive or difficult tasks easier to
perform. The built-in macro recorder makes it easy to create
reusable functions with a minimum of programming skills. Running a
CBL macro is as easy as picking a shortcut key on the
keyboard.
With all of its
capabilities, CADVANCE's CBL macro editing environment only provides
basic editing and debugging features. Large applications are
difficult to write and CBL macro speed is limited due to being an
interpreted language. Users of CADVANCE LiTe can only run macros
created and compiled in the full version and cannot create CBL macros of
their own.
To overcome the
limitations of CBL, CDI allows alternative application development
environments to be used. Many popular products that can
create Windows compatible DLL's can be used to create custom
applications for CADVANCE. The majority of these products use C as
the programming language. C preferred by software development
companies can be difficult to learn and code.
An alternative to C
is a product made by Borland called Delphi. Delphi, a Rapid
Application Development (RAD) environment uses Object Pascal as its
language and is easy to use. Delphi provides a full set of
professional features for CADVANCE application development and makes CDI
features not available to CBL macros accessible. A number of
applications have been written using Delphi, most notable and used by
many CADVANCE users is AETools. FIT has plans to further utilize
Delphi for its other add-on products currently written in C.
Features not
directly available to CBL are easily accessible using Delphi.
Custom forms are simple using Delphi's forms editor. Debugging
applications using the Delphi debugger allows rapid detection of
programming errors. The ability to create custom objects known as
Auxiliary Objects is only possible by writing a custom DLL. Delphi
allows deployment of functions in a single plug-in library for easy
distribution and maintenance of applications.
The gain in speed
of custom applications may be the greatest advantage for most custom
applications. CBL macros that seem slow will benefit the most from
conversion. The transition from CBL to Object Pascal requires
learning a different programming language. The CADVANCE specific
CDI function calls remain the same and useful macros written in CBL are
fairly easy to convert.
CADVANCE requires
Delphi applications to be written as DLL's. Usually located in the
CADVANCE program directory, DLL functions can be invoked from the
Utility/Applications menu. CBL macros and other Delphi DLL's
running inside of CADVANCE can have access to these functions as
well. The following would need to be added to the CADVANCE.ini
file so that the application would be visible in the Applications
menu.
[3rd Party
(CADVANCE.ini)]
Multiline &Hello=AuxNew CadvUtils.dll
2D
Multiline &Hello=AuxEdit CadvUtils.dll 3D
Borland Delphi is
an important addition to any CADVANCE users set of tools for creating
custom CADVANCE applications. CADVANCE is also a great platform
for Delphi developers that are looking to create powerful CAD
applications.
CBL (BASIC)
version of DrawLine
Sub DrawLine()
Dim i_ret as Integer
Dim
l_ret as Long
Dim i_term as integer
Dim i_menu as integer
Dim
startPoint as CDI_DD_POINT
Dim endPoint as CDI_DD_POINT
CdiDeleteCursor
i_ret:=CdiGetPoint('Line point #1',
startPoint, i_term, i_menu)
i_ret:=CdiGetPoint('Line point #2',
startPoint, i_term,
i_menu)
i_ret:=CdiObjStartLine(startPoint,CdiGetActLayer(),CdiGetStyle(),CdiGetWeight(),CdiGetCurColor())
l_ret:=CdiObjAddtoLine(endPoint,CDI_DRAWTO)
l_ret:=CdiObjEnd(CDI_TRUE,CDI_TRUE,CDI_OBJECT_COLOR)
End
sub
Delphi version of
DrawLine
procedure
DrawLine;
var
i_ret:integer;
l_ret:LongInt;
i_term:integer;
i_menu:integer;
startPoint:CDI_DD_POINT;
endPoint:CDI_DD_POINT;
begin
CdiDeleteCursor;
i_ret:=CdiGetPoint('Line point
#1', startPoint, i_term, i_menu);
i_ret:=CdiGetPoint('Line point
#2', startPoint, i_term, i_menu);
i_ret:=CdiObjStartLine(startPoint,CdiGetActLayer,CdiGetStyle,CdiGetWeight,CdiGetCurColor);
l_ret:=CdiObjAddtoLine(endPoint,
CDI_DRAWTO);
l_ret:=CdiObjEnd(CDI_TRUE, CDI_TRUE, CDI_OBJECT_COLOR);
end;
Simple Delphi
DLL
library
CadvUtil;
uses
Windows,
SysUtils;
//CADVANCE
declarations go here
procedure CdiPutMsg(information_msg: pchar);
stdcall;
external 'CAD1.DLL';
procedure
CdiPutInfoMsg(title: pchar; info_msg: pchar); stdcall;
external 'CAD1.DLL';
//functions and
procedures go here
procedure StartApp;stdcall;
begin
CdiPutInfoMsg('CADVANCE Utilities', 'Hello World');
end;
procedure
DllExitHandler(Reason:integer);
Begin
case
Reason of
DLL_PROCESS_DETACH :
;
DLL_PROCESS_ATTACH : ;
DLL_THREAD_ATTACH : ;
DLL_THREAD_DETACH :
;
else
end;
end;
//list the
exports here
exports
StartApp;
begin
{
Perform DLL initialization }
DLLProc:=@DLLExitHandler;
DLLExitHandler(DLL_PROCESS_ATTACH);
CdiPutMsg('Initializing utility module, please wait...');
end.
---------------------------------------------------------------------------------------------------