T-FLEX Parametric CAD. Fundamentals. 2D Design
T-FLEX Parametric CAD. Fundamentals. 2D Design T-FLEX Parametric CAD. Fundamentals. 2D Design
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.
- Page 693 and 694: Fundamentals. Two-Dimensional Desig
- Page 695 and 696: Fundamentals. Two-Dimensional Desig
- Page 697 and 698: Fundamentals. Two-Dimensional Desig
- Page 699 and 700: Fundamentals. Two-Dimensional Desig
- Page 701 and 702: Fundamentals. Two-Dimensional Desig
- Page 703 and 704: Fundamentals. Two-Dimensional Desig
- Page 705 and 706: Fundamentals. Two-Dimensional Desig
- Page 707 and 708: Fundamentals. Two-Dimensional Desig
- Page 709 and 710: Fundamentals. Two-Dimensional Desig
- Page 711 and 712: Fundamentals. Two-Dimensional Desig
- Page 713 and 714: Fundamentals. Two-Dimensional Desig
- Page 715 and 716: Fundamentals. Two-Dimensional Desig
- Page 717 and 718: Fundamentals. Two-Dimensional Desig
- Page 719 and 720: Fundamentals. Two-Dimensional Desig
- Page 721 and 722: Fundamentals. Two-Dimensional Desig
- Page 723 and 724: Fundamentals. Two-Dimensional Desig
- Page 725 and 726: Fundamentals. Two-Dimensional Desig
- Page 727 and 728: Fundamentals. Two-Dimensional Desig
- Page 729 and 730: Fundamentals. Two-Dimensional Desig
- Page 731 and 732: Fundamentals. Two-Dimensional Desig
- Page 733 and 734: Fundamentals. Two-Dimensional Desig
- Page 735 and 736: Fundamentals. Two-Dimensional Desig
- Page 737 and 738: Fundamentals. Two-Dimensional Desig
- Page 739 and 740: Fundamentals. Two-Dimensional Desig
- Page 741 and 742: Fundamentals. Two-Dimensional Desig
- Page 743: Fundamentals. Two-Dimensional Desig
- Page 747 and 748: Fundamentals. Two-Dimensional Desig
- Page 749 and 750: Fundamentals. Two-Dimensional Desig
- Page 751 and 752: Fundamentals. Two-Dimensional Desig
- Page 753 and 754: Fundamentals. Two-Dimensional Desig
- Page 755 and 756: Fundamentals. Two-Dimensional Desig
- Page 757 and 758: Two-dimensional design CONVERTING D
- Page 759 and 760: Two-dimensional design Performing C
- Page 761 and 762: Two-dimensional design 760 After co
- Page 763: Two-dimensional design 762 Use of t
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