Re: Pseudo scripting with excel - add layer
Posted by
Goran on
Apr 03, 2025; 8:07am
URL: https://forum.librecad.org/Pseudo-scripting-with-excel-add-layer-tp5726798p5726839.html
Thank you for your time and effort!
I will try to answer your questions.
sand1024 wrote
Actually, by "last" - it is possible either to consider the entity that was created last. OR - it might be the entity that was last in user's operations i.e. - last selected, last edited... (say, editing, moving etc)
So this is a good question: what should be defined by "last".
The "last" command belongs to the selection category.
The original definition of the "last" command is: "Selects the most recently created visible object. The object must be in the current space (model space or paper space), and its layer must not be frozen or turned off."
However, considering the last edited, moved, etc. entity would likely be more practical.
sand1024 wrote
Another thing - is the scope of this command. ...
However, the question of scope arises - in other words, what is the lifetime of the "last" and such entities.
If they exist only within the lifecycle of the command script being executed (accessible only by commands in the same script file) - implementation is straightforward, though I'm unsure if this is convenient.
If they could be shared between script files - this might cause confusion, be harder to implement, and I’m not convinced it’s necessary. Please share your thoughts.
IMHO, "last" is a temporary command for short-term use. As a script creator, I’m almost always focused on the last created entity. Everything else might be too complicated to implement.
Thank you for your suggestions! I’ll experiment with variables.
Personally, the most important features for me are implementing "change current layer to layer X" or "Add new Layer" as script commands (in the command line).
Best regards, Goran