T-FLEX Parametric CAD. Fundamentals. 2D Design
T-FLEX Parametric CAD. Fundamentals. 2D Design T-FLEX Parametric CAD. Fundamentals. 2D Design
Upon placing control elements on the form, one needs to define processing of the event of clicking the control element – the button. To do this, select that element on the form, switch to the «Properties» window and set the latter window into the event mode . In the right hand side column of the «Click» event, press , which will create the procedure «button1_Click». The same result could be achieved by double-clicking the control element – the button. In the coming up form code window, one needs to write the procedure «button1_Click». Macros The figure below depicts the form code window containing the function «button1_Click», in which the variables «X1», «Y1», «X2» and «Y2» are assigned values from control elements – the textBox1, textBox2, textBox3 and textBox4 input boxes, and «CreateLine» function (macro) is called. 753
Fundamentals. Two-Dimensional Design 754 After that, let's create a module, in which two functions are to be written. The function «ShowDialog» (a standard function of the development environment) will be displaying the screen form upon launching the macro. The previously defined function «CreateLine» creates 2D nodes, whose coordinates are the values specified by the user via the «FormLine» form dialog, and the segment between those nodes. The module’s source code is shown below. ‘Declaring references Imports System Imports TFlex Imports TFlex.Model Imports TFlex.Model.Model2D ‘Declaring namespace Namespace NewMacroNamespace ‘Declaring class Public Class NewMacroClass ‘The function, which will display the screen form «form» when executed Public Shared Sub ShowDialog() Dim form As LineForm form = new LineForm() form.ShowDialog() End Sub ‘The function with parameters (the macro), which creates a graphic line between two 2D nodes. ‘Coordinates of those nodes are input in the function as the dialog parameters Public Shared Sub CreateLine(ByVal NodeX1 As String, ByVal NodeY1 As String, ByVal NodeX2 As String, ByVal NodeY2 As String) Dim document As Document document = TFlex.Application.ActiveDocument
- 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 and 744: Fundamentals. Two-Dimensional Desig
- Page 745 and 746: 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: 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
<strong>Fundamentals</strong>. Two-Dimensional <strong>Design</strong><br />
754<br />
After that, let's create a module, in which two functions are to be written. The function «ShowDialog» (a<br />
standard function of the development environment) will be displaying the<br />
screen form upon launching the macro. The previously defined function<br />
«CreateLine» creates <strong>2D</strong> nodes, whose coordinates are the values specified<br />
by the user via the «FormLine» form dialog, and the segment between those<br />
nodes. The module’s source code is shown below.<br />
‘Declaring references<br />
Imports System<br />
Imports TFlex<br />
Imports TFlex.Model<br />
Imports TFlex.Model.Model<strong>2D</strong><br />
‘Declaring namespace<br />
Namespace NewMacroNamespace<br />
‘Declaring class<br />
Public Class NewMacroClass<br />
‘The function, which will display the screen form «form» when executed<br />
Public Shared Sub ShowDialog()<br />
Dim form As LineForm<br />
form = new LineForm()<br />
form.ShowDialog()<br />
End Sub<br />
‘The function with parameters (the macro), which creates a graphic line between two <strong>2D</strong><br />
nodes.<br />
‘Coordinates of those nodes are input in the function as the dialog parameters<br />
Public Shared Sub CreateLine(ByVal NodeX1 As String, ByVal NodeY1 As String,<br />
ByVal NodeX2 As String, ByVal NodeY2 As String)<br />
Dim document As Document<br />
document = TFlex.Application.ActiveDocument