25 Lua scripts
Lua is an open source scripting language that is used for various automations. Information about the language is available at: http://www.lua.org.
Archicad 21 and later: Any ArchiFrame Lua-script is using western 8-bit character set and strings are converted to/from utf-8. An exception to this are scripts loaded from xml-files – these scripts are using utf8 always internally. Script may change this default behaviour by setting global gScriptUtf8 to values:
- •
Missing/nil, default.
- •
0, script uses western locale.
- •
1, script is fully utf8.
Useful code pieces:
-- Dumps given variable into string
-- To use: ac_msgbox(dump(v))
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end25.1 Additions to standard Lua
25.1.1 io.open()
To open a file with utf8 file name in Windows (in Macintosh file names have been utf8-encoded for a long time), use prefix utf8, in io.open(), for example:
local hFile=io.open(strFileName, "utf8,wt")
25.2 Built-in support functions
25.2.1 ac_elemget (strGuid [,strOptions])
strOptions, specify to get more data. Multiple values can be used, and possible values are:
- •
elem=0 Do not give element info (field header)
- •
props=1 Give all set properties in returned table field props (works starting from Archicad 22)
- •
props=2 As previous but property’s group name is included before property name and \t is added as separator. There may be properties with the same name under different groups, so this way ArchiFrame gives the full property path.
- •
props={GUID}, speed optimization to get just single property for the element. Returned property table is empty if the element does not have the requested property. Includes props=1, just property name included.
- •
categories=1 Give all categories in returned table field categories. The categories is 1-based array each item having fields:
- •
typeguid, the guid of the category type. This guid remains the same among different language versions.
- •
typename, the Archicad localized type name.
- •
valueguid, the guid of the category value. This guid remains the same among different language versions.
- •
valuename, the Archicad localized value name.
- •
- •
classes Give classification data in returned table field classes. The classes is a table having classification system name as the key. The value is a table having fields:
- •
id, id of the classification item
- •
name, name of the classification item
- •
- •
ifc=1 Give IFC-data
Returns table of given element having fields:
- •
header.typeID, element type number, 6 = object.
- •
header.floor, element floor number.
- •
header.layer, element’s layer number.
- •
header.id, element’s ID
- •
header.libGuid, library part guid if any.
- •
If requested, field props which is array of Archicad properties set for the element. Property name is the array key, for example value=props["propname"].strvalue. ArchiFrame sets property name to lowercase. The fields are:
- •
numvalue, set if it is a number
- •
strvalue, set if it is a string value
- •
guidprop, the guid of the property to be able to ask single property value after initial call getting the guid from here
- •
Value may be missing if property value type is currently unsupported (like value list)
- •
For example, following properties:
Are returned from expression elem=ac_elemget (elemguid, "props=1") as:
elem.props["scandic_form"].strvalue="Form-test"
elem.props["scandic_manufacturer"].strvalue="Manu-test" …25.2.2 ac_findobj (strObjName [, nUseSelection])
Fills table of selected or all object in active storey. Table contains object guids.
- •
nUseSelection, 0 = get all; 1 = get selected or all if no selection; 2 = just give selected objects.
Returns: The table.
25.2.3 ac_getobjparam (strObjGuid, strParamName [, nRowNum, nColNum])
Gives requested parameter from the object, door or window. Parameters nRowNum and nColNum indexing starts from 1. Value 0 is ignored and -1 returns the table dimension. For example to get number of rows, set nRowNum to -1 and nColNum to 0.
Special strParamName-values:
- •
#id, returns the element ID
- •
#layer, returns the Archicad layer as number
- •
#guid, returns element's internal GUID.
- •
#floor, returns the storey number.
- •
#pos.x, returns x-co-ordinate of an object or middle pos for opening.
- •
#pos.y, returns y-co-ordinate of an object or lower pos for opening.
- •
#level, level relative to object’s home storey.
- •
#levelglob, added also floor zero level.
- •
#angle, returns object angle in radians or reflected state for opening (0/PI).
- •
#mirroring, returns 0/1 reflected state for objects and doors & windows.
- •
#libname, returns library part name.
- •
#libguid, the same as GUID.
- •
#pen, default pen.
- •
#linetype, line type.
- •
#useobjlinetype, use object’s line types.
- •
# useobjsectattrs, negation of [ ] Override Object’s Attributes (1=use object’s attributes, 0=nope, use overrides)
- •
#mat, 3D material index
- •
#matname, 3D material name
For doors and windows:
- •
#wido_sill, sill value as GDL global WIDO_SILL.
- •
#oside, 1 if mirrored to x axis, 0 otherwise.
- •
#refside, 1 if mirrored to x axis same as oSide, 0 otherwise.
For ArchiFrame elements:
Value | Description |
"#af_elemdata" | Gives information of the plank related to the element. The table fields are:
If used from projection scripts (dimension collector or DoProjSettings()-function), ptr refers to projection plank’s master/3D plank. Also, then following extra fields are available:
Fielrds bx*, bz* and poly are affected by piece’s end cuts. Lengthwise cuts are processed if all these conditions are met:
|
Also, all values described <elemparam name="xxx">value</elemparam> are supported. Character # must be given before the element’s parameter name, for example #cutfill. Attribute values in this case are returned as two values: numeric and attribute name. Exceptions:
- •
#materialrgb returns single string. It is the material’s colour in format "RGB" where all color values are between 0…1. Decimal separator is dot, for example "0.5, 0, 0". If the material is GENERAL, the return value is "0".
Returns: The parameter numeric/string or nil = parameter missing.
25.2.4 ac_getattrinfo (strAttrGuid) or ac_getattrinfo (nTypeNum, nAttrIndex)
Gives information of an attribute. Parameter nTypeNum is one of API_AttrTypeID (using numbering from AC26, AC27 has dropped API_PenID, API_FontID and some other types):
API_PenID = 1,
API_LayerID = 2,
API_LinetypeID = 3 and so on,
API_FilltypeID,
API_CompWallID,
API_MaterialID,
API_CityID,
API_LayerCombID,
API_ZoneCatID,
API_FontID,
API_ProfileID,
API_PenTableID,
API_DimStandID,
API_ModelViewOptionsID,
API_MEPSystemID,
API_OperationProfileID,
API_BuildingMaterialID,
API_MarkUpStyleID
Special value -1 means floor number and return values are: 1. String telling the floor name, 2. Number telling floor global level.
Returns: The table having fields
- •
type, one of following: "fill", "composite", "type_as_number".
- •
name, the attribute name.
- •
thickness, for composite the total thickness and for composite layers, the layer thickness.
For composites only:
- •
num_layers, number of layers.
- •
Layers, table of layers each having similar fields as requested for fill, except thickness also set.
25.2.5 ac_objectopen(strGuid)
In special cases strGuid can be nil and the function will open the default object depending on the special usage case. Opens the object for further processing. The guid may also be a C pointer obtained from ArchiFrame. The C pointer start with @ and is followed by 8 (32 bit) or 16 (64 bit) characters. Use pointers with care – misuse will crash the program.
Parameter strGuid may begin with character >. For example, if used in plank observer script, it will work with last saved version skipping ArchiFrame’s object cache buffer.
Returns: Nothing, in case of error, Lua error is raised.
25.2.6 ac_objectget (strParamName [, nRowNum, nColNum])
Works as ac_getobjparam but for object opened with call to ac_objectopen.
25.2.7 ac_objectset (strParamName, value [, nRowNum, nColNum])
Sets the parameter only if changed.
Returns: Nothing, in case of error, Lua error is raised.
25.2.8 ac_objectdelrow(strParamName, row1)
Deletes given array row defined by 1-based index. Object must have been opened with ac_objectopen().
25.2.9 ac_objectclose ()
Saves changes if any to opened object.
25.2.10 ac_environment (strSel [, additional parameters])
Selector can be one of the following:
25.2.11 ac_environment ("lang")
Returns language of theArchicad: "eng", "fin" or "swe".
25.2.12 ac_environment ("ntos", nVal, strType, strPrefs)
Converts number to string using current Archicad-settings. Parameter strType can be "length"| "angle" | "area" | "volume". strPrefs is either "work", "dim"or "calc" and it reflects to Archicad working, dimension lines and calculation settings. Parameter nVal is the numeric value. Returns string value.
25.2.13 ac_environment ("units", strType, strPrefs)
Returns four values:
- •
Unit type as number
- •
Unit string
- •
Multiplication factor to convert from Archicad’s internal format to user preferences, 0=no conversion, for example: 1' 2/32"
- •
How many decimals to use if numeric
Parameters are as "ntos" but no nVal parameter is not given. First return value numbers are:
APIUnit_Metric=0,
APIUnit_Centimetric,
APIUnit_Millimetric,
APIUnit_FootInch,
APIUnit_FootDecInch,
APIUnit_DecFoot,
APIUnit_Inch,
APIUnit_DecInch,
APIUnit_Decimetric,
APIUnit_DecYard,
APIUnit_Gallon
Please note that from AC22 on the values are (decimetre added so check the unit string for imperial check):
Meter,
Decimeter,
Centimeter,
Millimeter,
FootFracInch,
FootDecInch,
DecFoot,
FracInch,
DecInch
25.2.14 ac_environment ("userorigin")
Returns X, Y, Z of the user origin.
ac_environment ("reflevels")
Returns two numeric reference levels defined in AC.
25.2.15 ac_environment ("parsetext", strIn)
Parses texts having Archicad automatic texts like <ARCHITECT>. Returns parsed string.
25.2.16 ac_environment ("createguid")
Creates new GUID in form {4CABE438-C7F5-4B43-A6DF-B07114D6BDDF}.
ac_environment ("strreplace", strSource, strFind, strReplace)
Does find & replace without any character being pattern.
25.2.17 ac_environment ("layer", strName, nShow, nSetMask)
Shows (1) or hides (0) given layer(s). Name may contain wild characters * and ?, for example, “structural*”. If parameter nShow is -1, it will return the state of the layer (if wild card, the state of first matching layer). State is bit combination:
- •
1, bit0, is visible: 0 = hidden, 1 = visible.
- •
2, bit1, is locked.
- •
4, bit2, is mine in TeamWork.
- •
16, bit4, is forced to wireframe.
- •
32, bit5, the layer belongs to an Xref.
Optional parameter nSetMask defines which bits to apply from nShow to the layer status bits.
Another mode is nShow with value -2. Then the given layer will be created as visible if it is not created already (then its status is not changed). Call this again to set the status of newly created layer if needed. Returns negative error code if creating the layer failed, otherwise positive layer index.
Returns numeric status of the edited layer
25.2.18 ac_environment ("rebuild", nRegenerate)
Rebuilds display (for example after showing/hiding layers). With nRegenerate value 1 rebuild is done deeper.
25.2.19 ac_environment ("tolog", strText)
Puts given text to a log window (not a dialog).
25.2.20 ac_environment ("bittest", value, bitnum)
Returns value 0/1 for given bit in the value. Parameter bitnum must be between 0…31.
25.2.21 ac_environment ("getsel")
Returns table of selected element’s guids. Processes all element types. Return value nil means no selection.
25.2.22 ac_environment ("setsel", tblGuids)
Sets selection to given guid tbl which must start indexing from [1]. Nil = remove selection.
25.2.23 ac_environment ("suspendgroups", bSusped)
Sets suspending the groups to given bool value (false = nope, others = suspend). Returns previuous state of suspending: false = not suspended, true = yes.
25.2.24 ac_environment ("getcurrwindow")
Returns type of current window:
- •
1, floor plan (Google for text APIWind_FloorPlanID to get all values).
- •
2, section.
- •
3, detail.
- •
4, 3D window.
25.2.25 ac_environment ("getall", nFilterBits, nElemType1, nElemType2,…, nElemTypeN)
Returns table of all element’s guids (never nil but table can be empty).
nFilterBits as in API-calls, for example APIFilt_OnVisLayer|APIFilt_OnActFloor is 2+4 = 6. -1 = default: APIFilt_OnVisLayer|APIFilt_OnActFloor if current window is floor plan; APIFilt_OnVisLayer if current layer is anything else. ArchiFrame sets global gnListingAll to value 1 if selected (*) whole model even if in floor plan.
25.2.26 ac_environment ("filterelem", guid, nFilterBits)
Checks if given element fulfils the filter (for example is on visible layer which is number 2). Returns true or false.
ac_environment ("filedialog", bSaveAs, strTitle, strFilter, strFileExt)
Runs open or save as file dialog if bSaveAs is true. Parameter strTitle is the title of the dialog box, strFilter is in format "Text files (*.txt)|*.txt|All (*.*)|*.*|", strFileExt is the default file extension without the period. Returns nil if cancelled.
25.2.27 ac_environment ("findattr", nAttrType, strAttrName)
Find given attribute by name, strAttrName may contain wildcards and multiple values may be given with vertical bar. Returns 0 if not found.
ac_objectset("iMc", ac_environment("findattr", 6, "*tre-osb*|Tre-Mahogny"), add, 10)
nAttrType must be one of following (number increases by one for each line).
API_PenID = API_1,
API_LayerID,
API_LinetypeID,
API_FilltypeID,
API_CompWallID,
API_MaterialID,
API_CityID,
API_LayerCombID,
API_ZoneCatID,
API_FontID,
API_ProfileID,
API_PenTableID,
API_DimStandID,
API_ModelViewOptionsID,
API_MEPSystemID,
API_OperationProfileID,
API_GraphicOverrideID,
API_BuildingMaterialID,
25.2.28 ac_environment ("luacomchars", nCodePage)
Sets LuaCOM-interface’s global character set. Default is ANSI (0) and other possible value is UTF8 (65001). Returns previous setting that must be restored so that other sripts are not affected.
25.2.29 ac_environment ("acver")
Returns current Archicad-version as number: 19=1900, 20=2000, 21=2100 etc.
25.2.30 ac_environment ("solidsub", tblTargets, tblOperators)
Makes solid subtraction connection between all targets and operators that have intersecting bounding box. Both tables must be 1-based arrays.
25.2.31 ac_environment ("scriptdir")
Returns two values:
- 1.
Path to the script not including the last path character (C:\Folder for example or C: if root folder)
- 2.
Current path sepator character, either "/" or "\"
25.2.32 ac_environment ("mkdir", strPath)
Creates given folder. Returns true=succeeded, false=failed
25.2.33 ac_environment ("setautotext", strKey, strVal)
Sets given autotext. Please note that strKey is given without <>. Causes an error if fails. Example:
ac_environment("setautotext", " PROJECTNAME", "My Project")
25.2.34 ac_environment ("gridnext", x, y, dirx, diry)
Calculates next grid position from given position in given direction and returns information about the grid. Returns four values:
- •
Status: 0=no suitable grid, 1=moved to grid but grid not parallel or in 90 deg angle to the direction vector, 2=grid was parallel to direction vector and the result is good.
- •
x, y: the coordinates of the calculated position
- •
Information of the grid as a table having fields:
- •
x,y,z Grid origin
- •
angle Grid angle in radians
- •
mainx,mainy Spacing
- •
25.2.35 ac_msgbox (strText)
Shows message box. Useful for debugging.
25.2.36 ac_mbstoutf8 (strIn)
Converts given text encoding into UTF8. Returns converted string.
25.2.37 ac_utf8tombs(strIn, codepage)
Converts given utf8 text into requested codepage. Parameter codepage must be ne of the following numbers:
CC_Default = 0,
CC_System = 1,
CC_User = 2,
CC_Application = 3,
CC_Legacy = 4,
CC_WestEuropean = 11,
CC_EastEuropean = 12,
CC_Baltic = 13,
CC_Cyrillic = 14,
CC_Greek = 15,
CC_Turkish = 16,
CC_Hebrew = 21,
CC_Arabic = 22,
CC_Thai = 31,
CC_Japanese = 32,
CC_TradChinese = 33,
CC_SimpChinese = 34,
CC_Korean = 35,
CC_Symbol = 40
Returns converted string.
25.2.38 ac_geo (strSel [, additional parameters])
Selector can be one of following:
ac_geo ("linex", x1first, y1first, x2first, y2first, x1second, y1second, x2second, y2second)
Gives intersection point of two lines. Lines are infinite length. Returns: No value = no intersection pt, (X, Y) = the intersection point.
ac_geo ("linedist", x1, y1, x2, y2, x, y)
Calculates point distance from line. Return three values: Distance from the line (negative to the left and positive at right hand side), distance from beginning point towards end (negative before line starting point) and length of given line.
ac_geo ("calctranworld3", origfrom, vecxfrom, vecyfrom, veczfrom, origto, vecxto, vecyto, veczto)
Calculates transformation matrix [1...12] for given coordinate worlds. Returns table [12]. To transform a point, use:
Xnew = x*tblTran [1]+ y*tblTran [2]+ z*tblTran [3]+tblTran [4].
Ynew = x*tblTran [5]+ y*tblTran [6]+ z*tblTran [7]+tblTran [8].
Znew = x*tblTran [9]+ y*tblTran [10]+ z*tblTran [11]+tblTran [12].
Due to historical reasons, the offset values at [4], [8] and [12] work only with global coordinate system. Please find function MatInitTran from default ArchiFrameElements.xml to see how to transform from any world to any other world.
ac_geo ("matmul", mat1, mat2)
Multiplies matrix1 with matrix2. Matrices are in format calctranworld3 uses, col 4 is just added.
ac_geo ("linepolyx", x1, y1, x2, y2, tblPolys, [extendLine=false, onEdgeInside=true])
Calculates intersection of given line and table of polygons (format as in af_request (“getpoly”,…)). TblPolys is 1-based table of separate polygons (to be able to handle split surfaces).
If the two last parameters are missing, the shown default values are used.
Returns 1-based table of line segments each segment having fields x1, y1, x2, y2. Nil if there is no intersection.
ac_geo("polysdist", poly1, poly2)
Calculates minimum distance between two polygons (not polygon lists).
Returns the distance, 0=intersecting or touching.
25.2.39 ac_optiondlg (strID, strTitle, tblSettings)
Runs setting dialog and saves settings application a specific way – usually to user specific configuration file and to the current pln-file. Dialog looks like:
And code to run this is:
gbAskOptions=true
gbCnc-ToDb=true
-- CNC- writing settings, raises error if canceled
function GetCnc-Options()
local tblSettings, bRes, sErr, s, n
-- Ask only once
if gbAskOptions==false then
return true
end
tblSettings={}
tblSettings [1] ={}
tblSettings[1].cfgonly =1
tblSettings [1].type =2
tblSettings[1].prompt ="Save CNC- to production DB"
tblSettings [1].key ="cnc-db"
tblSettings[1].defvalue =0
tblSettings [2] ={}
tblSettings[2].cfgonly =1
tblSettings [2].type =1
tblSettings[2].prompt ="Handling of oversized up/downcuts"
tblSettings [2].key ="cnc-cut"
tblSettings[2].valuelist="\"1:Do not write cnc-\",\"2:Write cnc-\""
tblSettings[2].defvalue =1
bRes,sErr=ac_optiondlg("LDCN", "CNC- settings", tblSettings)
if not bRes then
if sErr~=nil then
RaiseError(sErr)
else
RaiseError("CANCELLED")
end
else
if tblSettings[1].value==0 then
gbCnc-ToDb=false
else
gbCnc-ToDb=true
end
end
gbAskOptions=false
endParameters:
Param | Description |
stride | Four letter long ID of the settings. Always start ID with LD not to mix it with application's own settings. For example LDCN. |
strTitle | Dialog title, set to nil if you just want to get the saved settings into the table tblSettings. No dialog is shown in this case. |
tblSettings | Table of the settings items. |
Return values: Boolean bRes, string strErr: bRes is true if dialog was run ok and closed with OK, false in case of internal error or dialog cancelled. In case of internal error strErr is set.
Settings table has fields:
Field | Description |
cfgonly | Optional number:
|
type | Numeric type:
|
prompt | To setting-column in the dialog. |
key | Unique key for the setting inside this setting dialog. |
defvalue | Default value to be used if no previously saved settings. |
value | If given for input: Value is not loaded from settings but instead this value is used. On output: The actual setting. |
valuelist | Given if type is 1. Contains items in format: "Number: Item text". Number is used as unique ID for the item. Items are separated with comma. Note Lua syntax for adding quotation marks in the string: "\"1:Do not write cnc-\", \"2:Write cnc-\"". |
25.2 ArchiFrame-specific functions
25.2.1 af_request (strSelector [, additional parameters])
Parameter strSelector defines what is requested:
Value | Description |
"getstring" | str = af_request("getstring", str_id, lang_code) Gives the localized string from data/ArchiFrameStrings.
Example: af_request("getstring", "pieces") Returns the localized string or parameter str_id if the string is not found. |
"singlemat" | TblMat = af_request ("singlemat", "id"), returns table for single material or nil if material does not exist. Passed id is searched for case insensitive. Fields are:
|
"matlist" | Returns table of all materials in material list as Lua hash-table (not 1-based indexed table). They key is the material ID and data is what singlemat gives plus field index telling the 1-based index in the order the materials are defined in ArchiFrameBlocks.xml. |
"plankinfo" | tblRes = af_request ("plankinfo", strPlankGuid, plankInfoProj, tblSettings), returns information about given plank. If strPlankGuid is missing, uses currently opened object/plank. If plankInfoProj is given, it contains projection information. tblSettings is optional settings. More info later. It is possible to get geometry information for element objects (in that case returns the framing geometry taking possible rotframing="x" attribute into account) or even Archicad beams, walls, doors, windows and columns too by giving strPlankGuid. Table has fields:
Quantities if requested:
If plankInfoProj is given, the plank is projected to given plane. Result is saved to field elemdata and has the same members as with #af_elemdata. Parameter plankInfoProj must contain fields (plankinfo queried for an element is fine):
Optional tblSettings may contain following fields:
Returns nil if failed. |
"parseinfo" | af_request("parseinfo", strParse, guidPlankBoard) Returns the parsed string. |
“getpoly” | tblRes = af_request ("getpoly", tblSettings, strPlankGuid), returns polygon information for given strGuid elem (plank, board, element). If strPlankGuid is missing, uses currently opened object/plank. If the given strPlankGuid refers to an ArchiFrameElement-object, this returns the framing polygon taking possible rotframing="x" attribute into account. tblSettings for boards may be nil. If given, it may contain following fields:
Returns table having following fields or nil = not supported type:
|
“delplank” | Marks currently opened object/ac_objectopen() to be deleted. Deletes all related projections etc. |
"getselplanks" | Returns guid table of selected plank objects. If selection contains projections, its master 3D plank will be returned instead. For historical reasons indexing of this starts from [0] and you need to use Lua pairs instead of ipairs: for i,v in pairs(tblSel) do xxx end To get only boards, give second parameter “board”. With any other value, only planks are collected. tblBoards = af_request ("getselplanks", "board") All planks&boards having parameter’s Special type value 1 (part of combined element source) are skipped. |
"getsellisting" | Returns table to be used as source elements for listing/cnc-. If anything selected, the lists are limited to the selection. If no selection, the result contains:
In both cases all planks&boards having parameter’s Special type value 1 (part of combined element source) are skipped. Returns 1-based array of tables containing fields:
If no elements, returns nil. |
"getselelemobjs" | Returns 1-based table of guids for ArchiFrameElement-objects related to selection. |
"afclick" | t=af_request("afclick", tblSettings) Asks user to click a plank or board. Parameter tblSettings has fields:
Returns table having fields:
Please see data-folder/ArchiFrameBlocks.xml part <mctool name="Element lifting drillings floor" for an example. |
"autocut" | t=af_request("autocut ", tblSettings) Automatically cuts planks with given settings. Parameter tblSettings may have these fields:
Does not return any value. The error message is dumped to the log window in case of error. |
"flushmc" | Flushes ArchiFrame’s internal machining table to the object’s parameters. Must be used after calling "adjustbegend" and similar for temporary plank before closing the plank to get all machinings offset correctly. Also normalizes the board’s polygon which is needed if you adjust the x1,y1 from 0,0. If the polygon’s origin was not 0,0 the machinings are moved accordingly. |
“getbegendplane” | TblPlane = af_request ("getbegendplane", "beg", nOptions). Returns global cutting plane for current plank’s begin or end (replace “beg” with “end”). Parameter tblPlane has fields pa, pb, pc, pd defining the plane equation. With numeric values any side can be queried, replace “beg” with values (see About the planks):
If parameter nOptions is missing or is 0, first cut for begin or end will be returned. With value 1, the result is always straight relative to the plank. |
“adjustbegend” | af_request ("adjustbegend", "beg", tblPlane). Adjusts currently opened plank’s end (“beg” or “end”) to given global plane. Parameter tblPlane has fields pa, pb, pc, pd defining the plane equation. |
"cutplank" | af_request ("cutplank", tblPlane) Splits currently opened plank into two pieces. Parameter tblPlane defines the cutting plane in global coordinates. Returns values:
|
"joinplanks" | af_request ("joinplanks", strGuid1, strGuid2). Joins given planks together. The requirements to join are:
Returns: true = ok and strGuid2 marked to be deleted at the end of the undo-scope, nil = nothing done. |
"adjusttoside" | af_request ("adjusttoside", tblSettings, strGuidTarget, tblGuidOperators). Adjust to side operation as with adjust to side tool palette. Parameter tblSettings may have fields.
Returns: nil = nothing done, tblNewPlanks = table of edited/new planks from the operation. |
“editplank” | af_request ("editplank", tblEdit) Edits single plank, tblEdit has following fields (give only the fields to edit). Edits are applied in order of this list (mat before xmlsetting for example):
An example of making duplicate and moving it in global z one meter up: Returns ptr in form @1234567812345678 to the original or temporary item. |
"boardgap" | af_request ("boardgap", tblGuids, tblSettings) Adds specified gap between board edges. Parameters:
|
"cmpplanks" | af_request ("cmpplanks", strGuid1, strGuid2). Compares two planks (not comparing the IDs). Comparison can be used for example in listings to make sure that planks having similar ID are similar. Return value:
|
"checkids" | af_request ("checkids", tblGuids). Checks that given planks & boards with the same ID are really the same. Parameters:
Returns: true=all good, false=errors found and dumped to the log window |
"plankx" | af_request ("plankx", strGuidTarget, sideTarget, strGuidCheck) Checks if there is intersection between two planks. Parameters:
Returns table with fields:
|
"mc_getenv" | af_request ("mc_getenv") Retrurns environment information for cnc-writers in a table having fields from ArchiFrameBlocks.xml / cnclimits:
|
"mc_getnewmcid" | af_request ("mc_getnewmcid") Generates new machining id for the plank opened by ac_objectopen(). |
"mc_findtextpos" | af_request ("mc_findtextpos", nSide14, dX1, dTextWidthMeter, dFontHeightMeters) Calculates position for plank ID that is as close as possible to dX1. If parameter dFontHeightMeters is given, its value is used instead of the text size in the ArchiFrame marking. Moves the text away from any existing markings and grooves. Returns the best calculated position. |
"mc_explodepanel" | af_request ("mc_explodepanel", guidBoardElem, tblSettings). Explodes given ArchiFrameBoard-object into separate temporary planks that will not be created into the model (to be used for listings and cnc-).
Returns 1-based table of plank @pointers. Nil = no planks created. |
"mc_nailings" | af_request("mc_nailings", tblTargets, tblGuidsBehind, tblSettings) Makes nailings to given planks or boards. Parameter tblSettings may contain following fields:
|
"mc_sawcuts" | af_request ("mc_sawcuts", guidElem, bViewBack, bAllowOrphan, tblSettings) Finds all placed ArchiFrameSawCut-objects that are over any projection of boards owned by given element using default orientation having saw blade on the right side. Parameters:
Returns 1-based table of saw cuts ordered by lineindex (main contour first) each item having fields:
|
"mc_hatches" | af_request ("mc_hatches", guidElem, bViewBack, strLayer). Finds all Archicad hatches from given layer that are over any projection owned by given element. Parameters:
Call mc_sawcuts before this to specify bAllowOrphan. Returns 1-based table of hatches each item having fields:
|
"mc_getacc" | af_request ("mc_getacc", guidElem) Finds all placed ArchiFrameAccessory and ArchiFrameElMarkers-objects that are inside any projection of given element. Scans all projections and related objects. In future may return more library part. Please check ac_elemget.header.libGuid to process the correct library parts and use ac_environment ("filterelem") to get only visible ones if needed. Parameters:
Returns 1-based table of resulting guids or nil=no objects related to the element. |
"mc_getcutinfo" | af_request ("mc_getcutinfo", tblInfo) Calculates information if a cut projected to one of the plank’s sides. Parameters are given in a table which has fields:
Returns a table having fields (btl-fields refer to btl cut code 010), angles are in radians:
|
"aflang" | Language selected into ArchiFrame: eng/fin/swe/nor/ger/ita. |
"afpaths" | Gives current settings paths ending to path separator character (\ in Win and / in Mac) as multiple return values: 1. Current path of the add-on folder 2. Current data folder 3. Current user specific data folder |
"dim_section" | af_request("dim_section", strLayer, tblSettings) Available only in dimension line scripts. Parameters:
Builds table of section polygon bound boxes. Section is made unifying the ArchiFrameElement-objects and the related planks/boards. Each returned table cell has these fields:
|
"dim_camera" | af_request("dim_camera") Available only in dimension line scripts. Gives current projection camera. Returns table having fields:
|
"elem_automodules" | af_request("elem_automodules ", tblSettings) Groups opening related framing parts with CNC-Module ID. Without any settings each opening gets own ID and IDs start from A. Parameter tblSettings can be nil and if not, it may contain these fields:
|
"xmltoelem" | af_request("xmltoelem", elemGuid, strXml) Applies the settings in the strXml into the given element. Parameter elemGuid may be nil to use object opened by the previous ac_objectopen()-call. Return value: false=no changes, true=target was changed (and set internally to need saving or if non-plank from internal buffer, it is saved automatically before returning) |
"xl_init" | Initializes connection to Excel writer libXL. |
When processing elements, there are these additional requests available:
Value | Description |
"elemcorethickness" | Returns the element core thickness. |
“elem_getpolyscount” | Returns number of polygons making up the element. Currently always 1. |
“elem_getpoly” | af_request ("elem_getpoly ", polyNum). polyNum is currently unused and should be 1. Creates Lua globals that are available at initial create planks phase. Please see Lua-scripts with elements. |
“elem_getinfo” | Returns table containing information about current element. Table fields are:
|
“elem_createplanks” | Issue when script has set up information for new planks. Please see Lua-scripts with elements. |
“elem_getstudmat” | Gives ID of random (actually first one sorted by plank’s GUID) vertical plank in the element. If no planks yet, gives ID of first material definition of the element. |
“elem_marknoplanks” | af_request ("elem_marknoplanks", x1, y1, x2, y2, nDelExisting), marks give rectangle in the element not to get any planks from spacing rules.
|
"elem_quantities" | af_request ("elem_quantities", strElemGuid, nOpenLayers [, tblSettings] ) Gives quantities for single element or layered element. Parameters:
Returns table containing information for separate layers and total quantities.
Fields for single element:
The quantity fields for single element or combined for multilayer element as calculated in weight tools:
The geometry information from geo-table:
|
“elem_domarkings” | af_request ("elem_domarkings", strXml). Like the xml-definition, may refer to settings inside <presettings>-tag: |
25.2.1.1 Element layers
af_request ("elem_openparent", guidElem).
GuidElem can be nil to get current element.
Resulting table contains fields:
Field | Description |
id | ID of element type from ArchiFrameElements.xml:
|
guid | Guid of the core layer/single layer element object. |
ptr | Another temporary ID for the master element. |
thickness | Total thickness of the layered elements including any empty space between elements. |
tblelems | Table of individual elements. |
Tblelems is indexed by 1-based index in the same order as defined in ArchiFrameElements.xml. The table contains these fields:
Field | Description |
id | ID of the referenced element or same as parent element if single layer element:
|
type | Type of the element layer (core for single layer elements): <layer ref="WALL 42x42 VERT" … type="intstud">. |
guid | Guid of the element object. |
ptr | Another temporary ID for the layer element. |
zoff | Offset in watching direction to first surface. |
xsize | Maximum width of the element. Lower left corner has always coordinates 0, 0. For walls this is the element length in floor plan. |
ysize | Maximum height of the element. For walls this is the height. |
thickness | Layer’s thickness, logically zsize. |
x1off | Offset from core layer’s left-hand side: positive extends over core. |
x2off | Offset from core layer’s right-hand side: positive extends over core. |
y1off | Offset from core layer’s lower side: positive extends over core. |
y2off | Offset from core layer’s upper side: positive extends over core. |
af_request (“elem_closeparent”, nSave).
Closes the current multilayer element.
Parameter | Description |
nSave | 1 = Save changes, with any other value all changes are discarded. |
af_request ("elem_openlayer", guidElem), af_request ("elem_closelayer").
Opens the given layer to edit planks and element polygon shape. Close does not save the changes, it just clears internal information. The changes are finally saved with elem_closeparent.
af_request (“elem_moveside”, nCorner, offset).
Moves side of an element layer.
Parameter | Description |
nCorner | 1 = left, 2 = right, 3 = bottom, 4 = top. |
offset | Positive extends, negative makes smaller. |
25.2.1.2 Element relations
af_request (“elem_getrelations”, guidElem [, xtolerance}).
Gets the relations for single element layer. GuidElem can be nil to process current element layer.
Parameter | Description |
GuidElem | Element layer, nil = use current layer. |
xtolerance | How far from the intersection the element’s end may be, default = 1 mm. Use if core is shortened over that in the corner type. |
Returns 1-based table of relations. Each relation items which are tables also have following fields:
Field | Description |
guidother | Guid of the related element layer object. |
typeother | Type of the related element layer: <layer ref="WALL 42x42 VERT" … type="intstud">. |
reltype | Numeric value:
|
x1,x2 | Intersection coordinates minimum and maximum values in X-axis. Can be outside the element area, negative before left hand side, bigger than length right from right hand side. |
x1off,x2off | Maximum distance from min/max point to the intersection of other plank |
angledeg | Angle in degrees between current element’s X-axis and other’s X-axis (which direction may have been swapped). Positive = on the left hand side, negative = on the right hand side. |
25.2.1.3 Element lintels
af_request (“elem_lintels”, settings) or af_request (“lintels”, settings).
Creates lintels according to passed setting table. Single lintel settings item contains these fields:
Field | Description |
minwidth | Minimum width of the opening to use these rules. Place definition for longest first and continue with shorter ones. |
mat | Material ID for the lintel beam. |
thickness, height | If material ID is generic without fixed size, these must be given. |
matstud | If given and non-empty, the material ID for additional studs. Original is moved further from the opening. |
front | Number of lintel beams to front side of the element, 0 = none. |
back | Number of lintel beams to back side of the element, 0 = none. |
delorg | 0 = keep source plank and place beams above it. |
beamvertical | 0 = if beam material’s thickness is bigger than its height, place as original piece 1 = beam always has global rotation of zero having its bottom downwards. |
extorg | 0: 1: |
totop | 0 = place lintel just above the opening (default). 1 = place the lintel below top sill. |
cutabove | 0 = extend studs above the lintel beam to bottom of the beam and create grooves, 1 = cut studs above lintel beams. |
studs | Number of additional studs, 0 = just create grooves to existing studs. |
extbeamtosides | 0 = Beams end to inner side of the furthest studs (king studs), default 1 = Extend beam to the outer side of the king stud |
joinbeamsdist | Joins newly created lintel beams closer or equal to the given value: The unit for the value is meters and value -1 or smaller will skip applying this rule. |
xmlbeam | Settings for the new beams (studs will have same settings as original ones), for example (also setting the projection pieces’ settings): gsXmlBeam="<s><elemparam name=\"material\">Paint-06</elemparam>" .. "<newelemprojside><objparam name=\"iFill\">25 %</objparam><objparam name=\"iFillPen\">20</objparam></newelemprojside>" .. "<newelemprojtop><objparam name=\"iFill\">25 %</objparam><objparam name=\"iFillPen\">20</objparam></newelemprojtop>" .. "</s>" |
Starting point:
These settings:
The result:
25.3 Lua-scripts with planks
ArchiFrame has a mechanism that allows the user to write custom code to edit any new or edited plank. There are two possible places:
- 1.
Before the plank is saved to Archicad in its cleanup operation. Then the plank does not have properties and categories since it does not have yet a guid if it is a new one. The called function has fixed name of OnPostClean. Use this always if you don’t need properties and categories since this has basically no impact to the performance.
- 2.
After the plank is saved to Archicad having all properties and categories set from xml. The called function has fixed name of OnPostSave. Useful if you need to work on the properties and categories.
The functions are under tag <observer> in ArchiFrameBlocks(Changes).xml. ArchiFrame will scan for tag names observer, observer1, observer2 etc. up to observer9 adding the contect of the new tags to the end of existing script. Please see examples in ArchiFrameBlocks.xml. The default implementation of the OnPostClean generates automatic reinforcements for I-shaped beams and sets some calculation parameters.
OnPostSave is called always if the plank or board is changed by the user or internally by ArchiFrame for 3D and projection parts. OnPostClean is called only for the 3D planks if there is a change in its geometry. Then for caching for example property GUIDs, it is possible to define function OnPostInit() that will be called once at the beginning of an undo session.
This mechanism allows setting properties automatically according to the plank’s parameters, for example it is possible to copy the plank length from object’s parameter iLen to a property like this:
gfnOrgPostClean = OnPostClean -- Save original function
gsGuidPropMemberNumber = nil -- To speed up things: Save the guid to be able to quickly check if it exists & set it
function OnPostInit()
gsGuidPropMemberNumber = nil -- Called once per active operation environment
end
-- Called just after the plank is saved to AC for master AND projection planks because master plank is saved after projections are updated (before calling this function).
-- And anyway AC-properties for master plank are updated only after saving the part to AC.
-- nCode 1=new plank, 2=edit old
-- Return value: 0=no change, 1=changed - save again
function OnPostSave( sGuid, nCode )
local res, s
res, s=pcall(OpenObj, sGuid) -- Silent fail
if not res then
return 0
end
local info, currLen, xmlTot
res = 0
xmlTot = ""
info = af_request("plankinfo")
if not info then
ac_objectclose()
return res
end
if info.type == 1 then
-- It is a plank
res = 0
currLen = ac_objectget("iLen")
if currLen then
-- It is a plank having the needed parameter
xmlTot = xmlTot .. string.format('<prop group="IW COMMON PROPERTIES" name="Lumber Length" value="%s"/>', string.format("%0.8f", currLen))
end
end
if xmlTot ~= "" then
xmlTot = "<t>" .. xmlTot .. "</t>"
if af_request("xmltoelem", sGuid, xmlTot) then
-- Nope - we do not set any parameters, return zero: res = 1
end
end
ac_objectclose()
return res -- Changed or not (caller will detect if changes in properties - no need to return that from here)
end25.4 Lua-scripts with elements
It is possible to create planks to the element with script instead of xml-definitions. The script gets information about element contour lines including openings. Contour line is always counterclockwise for both main contour and openings. For the main contour the left-hand side is towards the element and for openings, the right-hand side.
Lua globals set by ArchiFrame when handling elements:
Name | Description |
gGuidElem | Element object’s GUID to be used for ac_objectopen. Core layer or the owning layer for options scripts. |
gGuidElemStamp | Set if handling element stamp, nil = unknown. |
gElemIdStamp | The element ID to put into stamp: <elemtype class = "wall" id = "WALL 100 C/C 600" idstamp="50x100">. |
gAdjustElems | For options and corner scripts: Set to true if processing setting palette, nil if creating element planks. |
Edges are in Lua global gtblEdges and one line contains the following fields:
Field | Description |
index | Index to identify the edge. |
x1,y1,x2,y2 | Edge coordinates in element's coordinate system. Lower left corner is (0, 0). |
gx1,gy1,gz1 | Edge coordinates in global model 3D-coordinates. Missing if there is no plank related to this edge. |
holeindex | 0 = contour line, other = opening number 1…N. |
used | Is there a plank for this place from earlier <planks>-definitions:
|
tblPlankNums | Indexes to the planks created to this edge in creation order, nil = no planks yet. For historical reasons this contains just single plank having the longest common part with the polygon edge. |
tblPlankNumsAll | Unlike previous, this has all planks intersecting with the polygon edge. Sorted in the edge’s direction. Please note that the plank may be listed in multiple gtblEdges-items if the plank extends over many edges. |
Planks to be created are placed into table gtblCreate which has fields:
Field | Description |
group | Group name for <operations>-section. |
id | Material id. |
thickness | Material size if not fixed by material id. |
height | Material size if not fixed by material id. |
zoff | As in xml-definitions. |
z1, z2 | Additional z-offset added to zoff to the begin and the end. |
rotangle | As in xml-definitions. |
x1,y1,x2,y2 | Plank's reference line on element's surface. |
lineside | Defines reference line alignment: -1 = left, 0 = middle (default), 1= right. This does not work always – if not, the rotangle +90/-90 should be used instead. |
fixlen | If given, sets fixed length to the plank. |
guidsettings | If given, the plank settings like pens, fills etc. are taken from this existing plank. |
copyops | Related to guidsettings: If value = 1 all existing linked machinings (operations) like automatically updating grooves are copied from plank pointed by guidsettings. |
xmlsettings | Settings as XML-settings for an Archicad element. |
xmlsettingsproj | Settings to be applied to the related projection planks. Under the root tag there may be settings with these tag names:
|
mayturn | If given and set to true, ArchiFrame may turn the plank to be best in the element elevation. |
postlua | Lua-script inside <tag> to be run after the plank has been actually created internally. May refer to base script with attribute ref = “name”. |
extendtoelem | Possible values (bit mask so you can combine the options):
|
force | Controls overlapping pieces, possible values:
Additional modifier to be added to the force-value:
|
Number of existing planks is in global gnPlanks. New planks are appended according to table gtblCreate. Script may define operations for the planks by creating global variable gxmlOperations. Its format is like section Operations between the planks <operations>. For the script planks it is possible to refer to those using index number instead of group name, using format #number (for example target = "#1"). Many numbers may be used by separating numbers with comma, for example target = “#1, 2, 3, 4”. For example adjusting to successive planks together:
-- Adjust these two together
strXmlOp = string.format(
"%s" ..
"<joinends target=\"#%d\" operator=\"#%d\">\n" ..
" <joinends conntype=\"endtoend\" jointgap=\"0\"></joinends>\n" ..
"</joinends>\n",
strXmlOp, gnPlanks+i, gnPlanks+i+1)Please see also ac_getobjparam.
ArchiFrame provides these additional functions to this task:
Function | Description |
af_hasedgex ( edge, vecx, vecy ) | Checks whether an infinite area starting from given edge to given direction, intersects with any other edge. This is used to detect for example top side of the element (vex = 0 and vecy = 1, upwards). Returns. True = intersection found, false = no intersection. |
In addition to creating new planks, it is possible to edit planks defined earlier. To do so, ac_objectopen() is called with string format #index, where index is 1-based index to the plank. In dimension line scripts adding exclamation mark after dash will return the related 3D-piece instead of projection piece (#!%d). For example:
<!-- Sets different pen for studs -->
<script id="setcolours">
<![CDATA[
gnPlankCount=0
gtblCreate = {}
for i=1,gnPlanks do
ac_objectopen(string.format("#%d",i))
-- Vertical (studs) with different pen
x2=ac_objectget("iEndX")
y2=ac_objectget("iEndY")
if x2*x2+y2*y2<0.001 then
ac_objectset("#pen", 3)
end
ac_objectclose()
end
]]>
</script>25.4.1 Script to set planks’ or boards’ IDs inside an element, <renumscript>, <renumscriptnew>
<renumscriptnew> was added for backwards compatibility. It works just as <renumscript> except when using it ArchiFrame allows having an empty definition for the script to be used with element templates.
It is possible to set prefix and postfix to the ID based for example on plank’s role in the element. To do that, the recommended way is to include following line to the element definition xml under xml-tag <layer> after all <planks>-definitions or for boards the xml-path is layers/boarding/renumscript (please search for text renum from the default data/ArchiFrameElements.xml):
<renumscript ref="kwrenum"></renumscript>
This refers to a script in xml-path archiframe/elem/settings/scripts:
<script id="kwrenum">
<![CDATA[
-- Loaded once per element, called for each plank current plank opened already
-- Returns table having optional fields:
-- idpre To be added before ID, if starting with !, will not be visible
-- idpost To be added after ID, if starting with !, will not be visible
function GetPlankRenumData(guidElem)
local s, t
t={}
s=ac_objectget("iElemGroup")
if s=="vertical_y" then -- vertical_y_openingdouble for double opening pieces
t.idpost="!A"
end
return t
end
]]>
</script>
This example script sets the text “!A” to be appeneded after the plank ID. Exclamation mark ! means that the text is actually not appended – it just makes sure that planks classified as opening studs will get their own ID.
Another prefix is #num that tells ArchiFrame that this plank group should be numbered starting from the given number.
Third prefix is equation mark = which will cause the plank’s ID to be set exactly as given omitting the starting =.
For example, a plank renum script:
<script id="renum_by_role">
<![CDATA[
-- Loaded once per element, called for each plank current plank opened already
-- Returns table having optional fields:
-- idpre To be added before ID
-- idpost To be added after ID
-- For both, the special characters:
-- !, will not be visible
-- #num, useful for idpre - will define the starting number for the planks (not visible either)
function GetPlankRenumData(guidElem)
local s, t, res
t={}
s=ac_objectget("iElemGroup")
res="#1"
if string.match(s, "^vertical_x.*") then
res="#200"
elseif string.match(s, "^lintel.*") then
res="#250"
elseif string.match(s, "^bottom_force.*") or string.match(s, "^2ndbottom_force.*") then
res="#300"
elseif string.match(s, "^top_force.*") or string.match(s, "^2ndtop_force.*") then
res="#400"
elseif string.match(s, "^nogging.*") then
res="#500"
end
t.idpre=res
return t
end
]]>
And a board renum script:
<script id="renum_board_example">
<![CDATA[
-- Loaded once per element, called for each board current board opened already
-- Returns table having optional fields:
-- idpre To be added before ID
-- idpost To be added after ID
-- For both, the special characters:
-- !, will not be visible
-- #num, useful for idpre - will define the starting number for the planks (not visible either)
-- =, as the first character will set the idpre as it is to the target
function GetPlankRenumData(guidElem)
local dx, dy, t, res
t={}
dx=ac_objectget("iCurrWidth")
dy=ac_objectget("iCurrHeight")
res=""
if math.abs(dx-1.2)<0.0001 and dy>2 then
local s
-- Make ID: (owning element ID)#FULL
s = ac_getobjparam(gGuidElem, "#id")
res="=" .. s .. "#FULL"
end
t.idpre = res
return t
end
]]>
</script>
25.4.2 The corner script callback functions
If called from corner tool palette, Lua global gAdjustElems is set to true. Also these globals are present:
- •
gbCornerFindOther, UI value for check box Find connecting corner.
- •
gbCornerAdjustOther, UI value for check box Adjust connecting corner.
Set (sSettings, guidParent, nCorner).
Called to set single corner for given parent element. There are two cases when this function is called:
- •
When new element is created and corner types are already set.
- •
When corner type is changed from another type or from default using corner tool palette.
Parameter | Description |
sSettings | Previous settings string, “” = default settings. |
guidParent | Guid of the master element, use af_request (“elem_getparent”, guidParent) to process. |
nCorner | 1 = left, 2 = right, 3 = bottom, 4 = top. |
OnPlanksCreated (sSettings, guidElem, layerType, nCorner).
Called when planks for element outline and openings are placed but before (stud) spacing rules are applied. This script places the planks specific to the corner type.
Parameter | Description |
sSettings | Previous settings string, “”= default settings. |
guidElem | Current element’s guid. |
layerType | Type of the related element layer: <layer ref = "WALL 42x42 VERT" … type="intstud">. |
nCorner | Corner to handle 1 = left, 2 = right. |
25.4.3 Lua scripts with element options
Element options have fixed function names:
Function | Description |
Has() | Called by ArchiFrame to find out if the option is set for options UI. Return: -1 = Not known/no planks, 0 = nope, 1 = has. |
Settings(sSettings) | Called by ArchiFrame when user clicks Settings-button in UI. Return: nil = canceled, "" = clear settings/use defaults, str = settings str. |
Set(sSettings) | Called to set the option on either from options UI (gAdjustElems == true) or when creating element planks. |
Reset() | Called to cancel the option from options UI. |
GetName(sSettings, baseName) | Called to make special name for the options, for example, when user has set the settings to non-default. BaseName is string of the option name, add it to the front of the result string. Return: string to show in UI. |
25.4.4 Lua script to adjust generated saw cuts
ArchiFrame searches for fixed file name ArchiFrameSawCuts.lua from user specific settings folder when creating the saw cuts for selection:
If the script exists, it is loaded and this function is called:
-- tblLines is a table having auto-created saw lines for each polygon list edge following standard polygon rules: contour line ccw, holes cw
-- projWorld is geometry world of the owing ArchiFrameElement
-- guidElem Owner ArchiFrameElement
-- polyList Polygon list of the parts that saw cuts are created to, can be passed ac_geo("linepolyx",...)
-- Return value: either tblLines as passed here or it adjusted
function AdjustSawLines(tblLines, projWorld, guidElem, polyList)
Each item in tblLines has fields:
Field | Description |
x1, y1 | The starting point of the saw cut |
x2, y2 | The ending point of the saw cut |
depth | The depth of the saw cut (0=default) |
edgetype | The edge’s door/window type, please see the edge types from here. |
tooltype | 1=saw blade, 2=router |
overbeg | Boolean: is there overcut at begin |
overend | Boolean: is there overcut at end |
angledeg | The saw cut angle in degrees |
skip | Boolean: Script can set this item to skip this saw cut |
toleft | Boolean: Is the saw cut on the left side of the line (default=false) |
groupid | String: If saw cuts should be grouped in cnc-output, ""=no grouping |
groupnum | Number: Sequence number inside the group (must be unique if group is used) |
polyind | Polygon index in case of split surface (input only for the Lua-script) |
contourind | 0=outline, >0=hole index in current polygon (input only for the Lua-script) |
25.5 Other Lua extensions
Http-requests interface.
Res = curl_httpget ("http://www.google.com").
Makes http-get request. Returns server reply or causes an error if failed.