Сайт проектной организации Челябэнергопроект на русском языке   Русский
Main To write the mail Map
Die Web-seite der Projektorganisation Tscheljabenergoprojekt in Deutsch   Deutsch




Création de site web société française Chelyabenergoproekt   Française

Projects intellectual skill!
Our News
12/22/2016 Happy New Year!
Happy New Year! Administration ...
12/30/2015 Happy New Year!
Happy New Year! Administration ...
12/21/2015 Happy Energy!
Happy Energy! Administration ...



News of branch
объекты Ростехнадзора
The review of means of programming in AutoCAD
In given article for expansion of functionality AutoCAD and their adaptation the review of means of programming is resulted in the decision of specific problems.                                

In the world there is a set of systems of the automated designing, everyone with the advantages and lacks. Depending on sphere of their application all these CAD can be divided into groups conditionally. One systems are more suitable for mechanical engineering, shipbuilding and other technical areas, possibility of others are optimum for performance of works in a geodesy, cartography, hydrography: Taking into account all variety of possible applications to CAD variety of requirements is shown: first of all it is the convenient user interface, the qualitative drawing and presence of means of programming for the decision of specialised problems.

The special attention among CAD-systems is deserved by program complex AutoCAD. This system of the automated designing not only gives to the user the convenient graphic interface and provides reception of a high-quality drawing, but also has a wide tooling of programming. The user can modify graphic interface AutoCAD, expand functionality, add new commands. The flexible programming system we also named the main advantage AutoCAD. Almost all operations which are carried out in the environment of AutoCAD, it is possible to realise the program – for this purpose in system means of creation of scenarios and possibility of use of programming languages are provided.

Following languages concern means of programming AutoCAD:
- Visual C++;
- AutoLisp;
- Visual Basic for Application (VBA);
- Delphi;
- ARX;
- DCL.

Being part AutoCAD, AutoLisp allows to operate with variables of various types and to transfer their values to commands AutoCAD at data input. At answers to inquiries of commands AutoCAD there is a possibility to use expression AutoLisp in which various arithmetic and conditional operations over numerical values and values of certain variables can be carried out.

Besides means of performance of various calculations, AutoLisp contains functions and means which give access to a graphic database of current drawing AutoCAD. Besides, AutoLisp allows to operate graphic editor AutoCAD and to address to own commands of system. Thanks to possibilities of programs AutoLisp the functions which have been adjusted on a concrete scope are created. These functions include inquiries to the user (dialogues), choice possibility on a condition from several variants or use of several values by default. Though the macrodefinitions created at a writing of menu AutoCAD, can be difficult enough, in the absence of AutoLisp they remain only combinations of standard commands of system. Having included in the menu of functions of macrodefinition AutoLisp, you transform menu AutoCAD into intellectual means of automation of designing.

Possibilities with which provides AutoLisp:
- use of variables and expressions at answers to inquiries of commands AutoCAD;
- reading and creation of external files (information interchange with external programs which can be started from AutoCAD thus is carried out);
- creation of various functions and new commands AutoCAD that provides adjustment and expansion of graphic possibilities of system;
- program access (reading and editing) to the data which concern objects of designing, and also to tables AutoCAD containing the information on blocks, layers, kinds, styles and types of lines;
- programmed control by graphic screen AutoCAD, and also input/conclusion from various devices.

Let's notice that AutoLisp it can be used for designing automation almost in any area of a national economy: from mashino – and shipbuilding before building, a geodesy and cartography.

On AutoLisp does not make the big work to write the program for rendering to a detail of any complexity. And as AutoLisp represents language of creation of intellectual systems and has a wide set of mathematical functions, it approaches for performance of difficult mathematical calculations with the subsequent transfer of results to AutoCAD environment.

At the same time at AutoLisp, one of the oldest languages AutoCAD, there is also a serious lack – it is language of creation of scripts, the command and package files, not allowing to create programs with the graphic interface, programs for data exchange with external devices and other decisions intended for interaction with system functions of an operating system.

At creation on AutoLisp enough difficult programs evident and convenient information input in a command line not always is possible to make. Dialogue with the program can be improved, using programming language DCL (Dialog Control Language) which gives graphic menus, editing tools of attributes and dialogue windows. At sharing with a complex of commands AutoLisp this language provides possibility of a call and management of dialogue from the Lisp-program. All it considerably expands possibilities of adaptation AutoCAD under concrete applied problems. Language DCL allows to influence a way of a conclusion of a window, and also on its structure: buttons, lists, scales etc. Restrictions on the size and a window site are set by rules of designing of dialogue windows. The arrangement of elements of a window reminds an arrangement of paragraphs in the formatted text, therefore there is no necessity to set exact coordinates of fragments of windows. The dialogue window from menu AutoCAD is caused through function AutoLisp which supervises over dialogue.

Thus, use of these two programming languages allows to create difficult enough systems of the automated designing on the basis of program complex AutoCAD.

One of most modern languages of programming under AutoCAD is language VBA (Visual Basic for Application) which co-operates with AutoCAD through interface ActiveH Automation. In respect of expansion of possibilities AutoCAD this language essentially surpasses possibilities AutoLisp. Through interface ActiveH Automation it gets access to all elements of AutoCAD environment, all variables and commands thanks to what it is possible to modify the user graphic interface without the big efforts (to change the menu, rulers of tools, a graphic environment to add new commands to work with graphic database AutoCAD: layers, blocks, viewport, styles of display of the text, lines, pouring).

Language VBA has own set of variables and the developed system of tools for performance of mathematical, logic and system operations. It allows not only to create programs of realisation of difficult mathematical calculations, updatings of databases AutoCAD, automation of processes of plotting, but also to use VBA at a writing of more difficult programs connected with system events. For example, by means of VBA it is simple to create programs of interaction with system commands Windows, and also with other programs (Word, Excel, Access, etc.). It is necessary to carry To advantages of this language and presence of various tools for interaction with various databases (Access, Oracle, FoxPro, dBase, Paradox).

The mentioned possibilities of programming in language VBA allow to create difficult systems of automation of designing and preparation of the design documentation in a mode of real time. In acknowledgement it is enough to mention existing systems for working out of electric schemes with an automatic insert of electronic components and the subsequent entering of the information on components and the electronic scheme in databases. On termination of working out of the electronic scheme the user can receive in Excel or Access the full specification of the used components.

Thus VBA unites in itself functionality AutoLisp and DCL, in addition offering tools of interaction with program Windows environment and applied programs of various firms-developers which support technology ActiveX Automation.

Let's continue our review consideration ObjectARX – object-oriented expansion of program AutoCAD environment. Using programming language Visual C++ and libraries of language C++, ObjectARX allows to develop programs, to expand classes AutoCAD and reports, and also to form new teams which work similarly to the commands which have been built in in AutoCAD.

Programs ObjectARX are dynamic libraries (DLL) which divide address space AutoCAD and carry out direct references to kernel AutoCAD. It provides possibility of creation of new primitive things which behave as usual primitive things AutoCAD (points, lines, circles etc.).

ObjectARX opens direct access to databases AutoCAD, graphic system and all system of commands. Hence, there is a possibility to develop the program for interaction with Wednesday of designing, to create any graphic interfaces of the user, addressing to library MFC, to create programs with multiwindow interfaces, to form own classes and interaction reports, to co-operate with other program environments and external devices.

Thus, ObjectARX allows to create programs of any complexity. It several times surpasses in functionality AutoLisp, DCL and VBA. This programming language allows to write both a simple script, and tools of reprogramming of kernel AutoCAD, and also interactions with external devices. On ObjectARX and Visual C++ are written Autodesk Mechanical Desktop, Autodesk Land Desktop, Autodesk Map, Autodesk Civil Design and many other appendices to AutoCAD.

The described allows to draw following conclusions:
1. Using the programming modern languages, it is possible to add possibilities of the base software essentially.
2. Accurate representation about possibilities of each of languages allows to optimise process of creation of applied programs.
3. Each of languages in the best way corresponds to quite certain problems:

   – AutoLisp – automation of process of preparation of designing, creation of new commands, reception and information preservation under the current drawing, creation of scripts and change of the information in a current file;

   – VBA – change and addition of the graphic interface of the user, creation of new commands, association of Windows-programs and AutoCAD in a uniform complex;

   – ObjectARX – addition AutoCAD with new objects, classes, reports, methods and mechanisms of processing of the information; an establishment of communication AutoCAD with various system events and external devices.

By program working out it is necessary to consider following two important factors. The first – necessity of a fast writing of the program code, the second – speed of the created program. If more essential the first factor is represented, it is possible and it is necessary to use the joint approach to a writing: in parallel to involve all languages mentioned above, and to receive a complex code of the program. The certain programming language which allows to carry out a problem most conveniently and quickly is thus used. If speed reasons prevail, it is necessary to give unconditional preference to languages C++, Assembler and ARX.

Examples of programs for programmers can be found on an official site of developer AutoCAD and corresponding forums.

AutoCAD with its wide tooling of programming it is exclusively perspective in respect of expansion of functionality. The considered programming languages allow to modify this program complex, having adapted its possibilities for the decision of specific problems in any area.


Sources:
1. Donchenko M., Rjabenky O. Features of use of software for updating AutoCAD//CADmaster, #5 (25), 2004
[http://csf.ru/file/sYXlHXiBfCwHzPPd8296466/cm_25_autocad.pdf]
2. Autodesk – AutoCAD
[http://www.autodesk.ru/adsk/servlet/index?siteID=871736&id=12306406]

The author: Челябэнергопроект
Date: 07/22/2009

Comments of experts of Челябэнергопроект:
No
Статьи

смета проектных работ
©Chelenergyproject, info@chepr.ru, 2007-2013
DRA.RU - turnkey website; system administrator “Челябэнергопроект”
Main|About Us|Strategy of the company|
The competence / The competence|Contact Us