Scripting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Scripting

B.Teddy
This post was updated on .
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()

Reply | Threaded
Open this post in threaded view
|

Re: Scripting

LordOfBikes
Administrator
Welcome B.Teddy.

Primarily I miss the information which version of LibreCAD you installed, on which OS.

But I assume that you have installed any V2.x.y version.
LUA scripting is a feature of coming LibreCAD V3.x.y, but this is still under development, not productive yet.

LibreCAD V2 has no scripting support.
But started with V2.1.2 iirc, you can paste multiple command line instructions or import simple command files, one instruction per line. I wouldn't call that scripting, it's more like a macro feature.

Here are some links concerning this:
https://github.com/LibreCAD/LibreCAD/issues/907
https://github.com/LibreCAD/LibreCAD/issues/782

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Scripting

B.Teddy
Sorry, It was Version: 2.2.0-rc1 on Windows 10.

Thank You for your response.
Reply | Threaded
Open this post in threaded view
|

Re: Scripting

JohnSeers

Is there any progress on scripting?

Is V3 going to be released? Or is it available somewhere I do not know about?
Reply | Threaded
Open this post in threaded view
|

Re: Scripting

R. van Twisk
Administrator
Scripting will be available in LibreCAD v3, currently lua is supported