x

SALE
  1. en
  2. de
  3. uk
Saving the Properties of ArCADia System Elements
05 May 2021

ArCADia BIM: Creating Your Own Doors and Windows Using LUA Scripts

 

1. Tools

 

Scripts of windows and doors can be written in any notebook, even in the system one, however, you have to count with a lot of errors. I recommend the use of the free Notepad ++.

 

When writing scripts in this program we make fewer mistakes because the above program is designed to write code and what the most important thing it pays attention to the parentheses "()". This is a very useful functionality, and a plus for this program is that it knows the syntax of many languages.

 

Link to the page with Notepad ++ https://notepad-plus-plus.org/

 

Another tool that can be useful is the websites on the LUA language, I recommend using this source of knowledge directly  https://www.lua.org/pil/contents.html 

 

 

2. Where are the scripts?

 

All window and door scripts are located on the disk in the ArCADia main catalogs.

 

The path on my computer is as follows:

 

ArCADia BIM doors and windows scripts 3d objects

 

As you can see in the picture above, there are further catalogs in the "Scripts" catalog.

 

Ø Catalogue „.Modules”


ArCADia BIM doors and windows scripts 3d objects

 

Here are the LUA scripts that should not be modified. These files contain procedures that allow you to operate script objects in the ArCADia system.

 

By analyzing them, you can discover many system variables used in the ArCADia system.

 

Ø Catalogue „_@(Architecture.Scripts.DoorsFolder)

 

ArCADia BIM doors and windows scripts 3d objects

 

Here you can find the scripts for Doors.

 

Ø Catalogue „_@(Architecture.Scripts.WindowsFolder)

 

ArCADia BIM doors and windows scripts 3d objects

 

Here you can find the scripts for windows.

Ø File extensions in the above directories.

 

It should be noted that for each script there is a small drawing showing the appearance of the defined object.

 

The script file has the extension * .lua, while the graphic file must have the extension * .png and the properties width 200 pixels, high 150 pixels and 24bit.

 

Additionally, remember that the names of the script and the drawing showing the door or window defined in this script must have one name, eg "test1.lua"; "Test1.png." Such naming is necessary for the correct operation of the ArCADia program.

 

3. Construction of the script „*.lua”

 

3.1. Construction of the script - Description obtainable from ArCADiaSoft

 

Creating windows and doors using LUA scripts

Script files for each individual door / window can be found in the following directory:

…\ArCADia\Stage\Debug\x86\Scripts

 

The above files are opened with a text editor (preferably Notepad ++)

File: …\ArCADia\Stage\Debug\x86\Scripts\.Modules\OpeningUtils.lua contains most of the basic functions used to create LUA objects. In addition, more functions can be added in files in which specific objects are defined (remember the principle that we do not repeat the code, but also that any change in openingutils.lua may prevent backward compatibility of previously written scripts). The global functions (openingutils.lua) contain a brief description of what parameters they take and what objects returns. Similar descriptions should also be performed for functions used in script files.

Each script file consists of a number of functions that allow you to build the desired object.

 

The main functions are:

 

function GetKind( )

here we define the type: Door or Window

 

function Init( self )

here we define the initial values and add our own parameters (successively self.a ... self.h) function DescribeProperties( )

here we define how these values should appear in the property editor (their descriptions, type variables, scope)

 

function detail.GetDoorShape( self ) / function detail.GetWindowShape( self )

here we define the contour on the basis of which we will build a given object (important: for some

objects we use the detail.GetOpening function where we define the contour of the opening in the wall - where the contour of the opening is different from the door contour)

 

function DefineAppearance( self, canvas )

here we define the look on the plan, remember to try to use as much as possible of already written functions from openingutils.lua. We can also use our own functions as well as command sequences.

 

function Define3DAppearance( self, canvas, forScheme )

here we define the appearance in a 3D view. Comments j / w.

GENERAL REMARKS:

- both the file name and all parameter labels refer to the file architecture.translation

- the coordinate system is the system whose origin is the geometric center of the object being drawn (see the offset of the frame from the edge of the wall) and its axis x is parallel to the axis of the wall.-

 

3.2. Script build - My script construction description.

 

Each script defining a window or door is built of functions that should be properly programmed.

I will describe my function description based on an example taken from "life", a window script named _@(Architecture.Scripts.1WingWindow).lua”.

 

 

ArCADia BIM doors and windows scripts 3d objects

 

Description of a script fragment.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

 

Using these lines of code, additional functions from external libraries are loaded into the script.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

Thanks to this function, the program knows what will be generated using the script. This is a function that is necessary for the proper operation of the script.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

 

In this function, we define the default information about the object that we program and is necessary for the correct operation of the script. If this script is run for the first time, this data will be loaded into the ArCADia window.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

This function is responsible for collecting information from the user and forwarding it to the script and is necessary for the correct operation of the script.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

 

 

 

 

 

 

 

 

 

In short, these lines of code must be there and should not be changed and are necessary for the correct operation of the script.

 

Ø Code Fragment.

 

ArCADia BIM doors and windows scripts 3d objects

 

This function defines the geometry (contour) of the opening in the wall for windows and the outline of, for example, the window or door frame, there is an indirect function that is why the name has the word „detail”.

 

If we would look at the door script, this function would have the name „detail.GetDoorShape( self )”.

 

The above function is not necessary for proper operation of the script. In this case, it was written separately due to the fact that it will be used in several other places in this script and the programmer will not have to write the same code several times. Note - it's worth writing your own universal functions so that later you can use them in other scripts.

 

Ø Code Fragment

 

ArCADia BIM doors and windows scripts 3d objects

 

This function defines the shape of a window sill is an intermediate function, therefore it has a word in the name „detail”.

 

Ø Code Fragment

 

ArCADia BIM doors and windows scripts 3d objects

 

One of the most important functions, which is directly responsible for the appearance of the opening in the wall and is necessary for the correct operation of the script.

 

Ø Code Fragment

 

ArCADia BIM doors and windows scripts 3d objects

 

This modest function is responsible for the appearance of a window or door in a projection, i.e. a paper printout. It is necessary for the script to work properly.

 

Ø Code Fragment

 

ArCADia BIM doors and windows scripts 3d objects

 

This rather large function is an indirect function responsible for the appearance of the window or door in 3D view as I mentioned earlier, therefore the word used in the name „detail”.

 

The above function is not necessary for proper operation of the script. In this case, it was written separately for the clearer writing of the code. The programmer did not want to create a single powerful function, but only split one large one into several smaller ones responsible for another part of the window element.

 

Ø Code Fragment

 

ArCADia BIM doors and windows scripts 3d objects

 

This function is directly responsible for the appearance of the window or door in 3D view and is necessary for the correct operation of the script.

 

4. Detailed description of individual functions and elements of the script.

 

4.1. External libraries with functions

 

ArCADia BIM doors and windows scripts 3d objects

 

As I mentioned above, if you do not want to know exactly what these lines of code correspond to, leave them unchanged and go to the next chapter.

 

The above lines of code are responsible for loading additional libraries with universal functions that you can use in your scripts. These lines contain references to external scripts in the directory „.Modules”.

 

  • Line num 4 - is responsible for loading additional functions contained in the file „OpeningUtils.lua”. In this file ArCADiaSoft developers hid most of the repetitive functions by means of which windows and doors are generated. If you analyze them yourself, you can use these functions for your own purposes. If you do not intend to use them, you can omit this line.

 

  • Line num 5 - is responsible for basic functionalities used in ArCADia, I recommend always using it. Mirroring, changing 2D paths to 3D. If you analyze them yourself, you can use these functions for your own purposes. If you do not intend to use them, you can omit this line.

 

  • Line num 6 – is responsible for creating an empty function named „detail”, which is used to write additional intermediate type functionalities „functiondetail.GetWindowShape( self )”.

 

Note 1 - If you write a lot of your universal functions, you can place them in your own external library as ArCADia's programmers did. Later on you will be able to use them in subsequent scripts so as not to rewrite the same lines of code.

 

Note 2 – Pay attention to the command „local”, which is responsible for creating a function name within the entire script. The „local” command is also used to create local variables within one function.

 

Note 3 – You can use your own variable names of functions, they do not have to be the word „opening” and so on, only consistently remember to use your own variable function names.

 

4.2. Window, Door or another Object?

 

ArCADia BIM doors and windows scripts 3d objects

 

The above function is responsible for informing ArCADia which object will be generated by means of a script.

 

Line num 13 tells ArCADia that a window will be generated.

 

If you want to program a door, insert a line „return items.WallItemKind.Door”. In addition, you can also program a different object than a door or window, then we use the line „return items.WallItemKind.Other”.

The above line is important when generating lists of window and door carpentry. When using the line „return items.WallItemKind.Other” the object being programmed by us will not be included in the woodwork list.

 

4.3. Data downloaded from the user.

 

The ArCADia program provides many system variables that you can use to program your own objects using scripts. Thanks to them, the user can influence the generation of your door or window model.

Copyright © 2021 ArCADiasoft

HOME  |  PRODUCTS  |  COMPANY  |  CONTACT  |  FOR RESELLERS