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 as lx #---------------------------- # 2. Get the active document. #---------------------------- doc = lx.Application.getInstance().getActiveDocument() #-------------------------------------- # 3. Create a geometry in the document. #-------------------------------------- block = lx.Block.createIn(doc) #-------------------------------------------------------------------- # 4. Create an element in the document and assign the geometry to it. #-------------------------------------------------------------------- elem = lx.Element.createIn(doc) elem.setGeometry(block) #---------------------------------- # 5. Set the geometry's parameters. #---------------------------------- block.setXLength(5) block.setYLength(5) block.setZLength(5) #--------------------------- # 6. Recompute the document. #--------------------------- doc.recompute()