Below is a very simple script. The easiest way to test and get it working:
- Start Lexocad.
- In the menu go to: Extra > Python > Python Console. Copy the script below and paste it inside the interactive console, eventually press the [Enter] key.
# Create Block example # Import Lexocad libraries import OpenLxApp as lx # Get the active document doc = lx.Application.getInstance().getActiveDocument() # Create a geometry in the document block = lx.Block.createIn(doc) block.setXLength(3) block.setYLength(4) block.setZLength(5) # Create an element in the document and assign the geometry to it elem = lx.Element.createIn(doc) elem.setGeometry(block) # Recompute the document doc.recompute()
- Saved scripts (text files with “.py” extension) are loaded into Lexocad by drag’n’drop from Windows File Explorer and other programs.
- Frequently used scripts can be saved inside the folder “Lexocad.x64\Python\ Scripts” and quickly accessed in Extra > Python > Python Scripts.
- To see console output (error messages and print statements), go: Extra > Python > Python Console.