Month: November 2017
Removing an Element
This script shows how to remove an Element from the document. This can be done by calling the document’s ‘removeObject()’ method. Please be aware that the Element still exists in memory, it just does not belong to the document anymore. You can reassign it by calling the ‘addObject()’ method. This can be useful for undo/redo […]
Read MoreSetting the color of an Element
This script shows how to set the color, transparency and line width of an Element. There are four colors in Lexocad which define the visual appearance of an Element: Diffuse Color Emissive Color Specular Color Ambient Color Please refer to the Draw.OglMaterial class for more information. import Base import OpenLxApp as lx import OpenLxUI as ui app […]
Read MoreCopying 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