This page lists all available Lua API functions grouped by category.
Description: Adds a new catalogue to the catalogue with the given address.
Returns: Returns: (string) New catalogue's address. (String)
Parameters:
Description: Lists all the loaded catalogues in memory.
Parameters: None
Description: Sets product types to a catalogue with a given address.
Returns: Parameters: typeTag1 to typeTag10: (string) Type tags (maximum 10 types, optional). (Void)
Parameters:
Description: Creates a new product using an existing element and adds it to the given catalogue address.
Returns: Returns: (string) New product's address. (String)
Parameters:
Description: Creates a new product using an existing element and adds it to the given catalogue address. (Duplicate of ProductCreateFromElement)
Returns: Returns: (string) New product's address. (String)
Parameters:
Description: Saves a catalogue with a given address into the CAT folder of the application local folder.
Parameters:
Description: Creates a new element using a product with a given address.
Returns: Returns: (table) New element's details. (Table)
Parameters:
Description: Clears all the loaded catalogues.
Parameters: None
Description: Activates a product with a given address.
Parameters:
Description: Returns a table containing information about children of a catalogue object.
Returns: Returns: (table) Table containing information about children. (Table)
Parameters:
Description: Retrieves the number of products.
Parameters:
Description: Creates a new element from a catalog.
Parameters:
Description: Clears and refills database with default catalogs. All modifications to the database will be lost!!!
Returns: This function does not return a value. (Void)
Parameters: None
Description: Clears and refills user palette with default values. All modifications to the palette will be lost!!!
Returns: This function does not return a value. (Void)
Parameters: None
Description: Adds a catalogue to the catalogue with given name. Parameters: Catalogue name. Catalogue's ID in DB
Returns: This function does not return a value. (Void)
Parameters:
Description: Removes all products with given types from database. Parameters: Products type tags (maximum 10 types)
Returns: This function does not return a value. (Void)
Parameters:
Description: Adds a shape to a dynamic element and returns the shape index.
Returns: Index of the added shape (Int)
Parameters:
Example:
--[[ Adds a shape to a dynamic element. Parameters: Element tag, shape type ('Sphere', 'Box', 'Cylinder', 'Torus', 'SlicedTorus', 'Spheroid'). Returns: An index to the shape. Example: Add a sphere to a dynamic element. --]] InputAddPoint(2, -2, 3) for tag in CreateElement('DYNAMIC') do local shapeIndex = DynamicElementAddShape(tag, 'Sphere') SetShapeParameters(tag, shapeIndex, 0.5) end
Description: Sets shape coordinates for a dynamic element.
Parameters:
Example:
--[[ Sets the coordinates and orientation of a shape within a dynamic element. Parameters: Element tag, shape index, x, y, z coordinates, and orientation parameters. Example: Set the position of a sphere. --]] for tag in CreateElement('DYNAMIC') do local shapeIndex = DynamicElementAddShape(tag, 'Sphere') SetShapeCoordinates(tag, shapeIndex, 0, 0, 0, 1, 0, 0, 0, 1, 0) end
Description: Sets shape parameters for a dynamic element.
Parameters:
Example:
--[[ Sets the parameters of a shape. Parameters: Element tag, shape index, and shape-specific parameters. Shape-specific parameters: - Box: length, width, height - Cylinder: diameter, height - Sphere: diameter - Spheroid: length, width, height Example: Set the radius of a sphere. --]] for tag in CreateElement('DYNAMIC') do DynamicElementRemoveAllShapes(tag); local shapeIndex = DynamicElementAddShape(tag, 'Sphere') SetShapeParameters(tag, shapeIndex, 0.5) end
Description: Sets shape color for a dynamic element.
Parameters:
Example:
--[[ Sets the color of a shape. Parameters: Element tag, shape index, and RGBA color values (0-255). Example: Set the color of a shape to red. --]] for tag in CreateElement('DYNAMIC') do local shapeIndex = DynamicElementAddShape(tag, 'Sphere') SetShapeColor(tag, shapeIndex, 255, 0, 0, 255) end
Description: Sets shape name for a dynamic element.
Parameters:
Example:
--[[ Example for SetShapeName ]] --[[ Sets the name of the first shape of a dynamic element to "MyShape". ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); DynamicElementRemoveAllShapes(tag); local HIndex = DynamicElementAddShape(tag,'Sphere'); SetShapeName(tag, HIndex, "MyShape") end
Description: Sets shape physics for a dynamic element.
Parameters:
Example:
--[[ Example for SetShapePhysics ]] --[[ Sets the physics properties of a shape of a dynamic element. ]] --[[ Parameters: element tag, shape index, mass, linearDamping, angularDamping, friction, rollingFriction, restitution, collisionLayer. ]] --[[ - element_tag: The tag of the dynamic element. ]] --[[ - shapeIndex: The index of the shape to modify. ]] --[[ - mass: The mass of the shape. ]] --[[ - linearDamping: Damping force opposing linear motion. ]] --[[ - angularDamping: Damping force opposing rotational motion. ]] --[[ - friction: Friction coefficient. ]] --[[ - rollingFriction: Friction opposing rolling motion. ]] --[[ - restitution: Coefficient of restitution (bounciness). ]] --[[ - collisionLayer: The collision layer the shape belongs to. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); DynamicElementRemoveAllShapes(tag); local HIndex = DynamicElementAddShape(tag,'Sphere'); SetShapeParameters(tag, HIndex, 0.5) SetShapePhysics(tag, HIndex, 2, 0.5, 0.5, 0.5, 0.5, 0.5, 1) end
Description: List of shapes and parameters for dynamic elements.
Returns: Table containing shapes and their parameters (Table)
Parameters: None
Example:
--[[ Lists available shapes and their parameters for custom elements. Example: List shape parameters. --]] ListShapeParameters()
Description: Removes all shapes from a dynamic element.
Parameters:
Example:
--[[ Removes all shapes from a dynamic element. Parameter: Dynamic element tag. Example: Remove all shapes from a dynamic element before adding new ones. --]] for tag in CreateElement('DYNAMIC') do DynamicElementRemoveAllShapes(tag) end
Description: Adds a constraint to a dynamic element.
Returns: Index of the added constraint (Int)
Parameters:
Example:
--[[ Example for DynamicElementAddConstraint ]] --[[ Adds a constraint between two shapes of a dynamic element. ]] --[[ Parameters: element_tag, constraintType, shape1Index, shape2Index (optional, -1 if not needed). ]] --[[ - element_tag: The tag of the dynamic element. ]] --[[ - constraintType: The type of constraint ("Point", "Hinge", "Slider", or "ConeTwist"). ]] --[[ - shape1Index: The index of the first shape involved in the constraint. ]] --[[ - shape2Index: The index of the second shape involved in the constraint. Defaults to -1 if not applicable. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Sphere'); SetShapeParameters(tag, NIndex, 0.5) SetShapePhysics(tag, NIndex, 2, 0.5, 0.5, 0.5, 0.5, 0.5, 1) local HIndex = DynamicElementAddShape(tag,'Sphere'); SetShapeParameters(tag, HIndex, 0.7) SetShapePhysics(tag, HIndex, 2, 0.5, 0.5, 0.5, 0.5, 0.5, 1) local HConstIndex = DynamicElementAddConstraint(tag, "Point", HIndex, NIndex); SetConstraintPosition(tag, HConstIndex, HIndex, -0.7, 0, 0) SetConstraintPosition(tag, HConstIndex, NIndex, 0.5, 0, 0) end
Description: Sets constraint position for a dynamic element.
Parameters:
Example:
--[[ Example for SetConstraintPosition ]] --[[ Sets the position of a constraint for a dynamic element. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Sphere'); SetShapeParameters(tag, NIndex, 0.5) SetShapePhysics(tag, NIndex, 2, 0.5, 0.5, 0.5, 0.5, 0.5, 1) local HIndex = DynamicElementAddShape(tag,'Box'); SetShapeParameters(tag, HIndex, 0.7, 0.6,0.2) SetShapePhysics(tag, HIndex, 2, 0.5, 0.5, 0.5, 0.5, 0.5, 1) local HConstIndex = DynamicElementAddConstraint(tag, "Point", HIndex, NIndex); SetConstraintPosition(tag, HConstIndex, HIndex, -0.51, 0, 0) SetConstraintPosition(tag, HConstIndex, NIndex, 0.51, 0, 0) end
Description: Sets constraint axis for a dynamic element.
Parameters:
Example:
--[[ Example for SetConstraintAxis ]] --[[ Sets the axis of a hinge constraint for a dynamic element. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); SetPosition(tag,0,0,0); SetProperty(tag,'ANGLE',0); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Cylinder'); SetShapeCoordinates(tag,NIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,NIndex,0.7, 1.2) SetShapeColor(tag,NIndex, 255,150,220,200) SetShapeName(tag,NIndex,'Fix') SetShapePhysics(tag,NIndex,100,0.5,0.5,0.5,0.5,0.5,1) local HIndex = DynamicElementAddShape(tag,'Box'); SetShapeCoordinates(tag,HIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,HIndex,0.05,2,0.7) SetShapeColor(tag,HIndex, 255,255,200,136) SetShapeName(tag,HIndex,'Door 1') SetShapePhysics(tag,HIndex,0.1,0.1,0.1,0.1,0.1,0.5,1) local HConstIndex = DynamicElementAddConstraint(tag,"Hinge", HIndex,NIndex); SetConstraintAxis(tag, HConstIndex, HIndex, 0,0,1); SetConstraintAxis(tag, HConstIndex, NIndex, 0,0,1); SetConstraintPosition(tag, HConstIndex, NIndex, 0,0,0); SetConstraintPosition(tag, HConstIndex, HIndex, 0,0.7,0.1); SetConstraintCollision(tag, HConstIndex, false) end
Description: Enables or disables collision in a constraint for a dynamic element.
Parameters:
Example:
--[[ Example for SetConstraintCollision ]] --[[ Disables collision for a constraint in a dynamic element. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); SetPosition(tag,0,0,0); SetProperty(tag,'ANGLE',0); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Cylinder'); SetShapeCoordinates(tag,NIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,NIndex,0.7, 1.2) SetShapeColor(tag,NIndex, 255,150,220,200) SetShapeName(tag,NIndex,'Fix') SetShapePhysics(tag,NIndex,100,0.5,0.5,0.5,0.5,0.5,0.5,1) local HIndex = DynamicElementAddShape(tag,'Box'); SetShapeCoordinates(tag,HIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,HIndex,0.05,2,0.7) SetShapeColor(tag,HIndex, 255,255,200,136) SetShapeName(tag,HIndex,'Door 1') SetShapePhysics(tag,HIndex,0.1,0.1,0.1,0.1,0.1,0.1,0.5,1) local HConstIndex = DynamicElementAddConstraint(tag,"Hinge", HIndex,NIndex); SetConstraintAxis(tag, HConstIndex, HIndex, 0,0,1); SetConstraintAxis(tag, HConstIndex, NIndex, 0,0,1); SetConstraintPosition(tag, HConstIndex, NIndex, 0,0,0); SetConstraintPosition(tag, HConstIndex, HIndex, 0,0.7,0.1); SetConstraintCollision(tag, HConstIndex, false) end
Description: Sets minimum and maximum angle limits for a hinge constraint.
Parameters:
Example:
--[[ Example for SetHingeConstraintAngleLimit ]] --[[ Sets the angle limits for a hinge constraint in a dynamic element. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); SetPosition(tag,0,0,0); SetProperty(tag,'ANGLE',0); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Cylinder'); SetShapeCoordinates(tag,NIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,NIndex,0.7, 1.2) SetShapeColor(tag,NIndex, 255,150,220,200) SetShapeName(tag,NIndex,'Fix') SetShapePhysics(tag,NIndex,100,0.5,0.5,0.5,0.5,0.5,0.5,1) local HIndex = DynamicElementAddShape(tag,'Box'); SetShapeCoordinates(tag,HIndex, 0,0,1.1,1,0,0,0,1,0) SetShapeParameters(tag,HIndex,0.05,2,0.7) SetShapeColor(tag,HIndex, 255,255,200,136) SetShapeName(tag,HIndex,'Door 1') SetShapePhysics(tag,HIndex,0.1,0.1,0.1,0.1,0.1,0.1,0.5,1) local HConstIndex = DynamicElementAddConstraint(tag,"Hinge", HIndex,NIndex); SetConstraintAxis(tag, HConstIndex, HIndex, 0,0,1); SetConstraintAxis(tag, HConstIndex, NIndex, 0,0,1); SetConstraintPosition(tag, HConstIndex, NIndex, 0,0,0); SetConstraintPosition(tag, HConstIndex, HIndex, 0,0.7,0.1); SetConstraintCollision(tag, HConstIndex, false) SetHingeConstraintAngleLimit(tag, HConstIndex, 20, 160); end
Description: Sets constraint name for a dynamic element.
Parameters:
Example:
--[[ Example for SetConstraintName ]] --[[ Sets the name of a constraint for a dynamic element. ]] CreateNewImperialProject() InputClear() InputAddPoint(2,1,0) for tag in CreateElement('DYNAMIC') do print(tag); SetPosition(tag,0,0,0); SetProperty(tag,'ANGLE',0); DynamicElementRemoveAllShapes(tag); local NIndex = DynamicElementAddShape(tag,'Cylinder'); SetShapeCoordinates(tag,NIndex, 0,0,1,1,0,0,0,1,0) SetShapeParameters(tag,NIndex,0.7, 1.2) SetShapeColor(tag,NIndex, 255,150,220,200) SetShapeName(tag,NIndex,'Fix') SetShapePhysics(tag,NIndex,100,0.5,0.5,0.5,0.5,0.5,0.5,1) local HIndex = DynamicElementAddShape(tag,'Box'); SetShapeCoordinates(tag,HIndex, 0,0,1,1,0,0,0,1,0) SetShapeParameters(tag,HIndex,0.05,2,0.7) SetShapeColor(tag,HIndex, 255,255,200,136) SetShapeName(tag,HIndex,'Door 1') SetShapePhysics(tag,HIndex,0.1,0.1,0.1,0.1,0.1,0.1,0.5,1) local HConstIndex = DynamicElementAddConstraint(tag,"Hinge", HIndex,NIndex); SetConstraintAxis(tag, HConstIndex, HIndex, 0,0,1); SetConstraintAxis(tag, HConstIndex, NIndex, 0,0,1); SetConstraintPosition(tag, HConstIndex, NIndex, 0,0,0); SetConstraintPosition(tag, HConstIndex, HIndex, 0,0.7,0.1); SetConstraintCollision(tag, HConstIndex, false) SetHingeConstraintAngleLimit(tag, HConstIndex, 20, 160); SetConstraintName(tag, HConstIndex, "Door 1 constraint"); end
Description: Sets body parameters for a vehicle.
Parameters:
Example:
--[[ Example for SetBodyParameters (Vehicle) ]] --[[ Sets the body parameters of a vehicle. ]] --[[ Parameters: element_tag, Par1, Par2 (optional, default 1), Par3 (optional, default 1). ]] --[[ The meaning of Par1, Par2, and Par3 depends on the vehicle's shape: ]] --[[ - If the vehicle's shape is a Box: Par1 = length, Par2 = width, Par3 = height. ]] --[[ - If the vehicle's shape is a Cylinder: Par1 = diameter, Par2 = height. Par3 is not used. ]] --[[ - If the vehicle's shape is a Sphere: Par1 = diameter. Par2 and Par3 are not used. ]] --[[ - If the vehicle's shape is a Spheroid: Par1 = length, Par2 = width, Par3 = height. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetBodyShape(tag, "Box") SetBodyParameters(tag, 3, 1.5, 0.1) end
Description: Sets body color for a vehicle.
Parameters:
Example:
--[[ Example for SetBodyColor (Vehicle) ]] --[[ Sets the body color of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetBodyColor(tag, 255, 21, 82, 229) end
Description: Sets body physics for a vehicle.
Parameters:
Example:
--[[ Example for SetBodyPhysics (Vehicle) ]] --[[ Sets the body physics of a vehicle. ]] --[[ Parameters: element_tag, mass, linearDamping, angularDamping, friction, rollingFriction, restitution, collisionLayer. ]] --[[ - element_tag: The tag of the vehicle element. ]] --[[ - mass: The mass of the vehicle's body. ]] --[[ - linearDamping: Damping force opposing the vehicle's linear motion. ]] --[[ - angularDamping: Damping force opposing the vehicle's rotational motion. ]] --[[ - friction: Friction coefficient between the vehicle and the ground. ]] --[[ - rollingFriction: Friction opposing the vehicle's rolling motion. ]] --[[ - restitution: Coefficient of restitution (bounciness) of the vehicle. ]] --[[ - collisionLayer: The collision layer the vehicle's body belongs to. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetBodyPhysics(tag, 10, 0.2, 0.5, 0, 0, 0, 1) end
Description: Sets body shape for a vehicle.
Parameters:
Example:
--[[ Example for SetBodyShape (Vehicle) ]] --[[ Sets the body shape of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetBodyShape(tag, "Box") end
Description: Sets body material for a vehicle.
Parameters:
Example:
--[[ Example for SetBodyMaterial (Vehicle) ]] --[[ Sets the body material of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetBodyMaterial(tag, "Soft") end
Description: Sets wheel parameters for a vehicle.
Parameters:
Example:
--[[ Example for SetWheelParameters (Vehicle) ]] --[[ Sets the wheel parameters of a vehicle. ]] --[[ Parameters: element_tag, wheelParam1, wheelParam2, wheelParam3. ]] --[[ The meaning of the wheel parameters depends on the wheel's shape (inferred from the vehicle's shape): ]] --[[ - If the wheel's shape is a Box: wheelParam1 = length, wheelParam2 = width, wheelParam3 = height. ]] --[[ - If the wheel's shape is a Cylinder: wheelParam1 = diameter, wheelParam2 = height. wheelParam3 is not used. ]] --[[ - If the wheel's shape is a Sphere: wheelParam1 = diameter. wheelParam2 and wheelParam3 are not used. ]] --[[ - If the wheel's shape is a Spheroid: wheelParam1 = length, wheelParam2 = width, wheelParam3 = height. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetWheelParameters(tag, 0.1, 0.1, 0) end
Description: Sets wheel color for a vehicle.
Parameters:
Example:
--[[ Example for SetWheelColor (Vehicle) ]] --[[ Sets the wheel color of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetWheelColor(tag, 255, 0, 0, 120) end
Description: Sets wheel physics for a vehicle.
Parameters:
Example:
--[[ Example for SetWheelPhysics (Vehicle) ]] --[[ Sets the wheel physics of a vehicle. ]] --[[ Parameters: element_tag, mass, linearDamping, angularDamping, friction, rollingFriction, restitution, collisionLayer. ]] --[[ - element_tag: The tag of the vehicle element. ]] --[[ - mass: The mass of the wheel. ]] --[[ - linearDamping: Damping force opposing the wheel's linear motion. ]] --[[ - angularDamping: Damping force opposing the wheel's rotational motion. ]] --[[ - friction: Friction coefficient between the wheel and the ground. ]] --[[ - rollingFriction: Friction opposing the wheel's rolling motion. ]] --[[ - restitution: Coefficient of restitution (bounciness) of the wheel. ]] --[[ - collisionLayer: The collision layer the wheel belongs to. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetWheelPhysics(tag, 1, 0.2, 0.75, 1, 0, 0, 1) end
Description: Sets wheel shape for a vehicle.
Parameters:
Example:
--[[ Example for SetWheelShape (Vehicle) ]] --[[ Sets the wheel shape of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetWheelShape(tag, "Cylinder") end
Description: Sets wheel material for a vehicle.
Parameters:
Example:
--[[ Example for SetWheelMaterial (Vehicle) ]] --[[ Sets the wheel material of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetWheelMaterial(tag, "Stone") end
Description: Sets front light color for a vehicle.
Parameters:
Example:
--[[ Example for SetVehicleFrontLightColor (Vehicle) ]] --[[ Sets the front light color of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetVehicleFrontLightColor(tag, 255, 255, 0) end
Description: Sets rear light color for a vehicle.
Parameters:
Example:
--[[ Example for SetVehicleRearLightColor (Vehicle) ]] --[[ Sets the rear light color of a vehicle. ]] InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VEHICLE') do SetVehicleRearLightColor(tag, 255, 0, 0) end
Description: Returns an element property.
Returns: This function returns the value of the specified property. (Depends)
Parameters:
Example:
--[[ Returns an element property. Parameters: element tag, property tag. Returns: The property value (can be various types). Example: Gets the 'HEIGHT' property of the element with tag 'myElement'. --]] local height = GetProperty('myElement', 'HEIGHT') print(height)
Description: Sets an element property.
Returns: This function sets an element property. (Void)
Parameters:
Example:
--[[ Sets a property of an element. Parameters: Element tag, property name, property value. Example: Sets the HORIZONTAL_DISTANCE_CENTER and VERTICAL_DISTANCE_BOTTOM properties of a window. --]] for tag in CreateElement('WINDOW') do SetProperty(tag, 'HORIZONTAL_DISTANCE_CENTER', 0) SetProperty(tag, 'VERTICAL_DISTANCE_BOTTOM', 1.2) end
Description: Returns a Lua table containing information about all elements in the current project.
Returns: This function returns a Lua table containing information about all elements in the current project. (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing data for all elements. Returns: A list of lists of lists with element data. Example: Gets data for all elements and prints the tag of the first element. --]] local allElements = GetAllElements() if allElements and #allElements > 0 then print(allElements[1][1][1]) --[[ Prints the tag of the first element]] end
Description: Returns a Lua table containing information about all connected links to a node.
Returns: This function returns a Lua table containing information about all connected links to the node. (Table)
Parameters:
Example:
--[[ Returns a Lua table containing data for links connected to an element. Parameter: element tag. Returns: A list of lists of lists with connected link data. Example: Gets the connected links for the element with tag 'myElement'. --]] local connectedLinks = GetConnectedLinks('myElement') if connectedLinks and #connectedLinks > 0 then print(connectedLinks[1][1][1]) end
Description: List of all element tags in the current project with a given type.
Returns: This function returns a Lua iterator for iterating through the elements with the specified type. (Iterator)
Parameters:
Example:
--[[ Returns a list of element tags for a given type. Parameter: element type. Returns: An IEnumerable<string> of element tags. Example: Gets all 'FLOOR' element tags and prints the first tag. --]] local floorTags = GetElementsByType('FLOOR') for tag in floorTags do print(tag) break end
Description: Returns a Lua table containing information about children of an element.
Returns: A Lua table containing information about the children of the element (Table)
Parameters:
Example:
--[[ Returns a Lua table containing information about an element's children. Parameter: element tag. Returns: A list of lists of lists with children information. Example: Gets information about the children of the element with tag 'myElement'. --]] local childrenInfo = GetChildrenInfo('myElement') if childrenInfo and #childrenInfo > 0 then print(childrenInfo[1][1][1]) end
Description: Returns the tag of an element's parent.
Returns: The tag of the element's parent (String)
Parameters:
Example:
--[[ Returns the tag of the parent element. Parameter: element tag. Returns: The parent element's tag (string). Example: Gets the parent tag of the element with tag 'myElement'. --]] local parentTag = GetParentTag('myElement') print(parentTag)
Description: Returns the tag of an element's holder.
Returns: The tag of the element's holder (String)
Parameters:
Example:
--[[ Returns the tag of the holder element. Parameter: element tag. Returns: The holder element's tag (string). Example: Gets the holder tag of the element with tag 'myElement'. --]] local holderTag = GetHolderTag('myElement') print(holderTag)
Description: Checks if an element with the specified tag exists.
Returns: true if the element exists, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element exists. Parameter: element tag. Returns: True if the element exists, false otherwise. Example: Checks if the element with tag 'myElement' exists. --]] local exists = CheckElementExists('myElement') print(exists)
Description: Returns the type tag of an element.
Returns: The type tag of the element (String)
Parameters:
Example:
--[[ Retrieves the type of an element. Parameter: Element tag. Returns: The element type as a string. Example: Get and print the type of an element. --]] InputAddPoint(2, 1, 1) for tag in CreateElement('FIXTURE') do local elementType = GetElementType(tag) print('Element type: '.. elementType) end
Description: Returns an iterator for iterating through all vessel tags in the current project.
Returns: A Lua iterator for iterating through all vessel tags in the current project (Iterator)
Parameters: None
Example:
--[[ Returns a list of vessel tags. Returns: An IEnumerable<string> of vessel tags. Example: Gets all vessel tags and prints the first tag. --]] local vesselTags = GetVessels() for tag in vesselTags do print(tag) end
Description: Returns the system tag of an element.
Returns: The system tag of the element (String)
Parameters:
Example:
--[[ Returns the parent system of an element. Parameter: element tag. Returns: The parent system (string). Example: Gets the parent system of the element with tag 'myElement'. --]] local system = GetSystem('myElement') print(system)
Description: Returns the system type of an element.
Returns: The system type of the element (String)
Parameters:
Example:
--[[ Returns the type of the system. Parameter: element tag. Returns: The system type (string). Example: Gets the system type of the element with tag 'myElement'. --]] local systemType = GetSystemType('myElement') print(systemType)
Description: Creates element(s) using input objects and returns created element(s) tags.
Returns: The tag(s) of the created element(s) (Iterator)
Parameters:
Example:
--[[ Creates a new element of a specified type. Parameter: Element type (e.g., 'BUILDING', 'FLOOR', 'RNDCOLUMN', 'WALL', 'WINDOW', 'DYNAMIC'). Example: Create a building element and print it's tag. --]] InputAddPoint(0, 0, 0) for tag in CreateElement('BUILDING') do print(tag) end
Description: Creates element(s) using input objects and returns a lua table containing created elements' tags
Returns: New element's tag. (Table)
Parameters:
Example:
--[[ Creates a new element with additional parameters. Parameters: Element type, options (optional). Returns: A table of the created element tags. Example: Creates a new element of type 'FIXTURE' (which doesn't use options). --]] InputAddPoint(2, 1, 1) local newElementTags = CreateElement2('FIXTURE') for i, tag in ipairs(newElementTags) do print(tag) end
Description: Adds nodes from input objects to a link.
Parameters:
Example:
--[[ Adds a node to an element. Example: Adds a node to the element. --]] AddNodeToElement()
Description: Returns a table containing tags of connected nodes to a link.
Returns: A table containing tags of connected nodes to the link (Table)
Parameters:
Example:
--[[ Returns the tags of the nodes connected to a link. Parameter: Link tag. Returns: A list of node tags. Example: Gets the nodes connected to the link with tag 'myLink'. --]] local nodes = GetLinkNodes('myLink') for i, node in ipairs(nodes) do print(node) end
Description: Returns true if an element exists.
Returns: true if the element exists, false otherwise (Boolean)
Parameters:
Example:
--[[ Example for ElementExists ]] --[[ Returns true if an element exists. Parameter: element tag. ]] --[[ This function works only inside project script ]] InputClear() InputAddPoint(0,0,0) local newElementTags = CreateElement2('STRUCT_NODE') local elementTag = newElementTags[1] if ElementExists(elementTag) then print('Element with tag ' .. elementTag .. ' exists.') else print('Element with tag ' .. elementTag .. ' does not exist.') end
Description: Returns true if an element is a storage tank.
Returns: true if the element is a storage tank, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is a tank. Parameter: Element tag. Returns: True if the element is a tank, false otherwise. Example: Checks if the element with tag 'myElement' is a tank. --]] local isTank = IsTank('myElement') print(isTank)
Description: Returns true if an element is a valve.
Returns: true if the element is a valve, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is a valve. Parameter: Element tag. Returns: True if the element is a valve, false otherwise. Example: Checks if the element with tag 'myElement' is a valve. --]] local isValve = IsValve('myElement') print(isValve)
Description: Returns true if an element is a building column.
Returns: true if the element is a building column, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is a building column. Parameter: Element tag. Returns: True if the element is a building column, false otherwise. Example: Checks if the element with tag 'myElement' is a building column. --]] local isColumn = IsBuildingColumn('myElement') print(isColumn)
Description: Returns true if an element is insulated.
Returns: true if the element is insulated, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is insulated. Parameter: Element tag. Returns: True if the element is insulated, false otherwise. Example: Checks if the element with tag 'myElement' is insulated. --]] local isInsulated = IsInsulated('myElement') print(isInsulated)
Description: Returns the insulation of an element.
Returns: The insulation of the element (String)
Parameters:
Example:
--[[ Gets the insulation tag of an element. Parameter: Element tag. Returns: The insulation element tag (string). Example: Gets the insulation element tag of the element with tag 'myElement'. --]] local insulation = GetInsulation('myElement') print(insulation)
Description: Sets the insulation for an element.
Parameters:
Example:
--[[ Sets the insulation status of an element. Parameter: Element tag, insulation status (boolean). Example: Sets the element with tag 'myElement' to be insulated. --]] SetInsulation('myElement', true)
Description: Sets the fill color of an element.
Parameters:
Example:
--[[ Sets fill Color of an element. Parameters: element tag, alpha (0-255), red (0-255), green (0-255), blue (0-255),(optional) 1 or 2 for elements with 2 colors. Example: Sets the fill color of an element with tag 'myElement' to semi-transparent red. --]] SetFillColor('myElement', 128, 255, 0, 0)
Description: Sets the border color of an element.
Parameters:
Example:
--[[ Sets border Color of an element. Parameters: element tag, alpha (0-255), red (0-255), green (0-255), blue (0-255),(optional) 1 or 2 for elements with 2 colors. Example: Sets the border color of an element with tag 'myElement' to blue. --]] SetBorderColor('myElement', 255, 0, 0, 255)
Description: Refreshes an element.
Parameters:
Example:
--[[ Refreshes an element. Parameter: element tag. Example: Refreshes the element with tag 'myElement'. --]] RefreshElement('myElement')
Description: Checks if an element is attached to other elements.
Returns: true if the element is attached, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is attached. Parameter: element tag. Example: Checks if the element with tag 'myElement' is attached. --]] local attached = IsAttached('myElement') print(attached)
Description: Returns true if a node is on the end side of a linear link.
Returns: true if the node is on the end side of the linear link, false otherwise (Boolean)
Parameters:
Example:
--[[ Returns true if a node is on the end side of a linear link. Parameter: link tag, node tag. Example: Checks if the node with tag 'myNode' is on the end side of the link with tag 'myLink'. --]] local onEnd = GetNodeSide('myLink', 'myNode') print(onEnd)
Description: Returns the tag of the first node of a link.
Returns: The tag of the first node of the link (String)
Parameters:
Example:
--[[ Returns tag of the first node of a link. Parameter: link tag. Example: Gets the tag of the first node of the link with tag 'myLink'. --]] local firstNode = Get1stNode('myLink') print(firstNode)
Description: Returns the tag of the second node of a link.
Returns: The tag of the second node of the link (String)
Parameters:
Example:
--[[ Returns tag of the second node of a link. Parameter: link tag. Example: Gets the tag of the second node of the link with tag 'myLink'. --]] local secondNode = Get2ndNode('myLink') print(secondNode)
Description: Returns the angle between two linear links.
Returns: The angle between the two linear links (in radians) (Number)
Parameters:
Example:
--[[ Returns angle between 2 linear links. Parameters: link1 tag, link2 tag. Example: Gets the angle between the links with tags 'link1' and 'link2'. --]] local angle = GetAngleBetweenLinks('link1', 'link2') print(angle)
Description: Checks if an element is a linear link.
Returns: true if the element is a linear link, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is a linear link. Parameter: element tag. Example: Checks if the element with tag 'myElement' is a linear link. --]] local linear = IsLinearLink('myElement') print(linear)
Description: Checks if an element is a joint for linear links.
Returns: true if the element is a joint, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is a joint for linear links. Parameter: element tag. Example: Checks if the element with tag 'myElement' is a joint. --]] local isJoint = IsJoint('myElement') print(isJoint)
Description: Checks if an element is an appliance.
Returns: true if the element is an appliance, false otherwise (Boolean)
Parameters:
Example:
--[[ Checks if an element is an appliance. Parameter: element tag. Example: Checks if the element with tag 'myElement' is an appliance. --]] local isAppliance = IsAppliance('myElement') print(isAppliance)
Description: Sets the position data for a specified object.
Parameters:
Example:
--[[ Sets an element position. Parameters: element's tag, position x, y, z. Example: Sets the position of the element with tag 'myElement' to (1, 2, 3). --]] SetPosition('myElement', 1, 2, 3)
Description: Gets the direction data for a specified object.
Returns: Returns a Lua table containing direction data with the following fields: x: X-direction of the object, y: Y-direction of the object, z: Z-direction of the object (Table)
Parameters:
Example:
--[[ Returns a Lua table containing appliance's direction vector coordinates. Parameters: element tag. Returns: { A, B, C }. Example: Gets the direction vector of the appliance with tag 'myAppliance'. --]] local direction = GetDirection('myAppliance') print(direction[1], direction[2], direction[3]) --[[ Prints A, B, and C]]
Description: Sets the direction data for a specified object.
Parameters:
Example:
--[[ Sets an appliance direction. Parameters: element's tag, direction vector A, B, C. Example: Sets the direction of the appliance with tag 'myAppliance' to (0, 1, 0). --]] SetDirection('myAppliance', 0, 1, 0)
Description: Adds a node element, such as a pipe fitting, duct fitting, electrical joint, or structural node.
Returns: Returns the tag of the newly created node element. (String)
Parameters:
Example:
--[[ Adds a node of the given type at a specified position. In this example, we add a node of type 'PIPE_FITTING' at coordinates (5, 10, 4). Returns the tag of the created node. --]] local nodeTag = AddNode('PIPE_FITTING', 5, 10, 4, 'Elbow90') print('Created node: ' .. nodeTag)
Description: Adds a link element, such as a pipe, duct, wire, electrical conduit, or structural link.
Returns: Returns the tag of the newly created link element. (String)
Parameters:
Example:
--[[ Adds a link between two existing nodes. In this example, we first create two pipe fitting nodes and then link them with a pipe. Returns the tag of the created link. --]] local node1 = AddNode('PIPE_FITTING', 0, 0, 'Start') local node2 = AddNode('PIPE_FITTING', 10, 0, 'End') local linkTag = AddLink('PIPE', node1, node2, 'MainPipe') print('Created link: ' .. linkTag)
Description: Creates a new rectangular cuboid appliance element of the given type and returns its tag.
Returns: Returns the tag of the newly created appliance element. (String)
Parameters:
Example:
--[[ Example for AddRectangularAppliance ]] local applianceTag = AddRectangularAppliance('FURNITURE', 1.5, 0.7, 0.9, 2.0, 1.0, 0.45, 'CoffeeTable') print('Created appliance tag: ' .. applianceTag);
Description: Creates a new cylindrical appliance of the specified type and returns its element tag.
Returns: Returns the unique element tag of the newly created cylindrical appliance. (String)
Parameters:
Example:
--[[ Example for AddCylindricalAppliance ]] local applianceTag = AddCylindricalAppliance('HVAC_APPLIANCE', 2.0, 0.3, 1.0, 1.0, 0.2, true, 'AirDuct') print('Created appliance tag: ' .. applianceTag);
Description: Creates a new spherical appliance of the specified type and returns its element tag.
Returns: Returns the unique element tag of the newly created spherical appliance. (String)
Parameters:
Example:
--[[ Example for AddSphericalAppliance ]] local applianceTag = AddSphericalAppliance('FURNITURE', 1.0, 3.5, 2.0, 0.6, 'DecorativeGlobe') print('Created appliance tag: ' .. applianceTag);
Description: Attaches an element to a rectangular appliance at a specified side and offset.
Returns: Returns true if the element was successfully attached to the appliance; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Example for AttachToRectangularAppliance ]] -- Creates a table with 4 vertical cylindrical legs using appliance creation and attachment. -- Step 1: Create the tabletop (rectangular furniture appliance) local tabletopTag = AddRectangularAppliance('FURNITURE', 2.0, 1.0, 0.1, 0.0, 0.0, 0.75, 'TableTop') -- Step 2: Create cylindrical fixture legs -- Each leg is 0.75m tall and 0.05m in diameter, positioned vertically local leg1Tag = AddCylindricalAppliance('FIXTURE', 0.75, 0.05, 0.0, 0.0, 0.0, false, 'Leg1') local leg2Tag = AddCylindricalAppliance('FIXTURE', 0.75, 0.05, 0.0, 0.0, 0.0, false, 'Leg2') local leg3Tag = AddCylindricalAppliance('FIXTURE', 0.75, 0.05, 0.0, 0.0, 0.0, false, 'Leg3') local leg4Tag = AddCylindricalAppliance('FIXTURE', 0.75, 0.05, 0.0, 0.0, 0.0, false, 'Leg4') -- Step 3: Attach legs to the bottom of the tabletop at the four corners AttachToRectangularAppliance(leg1Tag, tabletopTag, 'Bottom', -0.9, -0.4) AttachToRectangularAppliance(leg2Tag, tabletopTag, 'Bottom', 0.9, -0.4) AttachToRectangularAppliance(leg3Tag, tabletopTag, 'Bottom', -0.9, 0.4) AttachToRectangularAppliance(leg4Tag, tabletopTag, 'Bottom', 0.9, 0.4) -- Step 4: Set CONNECTION_LENGTH for each leg to half the height (0.375) SetProperty(leg1Tag, 'CONNECTION_LENGTH', 0.375) SetProperty(leg2Tag, 'CONNECTION_LENGTH', 0.375) SetProperty(leg3Tag, 'CONNECTION_LENGTH', 0.375) SetProperty(leg4Tag, 'CONNECTION_LENGTH', 0.375) print('Created a table with 4 cylindrical legs.')
Description: Attaches an element to a cylindrical appliance (vertical or horizontal) at a specified side and offset.
Returns: Returns true if the element was successfully attached to the cylindrical appliance; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Example for AttachToCylindricalAppliance ]] -- Demonstrates attaching pipe fittings (nodes) to a vertical cylindrical tank on top, bottom, and side. -- Step 1: Create a vertical cylindrical tank (e.g., water tank) local tankTag = AddCylindricalAppliance('HYDRAULIC_APPLIANCE', 2.0, 1.0, 0.0, 0.0, 1.5, false, 'VerticalTank') -- Step 2: Add node elements for pipe fittings local topNodeTag = AddNode('PIPE_FITTING', 0.0, 0.0, 'TopFitting') local bottomNodeTag = AddNode('PIPE_FITTING', 0.0, 0.0, 'BottomFitting') local sideNodeTag = AddNode('PIPE_FITTING', 0.0, 0.0, 'SideFitting') -- Step 3: Attach pipe fittings to the tank -- Attach top node to center of the top (distance1 = 0, distance2 = 0) AttachToCylindricalAppliance(topNodeTag, tankTag, 'Top', 0.1, 0.15) -- Attach bottom node to center of the bottom (distance1 = 0, distance2 = 0) AttachToCylindricalAppliance(bottomNodeTag, tankTag, 'Bottom', 0.0, 0.08) -- Attach side node to 60 degrees (π/3 radians) at mid-height (distance1 = math.pi / 3, distance2 = 0.0) AttachToCylindricalAppliance(sideNodeTag, tankTag, 'Side', math.pi / 3, 0.0) print('Created a vertical tank with pipe fittings attached on top, bottom, and side.')
Description: Attaches an element to a spherical appliance using a polar angle and vertical offset.
Returns: Returns true if the element was successfully attached to the spherical appliance; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Example for AttachToSphericalAppliance ]] -- Demonstrates attaching electrical joints (nodes) to a spherical electric appliance using angle and vertical offset. -- Step 1: Create a spherical electric appliance (e.g., smart sensor hub) local hubTag = AddSphericalAppliance('ELECTRIC_APPLIANCE', 0.5, 0.0, 0.0, 1.2, 'SmartHub') -- Step 2: Add node elements for electrical joints local topJointTag = AddNode('ELECTRICAL_JOINT', 0.0, 0.0, 'TopJoint') local bottomJointTag = AddNode('ELECTRICAL_JOINT', 0.0, 0.0, 'BottomJoint') local sideJointTag = AddNode('ELECTRICAL_JOINT', 0.0, 0.0, 'SideJoint') -- Step 3: Attach joints to the spherical hub -- Top: angle = 0 (X-axis), vertical offset = +radius AttachToSphericalAppliance(topJointTag, hubTag, 0.0, 0.25) -- Bottom: angle = π (opposite side), vertical offset = -radius AttachToSphericalAppliance(bottomJointTag, hubTag, math.pi, -0.25) -- Side: angle = π/2 (90 degrees from X-axis), vertical offset = 0 (equator) AttachToSphericalAppliance(sideJointTag, hubTag, math.pi / 2, 0.0) print('Created a spherical electric hub with electrical joints attached on top, bottom, and side.')
Description: Attaches an element to a building floor at a given X, Y offset, and whether it is above or below the floor.
Returns: Returns true if the element was successfully attached to the building floor; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Creates a new project and building, adds a floor, creates a rectangular furniture item, and attaches the furniture to the floor using X/Y offset and aboveGround flag. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor = AddFloor(building, 3) -- Add a rectangular furniture item (e.g., a coffee table) local furnitureTag = AddRectangularAppliance('FURNITURE', 1.5, 0.7, 0.9, 2.0, 1.0, 0.45, 'CoffeeTable') -- Attach the furniture to the floor at X=1.5, Y=2.0, above the floor AttachToFloor(furnitureTag, floor, 1.5, 2.0, true) print('Coffee table attached to floor at (1.5, 2.0), above ground.')
Description: Attaches an element to a wall at a given horizontal and vertical offset from the center, and on the specified side.
Returns: Returns true if the element was successfully attached to the wall; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Creates a new project and building, adds floors and columns, creates a wall, then adds an electric light fixture and attaches it to the wall using local offsets and side selection. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) --[[ Add two columns and a wall between them]] local columns = AddColumns({{0, 0}, {4, 0}}, 'RNDCOLUMN', {floor0, floor1},true) local wall = AddWall(columns[1], columns[2], floor0, floor1) --[[ Add an electric light fixture (e.g., a wall-mounted lamp)]] local lightTag = AddRectangularAppliance('ELECTRIC_LIGHT', 0.3, 0.3, 0.2, 2.0, 0.0, 1.5, 'WallLamp') --[[ Attach the light fixture to the wall at horizontal=0.0, vertical=0.5, front side]] AttachToWall(lightTag, wall, 0.0, 0.5, true) print('Electric light fixture attached to wall.')
Description: Deletes an element with the specified tag.
Returns: Returns true if the element was successfully deleted; otherwise, returns false. (Boolean)
Parameters:
Example:
--[[ Deletes an element by its tag. First creates a new element of type 'FIXTURE' using CreateElement2, then deletes it using DeleteElement. Parameters: elementTag (string) Returns: true if the element was successfully deleted, otherwise false. --]] InputAddPoint(2, 1, 1) local tags = CreateElement2('FIXTURE') local tagToDelete = tags[1] local wasDeleted = DeleteElement(tagToDelete) print("Deleted element with tag " .. tagToDelete .. ": " .. tostring(wasDeleted))
Description: Adds a building to the project at specified (x, y) location.
Returns: Tags of created building and floor. (Table)
Parameters:
Example:
--[[ Creates a new project and adds a building at coordinates (2, 3). Also stores the created building and its default floor tags. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2]
Description: Adds a floor to a building.
Returns: Tag of the created floor. (String)
Parameters:
Example:
--[[ Creates a new project and building, then adds an additional floor at height 3. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local newFloor = AddFloor(building, 3)
Description: Adds a wall using two columns, optionally linking it to floors.
Returns: Tag of the created wall. (String)
Parameters:
Example:
--[[ Creates a project, building, floors, and columns, then adds a wall between two columns across two floors. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local columns = AddColumns({{0, 0}, {4, 0}}, 'RNDCOLUMN', {floor0, floor1}) local wall = AddWall(columns[1], columns[2], floor0, floor1)
Description: Adds a window to a wall.
Returns: Tag of the created window. (String)
Parameters:
Example:
--[[ Creates a project, building, floors, columns, and a wall, then adds a window to the wall at a given position. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local columns = AddColumns({{0, 0}, {4, 0}}, 'RNDCOLUMN', {floor0, floor1}) local wall = AddWall(columns[1], columns[2], floor0, floor1) local window = AddWindow(wall, 0.1, 1.5)
Description: Adds a door to a wall.
Returns: Tag of the created door. (String)
Parameters:
Example:
--[[ Creates a project, building, floors, columns, and a wall, then adds a door to the wall. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local columns = AddColumns({{0, 0}, {4, 0}}, 'RNDCOLUMN', {floor0, floor1}) local wall = AddWall(columns[1], columns[2], floor0, floor1) local door = AddDoor(wall, 0.2)
Description: Activates a building for subsequent operations.
Returns: No return value (Void)
Parameters:
Example:
--[[ Creates a new project and building, then activates that building. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] ActivateBuilding(building)
Description: Adds a set of building columns at input points, and optionally assigns them to specified floors, rooms, or zones.
Returns: Lua table of created column tags (Table)
Parameters:
Example:
--[[ Creates a new project with a building and floors, then adds four round columns at given positions. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local floor2 = AddFloor(building, 6) local floors = {floor0, floor1, floor2} local pts = {{0, 0}, {4, 0}, {4, 4}, {0, 4}} local columns = AddColumns(pts, 'RNDCOLUMN', floors,true)
Description: Assigns a set of columns to a floor, room or zone, and optionally resets its associated nodes.
Returns: No return value (Void)
Parameters:
Example:
--[[ Assigns a set of columns to a link with nodes (e.g., a floor, room, or zone). This example creates a building with 3 floors, adds a room and a zone, creates columns, then assigns the columns to a floor and to a room using SetColumns. --]] --[[ Create a new project]] CreateNewMetricProject() --[[ Add a building and its first floor]] local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local floor2 = AddFloor(building, 6) local floors = {floor0, floor1, floor2} --[[ Add input points and create columns]] local pts = {{0, 0}, {4, 0}, {4, 4}, {0, 4}} local columns = AddColumns(pts, 'RNDCOLUMN', floors, true) --[[ Create a room on floor1 using the created columns]] local room1 = AddRoom(floor1, 'Living Room', columns) --[[ Create a zone on floor2 using the same columns]] local zone1 = AddZone(floor2, 'ThermalZone1', columns) --[[ Reassign columns to floor2 and reset its node configuration]] SetColumns(floor2, columns, true) --[[ Reassign columns to the room, without resetting nodes]] SetColumns(room1, columns)
Description: Adds a room to a floor using column boundaries.
Returns: Tag of the created room. (String)
Parameters:
Example:
--[[ Creates a project, building, and floors, then adds columns and creates a room bounded by those columns on a floor. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local pts = {{0, 0}, {4, 0}, {4, 4}, {0, 4}} local columns = AddColumns(pts, 'RNDCOLUMN', {floor0, floor1}) SetColumns(floor1, columns) local room = AddRoom(floor1, 'main_room', columns)
Description: Adds a zone to a floor using column boundaries.
Returns: Tag of the created zone. (String)
Parameters:
Example:
--[[ Creates a project, building, floor, and columns, then adds a zone defined by the columns. --]] CreateNewMetricProject() local adb = AddBuilding(2, 3) local building = adb[1] local floor0 = adb[2] local floor1 = AddFloor(building, 3) local pts = {{0, 0}, {4, 0}, {4, 4}, {0, 4}} local columns = AddColumns(pts, 'RNDCOLUMN', {floor0, floor1}) local zone = AddZone(floor1, 'main_zone', columns)
Description: Adds a rectangular opening to a wall.
Returns: Tag of the created opening. (String)
Parameters:
Description: Returns the Missing value indicator.
Returns: Missing value indicator (-1.0E10) (Number)
Parameters: None
Example:
--[[ Example for EN_MISSING ]] --[[ Returns Missing value indicator: -1.0E10 ]] local missingValue = EN_MISSING() print("Missing value: " .. missingValue)
Description: Returns an EPANET constant value.
Returns: The value of the EPANET constant. (Number)
Parameters:
Example:
--[[ Example for EN_C ]] --[[ Returns an EPANET constant value. Parameters: EPANET constant name ]] local constantValue = EN_C("EN_DEMAND"); print("EN_DEMAND constant value: " .. constantValue);
Description: Lists EPANET constants.
Parameters: None
Example:
--[[ Example for List_EPANET_Constants ]] --[[ Lists EPANET constants ]] List_EPANET_Constants();
Description: Opens an EPANET project.
Parameters:
Example:
--[[ Example for ENopen ]] --[[ Opens an EPANET project. Parameters: Input file name, Report file name, Output file name ]] ENopen("input.inp", "report.rpt", "output.bin");
Description: Initializes a network prior to running a hydraulic analysis.
Parameters:
Example:
--[[ Example for ENinit ]] --[[ Initializes a network prior to running a hydraulic analysis.Parameters: Report file name, Output file name, Units type flag, Headloss type flag ]] ENinit("report.rpt", "output.bin", EN_C("EN_CFS"), EN_C("EN_HW"));
Description: Retrieves the EPANET version number.
Returns: The EPANET version number. (Int)
Parameters: None
Example:
--[[ Example for ENgetversion ]] --[[ Retrieves the toolkit API version number. ]] local version = ENgetversion(); print("EPANET version: " .. version);
Description: Retrieves the EPANET project title.
Returns: The EPANET project title (a list of strings). (Table)
Parameters: None
Example:
--[[ Example for ENgettitle ]] --[[ Returns a lua table containing 3 titles of the project. ]] local titles = ENgettitle(); for i, title in ipairs(titles) do print("Title " .. i .. ": " .. title[1]) end
Description: Sets the EPANET project title.
Parameters:
Example:
--[[ Example for ENsettitle ]] --[[ Sets the title lines of the project. Parameters: first title line, second title line, third title line ]] ENsettitle("My Project", "Created by Script", "Version 1.0");
Description: Saves the current network design to a file.
Parameters:
Example:
--[[ Example for ENsaveinpfile ]] --[[ Saves the current network data to a file. Parameters: filename. No return value. ]] ENsaveinpfile("network.inp");
Description: Saves the current report to a file.
Parameters: None
Example:
--[[ Example for ENsaveRepfile ]] --[[ Copies a project's report file from application cache folder to working folder. ]] ENsaveRepfile();
Description: Closes the current EPANET project.
Parameters: None
Example:
--[[ Example for ENclose ]] --[[ Closes a EPANET project and frees all of its memory. ]] ENclose();
Description: Solves the current EPANET hydraulic network.
Parameters: None
Example:
--[[ Example for ENsolveH ]] --[[ Performs a complete hydraulic analysis. No parameters. No return value. ]] ENsolveH();
Description: Saves the current hydraulic solution.
Parameters: None
Example:
--[[ Example for ENsaveH ]] --[[ Transfers a project's hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals. ]] ENsaveH();
Description: Opens a previously saved hydraulic solution.
Parameters: None
Example:
--[[ Example for ENopenH ]] --[[ Opens the hydraulic analysis solver. No parameters. No return value. ]] ENopenH();
Description: Initializes the hydraulic analysis engine.
Parameters:
Example:
--[[ Example for ENinitH ]] --[[ Initializes the hydraulic analysis solver. Parameters: initFlag. No return value. ]] ENinitH(EN_C("EN_SAVE"));
Description: Runs a step-by-step hydraulic analysis.
Returns: Error code (0 if successful). (Int)
Parameters: None
Example:
--[[ Example for ENrunH ]] --[[ Runs a single period hydraulic analysis. Parameters: time. Returns: Simulation time. ]] local currentTime = ENrunH(0); print("Current simulation time: " .. currentTime);
Description: Advances to the next time period in a hydraulic analysis.
Returns: Time period number, or 0 if at the end. (Int)
Parameters: None
Example:
--[[ Example for ENnextH ]] --[[ Advances the hydraulic analysis period. No parameters. Returns: Time step. ]] local timeStep = ENnextH(); print("Time step: " .. timeStep);
Description: Closes the current hydraulic analysis.
Parameters: None
Example:
--[[ Example for ENcloseH ]] --[[ Closes the hydraulic analysis solver. No parameters. No return value. ]] ENcloseH();
Description: Saves the current hydraulic solution to a binary file.
Parameters:
Example:
--[[ Example for ENsavehydfile ]] --[[ Saves the current hydraulic solution to a file. Parameters: filename. No return value. ]] ENsavehydfile("hydraulic_results.hyd");
Description: Uses a specific binary file containing a previously saved hydraulic solution.
Parameters:
Example:
--[[ Example for ENusehydfile ]] --[[ Specifies that a previously saved hydraulic solution file should be used. Parameters: filename. No return value. ]] ENusehydfile("hydraulic_solution.hyd");
Description: Writes a line of text to the EPANET report file.
Parameters:
Example:
--[[ Example for ENwriteline ]] --[[ Writes a line of text to the output report. Parameters: line of text. No return value. ]] ENwriteline("This is a custom report line.");
Description: Generates the standard EPANET report.
Parameters: None
Example:
--[[ Example for ENreport ]] --[[ Generates a standard report on simulation results. ]] ENreport();
Description: Copies the current report to a file.
Parameters:
Example:
--[[ Example for ENcopyreport ]] --[[ Copies the current report to a file. Parameter: file name ]]nENcopyreport("report_copy.rpt");
Description: Clears the current report.
Parameters: None
Example:
--[[ Example for ENclearreport ]] --[[ Clears the current report from memory. ]] ENclearreport();
Description: Resets the current report.
Parameters: None
Example:
--[[ Example for ENresetreport ]] --[[ Resets all report options to their default values. No parameters. No return value. ]] ENresetreport();
Description: Sets the name of the report file.
Parameters:
Example:
--[[ Example for ENsetreport ]] --[[ Sets various options that control the content of the output report. Parameters: report options string. No return value. ]] ENsetreport("pagesize 0");
Description: Sets the status reporting option.
Parameters:
Example:
--[[ Example for ENsetstatusreport ]] --[[ Sets the items to be reported in the status report. Parameters: report options. No return value. ]] ENsetstatusreport(1);
Description: Retrieves the number of network elements of a specific type.
Returns: The number of elements of the specified type. (Int)
Parameters:
Example:
--[[ Example for ENgetcount ]] --[[ Retrieves the number of network elements of a specific type. Parameters: object code. ]] local numJunctions = ENgetcount(EN_C("EN_NODECOUNT")); print("Number of junctions: " .. numJunctions);
Description: Retrieves a summary statistic for an EPANET analysis.
Returns: The value of the specified statistic. (Number)
Parameters:
Example:
--[[ Example for ENgetstatistic ]] --[[ Retrieves a statistical result for a specific element and property. Parameters: object code, element index, property code. Returns: Statistic value. ]] local averagePressure = ENgetstatistic(EN_C("EN_NODE"), 1, EN_C("EN_PRESSURE")); print("Average pressure at node 1: " .. averagePressure);
Description: Retrieves the index of a node or link given its ID.
Returns: The index number of the element. (Int)
Parameters:
Example:
--[[ Example for ENgetresultindex ]] --[[ Retrieves the order in which a node or link appears in an output file. Parameters: object type (number), index (number). Returns: The order in which the object appears in the output file (number). ]] local nodeOrder = ENgetresultindex(EN_C("EN_NODES"), 1); print("Order of first node in output: " .. nodeOrder);
Description: Retrieves the current value of a computation option.
Returns: The value of the specified computation option. (Number)
Parameters:
Example:
--[[ Example for ENgetoption ]] --[[ Retrieves the value of an analysis option. Parameters: option type (number). Returns: The value of the analysis option (number). ]] local headlossOption = ENgetoption(EN_C("EN_HEADLOSS")); print("Headloss option: " .. headlossOption);
Description: Sets the value of a computation option.
Parameters:
Example:
--[[ Example for ENsetoption ]] --[[ Sets the value for an analysis option. Parameters: option type (number), option value (number). ]] ENsetoption(EN_C("EN_HEADLOSS"), EN_C("EN_DW"));
Description: Retrieves the code number of the flow units option.
Returns: The code number of the flow units option. (Int)
Parameters: None
Example:
--[[ Example for ENgetflowunits ]] --[[ Retrieves a project's flow units (EN_FlowUnits). Returns: The flow units code (number). ]] local flowUnits = ENgetflowunits(); print("Flow units: " .. flowUnits);
Description: Sets the code number of the flow units option.
Parameters:
Example:
--[[ Example for ENsetflowunits ]] --[[ Sets a project's flow units. Parameters: flow units (number). ]] ENsetflowunits(EN_C("EN_LPS"));
Description: Retrieves the value of a time parameter.
Returns: The value of the specified time parameter. (Int)
Parameters:
Example:
--[[ Example for ENgettimeparam ]] --[[ Retrieves the value of a time parameter. Parameters: parameter code. Returns: Parameter value. ]] local duration = ENgettimeparam(EN_C("EN_DURATION")); print("Duration of simulation: " .. duration);
Description: Sets the value of a time parameter.
Parameters:
Example:
--[[ Example for ENsettimeparam ]] --[[ Sets the value of a time parameter. Parameters: parameter code, value. No return value. ]] ENsettimeparam(EN_C("EN_HYDSTEP"), 60);
Description: Retrieves information about water quality analysis.
Returns: A table containing information about water quality analysis. (Table)
Parameters: None
Example:
--[[ Example for ENgetqualinfo ]] --[[ Gets information about the type of water quality analysis requested. Returns: An array of strings containing information about the analysis. ]] local qualInfo = ENgetqualinfo(); for i, info in ipairs(qualInfo) do print(info[1]); end
Description: Retrieves information about the type of water quality analysis.
Returns: A table containing information about the type of water quality analysis. (Table)
Parameters: None
Example:
--[[ Example for ENgetqualtype ]] --[[ Retrieves the type of water quality analysis being conducted. No parameters. Returns: Quality type code. ]] local qualityType = ENgetqualtype(); print("Quality type: " .. qualityType);
Description: Sets the type of water quality analysis.
Parameters:
Example:
--[[ Example for ENsetqualtype ]] --[[ Sets the type of water quality analysis to be conducted. Parameters: quality type code, chemical name, mass units name. No return value. ]] ENsetqualtype(EN_C("EN_CHEMICAL"), "Chlorine", "mg/L");
Description: Solves the current EPANET water quality network.
Parameters: None
Example:
--[[ Example for ENsolveQ ]] --[[ Performs a water quality analysis. No parameters. No return value. ]] ENsolveQ();
Description: Opens a previously saved water quality solution.
Parameters: None
Example:
--[[ Example for ENopenQ ]] --[[ Opens the water quality analysis solver. No parameters. No return value. ]] ENopenQ();
Description: Initializes the water quality analysis engine.
Parameters:
Example:
--[[ Example for ENinitQ ]] --[[ Initializes the water quality analysis. Parameters: initFlag. No return value. ]] ENinitQ(EN_C("EN_SAVE"));
Description: Runs a step-by-step water quality analysis.
Returns: Error code (0 if successful). (Int)
Parameters: None
Example:
--[[ Example for ENrunQ ]] --[[ Runs a single period water quality analysis. Parameters: time. Returns: Simulation time. ]] local currentTime = ENrunQ(0); print("Current water quality simulation time: " .. currentTime);
Description: Advances to the next time period in a water quality analysis.
Returns: Time period number, or 0 if at the end. (Int)
Parameters: None
Example:
--[[ Example for ENnextQ ]] --[[ Advances the water quality analysis period. No parameters. Returns: Time step. ]] local timeStep = ENnextQ(); print("Time step for water quality: " .. timeStep);
Description: Advances to the next time step in a water quality analysis.
Returns: Time step number, or 0 if at the end. (Int)
Parameters: None
Example:
--[[ Example for ENstepQ ]] --[[ Advances the water quality analysis one time step. No parameters. Returns: Simulation time. ]] local currentTime = ENstepQ(); print("Current water quality simulation time: " .. currentTime);
Description: Closes the current water quality analysis.
Parameters: None
Example:
--[[ Example for ENcloseQ ]] --[[ Closes the water quality analysis solver. No parameters. No return value. ]] ENcloseQ();
Description: Adds a node to the network.
Parameters:
Example:
--[[ Example for ENaddnode ]] --[[ Adds a new node to the project. Parameters: node ID (string), node type (number). Returns: Index of the newly added node. ]] local junctionIndex = ENaddnode("J1", EN_C("EN_JUNCTION")); print("Index of added junction: " .. junctionIndex);
Description: Deletes a node from the network.
Parameters:
Example:
--[[ Example for ENdeletenode ]] --[[ Deletes a node from the project. Parameters: node index (number), action code (number). No return value. ]] ENdeletenode(1, EN_C("EN_DELETE"));
Description: Retrieves the index of a node.
Parameters:
Example:
--[[ Example for ENgetnodeindex ]] --[[ Retrieves the index of a node given its ID name. Parameters: id. ]] local nodeIndex = ENgetnodeindex("J1"); print("Index of node J1: " .. nodeIndex);
Description: Retrieves the ID of a node.
Parameters:
Example:
--[[ Example for ENgetnodeid ]] --[[ Retrieves the ID name of a node given its index. Parameters: index. ]] local nodeId = ENgetnodeid(1); print("ID of node 1: " .. nodeId);
Description: Sets the ID of a node.
Parameters:
Example:
--[[ Example for ENsetnodeid ]] --[[ Changes the ID name of a node. Parameters: nodeIndex (number), newID (string). No return value. ]] ENsetnodeid(1, "NewJunctionID");
Description: Retrieves the type of a node.
Parameters:
Example:
--[[ Example for ENgetnodetype ]] --[[ Retrieves a node's type given its index. Parameters: node index (number). Returns: Node type (number). ]] local nodeType = ENgetnodetype(1); print("Type of node 1: " .. nodeType);
Description: Retrieves a property value for a node.
Parameters:
Example:
--[[ Example for ENgetnodevalue ]] --[[ Retrieves a property value for a node. Parameters: node index (number), property (number). Returns: Property value (number). ]] local pressure = ENgetnodevalue(1, EN_C("EN_PRESSURE")); print("Pressure at node 1: " .. pressure);
Description: Sets a property value for a node.
Parameters:
Example:
--[[ Example for ENsetnodevalue ]] --[[ Sets a property value for a node. Parameters: node index (number), property (number), value (number). No return value. ]] ENsetnodevalue(1, EN_C("EN_ELEVATION"), 150.0);
Description: Sets data for a junction node.
Parameters:
Example:
--[[ Example for ENsetjuncdata ]] --[[ Sets properties for a junction. Parameters: index (number), elevation (number), primary demand (number), pattern ID (string). No return value. ]] ENsetjuncdata(1, 100.0, 5.0, "DemandPattern");
Description: Sets data for a tank node.
Parameters:
Example:
--[[ Example for ENsettankdata ]] --[[ Sets properties for a tank node. Parameters: index (number), bottom elevation (number), initial water level (number), minimum water level (number), maximum water level (number), diameter (number), minimum volume (number), volume curve ID (string). No return value. ]] ENsettankdata(1, 0.0, 10.0, 5.0, 15.0, 20.0, 0.0, "TankVolumeCurve");
Description: Retrieves coordinates for a node.
Parameters:
Example:
--[[ Example for ENgetcoord ]] --[[ Returns (x, y) coordinates of a node. Parameters: node index (number). Returns: Table containing (x, y) coordinates. ]] local coordinates = ENgetcoord(1); print("X coordinate: " .. coordinates[1][1] .. ", Y coordinate: " .. coordinates[1][2]);
Description: Sets coordinates for a node.
Parameters:
Example:
--[[ Example for ENsetcoord ]] --[[ Sets (x, y) coordinates of a node. Parameters: node index (number), xCoord (number), yCoord (number). No return value. ]] ENsetcoord(1, 100.0, 200.0);
Description: Retrieves the demand model.
Parameters: None
Example:
--[[ Example for ENgetdemandmodel ]] --[[ Retrieves the type of demand model in use and its parameters. No parameters. Returns: Table containing demand model info. ]] local demandModel = ENgetdemandmodel(); print("Demand model type: " .. demandModel[1][1]);
Description: Sets parameters of a demand model.
Parameters:
Example:
--[[ Example for ENsetdemandmodel ]] --[[ Sets the type of demand model and its parameters. Parameters: type (number), pmin (number), preq (number), pexp (number). No return value. ]] ENsetdemandmodel(EN_C("EN_DEMAND_CONST"), 0.0, 1.0, 2.0);
Description: Adds a new demand to a node.
Parameters:
Example:
--[[ Example for ENadddemand ]] --[[ Appends a new demand to a junction node. Parameters: node index (number), base demand (number), demand pattern (string), demand name (string). No return value. ]] ENadddemand(1, 2.5, "DemandPattern", "ResidentialDemand");
Description: Deletes a demand from a node.
Parameters:
Example:
--[[ Example for ENdeletedemand ]] --[[ Deletes a demand from a junction node. Parameters: node index (number), demand index (number). No return value. ]] ENdeletedemand(1, 1);
Description: Retrieves the index of a demand.
Parameters:
Example:
--[[ Example for ENgetdemandindex ]] --[[ Retrieves the index of a node's named demand category. Parameters: node index (number), demand name (string). Returns: Demand index (number). ]] local demandIndex = ENgetdemandindex(1, "ResidentialDemand"); print("Index of ResidentialDemand: " .. demandIndex);
Description: Retrieves the number of demands at a node.
Parameters:
Example:
--[[ Example for ENgetnumdemands ]] --[[ Retrieves the number of demand categories for a junction node. Parameters: node index (number). Returns: Number of demands (number). ]] local numDemands = ENgetnumdemands(1); print("Number of demands for node 1: " .. numDemands);
Description: Retrieves the base demand value.
Parameters:
Example:
--[[ Example for ENgetbasedemand ]] --[[ Gets the base demand for a node's demand category. Parameters: nodeI index (number), demand index (number). Returns: Base demand (number). ]] local baseDemand = ENgetbasedemand(1, 1); print("Base demand for category 1: " .. baseDemand);
Description: Sets the base demand value.
Parameters:
Example:
--[[ Example for ENsetbasedemand ]] --[[ Sets the base demand for a node's demand category. Parameters: node index (number), demand index (number), base demand (number). No return value. ]] ENsetbasedemand(1, 1, 3.0);
Description: Retrieves the demand pattern assigned to a specific demand.
Returns: Index of the assigned demand pattern. (Int)
Parameters:
Example:
--[[ Example for ENgetdemandpattern ]] --[[ Retrieves the index of a time pattern assigned to a node's demand category. Parameters: nodeIndex (number), demand index (number). Returns: Pattern index (number). ]] local patternIndex = ENgetdemandpattern(1, 1); print("Pattern index for demand category 1: " .. patternIndex);
Description: Assigns a demand pattern to a specific demand.
Parameters:
Example:
--[[ Example for ENsetdemandpattern ]] --[[ Sets the index of a time pattern for a node's demand category. Parameters: node index (number), demand index (number), pattern index (number). No return value. ]]nENsetdemandpattern(1, 1, 2);
Description: Retrieves the name assigned to a specific demand.
Returns: Name of the assigned demand. (String)
Parameters:
Example:
--[[ Example for ENgetdemandname ]] --[[ Retrieves a node's demand category name. Parameters: node index, demand index. ]] local demandName = ENgetdemandname(1, 1); print("Demand name for category 1: " .. demandName);
Description: Assigns a name to a specific demand.
Parameters:
Example:
--[[ Example for ENsetdemandname ]] --[[ Assigns a name to a node's demand category. Parameters: node index, demand id, demand name. ]] ENsetdemandname(1, 1, "CommercialDemand");
Description: Adds a new link to the network.
Returns: Index of the newly added link. (Int)
Parameters:
Example:
--[[ Example for ENaddlink ]] --[[ Adds a new link to a project. Parameters: id, link type, from node, to node. ]] local linkIndex = ENaddlink("L1", EN_C("EN_PIPE"), "J1", "J2"); print("Index of added link: " .. linkIndex);
Description: Deletes an existing link from the network.
Parameters:
Example:
--[[ Example for ENdeletelink ]] --[[ Deletes a link from the project. Parameters: index, actionCode. ]] ENdeletelink(1, EN_C("EN_DELETE"));
Description: Retrieves the index of a link given its ID.
Returns: Index of the link. (Int)
Parameters:
Example:
--[[ Example for ENgetlinkindex ]] --[[ Gets the index of a link given its ID name. Parameters: id. ]] local linkIndex = ENgetlinkindex("L1"); print("Index of link L1: " .. linkIndex);
Description: Retrieves the ID of a link given its index.
Returns: ID of the link. (String)
Parameters:
Example:
--[[ Example for ENgetlinkid ]] --[[ Gets the ID name of a link given its index. Parameters: index. ]] local linkId = ENgetlinkid(1); print("ID of link 1: " .. linkId);
Description: Assigns a new ID to a link.
Parameters:
Example:
--[[ Example for ENsetlinkid ]] --[[ Changes the ID name of a link. Parameters: index, new id. ]] ENsetlinkid(1, "NewPipeID");
Description: Retrieves the type of a link.
Returns: Type of the link. (Int)
Parameters:
Example:
--[[ Example for ENgetlinktype ]] --[[ Retrieves a link's type. Parameters: index. ]] local linkType = ENgetlinktype(1); print("Type of link 1: " .. linkType);
Description: Sets the type of a link.
Parameters:
Example:
--[[ Example for ENsetlinktype ]] --[[ Sets a link's type. Parameters: index, type, new type. ]] ENsetlinktype(1, EN_C("EN_PIPE"), EN_C("EN_PUMP"));
Description: Retrieves the nodes connected to a link.
Returns: Table containing indices of the connected nodes. (Table)
Parameters:
Example:
--[[ Example for ENgetlinknodes ]] --[[ Gets the indexes of a link's start- and end-nodes. Parameters: index. ]] local linkNodes = ENgetlinknodes(1); print("Start node: " .. linkNodes[1][1] .. ", End node: " .. linkNodes[1][2]);
Description: Sets the nodes connected to a link.
Parameters:
Example:
--[[ Example for ENsetlinknodes ]] --[[ Sets the indexes of a link's start- and end-nodes. Parameters: index, startNodeIndex, endNodeIndex. ]] ENsetlinknodes(1, 2, 3);
Description: Retrieves a value for a link attribute.
Returns: Value of the link attribute. (Number)
Parameters:
Example:
--[[ Example for ENgetlinkvalue ]] --[[ Retrieves a property value for a link. Parameters: index, property. ]] local linkLength = ENgetlinkvalue(1, EN_C("EN_LENGTH")); print("Length of link 1: " .. linkLength);
Description: Sets a value for a link attribute.
Parameters:
Example:
--[[ Example for ENsetlinkvalue ]] --[[ Sets a property value for a link. Parameters: index, property, value. ]] ENsetlinkvalue(1, EN_C("EN_LENGTH"), 150.0);
Description: Sets data for a pipe link.
Parameters:
Example:
--[[ Example for ENsetpipedata ]] --[[ Sets properties for a pipe link. Parameters: index, length, diameter, roughness, minor loss coefficient. ]] ENsetpipedata(1, 200.0, 0.3, 0.01, 0.5);
Description: Retrieves the number of vertices in a link.
Returns: Number of vertices in the link. (Int)
Parameters:
Example:
--[[ Example for ENgetvertexcount ]] --[[ Retrieves the number of interior vertex points for a link. Parameters: index. ]] local vertexCount = ENgetvertexcount(1); print("Vertex count for link 1: " .. vertexCount);
Description: Retrieves the coordinates of a vertex in a link.
Returns: Table containing the coordinates of the vertex. (Table)
Parameters:
Example:
--[[ Example for ENgetvertex ]] --[[ Retrieves the coordinates of an interior vertex point for a link. Parameters: index, vertex number. ]] local vertex = ENgetvertex(1, 1); print("Vertex X: " .. vertex[1][1] .. ", Vertex Y: " .. vertex[1][2]);
Description: Sets the vertices for a link.
Parameters:
Example:
--[[ Example for ENsetvertices ]] --[[ Sets the coordinates of the interior vertex points for a link. Parameters: index, x-coordinates table, y-coordinates table, number of vertices. ]] ENsetvertices(1, {10, 20}, {30, 40}, 2);
Description: Retrieves the index of a pump's head curve.
Returns: The pump's head curve index. (Int)
Parameters:
Example:
--[[ Example for ENgetheadcurveindex ]] --[[ Retrieves the curve assigned to a pump's head curve. Parameters: link index. ]] local curveIndex = ENgetheadcurveindex(1); print("Head curve index for pump 1: " .. curveIndex);
Description: Assigns a head curve to a pump.
Parameters:
Example:
--[[ Example for ENsetheadcurveindex ]] --[[ Assigns a curve to a pump's head curve. Parameters: link index, curve index. ]] ENsetheadcurveindex(1, 2);
Description: Retrieves the type of pump.
Returns: The pump's type (see EN_PumpType). (Int)
Parameters:
Example:
--[[ Example for ENgetpumptype ]] --[[ Retrieves the type of head curve used by a pump. Parameters: link index. ]] local pumpType = ENgetpumptype(1); print("Pump type for pump 1: " .. pumpType);
Description: Adds a new time pattern to the project.
Parameters:
Example:
--[[ Example for ENaddpattern ]] --[[ Adds a new time pattern to the project. Parameters: id. ]] ENaddpattern("NewPattern");
Description: Deletes a time pattern from the project.
Parameters:
Example:
--[[ Example for ENdeletepattern ]] --[[ Deletes a time pattern from the project. Parameters: index. ]] ENdeletepattern(1);
Description: Retrieves the index of a time pattern given its ID name.
Returns: The time pattern's index. (Int)
Parameters:
Example:
--[[ Example for ENgetpatternindex ]] --[[ Retrieves the index of a time pattern given its ID name. Parameters: id. Returns: Pattern index. ]] local patternIndex = ENgetpatternindex("Pattern1"); print("Index of Pattern1: " .. patternIndex);
Description: Retrieves the ID name of a time pattern given its index.
Returns: The time pattern's ID name. (String)
Parameters:
Example:
--[[ Example for ENgetpatternid ]] --[[ Retrieves the ID name of a time pattern given its index. Parameters: index. Returns: Pattern ID. ]] local patternId = ENgetpatternid(1); print("ID of pattern 1: " .. patternId);
Description: Assigns a new ID name to a time pattern.
Parameters:
Example:
--[[ Example for ENsetpatternid ]] --[[ Assigns a new ID name to a time pattern. Parameters: index, new pattern ID. No return value. ]] ENsetpatternid(1, "NewPatternID");
Description: Retrieves the number of time periods in a time pattern.
Returns: The number of time periods in the pattern. (Int)
Parameters:
Example:
--[[ Example for ENgetpatternlen ]] --[[ Retrieves the number of time periods in a time pattern. Parameters: index. Returns: Pattern length. ]] local patternLength = ENgetpatternlen(1); print("Length of pattern 1: " .. patternLength);
Description: Retrieves a multiplier factor from a time pattern.
Returns: The pattern factor for the given time period. (Number)
Parameters:
Example:
--[[ Example for ENgetpatternvalue ]] --[[ Retrieves a multiplier value for a specific period in a time pattern. Parameters: index, period. Returns: Multiplier value. ]] local multiplier = ENgetpatternvalue(1, 5); print("Multiplier for period 5: " .. multiplier);
Description: Sets a multiplier factor for a time pattern for a given time period.
Parameters:
Example:
--[[ Example for ENsetpatternvalue ]] --[[ Sets a multiplier value for a specific period in a time pattern. Parameters: index, period, multiplier. No return value. ]] ENsetpatternvalue(1, 5, 1.2);
Description: Retrieves the average of all pattern factors in a time pattern.
Returns: The average of all of the time pattern's factors. (Number)
Parameters:
Example:
--[[ Example for ENgetaveragepatternvalue ]] --[[ Retrieves the average multiplier value of a time pattern. Parameters: pattern index. Returns: Average multiplier value. ]] local avgMultiplier = ENgetaveragepatternvalue(1); print("Average multiplier for pattern 1: " .. avgMultiplier);
Description: Sets all time pattern factors at once.
Parameters:
Example:
--[[ Example for ENsetpattern ]] --[[ Sets all multiplier values for a time pattern. Parameters: pattern index, table of multiplier values, number of multipliers. No return value. ]] ENsetpattern(1, {1.0, 1.2, 0.8, 1.0}, 4);
Description: Adds a new data curve to the project.
Returns: The new curve contains a single data point (1.0, 1.0). (Void)
Parameters:
Example:
--[[ Example for ENaddcurve ]] --[[ Adds a new curve to the project. Parameters: curve ID. No return value. ]] ENaddcurve("Curve1");
Description: Deletes a data curve from the project.
Parameters:
Example:
--[[ Example for ENdeletecurve ]] --[[ Deletes a curve from the project. Parameters: curve index. No return value. ]] ENdeletecurve(1);
Description: Retrieves the index of a curve given its ID name.
Returns: The curve's index. (Int)
Parameters:
Example:
--[[ Example for ENgetcurveindex ]] --[[ Retrieves the index of a curve given its ID name. Parameters: curve ID. Returns: Curve index. ]] local curveIndex = ENgetcurveindex("Curve1"); print("Index of Curve1: " .. curveIndex);
Description: Retrieves the ID name of a curve given its index.
Returns: The curve's ID name. (String)
Parameters:
Example:
--[[ Example for ENgetcurveid ]] --[[ Retrieves the ID name of a curve given its index. Parameters: curve index. Returns: Curve ID. ]] local curveId = ENgetcurveid(1); print("ID of curve 1: " .. curveId);
Description: Assigns a new ID name to a curve.
Parameters:
Example:
--[[ Example for ENsetcurveid ]] --[[ Assigns a new ID name to a curve. Parameters: curve index, new curve ID. No return value. ]] ENsetcurveid(1, "NewCurveID");
Description: Retrieves the number of data pairs contained in a curve.
Returns: The number of data pairs in the curve. (Int)
Parameters:
Example:
--[[ Example for ENgetcurvelen ]] --[[ Retrieves the number of points in a curve. Parameters: curve index. Returns: Curve length. ]] local curveLength = ENgetcurvelen(1); print("Length of curve 1: " .. curveLength);
Description: Retrieves the type of data stored in a curve.
Returns: The curve's type (see EN_CurveType). (Int)
Parameters:
Example:
--[[ Example for ENgetcurvetype ]] --[[ Retrieves the curve type code. Parameters: curve index. Returns: Curve type code. ]] local curveType = ENgetcurvetype(1); print("Type of curve 1: " .. curveType);
Description: Retrieves a value from a curve.
Returns: A table containing the curve value (Table)
Parameters:
Example:
--[[ Example for ENgetcurvevalue ]] --[[ Retrieves the x,y value of a point in a curve. Parameters: curve index, point number. Returns: Table containing the x, y values. ]] local curveValue = ENgetcurvevalue(1, 1); print("X value: " .. curveValue[1][1] .. ", Y value: " .. curveValue[1][2]);
Description: Sets a value for a curve.
Parameters:
Example:
--[[ Example for ENsetcurvevalue ]] --[[ Sets the x,y value of a point in a curve. Parameters: curve index, point number, x value, y value. No return value. ]] ENsetcurvevalue(1, 1, 0.0, 10.0);
Description: Retrieves a curve.
Returns: A table containing the curve (Table)
Parameters:
Example:
--[[ Example for ENgetcurve ]] --[[ Retrieves all x,y values for a curve. Parameters: curve index. Returns: Table containing all curve points. ]]nlocal curvePoints = ENgetcurve(1);
Description: Sets a curve.
Parameters:
Example:
--[[ Example for ENsetcurve ]] --[[ Sets all x,y values for a curve. Parameters: curve index, table of x values, table of y values, number of points. No return value. ]] ENsetcurve(1, {0, 10, 20}, {10, 20, 30}, 3);
Description: Adds a new simple control to EPANET.
Returns: Index of the added control (Int)
Parameters:
Example:
--[[ Example for ENaddcontrol ]] --[[ Adds a new simple control statement to the project. Parameters: table of control parameters. Returns: Control index. ]] local newControlIndex = ENaddcontrol({EN_C("EN_CTRL_TIMER"), EN_C("EN_PUMP"), 2, 18.0, 0.0}); print("Index of new control: " .. newControlIndex);
Description: Deletes a simple control.
Parameters:
Example:
--[[ Example for ENdeletecontrol ]] --[[ Deletes a simple control statement from the project. Parameters: control index. No return value. ]] ENdeletecontrol(1);
Description: Retrieves a simple control.
Returns: A table containing the control (Table)
Parameters: None
Example:
--[[ Example for ENgetcontrol ]] --[[ Retrieves the parameters that define a simple control statement. Parameters: control index. Returns: Table containing control parameters. ]] local controlParams = ENgetcontrol(1); print("Control type: " .. controlParams[1][1]);
Description: Sets parameters for a simple control.
Parameters:
Example:
--[[ Example for ENsetcontrol ]] --[[ Sets the parameters that define a simple control statement. Parameters: control index, table of control parameters. No return value. ]] ENsetcontrol(1, {EN_C("EN_CTRL_LOWLEVEL"), EN_C("EN_LINK"), 1, 10.0, ""});
Description: Adds a rule-based control.
Parameters:
Example:
--[[ Example for ENaddrule ]] --[[ Adds a new rule-based control statement. Parameters: rule string. Returns: Rule index. ]] local newRuleIndex = ENaddrule("OPEN LINK 1 IF TIME 8"); print("Index of new rule: " .. newRuleIndex);
Description: Deletes a rule-based control.
Parameters:
Example:
--[[ Example for ENdeleterule ]] --[[ Deletes a rule-based control statement. Parameters: rule index. No return value. ]] ENdeleterule(1);
Description: Retrieves a rule-based control's summary.
Returns: A table containing rule summary information (Table)
Parameters:
Example:
--[[ Example for ENgetrule ]] --[[ Retrieves a rule-based control statement. Parameters: rule index. Returns: Rule string. ]] local ruleString = ENgetrule(1); print("Rule 1: " .. ruleString);
Description: Retrieves the ID of a rule.
Returns: The ID of the rule (String)
Parameters:
Example:
--[[ Example for ENgetruleID ]] --[[ Retrieves the ID of a rule given its index. Parameters: rule index. Returns: Rule ID. ]] local ruleId = ENgetruleID(1); print("ID of rule 1: " .. ruleId);
Description: Sets the priority for a rule.
Parameters:
Example:
--[[ Example for ENsetrulepriority ]] --[[ Sets the priority of a rule. Parameters: rule index, priority. No return value. ]] ENsetrulepriority(1, 2);
Description: Retrieves a premise from a rule.
Returns: A table containing the premise (Table)
Parameters:
Example:
--[[ Example for ENgetpremise ]] --[[ Retrieves a premise clause from a rule. Parameters: rule index, premise index. Returns: Table containing premise information. ]] local premise = ENgetpremise(1, 1); print("Premise logical operator: " .. premise[1][1]);
Description: Sets a premise in a rule.
Parameters:
Example:
--[[ Example for ENsetpremise ]] --[[ Sets a premise clause in a rule. Parameters: rule index, premise index, table of premise parameters. No return value. ]] ENsetpremise(1, 1, {EN_C("EN_AND"), EN_C("EN_TIME"), EN_C("EN_GT"), 18.0, ""});
Description: Sets the object index for a premise.
Parameters:
Example:
--[[ Example for ENsetpremiseindex ]] --[[ Sets the index of a premise object. Parameters: rule index, premise index, object index. No return value. ]] ENsetpremiseindex(1, 1, 2);
Description: Sets the status of a premise.
Parameters:
Example:
--[[ Example for ENsetpremisestatus ]] --[[ Sets the status of a premise. Parameters: rule index, premise index, status. No return value. ]] ENsetpremisestatus(1, 1, EN_C("EN_OPEN"));
Description: Sets the value in a premise.
Parameters:
Example:
--[[ Example for ENsetpremisevalue ]] --[[ Sets the value in a premise clause. Parameters: rule index, premise index, value. No return value. ]] ENsetpremisevalue(1, 1, 20.0);
Description: Retrieves a THEN action from a rule.
Returns: A table containing the THEN action (Table)
Parameters:
Example:
--[[ Example for ENgetthenaction ]] --[[ Retrieves the THEN clause from a rule. Parameters: rule index. Returns: Table containing THEN action parameters. ]] local thenAction = ENgetthenaction(1); print("THEN action type: " .. thenAction[1][1]);
Description: Sets a THEN action in a rule.
Parameters:
Example:
--[[ Example for ENsetthenaction ]] --[[ Sets the THEN clause for a rule. Parameters: rule index, table of THEN action parameters. No return value. ]] ENsetthenaction(1, {EN_C("EN_SETTING"), EN_C("EN_LINK"), 1, 1.0, ""});
Description: Retrieves an ELSE action from a rule.
Returns: A table containing the ELSE action (Table)
Parameters:
Example:
--[[ Example for ENgetelseaction ]] --[[ Retrieves the ELSE clause from a rule. Parameters: rule index. Returns: Table containing ELSE action parameters. ]] local elseAction = ENgetelseaction(1); print("ELSE action type: " .. elseAction[1][1]);
Description: Sets an ELSE action in a rule.
Parameters:
Example:
--[[ Example for ENsetelseaction ]] --[[ Sets the ELSE clause for a rule. Parameters: rule index, table of ELSE action parameters. No return value. ]] ENsetelseaction(1, {EN_C("EN_SETTING"), EN_C("EN_LINK"), 1, 0.0, ""});
Description: Initializes the EPANET solver.
Parameters: None
Example:
--[[ Example for ENRinit ]] --[[ Initializes the EPANET-Risk module. No parameters. No return value. ]] ENRinit();
Description: Closes the EPANET solver.
Parameters: None
Example:
--[[ Example for ENRclose ]] --[[ Closes the EPANET-Risk module. No parameters. No return value. ]] ENRclose();
Description: Opens an EPANET input file.
Parameters:
Example:
--[[ Example for ENRopen ]] --[[ Opens an EPANET-Risk project. Parameters: input filename, report filename. No return value. ]] ENRopen("input.inp", "report.txt");
Description: Retrieves the EPANET version number.
Parameters: None
Example:
--[[ Example for ENRgetVersion ]] --[[ Retrieves the EPANET-Risk version number. No parameters. Returns: Version number. ]] local version = ENRgetVersion(); print("EPANET-Risk version: " .. version);
Description: Retrieves the number of network components.
Parameters: None
Example:
--[[ Example for ENRgetNetSize ]] --[[ Retrieves the number of nodes and links in the network. No parameters. Returns: Table containing node count and link count. ]] local netSize = ENRgetNetSize(); print("Node count: " .. netSize[1][1] .. ", Link count: " .. netSize[1][2]);
Description: Retrieves the flow units code.
Parameters: None
Example:
--[[ Example for ENRgetUnits ]] --[[ Retrieves the flow units used in the network. No parameters. Returns: Flow units code. ]] local flowUnits = ENRgetUnits(); print("Flow units: " .. flowUnits);
Description: Retrieves various time step parameters.
Parameters: None
Example:
--[[ Example for ENRgetTimes ]] --[[ Retrieves various simulation time parameters. No parameters. Returns: Table containing time parameters. ]] local timeParams = ENRgetTimes();
Description: Retrieves the ID name of a network element.
Parameters:
Example:
--[[ Example for ENRgetElementName ]] --[[ Retrieves the ID of a network element given its index and type. Parameters: element index, element type. Returns: Element ID. ]] local nodeId = ENRgetElementName(1, EN_C("EN_NODE")); print("Node ID: " .. nodeId);
Description: Retrieves energy usage results for a pump during a period.
Returns: An array of energy usage values. (Table)
Parameters:
Example:
--[[ Example for ENRgetEnergyUsage ]] --[[ Retrieves energy usage results. Parameters: start period, end period. Returns: Table containing energy usage data. ]] local energyUsage = ENRgetEnergyUsage(0, 3600);
Description: Retrieves average network reaction rates over a time period.
Returns: An array of reaction rate values. (Table)
Parameters: None
Example:
--[[ Example for ENRgetNetReacts ]] --[[ Retrieves network reaction results. Parameters: start period, end period. Returns: Table containing reaction data. ]] local reactions = ENRgetNetReacts(0, 3600);
Description: Frees all memory used to store EPANET data.
Parameters: None
Example:
--[[ Example for ENRfree ]] --[[ Frees all memory used by the EPANET-Risk module. No parameters. No return value. ]] ENRfree();
Description: Retrieves a time series of results for a node.
Returns: An array of time series values. (Table)
Parameters:
Example:
--[[ Example for ENRgetNodeSeries ]] --[[ Retrieves a time series of results for a node. Parameters: node index, property code. Returns: Table containing the time series. ]] local nodeSeries = ENRgetNodeSeries(1, EN_C("EN_PRESSURE"));
Description: Retrieves a time series of results for a link.
Returns: An array of time series values. (Table)
Parameters:
Example:
--[[ Example for ENRgetLinkSeries ]] --[[ Retrieves a time series of results for a link. Parameters: link index, property code. Returns: Table containing the time series. ]] local linkSeries = ENRgetLinkSeries(1, EN_C("EN_FLOW"));
Description: Get a particular attribute for all nodes at a given time.
Returns: An array of node attribute values. (Table)
Parameters:
Example:
--[[ Example for ENR_getNodeAttribute ]] --[[ Retrieves a node attribute. Parameters: node index, attribute code. Returns: Attribute value. ]] local nodeElevation = ENR_getNodeAttribute(1, EN_C("EN_ELEVATION")); print("Node elevation: " .. nodeElevation);
Description: Get a particular attribute for all links at a given time.
Parameters:
Example:
--[[ Example for ENRgetLinkAttribute ]] --[[ Retrieves a link attribute. Parameters: link index, attribute code. Returns: Attribute value. ]] local linkLength = ENRgetLinkAttribute(1, EN_C("EN_LENGTH")); print("Link length: " .. linkLength);
Description: Get all attributes for a node at a given time.
Returns: An array of node result values. (Table)
Parameters:
Example:
--[[ Example for ENRgetNodeResult ]] --[[ Retrieves a node result for a specific time period. Parameters: node index, property code, time period. Returns: Result value. ]] local nodePressure = ENRgetNodeResult(1, EN_C("EN_PRESSURE"), 3600); print("Node pressure: " .. nodePressure);
Description: Get all attributes for a link at a given time.
Returns: An array of link result values. (Table)
Parameters:
Example:
--[[ Example for ENRgetLinkResult ]] --[[ Retrieves a link result for a specific time period. Parameters: link index, property code, time period. Returns: Result value. ]] local linkFlow = ENRgetLinkResult(1, EN_C("EN_FLOW"), 3600); print("Link flow: " .. linkFlow);
Description: Clears the current error status.
Parameters: None
Example:
--[[ Example for ENRclearError ]] --[[ Clears the EPANET-Risk error code. No parameters. No return value. ]] ENRclearError();
Description: Checks the current error status.
Returns: The current error code. (String)
Parameters: None
Example:
Example for ENRcheckError\n Checks for EPANET errors and returns the error message if any.\n--]]\nlocal errorMessage = ENRcheckError()\nif errorMessage ~= \"\" then\n print(\"EPANET Error: \" .. errorMessage)\nelse\n print(\"No EPANET errors.\")\nend
Description: Verifies that all input data has been entered correctly. (Beta version.)
Parameters: None
Example:
--[[ Example for ENVerifyInput ]] --[[ Verifies the EPANET input file. No parameters. Returns: Error code. ]] local errorCode = ENVerifyInput(); print("Input verification result: " .. errorCode);
Description: Verifies that a string is valid to be used as an EPANET object ID.
Parameters:
Example:
--[[ Example for ENIsIDValid ]] --[[ Checks if an ID name is valid. Parameters: ID name. Returns: 1 if valid, 0 if not. ]] local isValid = ENIsIDValid("ValidID"); print("Is ValidID valid? " .. isValid);
Description: Adds a header line to the report.
Returns: This function adds a header line to the report with specified text, size, and color. (Void)
Parameters:
Example:
--[[ Adds a header line to report. Parameters: Text, size of the font, css color name Example: This example adds word 'Hello', in red, with font number 12, to output --]] print('Hello', 12, 'red')
Description: Adds a paragraph to the report.
Returns: This function adds a paragraph to the report with specified text, color, and an optional label. (Void)
Parameters:
Example:
--[[ Prints a paragraph to the output. Parameter: Text string. Example: Print a simple paragraph. --]] printp('This is a paragraph of text.','red','Source')
Description: Adds a line of HTML tags to the report body.
Returns: This function adds a line of HTML code to the report body. (Void)
Parameters:
Example:
--[[ Prints HTML formatted text to the output. Parameter: HTML string. Example: Print a link using HTML. --]] printHTML('<p>Click <a href="https://example.com">here</a> for more info.</p>')
Description: Clears the report.
Returns: This function clears the report. (Void)
Parameters: None
Example:
--[[ Clears the report. Example: Clears the current report. --]] clear()
Description: List of all elements in the current project.
Returns: This function lists all elements in the current project. (Void)
Parameters:
Example:
--[[ Lists all elements in the current project. Example: List all elements. --]] ListElements()
Description: List of all objects in the current project tree.
Returns: This function lists all objects in the current project tree. (Void)
Parameters:
Example:
--[[ Lists all objects in the current project. Example: List all objects. --]] ListObjects()
Description: List of all available commands in the Lua script editor.
Returns: This function lists all available commands in the Lua script editor. (Void)
Parameters: None
Example:
--[[ Lists all available commands with their required parameters. Example: List all commands. --]] ListCommands()
Description: List of all available types in the Lua script editor.
Returns: This function lists all available types in the Lua script editor. (Void)
Parameters: None
Example:
--[[ Lists all available element types and their tags. Example: List all element types. --]] ListTypes()
Description: List of properties for a given type.
Returns: This function lists the properties for a given type. (Void)
Parameters:
Example:
--[[ Lists the properties for a specific element type. Parameter: Element type (e.g., 'PIPE'). Example: List properties for 'PIPE' elements. --]] ListTypeProperties('PIPE')
Description: Returns a Lua table containing properties of an element.
Returns: This function returns a Lua table containing the properties of an element. (Table)
Parameters:
Example:
--[[ Returns a Lua table containing properties of an element. Parameter: element tag. Returns: A list of lists, where each inner list represents a property. Example: Gets the properties of the element with tag 'myElement' and prints the first property's name. --]] local properties = GetTypeProperties('myElement') if properties and #properties > 0 then print(properties[1][1]) --[[ Prints the first property's name]] end
Description: Finds objects with the same tag in the current project.
Returns: This function finds objects with the same tag in the current project and automatically fixes the tag if the value is set to true. (Void)
Parameters:
Example:
--[[ Checks for duplicate element tags. Parameter: Boolean value (true to fix duplicate tags, false to disable fix). Example: duplicate element tags checking and fixing. --]] CheckDuplicate(true)
Description: Lists all nodes in the current project.
Returns: This function lists all nodes in the current project. (Void)
Parameters:
Example:
--[[ Lists all nodes in the current project. Example: List all nodes. --]] ListNodes()
Description: Lists all links in the current project.
Returns: This function lists all links in the current project. (Void)
Parameters:
Example:
--[[ Lists all links in the current project. Example: List all links. --]] ListLinks()
Description: Returns an iterator for iterating through all system types.
Returns: A Lua iterator for iterating through all system types (Iterator)
Parameters: None
Example:
--[[ Example for GetSystemTypes ]] --[[ Returns all system types. ]] for type in GetSystemTypes() do print(type) end
Description: Creates a new metric project.
Parameters: None
Example:
--[[ Creates a new project using metric units. Example: Start a new metric project. --]] CreateNewMetricProject()
Description: Creates a new imperial project.
Parameters: None
Example:
--[[ Creates a new project using imperial units. Example: Creates a new project with imperial units. --]] CreateNewImperialProject()
Description: Clears input objects.
Parameters: None
Example:
--[[ Clears the current input buffer. This is often used before adding new points or elements. Example: Clear any previous inputs. --]] InputClear()
Description: Adds an enter key to input objects.
Parameters: None
Example:
--[[ Simulates pressing the Enter key, often used to finalize an input sequence. Example: Finalize the element creation. --]] InputAddEnterKey()
Description: Adds an element to input objects.
Parameters:
Example:
--[[ Adds an element to the input buffer, often used in conjunction with CreateElement. Parameter: Element tag. Example: Add two fixture elements to the input. --]] InputClear InputAddPoint(1, 1, 0) local fixture1 = CreateElement2('FIXTURE')[1] InputClear InputAddPoint(2, 2, 0) local fixture2 = CreateElement2('FIXTURE')[1] InputAddElement(fixture1) InputAddElement(fixture2)
Description: Adds a point to input objects.
Parameters:
Example:
--[[ Adds a point to the input buffer. Parameters: x, y, z coordinates of the point. Example: Add a point at coordinates (0, 0, 0). --]] InputAddPoint(0, 0, 0)
Description: Returns the current date and time formatted using Microsoft Standard date and time format strings.
Returns: The formatted current date and time (String)
Parameters:
Example:
--[[ Returns the current date and time. Parameter: data-time format. Returns: A string representing the current date and time. Example: Gets the current date and time. --]] local now = GetDateTimeNow("hh-mm-ss") print(now)
Description: Returns the active project's numerical property.
Returns: The value of the specified property (Depends)
Parameters:
Example:
--[[ Gets a project property. Parameter: Property name. Returns: The value of the project property. Example: Gets the project property named 'ProjectName'. --]] local projectName = GetProjectProperty('NAME') print(projectName)
Description: Sets the active project's numerical property.
Parameters:
Example:
--[[ Sets a project property. Parameter: Property tag, property value. Example: Sets the project property 'NAME' to 'My Project'. --]] SetProjectProperty('NAME', 'My Project')
Description: Outputs a Lua table.
Parameters:
Example:
--[[ Prints a table to the output. Parameters: A title string and the table to print. Example: Create and print a simple table. --]] local a = {} local header = {'Column 1', 'Column 2'} local row1 = {1, 2} local row2 = {3, 4} table.insert(a, header) table.insert(a, row1) table.insert(a, row2) printTable('My Table', a)
Description: Sets the working plane visibility.
Parameters:
Example:
--[[ Sets the visibility of the work plane. Parameter: Boolean value (true to show, false to hide). Example: Hides the work plane. --]] SetWorkPlaneVisibility(false)
Description: Sets the working plane position.
Parameters:
Example:
--[[ Sets the position of the work plane. Parameters: x, y, z coordinates. Example: Sets the work plane position to (5, 5, 5). --]] SetWorkPlanePosition(5, 5, 5)
Description: Sets the working plane rotation around coordinate axes.
Parameters:
Example:
--[[ Sets Working plane rotation around coordinate axis. Parameters: rotation angles around x, y and z (radian). Example: Rotates the working plane by 0.5 radians around the X-axis, 0.2 radians around the Y-axis, and 0.1 radians around the Z-axis. --]] SetWorkPlaneRotation(0.5, 0.2, 0.1)
Description: Marks the first run of the script.
Parameters: None
Example:
--[[ No parameters. Example: --]] SetFirstRun()
Description: Saves a string to a text file inside the app local folder.
Parameters:
Example:
--[[ Saves a string to a text file inside app local folder. Parameters: string, filename, folder name. Example: Saves the string 'Hello, world!' to a file named 'myFile.txt' in a folder named 'myFolder'. --]] SaveTextFile('Hello, world!', 'myFile.txt', 'myFolder')
Description: Returns the description of a type.
Returns: The description of the specified type (String)
Parameters:
Example:
--[[ Returns description of a type. Parameter: type tag. Example: Gets the description of the 'BUILDING' type. --]] local description = GetTypeDescription('BUILDING') print(description)
Description: Returns a project's variable value as a string.
Returns: The value of the project's variable as a string (String)
Parameters:
Example:
--[[ Returns a project's variable value as a string. Parameter: variable name. Example: Gets the value of the project variable named 'myVariable'. --]] local variableValue = GetProjectVariable('myVariable') print(variableValue)
Description: Returns a project's variable value as a number.
Returns: The value of the project's variable as a number (Number)
Parameters:
Example:
--[[ Returns a project's variable value as a number. Parameter: variable name. Example: Gets the numerical value of the project variable named 'myVariable'. --]] local variableNumber = GetProjectVariableAsNumber('myVariable') print(variableNumber)
Description: Sets a project's variable value.
Parameters:
Example:
--[[ Sets a project's variable value. Parameter: variable name, variable value. Example: Sets the value of the project variable named 'myVariable' to 'hello'. --]] SetProjectVariable('myVariable', 'hello')
Description: Renames a project variable.
Parameters:
Example:
--[[ Renames a project variable. Parameters: old variable name, new variable name. Example: Renames the project variable 'oldVariable' to 'newVariable'. --]] RenameProjectVariable('oldVariable', 'newVariable')
Description: Sets a project variable's name.
Parameters:
Example:
--[[ Sets a project variable's name. Parameters: variable number (0 to 19), new variable name. Example: Sets the name of the project variable at index 1 to 'newVariableName'. --]] SetProjectVariableName(1, 'newVariableName')
Description: Sets the project's time.
Parameters:
Example:
--[[ Sets project's time. Parameters: hour (0-23), minute (0-59), second (0-59). Example: Sets the project time to 10:30:45. --]] SetProjectTime(10, 30, 45)
Description: Returns a Lua table containing the project's time.
Returns: A table containing project's time (hour, minute, second) (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing project's time. Returns: { hour, minute, second }. Example: Gets the project time and prints the hour. --]] local time = GetProjectTime() print(time[1]) --[[ Prints the hour]]
Description: Sets the project's sunrise time.
Parameters:
Example:
--[[ Sets project's sunrise time. Parameters: hour (0-23), minute (0-59), second (0-59). Example: Sets the project sunrise time to 06:15:00. --]] SetProjectSunrise(6, 15, 0)
Description: Returns a Lua table containing the project's sunrise time.
Returns: A table containing project's sunrise time (hour, minute, second) (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing project's sunrise time. Returns: { hour, minute, second }. Example: Gets the project sunrise time and prints the minute. --]] local sunrise = GetProjectSunrise() print(sunrise[2]) --[[ Prints the minute]]
Description: Sets the project's sunset time.
Parameters:
Example:
--[[ Sets project's sunset time. Parameters: hour (0-23), minute (0-59), second (0-59). Example: Sets the project sunset time to 18:45:30. --]] SetProjectSunset(18, 45, 30)
Description: Returns a Lua table containing the project's sunset time.
Returns: A table containing project's sunset time (hour, minute, second) (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing project's sunset time. Returns: { hour, minute, second }. Example: Gets the project sunset time and prints the second. --]] local sunset = GetProjectSunset() print(sunset[3]) --[[ Prints the second]]
Description: Sets the project's date.
Parameters:
Example:
--[[ Sets project date. Parameters: year (1-9999), month (1-12), day (1-31). Example: Sets the project date to January 15, 2025. --]] SetProjectDate(2025, 1, 15)
Description: Returns a Lua table containing the project's date.
Returns: A table containing project's date (year, month, day) (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing project date. Returns: { year, month, day }. Example: Gets the project date and prints the year. --]] local date = GetProjectDate() print(date[1]) --[[ Prints the year]]
Description: Returns true if the project's time is between the project's sunrise and sunset.
Returns: true if it is daytime, false if it is nighttime (Boolean)
Parameters: None
Example:
--[[ Returns true if project time is between project sunrise and project sunset. Example: Checks if it is currently daytime in the project. --]] local isDaytime = IsDay() print(isDaytime)
Description: Returns a Lua table containing the direction vector of the sunlight.
Returns: A table containing the direction vector of the sunlight (x, y, z) (Table)
Parameters: None
Example:
--[[ Returns a Lua table containing project's sun light direction vector. Returns: { x, y, z }. Example: Gets the sun light direction vector and prints the x component. --]] local direction = GetSunLightDirection() print(direction[1]) --[[ Prints the x component]]
Description: Gets the position data for a specified object.
Returns: Returns a Lua table containing position data with the following fields: x: X-coordinate of the object, y: Y-coordinate of the object, z: Z-coordinate of the object (Table)
Parameters:
Example:
--[[ Returns a Lua table containing element position coordinates. Parameter: element tag. Returns: { x, y, z }. Example: Gets the position of the element with tag 'myElement'. --]] local position = GetPosition('myElement') print(position[1], position[2], position[3]) --[[ Prints x, y, and z]]
Description: Raises an exception with the given error message.
Parameters:
Example:
--[[ Raises an exception. Parameter: exception message. Example: Raises an error with the message 'Invalid input'. --]] RaiseError('Invalid input')
Description: Opens the application's local folder.
Parameters: None
Example:
--[[ Opens Application's Local Folder. Example: Opens the application's local folder. --]] OpenAppLocalFolder()
Description: Opens the application's temporary folder.
Parameters: None
Example:
--[[ Opens Application's Temporary Folder. Example: Opens the application's temporary folder. --]] OpenAppTemporaryFolder()
Description: Opens the application's working folder.
Parameters:
Example:
--[[ Opens Application's Working Folder. Parameter: (optional) Subfolder name. Example: Opens the application's working folder. --]] OpenAppWorkingFolder()
Description: Opens the application's local cache folder.
Parameters: None
Example:
--[[ Opens Application's Local Cache Folder. Example: Opens the application's local cache folder. --]] OpenAppLocalCacheFolder()
Description: Returns a Lua table containing a list of information about specific regions.
Returns: Output: A Lua table containing region information. (Table)
Parameters: None
Example:
--[[ Returns a lua table containing a list of information about specific regions. Returns: A list of lists, where each inner list contains information about a region. Example: Gets information about regions and prints the first region's information. --]] local regions = RegionsInfo() if regions and #regions > 0 then for i, value in ipairs(regions[1]) do print(i, value) end end
Description: Checks if a table represents a simple polygon.
Returns: True if the polygon is simple, false otherwise. (Boolean)
Parameters:
Example:
--[[ Example for IsSimplePolygon ]] --[[ Check if a polygon formed by a set of points is simple. Parameters: a lua table containing the points ]] local simplePolygon = IsSimplePolygon({{0, 0}, {1, 1}, {2, 0}, {1, -1}}); print("Is the polygon simple? " .. tostring(simplePolygon));
Description: Checks if a table represents a convex polygon.
Returns: True if the polygon is convex, false otherwise. (Boolean)
Parameters:
Example:
--[[ Example for IsConvexPolygon ]] --[[ Check if a polygon formed by a set of points is convex. Parameters: a lua table containing the points ]] local convexPolygon = IsConvexPolygon({{0, 0}, {1, 1}, {2, 0}, {1, -1}}); print("Is the polygon convex? " .. tostring(convexPolygon));
Description: Calculates the convex hull of a set of 2D points.
Returns: Returns a table of points that form the convex hull of the input set of points. (Table)
Parameters:
Example:
--[[ Example for GetConvexHull ]] --[[ Returns the convex hull of the given points. Parameters: points ]] local points = { {-50, 40}, {20, 40}, {80, 40}, {-50, 10}, {-10, 10}, {10, 10}, {-10, -10}, {30, -10}, {80, -10}, {-50, -40}, {-10, -40}, {30, -40}, {80, -40} }; local hull = GetConvexHull(points); print("Convex Hull Points:"); for i, point in ipairs(hull) do print("Point " .. i .. ": X = " .. point[1] .. ", Y = " .. point[2]); end
Description: Checks if a point is inside a convex polygon.
Returns: Returns true if the point is inside the convex polygon or on its edge. (Boolean)
Parameters:
Example:
--[[ Example for IsPointInConvexPolygon ]] --[[ Returns true if the point is inside the convex polygon. Parameters: polygonPoints (table), point (table) ]] local polygon = { {0, 0}, {10, 0}, {10, 10}, {0, 10} }; local point = {5, 5}; local inside = IsPointInConvexPolygon(polygon, point); print("Is point inside polygon: " .. tostring(inside));
Description: Processes 2D points and partition definitions to generate walls and partition wall sequences.
Returns: Returns a table with two entries: { [1] = list of walls as point index pairs, [2] = list of wall index sequences for each partition including the global space. } (Table)
Parameters:
Example:
--[[ Processes a list of 2D points and a set of partition definitions to compute wall segments and partition wall sequences. --]] local points = { {-50, 40}, {20, 40}, {80, 40}, {-50, 10}, {-10, 10}, {10, 10}, {-10, -10}, {30, -10}, {80, -10},{-50,-40}, {-10, -40}, {30, -40}, {80, -40} } local partitions = { {2, 3, 9, 8, 6}, {1, 2, 6, 5, 4}, {4, 5, 7, 11, 10}, { 5, 6, 8, 7}, {7, 8, 12, 11}, {8, 9, 13, 12} } printp('Input Points:', 'magenta') for i, pt in ipairs(points) do printp(i .. ': {' .. pt[1] .. ', ' .. pt[2] .. '}', 'yellow') end printp('Partition Definitions (point indices):', 'magenta') for i, part in ipairs(partitions) do local s = 'Partition ' .. i .. ': {' for j, idx in ipairs(part) do s = s .. idx .. (j < #part and ', ' or '') end s = s .. '}' printp(s, 'cyan') end local result = ProcessWalls(points, partitions) local walls = result[1] local partitionWallSequences = result[2] printp('All Walls:', 'green') for i, wall in ipairs(walls) do printp('Wall ' .. i .. ': {' .. wall[1] .. ', ' .. wall[2] .. '}', 'yellow') end printp('Partition Wall Sequences:', 'green') for i, seq in ipairs(partitionWallSequences) do local s = 'Partition ' .. i .. ': {' for j, w in ipairs(seq) do s = s .. w if j < #seq then s = s .. ', ' end end s = s .. '}' printp(s, 'cyan') end
Description: Returns Material ID of a homogen body.
Returns: Material ID. (String)
Parameters:
Example:
--[[ Example for GetMaterialID ]] --[[ Returns Material ID of a homogen body. Parameter: element tag ]] local materialId = GetMaterialID("elementTag"); --[[ Replace \"elementTag\" with the actual element tag]] print("Material ID: " .. materialId);
Description: Sets layer material ID of an element.
Parameters:
Example:
--[[ Example for SetLayerMaterialID ]] --[[ Sets layer material ID of an element. Parameter: element tag, layernumber, material id ]] SetLayerMaterialID("elementTag", 0, "S30", 1); --[[ Replace with actual values]]
Description: Sets layer thickness of an element.
Parameters:
Example:
--[[ Example for SetLayerThickness ]] --[[ Sets layer thickness of an element. Parameter: element tag, layernumber, thickness, (optional) 1 or 2 for elements with double multi-layer body ]] SetLayerThickness("elementTag", 0, 0.05, 1); --[[ Replace with actual values]]
Description: Creates a new instance of a material and adds it to the materials collection.
Parameters:
Example:
--[[ Example for MaterialAddtoCollection ]] --[[ Creates a new instance of material and adds it to materials collection.Parameters: Material tag, Material ID ]] MaterialAddtoCollection("HRSteel", "S30"); --[[ Replace with actual values]]
Description: Returns tags for all materials in the material collection.
Returns: A Lua table containing tags for all materials. (Iterator)
Parameters: None
Example:
--[[ Example for MaterialGetCollectionTags ]] --[[ Returns tags for all materials in material collection ]] for tag in MaterialGetCollectionTags() do print("Material Tag: " .. tag); end
Description: Lists all numerical properties of a material with a given tag.
Parameters:
Example:
--[[ Example for MaterialListProperties ]] --[[ Lists all numerical properties of a material with given tag. Parameter: material tag ]] MaterialListProperties("materialTag"); --[[ Replace with actual value]]
Description: Returns the property of the given material.
Returns: The property value. (Depends)
Parameters:
Example:
--[[ Example for MaterialGetProperty ]] --[[ Returns property of given material. Parameters: material tag, Property Tag ]] local propertyValue = MaterialGetProperty("materialTag", "PropertyTag"); --[[ Replace with actual values]] print("Property Value: " .. tostring(propertyValue));
Description: Sets the property of the given material.
Parameters:
Example:
--[[ Example for MaterialSetProperty ]] --[[ Sets property of given material. Parameters: material tag, Property Tag, Value ]] MaterialSetProperty("materialTag", "PropertyTag", 20); --[[ Replace with actual values]]
Description: Lists all materials in the built-in library.
Parameters: None
Example:
--[[ Example for ListMaterialsLibrary ]] --[[ Lists all materials in the built-in library. ]] ListMaterialsLibrary();
Description: Returns the Material ID of the liquid distribution system of an element.
Returns: Material ID. (String)
Parameters:
Example:
--[[ Example for GetElementLiquidID ]] --[[ Returns Material ID of the liquid distribution system of an element. Parameter: (optional) element tag ]] local liquidId = GetElementLiquidID("elementTag"); --[[ Replace \"elementTag\" with the actual element tag]] print("Element Liquid ID: " .. liquidId);
Description: Returns the Material ID of a Liquid distribution system.
Returns: Material ID. (String)
Parameters:
Example:
--[[ Example for GetSystemLiquidID ]] --[[ Returns Material ID of a Liquid distribution system. Parameter: (optional) System name ]] local systemLiquidId = GetSystemLiquidID("systemName"); --[[ Replace \"systemName\" with the actual system name]] print("System Liquid ID: " .. systemLiquidId);
Description: Returns the number of layers for a given multi-layer body name.
Returns: Number of layers. (Int)
Parameters:
Example:
--[[ Example for GetLayersCount ]] --[[ Returns number of layers for a given multi-layer body name.Parameter: element tag, (optional) 1 or 2 for elements with double multi-layer body ]] local layerCount = GetLayersCount("elementTag", 1); --[[ Replace with actual values]] print("Layer Count: " .. layerCount);
Description: Sets the number of layers for a given multi-layer body name.
Parameters:
Example:
--[[ Example for SetLayersCount ]] --[[ Sets number of layers for a given multi-layer body name.Parameter: element tag, number of layers, (optional) 1 or 2 for elements with double multi-layer body ]] SetLayersCount("elementTag", 3, 1); --[[ Replace with actual values]]
Description: Returns a Lua table containing data for layers in a given multi-layer body name.
Returns: A Lua table containing data for layers. (Table)
Parameters:
Example:
--[[ Example for GetLayers ]] --[[ Returns a Lua table containing data for layers in a given multi-layer body. ]] --[[ This example creates a new project, adds a floor, and then retrieves and prints the floor's layer data. ]] CreateNewMetricProject(); InputClear(); InputAddPoint(0,0,0); --[[ Create a floor ]] local floorTag = CreateElement2('BUILDING')[2]; local layers = GetLayers(floorTag, 1); if layers then print("Layers for Floor: " .. floorTag) for i, layer in ipairs(layers) do print(" Layer " .. i .. ":") for j, property in ipairs(layer) do print(" " .. property[1] .. ": " .. tostring(property[2])); end end else print("No layers found for the floor: " .. floorTag); end
Description: Clears the material collection.
Parameters: None
Example:
--[[ Example for MaterialClearCollection ]] --[[ Clears material collection ]] MaterialClearCollection();
Description: Checks if a material tag exists.
Returns: True if the material tag exists, otherwise false. (Boolean)
Parameters:
Example:
--[[ Example for CheckMaterialTagExists ]] --[[ Checks if a material tag exists.Parameters: material tag. Returns true or false ]] local tagExists = CheckMaterialTagExists("PROJECT_AIR"); --[[ Replace with actual value]] print("Tag Exists: " .. tostring(tagExists));
Description: Returns the value of a number raised to the power of another number.
Returns: The result of x raised to the power of y. (Number)
Parameters:
Example:
--[[ Example for Pow ]] --[[ Returns a specified number raised to the specified power. Parameters: number, value ]] local result = Pow(2, 3); print("2 raised to the power of 3 is: " .. result);
Description: Returns the value of a number rounded to a specified number of digits.
Returns: The number rounded to the specified number of digits. (Number)
Parameters:
Example:
--[[ Example for Round ]] --[[ Returns the largest integer less than or equal to the specified double precision floating-point value. Parameters: number, decimals ]] local roundedValue = Round(3.14159, 2); print("3.14159 rounded to 2 decimals is: " .. roundedValue);
Description: Returns the middle value of five numbers.
Returns: The middle value of the five numbers. (Number)
Parameters:
Example:
--[[ Example for MiddleNumber ]] --[[ Returns Y value of a specified X, on a line between 2 points. Parameters: X, X1, Y1, X2, Y2 ]] local middleY = MiddleNumber(5, 0, 0, 10, 10); print("The Y value at X=5 between (0,0) and (10,10) is: " .. middleY);
Description: Parses and evaluates a mathematical expression.
Returns: The result of the parsed expression. (Number)
Parameters:
Example:
--[[ Example for ParseMathExpression ]] --[[ Parses a mathematical expression written in Lua language and returns it's value. Parameters: mathematical expression, variable, value ]] local expressionResult = ParseMathExpression("2 * x + 1", "x", 5); print("The result of the expression 2 * x + 1 where x = 5 is: " .. expressionResult);
Description: Converts a double to a fraction string.
Returns: The fraction string representation of the number. (String)
Parameters:
Example:
--[[ Example for Double2Fraction ]] --[[ Returns a number in fraction form. Parameters: number ]] local fraction = Double2Fraction(0.75); print("0.75 as a fraction is: " .. fraction);
Description: Adds a new Modelica package.
Returns: Address of the created package. (String)
Parameters:
Example:
--[[ Example for ModelicaAddPackage ]] --[[ Creates a new package and adds it to the given address. parameters: package address, name, (optional) description. returns new package address ]] local newPackageAddress = ModelicaAddPackage("", "MyPackage", "A package description"); print("New package address: " .. newPackageAddress);
Description: Adds a new Modelica model.
Returns: Address of the created model. (String)
Parameters:
Example:
--[[ Example for ModelicaAddModel ]] --[[ Creates a new model and adds it to the given address. parameters: package address, name, (optional) description. returns new model address ]] local newModelAddress = ModelicaAddModel(newPackageAddress, "MyModel", "A model description"); print("New model address: " .. newModelAddress);
Description: Adds a new component to a Modelica model.
Returns: Address of the created component. (String)
Parameters:
Example:
--[[ Example for ModelicaAddComponent ]] --[[ Creates a new component and adds it to the given address. parameters: model address, type, name, (optional) description. returns new variable address ]] local newComponentAddress = ModelicaAddComponent(newModelAddress, "Modelica.Mechanics.Rotational.Components.Inertia", "inertia1", "An inertia component"); print("New component address: " .. newComponentAddress);
Description: Adds a new Real variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddRealVariable ]] --[[ Creates a new real variable and adds it to the given address. parameters: model or component address, name, (optional) description. returns new variable address ]] local newRealVariableAddress = ModelicaAddRealVariable(newModelAddress, "time", "Time variable"); print("New real variable address: " .. newRealVariableAddress);
Description: Adds a new Integer variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddIntegerVariable ]] --[[ Creates a new integer variable and adds it to the given address. parameters: model or component address, name, (optional) description. returns new variable address ]] local newIntegerVariableAddress = ModelicaAddIntegerVariable(newModelAddress, "counter", "Counter variable"); print("New integer variable address: " .. newIntegerVariableAddress);
Description: Adds a new String variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddStringVariable ]] --[[ Creates a new string variable and adds it to the given address. parameters: model or component address, name, (optional) description. returns new variable address ]] local newStringVariableAddress = ModelicaAddStringVariable(newModelAddress, "modelName", "Name of the model"); print("New string variable address: " .. newStringVariableAddress);
Description: Adds a new Boolean variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddBooleanVariable ]] --[[ Creates a new boolean variable and adds it to the given address. parameters: model or component address, name, (optional) description. returns new variable address ]] local newBooleanVariableAddress = ModelicaAddBooleanVariable(newModelAddress, "running", "Boolean status"); print("New boolean variable address: " .. newBooleanVariableAddress);
Description: Adds a new SI unit variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddSIVariable ]] --[[ Creates a new physical variable from the Modelica Standard Library, and adds it to the given address. parameters: model or component address, type name, variable name, (optional) description. returns new variable address ]] --[[ You can use ListQuantities() command to find the quantity SI name.]] local newSIVariableAddress = ModelicaAddSIVariable(newModelAddress, "AngularVelocity", "omega", "Angular velocity"); print("New SI variable address: " .. newSIVariableAddress);
Description: Adds a new derived variable to a Modelica model.
Returns: Address of the created variable. (String)
Parameters:
Example:
--[[ Example for ModelicaAddDerivedVariable ]] --[[ Creates a new physical variable, and adds it to the given address. parameters: model or component address, quantity tag, variable name, (optional) description. returns new variable address ]] local newDerivedVariableAddress = ModelicaAddDerivedVariable(newModelAddress, "Torque", "torque", "Output torque"); print("New derived variable address: " .. newDerivedVariableAddress);
Description: Saves a Modelica package to a file.
Parameters:
Example:
--[[ Example for ModelicaSavePackage ]] --[[ Saves the package as .mo file in the app local folder. parameter: file name ]] ModelicaSavePackage( "MyPackage"..GetDateTimeNow("hh mm")..".mo");OpenAppWorkingFolder("MOD");
Description: Clears all Modelica data.
Parameters: None
Example:
--[[ Example for ModelicaClearAll ]] --[[ Removes all nested packages. ]] ModelicaClearAll();
Description: Sets a Modelica variable as a parameter.
Parameters:
Example:
--[[ Example for ModelicaSetAsParameter ]] --[[ Sets variable with given address as Modelica parameter. parameters: variable address. ]] ModelicaSetAsParameter(newRealVariableAddress);
Description: Sets the start value for a Modelica variable.
Parameters:
Example:
--[[ Example for ModelicaSetStart ]] --[[ Sets start value of a variable with given address as Modelica parameter. parameters: variable address, start value. ]] ModelicaSetStart(newRealVariableAddress, "0.01");
Description: Sets the unit for a Modelica variable.
Parameters:
Example:
--[[ Example for ModelicaSetUnit ]] --[[ Sets unit of a variable with given address as Modelica parameter. parameters: variable address, unit. ]] ModelicaSetUnit(newRealVariableAddress, "Modelica.SIunits.rad/s");
Description: Sets an annotation for a Modelica object.
Parameters:
Example:
--[[ Example for ModelicaSetAnnotation ]] --[[ Sets annotation value of a Modelica object with given address. parameters: object address, annotation value. ]] ModelicaSetAnnotation(newModelAddress, "Placement(visible = true, transformation(origin = {0, 0}))");
Description: Extends a Modelica model.
Parameters:
Example:
--[[ Example for ModelicaExtendModel ]] --[[ Sets inheritance of a model with given address. parameters: model address, package name. ]] ModelicaExtendModel(newModelAddress, "Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlange");
Description: Modifies a Modelica model.
Parameters:
Example:
--[[ Example for ModelicaModifyModel ]] --[[ Adds a modification clause to a model definition with given address. parameters: model address, modification clause. ]] ModelicaModifyModel(newModelAddress, "inertia1.flange.use_support = true");
Description: Adds an equation to a Modelica model.
Parameters:
Example:
--[[ Example for ModelicaAddEquation ]] --[[ Adds an equation to a model with given address. parameters: model address, equation. ]] ModelicaAddEquation(newModelAddress, "inertia1.flange.tau = torque");
Description: Adds an initial equation to a Modelica model.
Parameters:
Example:
--[[ Example for ModelicaAddInitialEquation ]] --[[ Adds an initial equation to a model with given address. parameters: model address, equation. ]] ModelicaAddInitialEquation(newModelAddress, "Modelica.Math.sin(time) = 0");
Description: Imports a Modelica model.
Parameters:
Example:
--[[ Example for ModelicaModelImport ]] --[[ Adds an import line to a model definition with given address. parameters: model address, import expression. ]] ModelicaModelImport(newModelAddress, "import Modelica.Math.sin;");
Description: Adds a connection between two Modelica components.
Returns: Address of the created connection. (String)
Parameters:
Example:
--[[ Example for ModelicaAddConnection ]] --[[ Adds a connection between two components. parameters: model address, component 1 address, component 1 port name, component 2 address, component 2 port name. returns new connection address ]] local connectionAddress = ModelicaAddConnection(newModelAddress, "inertia1", "flange", "motor", "flange"); print("New connection address: " .. connectionAddress);
Description: Retrieves the address of a Modelica object given its name.
Returns: Address of the Modelica object. (String)
Parameters:
Example:
--[[ Example for ModelicaGetAddressFromName ]] --[[ Returns address of a Modelica object with given name. parameter: object name. returns object address. ]] local objectAddress = ModelicaGetAddressFromName("inertia1"); print("Object address: " .. objectAddress);
Description: Adds a start attribute to a Modelica component.
Parameters:
Example:
--[[ Example for ModelicaComponentAddStartAttribute ]] --[[ Adds an start-attribute to a component with given address. parameters: component address, start-attribute. ]] ModelicaComponentAddStartAttribute(newComponentAddress, "initw = 5");
Description: Sets a Modelica component as inner.
Parameters:
Example:
--[[ Example for ModelicaSetInner ]] --[[ Sets a component as inner. parameters: component address ]] ModelicaSetInner(newComponentAddress);
Description: Sets a Modelica component as outer.
Parameters:
Example:
--[[ Example for ModelicaSetOuter ]] --[[ Sets a component as outer. parameters: component address ]] ModelicaSetOuter(newComponentAddress);
Description: Returns a Lua table containing list of wire gauges and diameters.
Returns: A Lua table containing wire gauges and diameters. (Table)
Parameters: None
Example:
--[[ Example for GetWireGauges ]] --[[ Returns a Lua table containing list of wire gauges and diameters.]] local wireGauges = GetWireGauges() for i, gauge in ipairs(wireGauges) do print("Gauge: " .. gauge[1] .. ", Diameter: " .. gauge[2]) end
Description: Returns a Lua table containing pipe outside diameters and wall thicknesses from ASME B36.10.
Returns: A Lua table containing pipe outside diameters and wall thicknesses. (Table)
Parameters: None
Example:
--[[ Example for GetPipeDimensionsB3610 ]] --[[ Returns a Lua table containing pipe outside diameters and wall thicknesses. ]] local pipeDimensions = GetPipeDimensionsB3610() for schi, schj in ipairs(pipeDimensions) do print('*************', 18, 'blue'); printp('SCH: ' .. schj[1]); print(' '); for schi2, schj2 in ipairs(schj[2]) do print(' '); printp('NOMINAL SIZE: ' .. schj2[1]); printp('OUTSIDE_DIAMETER: ' .. schj2[2]); printp('WALL_THICKNESS: ' .. schj2[3]); end end
Description: Returns a Lua table containing nominal pipe sizes from ASME B36.10.
Returns: A Lua table containing nominal pipe sizes. (Table)
Parameters: None
Example:
--[[ Example for GetNominalPipeSizesB3610]] --[[ Returns a Lua table containing nominal pipe sizes.]] local nominalSizes = GetNominalPipeSizesB3610() for i, size in ipairs(nominalSizes) do print("Nominal Pipe Size: " .. size) end
Description: Returns a Lua table containing pipe diametre nominals from ASME B36.10.
Returns: A Lua table containing pipe diametre nominals. (Table)
Parameters: None
Example:
--[[ Example for GetDiametreNominalsB3610]] --[[ Returns a Lua table containing pipe diametre nominal.]] local diameterNominals = GetDiametreNominalsB3610() for i, nominal in ipairs(diameterNominals) do print("Diameter Nominal: " .. nominal[1] .. ", Value: " .. nominal[2]) end
Description: Returns a Lua table containing pipe outside diameters from ASME B36.10.
Returns: A Lua table containing pipe outside diameters. (Table)
Parameters: None
Example:
--[[ Example for GetOutsideDiametersB3610]] --[[ Returns a Lua table containing pipe outside diameters.]] local outsideDiameters = GetOutsideDiametersB3610() for i, diameter in ipairs(outsideDiameters) do print("Outside Diameter: " .. diameter[1] .. ", Value: " .. diameter[2]) end
Description: Returns a Lua table containing pipe schedule names from ASME B36.10.
Returns: A Lua table containing pipe schedule names. (String)
Parameters: None
Example:
--[[ Example for GetScheduleNamesB3610]] --[[ Returns a Lua table containing pipe schedule names from ASME B36.10.]] local scheduleNames = GetScheduleNamesB3610() for i, name in ipairs(scheduleNames) do print("Schedule Name: " .. name) end
Description: Returns a Lua table containing pipe type names from ASTM B88.
Returns: A Lua table containing pipe type names. (String)
Parameters: None
Example:
--[[ Example for GetTypesNamesB88]] --[[ Returns a Lua table containing pipe type names from ASTM B88.]] local typeNames = GetTypesNamesB88() for i, name in ipairs(typeNames) do print("Type Name: " .. name) end
Description: Returns a Lua table containing nominal pipe sizes from ASTM B88.
Returns: A Lua table containing nominal pipe sizes. (String)
Parameters: None
Example:
--[[ Example for GetNominalPipeSizesB88]] --[[ Returns a Lua table containing nominal pipe sizes from ASTM B88.]] local nominalSizes = GetNominalPipeSizesB88() for i, size in ipairs(nominalSizes) do print("Nominal Pipe Size: " .. size) end
Description: Returns a Lua table containing diametre nominals from ASTM B88.
Returns: A Lua table containing diametre nominals. (Table)
Parameters: None
Example:
--[[ Example for GetDiametreNominalsB88]] --[[ Returns a Lua table containing diametre nominals from ASTM B88.]] local diameterNominals = GetDiametreNominalsB88() for i, nominal in ipairs(diameterNominals) do print("Diameter Nominal: " .. nominal[1] .. ", Value: " .. nominal[2]) end
Description: Returns a Lua table containing outside diameters from ASTM B88.
Returns: A Lua table containing outside diameters. (Table)
Parameters: None
Example:
--[[ Example for GetOutsideDiametersB88]] --[[ Returns a Lua table containing outside diameters from ASTM B88.]] local outsideDiameters = GetOutsideDiametersB88() for i, diameter in ipairs(outsideDiameters) do print("Outside Diameter: " .. diameter[1] .. ", Value: " .. diameter[2]) end
Description: Returns a Lua table containing pipe outside diameters and wall thicknesses from ASTM B88.
Returns: A Lua table containing pipe outside diameters and wall thicknesses. (Table)
Parameters: None
Example:
--[[ Example for GetPipeDimensionsB88 ]] --[[ Returns a Lua table containing pipe outside diameters and wall thicknesses from ASTM B88. ]] local pipeDimensions = GetPipeDimensionsB88() for i, entry in ipairs(pipeDimensions) do print("SCH: " .. entry[1]) for j, dim in ipairs(entry[2]) do print("__________________________ ") print("NOMINAL SIZE: " .. dim[1]) print("DIAMETER: " .. dim[2]) print("WALL THICKNESS: " .. dim[3]) end end
Description: Returns a Lua table containing flange dimensions from ASME B16.5.
Returns: A Lua table containing flange dimensions. (Table)
Parameters: None
Example:
--[[ Example for GetFlangeDimensionsB165 ]] --[[ Returns a Lua table containing flange dimensions from ASME B16.5. ]] local flangeDimensions = GetFlangeDimensionsB165() for i, flgj in ipairs(flangeDimensions) do print("***************************"); print("CLASS NAME: " .. flgj[1]); local classinfo = flgj[2]; for j, sizej in ipairs(classinfo) do print("___________________________"); print("NOMINAL SIZE: " .. sizej[1]); print("OUTSIDE_DIAMETER: " .. sizej[2]); print("WALL_THICKNESS: " .. sizej[3]); print("BOLT_CIRCLE_DIAMETER" .. sizej[4]); print("HOLE_DIAMETER: " .. sizej[5]); print("HOLE_NUMBER: " .. sizej[6]); end end
Description: Returns a Lua table containing data for a given shape: shape type. Parameters: EDI STD Nomenclature, parameter Tag
Returns: A Lua table containing data for a given shape. (Table)
Parameters:
Example:
--[[ Example for GetAISC_ShapeData ]] --[[ Returns a Lua table containing data for a given shape: shape type. ]] --[[ Parameters: EDI STD Nomenclature, parameter Tag ]] local shapeData = GetAISC_ShapeData("W14X30", "OVERALL_DEPTH") for i, data in ipairs(shapeData) do print("Data: " .. data) end
Description: Returns a Lua table containing EDI STD Nomenclature names for a specified shape type, from AISC database. Parameters: shape type, imperial units (true or false)
Returns: A Lua table containing EDI STD Nomenclature names for a specified shape type. (String)
Parameters:
Example:
--[[ Example for GetAISC_ShapeNames ]] --[[ Returns a Lua table containing EDI STD Nomenclature names for a specified shape type, from AISC database. ]] --[[ Parameters: shape type, imperial units (true or false) ]] local shapeNames = GetAISC_ShapeNames("W", true) for i, name in ipairs(shapeNames) do print("Shape Name: " .. name) end
Description: Displays a message.
Parameters:
Example:
--[[ Example for ShowMessage ]] --[[ Shows a message on the screen. ]] --[[ This function works only inside project script ]] ShowMessage('Hello, Lua!')
Description: Gets the current camera position.
Returns: A table containing the X, Y, and Z coordinates of the camera. (Table)
Parameters: None
Example:
--[[ Example for GetCameraPosition ]] --[[ Returns the camera's position as a table. ]] --[[ This function works only inside project script ]] local pos = GetCameraPosition() print('Camera Position: x=' .. pos[1] .. ', y=' .. pos[2] .. ', z=' .. pos[3])
Description: Sets the camera position.
Parameters:
Example:
--[[ Example for SetCameraPosition ]] --[[ Sets the camera's position. ]] --[[ This function works only inside project script ]] SetCameraPosition(10, 5, 0)
Description: Gets the current camera direction.
Returns: A table containing the X, Y, and Z direction components of the camera. (Table)
Parameters: None
Example:
--[[ Example for GetCameraDirection ]] --[[ Returns the camera's direction as a table. ]] --[[ This function works only inside project script ]] local dir = GetCameraDirection() print('Camera Direction: a=' .. dir[1] .. ', b=' .. dir[2] .. ', c=' .. dir[3])
Description: Sets the camera direction.
Parameters:
Example:
--[[ Example for SetCameraDirection ]] --[[ Sets the camera's direction. ]] --[[ This function works only inside project script ]] SetCameraDirection(0, 1, 0)
Description: Gets the number of times that the project script runs.
Returns: The number of intervals. (Int)
Parameters: None
Example:
--[[ Example for GetNumberOfIntervals ]] --[[ Returns the total number of script intervals. ]] --[[ This function works only inside project script ]] local intervals = GetNumberOfIntervals() print('Total Intervals: ' .. intervals)
Description: Gets the number of remaining intervals for the project script.
Returns: The number of remaining intervals. (Int)
Parameters: None
Example:
--[[ Example for GetRemainingIntervals ]] --[[ Returns the remaining number of script intervals. ]] --[[ This function works only inside project script ]] local remaining = GetRemainingIntervals() print('Remaining Intervals: ' .. remaining)
Description: Sets the number of times that the project script runs.
Parameters:
Example:
--[[ Example for SetNumberOfIntervals ]] --[[ Sets the number of script intervals. ]] --[[ This function works only inside project script ]] SetNumberOfIntervals(3)
Description: Returns the interval between project script runs, in milliseconds.
Returns: The interval between project script runs, in milliseconds. (Number)
Parameters: None
Example:
--[[ Example for GetScriptInterval ]] --[[ Returns the script interval in Seconds. ]] --[[ This function works only inside project script ]] local interval = GetScriptInterval() print('Script Interval: ' .. interval .. ' Seconds')
Description: Sets the interval between project script runs.
Parameters:
Example:
--[[ Example for SetScriptInterval ]] --[[ Sets the script interval in Seconds. ]] --[[ This function works only inside project script ]] SetScriptInterval(0.5)
Description: Adds a ray line to the list of raycast calculations.
Parameters:
Example:
--[[ Example for AddRay ]] --[[ Adds a ray for raycasting. ]] --[[ This function works only inside project script ]] AddRay(0, 0, 0, 0, 1, 0)
Description: Clears the list of raycast calculations.
Parameters: None
Example:
--[[ Example for ClearRays ]] --[[ Clears all rays. ]] --[[ This function works only inside project script ]] ClearRays()
Description: Calculates raycasts.
Parameters: None
Example:
--[[ Example for CalculateRaycasts ]] --[[ Calculates raycasts. ]] --[[ This function works only inside project script ]] if not ElementExists("OBJECT1") then ClearRays() InputClear(); InputAddPoint(0, 3, 0); local newElementTags = CreateElement2('FURNITURE'); SetProperty(newElementTags[1], "TAG", "OBJECT1"); UpdateScene(); end SetNumberOfIntervals(2); local interv; interv = GetRemainingIntervals(); if (interv > 1) then AddRay(0, 0, 0.5, 0, 1, 0) CalculateRaycasts() else local position = GetRaycastResultPosition(1) local direction = GetRayDirection(1) local normal = GetRaycastResultNormal(1) print('Hit Position: x=' .. position[1] .. ', y=' .. position[2] .. ', z=' .. position[3]) print('Ray Direction: a=' .. direction[1] .. ', b=' .. direction[2] .. ', c=' .. direction[3]) print('Hit Normal: x=' .. normal[1] .. ', y=' .. normal[2] .. ', z=' .. normal[3]) local distance = GetRaycastResultDistance(1) print('Hit Distance: ' .. distance) local tag = GetRaycastResultTag(1) print('Hit Tag: ' .. tag) end
Description: Gets the position of a raycast result.
Returns: A table containing the X, Y, and Z coordinates of the raycast result. (Table)
Parameters:
Example:
--[[ Example for GetRaycastResultPosition ]] --[[ Gets the hit position of a raycast. ]] --[[ This function works only inside project script ]] --[[ See CalculateRaycasts for a complete exmple]] local position = GetRaycastResultPosition(1) print('Hit Position: x=' .. position[1] .. ', y=' .. position[2] .. ', z=' .. position[3])
Description: Gets the normal vector of a raycast result.
Returns: A table containing the X, Y, and Z components of the normal vector. (Table)
Parameters:
Example:
--[[ Example for GetRaycastResultNormal ]] --[[ Gets the hit normal of a raycast. ]] --[[ This function works only inside project script ]] --[[ See CalculateRaycasts for a complete exmple]] local normal = GetRaycastResultNormal(1) print('Hit Normal: x=' .. normal[1] .. ', y=' .. normal[2] .. ', z=' .. normal[3])
Description: Gets the distance of a raycast result.
Returns: The distance of the raycast result. (Number)
Parameters:
Example:
--[[ Example for GetRaycastResultDistance ]] --[[ Gets the hit distance of a raycast. ]] --[[ This function works only inside project script ]] --[[ See CalculateRaycasts for a complete exmple]] local distance = GetRaycastResultDistance(1) print('Hit Distance: ' .. distance)
Description: Saves a screenshot.
Parameters:
Example:
--[[ Example for SaveScreenshot ]] --[[ Saves a screenshot. ]] --[[ This function works only inside project script ]] SaveScreenshot('screenshot.png') OpenAppWorkingFolder("IMG")
Description: Sets the screenshot scale.
Parameters:
Example:
--[[ Example for SetScreenshotScale ]] --[[ Sets the screenshot scale. ]] --[[ This function works only inside project script ]] SetScreenshotScale(800, 600)
Description: Adds a line to the scene.
Parameters:
Example:
--[[ Example for AddLine ]] --[[ Adds a temporary line. ]] --[[ This function works only inside project script ]] AddLine(0, 0, 0, 1, 1, 1, 255, 0, 0)
Description: Gets the tag of the element hit by a raycast.
Returns: The tag of the hit element. (String)
Parameters:
Example:
--[[ Example for GetRaycastResultTag ]] --[[ Gets the tag of the hit element of a raycast. ]] --[[ See CalculateRaycasts for a complete exmple]] local tag = GetRaycastResultTag(1) print('Hit Tag: ' .. tag)
Description: Gets the origin of a ray.
Returns: A table containing the X, Y, and Z coordinates of the ray's origin. (Table)
Parameters:
Example:
--[[ Example for GetRayOrigin ]] --[[ Gets the origin of a ray. ]] --[[ This function works only inside project script ]] AddRay(0, 0, 0, 0, 1, 0) CalculateRaycasts() local origin = GetRayOrigin(1) print('Ray Origin: x=' .. origin[1] .. ', y=' .. origin[2] .. ', z=' .. origin[3])
Description: Gets the direction of a ray.
Returns: A table containing the X, Y, and Z components of the ray's direction. (Table)
Parameters:
Example:
--[[ Example for GetRayDirection ]] --[[ Gets the direction of a ray. ]] --[[ This function works only inside project script ]] --[[ See CalculateRaycasts for a complete exmple]] local direction = GetRayDirection(1) print('Ray Direction: a=' .. direction[1] .. ', b=' .. direction[2] .. ', c=' .. direction[3])
Description: Returns the number of rays.
Returns: The number of rays. (Int)
Parameters: None
Example:
--[[ Example for GetRayCount ]] --[[ Returns the number of rays. ]] --[[ This function works only inside project script ]] local count = GetRayCount() print('Ray Count: ' .. count)
Description: Checks if a ray has been calculated.
Returns: True if the ray is calculated, false otherwise. (Boolean)
Parameters:
Example:
--[[ Example for IsRayCalculated ]] --[[ Checks if a raycast is calculated. ]] --[[ This function works only inside project script ]] AddRay(0, 0, 0, 0, 1, 0) CalculateRaycasts() local calculated = IsRayCalculated(1) print('Ray 1 Calculated: ' .. tostring(calculated))
Description: Updates the scene.
Parameters: None
Example:
--[[ Example for UpdateScene ]] --[[ Updates the scene. ]] --[[ This function works only inside project script ]] UpdateScene()
Description: Cleans ray bundles.
Parameters: None
Example:
--[[ Example for CleanRayBundles ]] --[[ Cleans all ray bundles. ]] --[[ This function works only inside project script ]] CleanRayBundles()
Description: Traces ray bundles.
Parameters: None
Example:
--[[ Example for TraceRayBundles ]] --[[ Traces all ray bundles. ]] --[[ This function works only inside project script ]] TraceRayBundles()
Description: Draws ray bundles.
Parameters: None
Example:
--[[ Example for DrawRayBundles ]] --[[ Draws all ray bundles. ]] --[[ This function works only inside project script ]] DrawRayBundles()
Description: Adds a new layer to the canvas.
Parameters:
Example:
--[[Example for CanvasAddLayer Adds a new layer to the canvas. --]] CanvasAddLayer('MyLayer')
Description: Clears all layers in the canvas.
Parameters: None
Example:
--[[Example for CanvasClearLayers Clears all layers in the canvas. --]] CanvasClearLayers()
Description: Adds a drawing to the active layer.
Parameters:
Example:
--[[Example for AddDrawing Adds a drawing to the active layer. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing')
Description: Clears all drawings in the active layer.
Parameters: None
Example:
--[[Example for ClearDrawings Clears all drawings in the active layer. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') ClearDrawings()
Description: Adds a line to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddLine Adds a line to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') DrawingAddLine(0, 0, 10, 10)
Description: Adds a circle to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddCircle Adds a circle to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') DrawingAddCircle(5, 5, 3)
Description: Adds an arc to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddArc Adds an arc to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') DrawingAddArc(5, 5, 3, 0, 3.14)
Description: Adds a rectangle to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddRectangle Adds a rectangle to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') DrawingAddRectangle(5, 5, 4, 2, 0.5)
Description: Adds a polygon to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddPolygon Adds a polygon to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') local polygon = {{x=0, y=0}, {x=1, y=1}, {x=2, y=0}} DrawingAddPolygon(polygon)
Description: Adds a path to the active drawing.
Parameters:
Example:
--[[Example for DrawingAddPath Adds a path to the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') local path = {{x=0, y=0, bulge=0}, {x=1, y=1, bulge=0.5}, {x=2, y=0, bulge=0}} DrawingAddPath(path)
Description: Saves the canvas as DXF in the app local folder.
Parameters:
Example:
--[[Example for CanvasSaveAsDXF Saves the canvas as a DXF file. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') CanvasSaveAsDXF('my_drawing '..GetDateTimeNow('hh-mm-ss')) OpenAppWorkingFolder("DXF")
Description: Prints the canvas in the report.
Parameters:
Example:
--[[Example for PrintCanvas Prints the canvas. --]] PrintCanvas(1)
Description: Sets the size of the canvas.
Parameters:
Example:
--[[Example for SetCanvasSize Sets the size of the canvas. --]] SetCanvasSize(800, 600)
Description: Sets the line weight of a layer.
Parameters:
Example:
--[[Example for SetLayerLineWeight Sets the line weight of a layer. --]] CanvasAddLayer('MyLayer') SetLayerLineWeight('MyLayer', 0.5)
Description: Sets the color of a layer.
Parameters:
Example:
--[[Example for SetLayerColor Sets the color of a layer. --]] CanvasAddLayer('MyLayer') SetLayerColor('MyLayer', 'FF0000')
Description: Sets the line style of a layer.
Parameters:
Example:
--[[Example for SetLayerLineStyle Sets the line style of a layer. --]] CanvasAddLayer('MyLayer') SetLayerLineStyle('MyLayer', 1)
Description: Enables or disables a layer.
Parameters:
Example:
--[[Example for SetLayerEnabled Sets a layer enabled or disabled. --]] CanvasAddLayer('MyLayer') SetLayerEnabled('MyLayer', true)
Description: Sets the active layer for drawing operations.
Parameters:
Example:
--[[Example for SetActiveLayer Sets the active layer. --]] CanvasAddLayer('MyLayer') SetActiveLayer('MyLayer')
Description: Sets the active drawing for modification.
Parameters:
Example:
--[[Example for SetActiveDrawing Sets the active drawing. --]] CanvasAddLayer('MyLayer') AddDrawing('MyDrawing') SetActiveDrawing('MyDrawing')
Description: Adds a vertex to a drawing element.
Returns: Index of the added vertex (Int)
Parameters:
Example:
--[[Example for AddVertex Adds a vertex to a 2D path element. --]] local tag = 'MyElement' AddVertex(tag, 0, 0, 0, 1)
Description: Clears all vertices from a drawing element.
Parameters:
Example:
--[[Example for ClearVertices Clears vertices of a 2D path element. --]] local tag = 'MyElement' ClearVertices(tag)
Description: Resets the application's structural file converter.
Parameters:
Example:
--[[Example for StructReset Resets the application's structural file converter. --]] StructReset()
Description: Adds a structural link to the application's structural file converter.
Parameters:
Example:
--[[Example for StructAddLink Adds a structural link. -- This example assumes you have created nodes and have their tags. --]] local node1Tag = 'Node1' local node2Tag = 'Node2' InputClear() InputAddElement(node1Tag) InputAddElement(node2Tag) for tag in CreateElement('STRUCT_LINK') do StructAddLink(tag) end
Description: Adds a structural node to the application's structural file converter.
Parameters:
Example:
--[[Example for StructAddNode Adds a structural node. -- This example assumes you have created a point and have its coordinates. --]] InputClear() InputAddPoint(0, 0, 0) for tag in CreateElement('STRUCT_NODE') do StructAddNode(tag) end
Description: Generates and saves output files.
Parameters: None
Example:
--[[Example for StructGenOutputs Generates and saves output files. -- This example assumes you have a structural model created. --]] StructGenOutputs()
Description: Sets id numbers for structural links and nodes.
Parameters: None
Example:
--[[Example for StructSetNumbers assigns unique numbers to the links and nodes. --]] -- StructSetNumbers()
Description: Checks if an element is a structural link.
Returns: True if the element is a structural link, false otherwise. (Boolean)
Parameters:
Example:
--[[Example for IsStructLink Checks if an element is a structural link. -- This example assumes you have element tags. --]] local elementTag = 'Link123' local isLink = IsStructLink(elementTag) print('Is ' .. elementTag .. ' a structural link? ' .. tostring(isLink))
Description: Checks if an element is a structural node.
Returns: True if the element is a structural node, false otherwise. (Boolean)
Parameters:
Example:
--[[Example for IsStructNode Checks if an element is a structural node. -- This example assumes you have element tags. --]] local elementTag = 'Node456' local isNode = IsStructNode(elementTag) print('Is ' .. elementTag .. ' a structural node? ' .. tostring(isNode))
Description: Sets reaction values for a structural node.
Parameters:
Example:
--[[Example for SetStrucNodeRestraint Sets reaction values for a structural node. -- This example assumes you have a node tag. --]] local nodeTag = 'Node1' SetStrucNodeRestraint(nodeTag, true, true, true, false, false, false)
Description: Adds load information to a structural node.
Returns: The index of the added load. (Int)
Parameters:
Example:
--[[Example for AddStrucNodeLoad Adds load information to a structural node. -- This example assumes you have a node tag. --]] local nodeTag = 'Node1' AddStrucNodeLoad(nodeTag, 1, 100, -200, 0, 0, 0, 0, 'NodeLoad1', 0)
Description: Adds prescribed displacements values to a structural node.
Returns: The index of the added displacement. (Int)
Parameters:
Example:
--[[Example for AddStrucNodeDisplacement Adds prescribed displacement values to a structural node. -- This example assumes you have a node tag. --]] local nodeTag = 'Node1' AddStrucNodeDisplacement(nodeTag, 1, 0.01, 0, 0, 0, 0, 0, 'NodeDisplacement1', 0)
Description: Sets extra node mass and rotatory inertia values for a structural node.
Parameters:
Example:
--[[Example for SetStrucNodeMassInertia Sets extra node mass and rotatory inertia values. -- This example assumes you have a node tag. --]] local nodeTag = 'Node1' SetStrucNodeMassInertia(nodeTag, 10, 0, 0, 0)
Description: Sets matrix condensation values for a structural node.
Parameters:
Example:
--[[Example for SetStrucNodeMatrixCondensation Sets matrix condensation values for a structural node. --]] local nodeTag = 'Node1' SetStrucNodeMatrixCondensation(nodeTag, 0, 0, 0, 0, 0, 0)
Description: Adds uniform load values to a structural link.
Returns: Index of created load. (Int)
Parameters:
Example:
--[[Example for AddStrucLinkUniformLoad Adds uniform load values to a structural link. -- This example assumes you have a link tag. --]] local linkTag = 'Link1' AddStrucLinkUniformLoad(linkTag, 1, 0, -100, 0, 'UniformLoad1', 0)
Description: Adds trapezoid load values to a structural link.
Returns: Index of created load. (Int)
Parameters:
Example:
--[[Example for AddStrucLinkTrapezoidLoad Adds trapezoid load values to a structural link. -- This example assumes you have a link tag. --]] local linkTag = 'Link1' AddStrucLinkTrapezoidLoad(linkTag, 1, 0, 1, 0, 100, 0, 0, 0, 0, 0, 1, -100, 200, 'TrapezoidLoad1', 0)
Description: Adds a concentrated load values to a structural link.
Returns: Index of created load. (Int)
Parameters:
Example:
--[[Example for AddStrucLinkConcentratedLoad Adds a concentrated load values to a structural link. -- This example assumes you have a link tag. --]] local linkTag = 'Link1' AddStrucLinkConcentratedLoad(linkTag, 1, 0, 100, 0, 0.5, 'ConcentratedLoad1', 0)
Description: Adds a temperature load values to a structural link.
Returns: Index of created load. (Int)
Parameters:
Example:
--[[Example for AddStrucLinkTemperatureLoad Adds a temperature load values to a structural link. -- This example assumes you have a link tag. --]] local linkTag = 'Link1' AddStrucLinkTemperatureLoad(linkTag, 1, 1e-05, 0, 0, 20, 20, 20, 20, 'TemperatureLoad1', 0)
Description: Retrieves the symbol for a specific unit within a quantity.
Returns: The symbol of the unit. (String)
Parameters:
Example:
--[[Example for GetUnitSymbol Returns the unit symbol of an element's numerical property. --]] CreateNewMetricProject() InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VCYL_AS_TANK') do local symbol = GetUnitSymbol(tag, 'DIAMETER') print('Diameter Unit Symbol: ' .. symbol) end
Description: Retrieves the symbol for a unit within the project's unit system.
Returns: The symbol of the project unit. (String)
Parameters:
Example:
--[[Example for GetProjectUnitSymbol Returns the unit symbol of the active project for a given quantity (length). --]] CreateNewMetricProject() local symbol = GetProjectUnitSymbol('LE') print('Project Length Unit Symbol: ' .. symbol)
Description: Retrieves the name of a unit within the project's unit system.
Returns: The name of the project unit. (String)
Parameters:
Example:
--[[Example for GetProjectUnitName Returns the unit name of the active project for a given quantity (length). --]] CreateNewMetricProject() local name = GetProjectUnitName('LE') print('Project Length Unit Name: ' .. name)
Description: Retrieves the quantity tag associated with a specific unit.
Returns: The quantity tag. (String)
Parameters:
Example:
--[[Example for GetQuantityTag Returns the quantity tag of an element's numerical property. --]] CreateNewMetricProject() InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VCYL_AS_TANK') do local quantityTag = GetQuantityTag(tag, 'DIAMETER') print('Diameter Quantity Tag: ' .. quantityTag) end
Description: Retrieves the Modelica unit name for a given quantity and unit symbol.
Returns: The Modelica unit name. (String)
Parameters:
Example:
--[[Example for GetModelicaUnitName Returns the Modelica unit name of an element's numerical property. --]] CreateNewMetricProject() InputClear() InputAddPoint(0,0,0) for tag in CreateElement('VCYL_AS_TANK') do local modelicaUnit = GetModelicaUnitName(tag, 'DIAMETER') print('Diameter Modelica Unit Name: ' .. modelicaUnit) end
Description: Retrieves the unit symbol for a given material property.
Returns: The unit symbol for the material property. (String)
Parameters:
Example:
--[[Example for GetMaterialUnitSymbol Returns the unit symbol of a material's numerical property. -- This example assumes you have a material with a property. --]] local materialTag = 'SomeMaterialTag' MaterialAddtoCollection(materialTag ,'S30') local symbol = GetMaterialUnitSymbol(materialTag, 'ABS_PRESSURE') print('Material Absolute Pressure Unit Symbol: ' .. symbol)
Description: Lists all available quantities.
Parameters: None
Example:
--[[Example for ListQuantities Lists all quantities. --]] ListQuantities()
Description: Lists all units for a given quantity.
Parameters:
Example:
--[[Example for ListUnits Lists all units available for a quantity. --]] ListUnits('LE')
Description: Adds a new unit to the unit system.
Parameters:
Example:
--[[Example for AddUnit Adds a new unit to a quantity. --]] AddUnit('LE', 'Miles', 0.0006214, 'mi') ListUnits('LE')
Description: Converts a value from one unit to another.
Returns: The converted value. (Number)
Parameters:
Example:
--[[Example for ConvertUnit Converts a value from one unit to another. --]] CreateNewMetricProject(); AddUnit('LE','Miles',0.0006214, 'mi'); local converted = ConvertUnit(1000, 'LE', 'Meter', 'Miles') print('1000 meters is equal to ' .. converted .. ' miles')