Login  Register

Scripting

Posted by B.Teddy on Oct 25, 2018; 11:32pm
URL: https://forum.librecad.org/Scripting-tp5716568.html

Hello,

New user, just installed on my system.

Tried to go thru an example of scripting.

Could not find LUA in Librecad.

Tutorials? How-To's? User's Guide? Nothing.

Is scripting still part of Librecad?
What script language is being used?
How do I get to the area to input a script?
Where does it save it?
Does it stay part of the drawing/project or are they two separate things?

Thank You for you help.

P.S. Trying to do something like this:

Example 1:

Create a line and copy/rotate the line 7 times. This create 128 entities, because the Copy operation copy all the lines on each loop.

-- Get the layer
local layer = document:layerByName("0")

-- Create a Line
local l=Line(Coord(0,0), Coord(10,100), layer);

-- Get the builder object (will be renamed later)
local b=EntityBuilder(document)

-- Append the line
b:appendEntity(l)

-- Put the line in next operations stack
b:appendOperation(Push())

-- Make a copy 'in place' of the line
b:appendOperation(Copy(Coord(0,0)))

-- Rotate the line
b:appendOperation(Rotate(Coord(0,0), math.rad(45)))

-- Do this 7 times
b:appendOperation(Loop(7))

-- Apply into the document
b:execute()