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 = lx.Application.getInstance() doc = app.getActiveDocument() block = lx.Block.createIn(doc) elem = lx.Element.createIn(doc) elem.setGeometry(block) #--------------------------------- # 5. Define the visual appearance. #--------------------------------- red = 255; green = 0; blue = 0; transparency = 50; lineThickness = 5; #---------------------------------- # 6. Set the values to the element. #---------------------------------- elem.setDiffuseColor(Base.Color(red, green, blue)) elem.setTransparency(transparency) elem.setLineWidth(lineThickness) #--------------------------- # 7. Recompute the document. #--------------------------- doc.recompute()