LibreCAD 3 - Document operations

From LibreCAD wiki
Jump to: navigation, search

LibreCAD 3 has many operations accessible in Lua. You can see the full up-to-date list here.

Builder

The Builder is a container for others Document operations (including Builder itself).

This class is used to prevent the Document being in invalid state on undo/redo. All the operations added to Builder are undo-ed at the same time.

EntityBuilder

The EntityBuilder is a class designed to insert entities in the document and modify them.

To use it, you have to add the entities using appendEntity() method.

If you need it, you can do operations on the entities before inserting them, with appendOperation() method.

If two operations are incompatible, you can use processStack() method, it will modify each entity and clear the Operation queue.

Push / SelectByLayer

Those are the most important operations and are required before doing anything else.

The operations use their own list of entities and not the one used by appendEntity(). The Push operation add every entity present in the EntityBuilder to the list, and SelectByLayer only add the ones from a specific layer. More selectors will be added in the future.

Loop

This will repeat each operation added before n times.

Other operations

The other operations doesn't need explanations, this includes:

  • AddLayer
  • RemoveLayer
  • ReplaceLayer
  • AddBlock
  • RemoveBlock
  • ReplaceBlock
  • AddLinePattern
  • RemoveLinePattern
  • ReplaceLinePattern