File JavaScript
In teoria, un servizio web può essere creato con qualsiasi linguaggio di programmazione. In this article, the programming environment is JavaScript. As a matter of fact, scripting can be used to define the topology of the structure, the load cases, and the loads. To create script files, it is enough to have an editor such as the one used in this article (Notepad ++).
In the JavaScript file provided in this example, the input parameters are defined with the input_data() function. These parameters can be assigned in different categories (basic data, geometry, supports, sections, and so on).
In terms of basic data, parameter "n" is defined as the type "integer" (using the parameter_int() function) in order to allow dynamic generation of the number of bays. In the “Geometry” category, on the other hand, the parameter_float() function is used for the creation of the frame span (a), the height of the column (H_1), the height of the roof (H_2), and the bay length (L). As can be seen in Image 1, parameter “L” (Bay length) is created dynamically by the multiplicity counter kn, which was defined earlier.
Next, the variables defined as input data can be employed by the generate() function to generate the block; that is, to create nodes and members, assign supports to nodes, create coordinate systems, and create dimensions. This is shown in Image 2, and it can be further explored in the script provided at the end of the article.
It is to be noted that all available objects and attributes can be found in the Console (View → Console). As Image 3 shows, the objects and their properties can be displayed through the icon indicated in the image.
Although not used in this example, the global_parameters() function can also be adopted in the script. This function serves to parameterize the block, as discussed in the Knowledge Base article "Parameterized Models as Blocks in RFEM 6":
Creating and Saving Blocks with JavaScript
Blocks in RFEM 6 are listed as Special Objects in the navigator. To create a new block, right-click this entry and choose “New Block” from the drop-down menu. This opens a dialog box where you can create and save blocks. When working with blocks in JavaScript, switch to the “JavaScript” tab as shown in Image 4. You can then click the “Edit JavaScript” button ( ) to write directly in the tab, or use the “Open JavaScript file” button ( ) to import a file. After editing, click the button to apply the JavaScript, then save the block using the per modificare. In the "Save as Block" dialog box, you will be prompted to name the block and set its categorization, such as model type, objects used, and model categories (Image 5).
After saving a block, it can be imported easily into any RFEM 6 file. To do this, open Dlubal’s Block Manager and select the desired block from the appropriate category. Before insertion, the block can be adjusted in the “Edit Block” window, which opens automatically upon selecting the block. For dynamic blocks created via scripting, the input parameters can be edited in the “Structure” tab of this dialog box (Image 6).
As mentioned above, the advantage of dynamic blocks is the possibility to introduce modifications by changing the input variables. Thus, given the manner in which the number of bays (n) and the bay length (L) have been defined in the script, the latter will change automatically when the former are changed.
In this example, the predefined number of bays is three and, therefore, three bay lengths are listed as parameters <nobr>(Image 6)</nobr>. However, the variable “n” can be easily changed into any other number (for example, five), and the structure will be modified accordingly (Image 7).
Osservazioni finali
Dynamic blocks in RFEM 6 can be created easily by scripting. To create script files, it is sufficient to have a script editor. At this point, parameters can be created dynamically in the script, thus allowing interactive modification of the block afterwards.
The blocks created in this manner can be saved by importing the JavaScript file in the “Save as Block” window. Once available in Dlubal's Block Manager, they can be imported easily into any RFEM 6 file. Since the blocks are dynamic, interactive modifications of structural parameters as a result of modified input variables are possible each time the blocks are used in an RFEM file.