Copying an Element

This script shows how to copy an Element. import Geom import OpenLxApp as lx import OpenLxUI as ui app = lx.Application.getInstance() doc = app.getActiveDocument() #———————- # Creating 1st element. #———————- cylinder = lx.RightCircularCylinder.createIn(doc) elem1 = lx.Element.createIn(doc) elem1.setGeometry(cylinder) cylinder.setHeight(0.5) cylinder.setRadius(0.5) #————————————- # Copying and positioning 2nd element. #————————————- elem2 = elem1.copy() elem2.translate(Geom.Vec(0, 2, 0), Geom.CoordSpace_WCS) doc.recompute()

Read More

Translating an Element

This script shows how to translate (move) an Element. Translations can be done in the local space of the Element (LCS – Local Coordinate System) or in the global space of the scene (WCS- World Coordinate System import Geom import OpenLxApp as lx import OpenLxUI as ui app = lx.Application.getInstance() doc = app.getActiveDocument() #——————– # […]

Read More

Creation of an Element

This first script is basically the same as the one in ‘Quick Start’. It just creates an Element with a Block as its geometry. For a detailed description of this script please refer to the Quick Start page. #=============================================================================== # # CREATING AN ELEMENT # #=============================================================================== #—————————– # 1. Import Lexocad libraries. #—————————– import OpenLxApp […]

Read More

Editors

If you want to use a special editor to create your Python scripts, take a look at the following ones: Eclipse https://www.eclipse.org/ Notepad++ https://notepad-plus-plus.org/ PyCharm https://www.jetbrains.com/pycharm/ Python Tools for Visual Studio https://github.com/Microsoft/PTVS

Read More

A closer look at the script

Let us examine the example a bit closer. # Import Lexocad libraries import OpenLxApp as lx The import statement loads existing Python code from another file – a module. The Python binding to Lexocad is defined by modules. By importing a module you gain access to Lexocad’s functions through the API (Application Programming Interface). # […]

Read More

Quick Start

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 […]

Read More