T-FLEX Parametric CAD. Fundamentals. 2D Design

T-FLEX Parametric CAD. Fundamentals. 2D Design T-FLEX Parametric CAD. Fundamentals. 2D Design

scp.s.scptuj.mb.edus.si
from scp.s.scptuj.mb.edus.si More from this publisher
30.07.2013 Views

Macros References are required for accessing properties, methods and events of a particular object and for using this object while programming a macro. For example, to use T-FLEX CAD commands in a Project, you would need to reference TFlexAPI.dll. At the time of creating a new project, main references are already added to it for using Microsoft Windows and T-FLEX CAD objects. The «Projects» window, just like the «Macros» window, displays all currently opened Projects from T-FLEX CAD files, as well as Projects from the files located in the special folder «/Program/Macros». These two windows are synchronized. Closing a Project (document) file in T-FLEX CAD also makes it close in the «Projects» window of the macro editor. Similarly, a macro that has been created and made executable in the Macro editor consequently appears in the «Macros» window of T-FLEX CAD. Project elements are displayed in this window as a hierarchical structure. Displaying project elements as a tree simplifies viewing and selecting them. The project contains folders with modules, forms and references. There are two alternatives to add a new element to a project: • Right clicking the desired folder (for example, «Modules») lets • you access the option «Add» in the context menu. After selecting this option, the respective element will be added. When adding a reference, an input box appears for the user to type in the reference. Alternatively, a new module (form, reference) can be created by selecting an appropriate option on the «Project» toolbar. As it was mentioned earlier, each Project can contain an unlimited number of macros (procedures). To tackle the issue of repeating macro names, T-FLEX CAD uses namespaces. A namespace is an area of a program within which a macro (procedure) name must be unique. Use of namespaces helps working with a large number of macros. Namespaces are used as a convenient way of structuring a large number of macros. By using a namespace, one can create two macros with the same names within a common project. In this way, the macros will belong to different namespaces. This approach implies uniqueness of names of namespaces themselves. The names of namespaces should preferably reflect on their purpose as well. 743

Fundamentals. Two-Dimensional Design 744 Let's review in details the structure of employing macros in T-FLEX CAD. Macro (Macro1) . Class (Messages) PROJECT (File T-FLEX CAD “Example.grb”) Module 1 Module 2 Module 3 Macro (Macro1) Namespace (Namespace 1) Macro (Macro1) . Class (Messages) Macro (Macro1) Namespace (Namespace 2) . Class (Messages) Macro (Macro1) Macro (Macro1) The above scheme illustrates a project from the file «Example.grb». Three modules were created in this project. «Module2» and «Module3» use the namespaces «Namespace1» and «Namespace2», respectively. All three modules use the same class «Messages». Two respective macros are created in each module. In this example, one of the macros in each module use the same name «Macro1». In reality, those are completely different macros, yet having the same names. Such a macros naming structure can be used in the cases when macros serve for similar purposes. Now, let's review macros representation in T-FLEX CAD environment. More details on handling macro editor windows will be provided below. At this point, let's limit ourselves to reviewing just the structure of macros representation. As shown on the figure below, a hierarchical structure of nested folders appears upon opening the project «Example», that represent namespaces (the folders with the icon ) and classes (the folders with the icon ), with their respective macros enclosed within.

Macros<br />

References are required for accessing properties, methods and events of a particular object and for using this<br />

object while programming a macro. For example, to use T-<strong>FLEX</strong> <strong>CAD</strong> commands in a Project, you would<br />

need to reference TFlexAPI.dll. At the time of creating a new project, main references are already added to it<br />

for using Microsoft Windows and T-<strong>FLEX</strong> <strong>CAD</strong> objects.<br />

The «Projects» window, just like the «Macros» window, displays all<br />

currently opened Projects from T-<strong>FLEX</strong> <strong>CAD</strong> files, as well as Projects<br />

from the files located in the special folder «/Program/Macros». These two<br />

windows are synchronized. Closing a Project (document) file in T-<strong>FLEX</strong><br />

<strong>CAD</strong> also makes it close in the «Projects» window of the macro editor.<br />

Similarly, a macro that has been created and made executable in the<br />

Macro editor consequently appears in the «Macros» window of T-<strong>FLEX</strong><br />

<strong>CAD</strong>.<br />

Project elements are displayed in this window as a hierarchical structure.<br />

Displaying project elements as a tree simplifies viewing and selecting<br />

them. The project contains folders with modules, forms and references.<br />

There are two alternatives to add a new element to a project:<br />

• Right clicking the desired folder (for example, «Modules») lets<br />

•<br />

you access the option «Add» in the context menu. After selecting<br />

this option, the respective element will be added. When adding a<br />

reference, an input box appears for the user to type in the reference.<br />

Alternatively, a new module (form, reference) can be created by<br />

selecting an appropriate option on the «Project» toolbar.<br />

As it was mentioned earlier, each Project can contain an unlimited number of macros (procedures). To tackle<br />

the issue of repeating macro names, T-<strong>FLEX</strong> <strong>CAD</strong> uses namespaces. A namespace is an area of a program<br />

within which a macro (procedure) name must be unique. Use of namespaces helps working with a large<br />

number of macros. Namespaces are used as a convenient way of structuring a large number of macros. By<br />

using a namespace, one can create two macros with the same names within a common project. In this way,<br />

the macros will belong to different namespaces. This approach implies uniqueness of names of namespaces<br />

themselves. The names of namespaces should preferably reflect on their purpose as well.<br />

743

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!