feature request

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

feature request

pcdwarf
Hi
I'm making a lot of precedural drawing and I'm using LibreCAD mostly in command mode, with a lot of commands generated from another program.

At first I used to copy-paste but it was a lot of work.
I'm currently using xdotool to submit my generated commands through the GUI.
This must be kept very slow to keep it reliable but at least it's an automated process.

I think it would be great if there was some sort of pipe to send commands to LibreCAD from another program.

maybe a named pipe or a TCP socket.
I think the named pipe would be very easy to implement although it may be limited to the linux/posix version

what do you think about it ?


Reply | Threaded
Open this post in threaded view
|

Re: feature request

R. van Twisk
Administrator
There are two options:

1) Use LibreCAD 2 and create a plugin. This allows you to create a little GUI around your process but obviously it's not that versatile

2) Use LibreCAD 3 + Lua to create DXF drawings from command line. This is sorta your pipeline solution. Exception you use LibreCAD in a scripted situation from command line (a GUI is also possible in this case though...). However LibreCAD 3 is not stable yet, but I am pretty sure it will be stable enough for your procedural drawings.

Reply | Threaded
Open this post in threaded view
|

Re: feature request

pcdwarf
Hi

I just looked at https://wiki.librecad.org/index.php/LibreCAD_Plugin_Development

this is nice but the plugin API does not seem able to interact with the commandline box but directly with the document.

so, I have to recreate the command parser and call the drawing methods directly...
Another problem is that the plugin is designed to be executed by the user as a procedure. it is not made to wait for incoming orders.

in fact it is quite odd to have a command line that is not designed to be connected to some data stream that could be a file, a terminal or a command generator. At first, I was expecting librecad would read stdin the very same way it reads the command line box.





Reply | Threaded
Open this post in threaded view
|

Re: feature request

R. van Twisk
Administrator
Hi,

yes that's correct and I figured already that was properly not a good option for yuu.

Perhaps the lua route would be better for you? Although when using Lua you cannot really stream values into LibreCAD, you can get thing's executed in a specific order and generate your DXF including read from command line.

Here is basic code on how to do it: https://github.com/LibreCAD/LibreCAD_3/tree/master/luacmdinterface

We just need to think how to create a DXF out of your code, current output is now png and svg. Perhaps we can talk to the current developers if it's easy to add DXF output.

Ries

Reply | Threaded
Open this post in threaded view
|

Re: feature request

pcdwarf
Hi.

I've read some c++ code from librecad's github but i'm not familiar with Qt and its way to handle the GUI events.
i was thinking about reading stdin or a named pipe in the big main loop and then to feed it to the cmdline interpreter but it do not seems so trivial.

about librecad3. I do not understand Lua. It seems quite different from the languages I'm used to and I have no time to invest in learning it now.

maybe later...







 

Reply | Threaded
Open this post in threaded view
|

Re: feature request

R. van Twisk
Administrator
Lua is by far simler than c++! We have made it such that you don't have to worry about the nitty gritty details of c++, memory handling ets.

Here is an example: https://github.com/LibreCAD/LibreCAD_3/blob/master/luacmdinterface/test.lua

That is all the code you need, and this one does some math you might not need...
This lua code can be read by LibreCAD and build a drawing in memory and output to PNG or SVG.

RIes