Posted by
Goran on
Apr 01, 2025; 2:00pm
URL: https://forum.librecad.org/Pseudo-scripting-with-excel-add-layer-tp5726798p5726815.html
Hello sand1024
sand1024 wrote
@dxli
.....
However, as a quick fix for now - I could just add command for setting specified layer as a current one.
@Goran
If you have any ideas regarding support of such kind of scripting based on your experience - please share them.
In my experience, besides the ability to create a new layer, one of the essential commands is the command 'last',
which is used to select the last used or drawn entity.
Also, it would be very useful to use the Move/Copy command from the command line to create multiple copies,
something like a rectangular array in AutoCAD. Here's an example of using a script behind AutoCAD:
(command) _pline 31,2480 @0,330
(command) -array last R 1 2 18
(command)
The command '-array' creates an array of copies of the last drawn object.
'last' means that the array is created based on the last selected object.
'R' indicates a rectangular array.
'1 2' means the array has 1 row and 2 columns.
'18' represents the spacing between the array elements.
A line command like 'mv last R 1 10 18' would be desirable, meaning 'copy in one row,
10 copies of the last drawn entity at a spacing of +18 units in which the drawing is made.'
Another variation would be 'mv last R 1 10 -18', meaning 'copy 1 rows, 10 copies of the last
drawn entity at a spacing of -18 units in which the drawing is made.' There could also be an
option like 'mv R -1 10 -18'.
Additionally, it would be convenient if a user coordinate system could be created.
The script always draws from the 0,0 coordinates, and it would be desirable for 0,0 to be
repositioned by the user without having to move all the elements in the drawing.
My experience is that all the 'dirty work' of calculations can be done in Excel,
or even better in LibreOffice Calc, and that this approach can produce quite powerful
parametric scripts for drawing highly complex designs!
Best Regards, Goran