Script Macro Recorder

Please use this forum to post feedback and suggestions related to QCAD version 3

Moderator: andrew

Re: Script Macro Recorder

Postby andrew » Tue Mar 11, 2014 2:15 pm

clive wrote:Would something like this be difficult to develop and introduce ?

Could you provide a use case for such a script macro recorder?
What kind of operations would you typically like to record and subsequently repeat with such a tool? Thanks!
User avatar
Site Admin
Posts: 4011
Joined: Fri Mar 30, 2007 6:07 am

Re: Script Macro Recorder

Postby andrew » Tue Mar 11, 2014 3:42 pm

Thanks Clive.

I can see the main difficulty in finding out what information should be recorded. A script recorder can only record the tools you are using and the coordinates and properties that are involved. It cannot, however, know based on what logic you make your choices.

Let's say you select a blue line somewhere in a drawing. The script recorder can only assume that you selected that particular line based on its position. However, you might have selected that particular line because "it is the left side of the only blue rectangle in the drawing". That part of the logic cannot be recorder or replayed. In face, it only exists in your head. An observer would likely not know either why you've selected that line.

Automatically creating/setting a set or single layers for drawing with at any time.

How about a tool that imports a drawing (including layers) into the current one for this task?

Automatically 'arraying' (using Copy/Move tool - 'we really need a dedicated array tool :wink: ) of entities at set quantities/coordinates for exact sizes (I'm thinking laser cutting again - I get a lot of meshes to produce for facades).

This is a typical task that a recorder could not record unless all the drawings have the same number of entities of the same shape and size in the same places.
A recorder would record a sequence of select / move commands, for example:
- select everything inside rectangle 10/50 - 100/150
- move selection by 74.5/43.2
- ... (repeat for more coordinates to move other parts to appropriate places)

In the end you would have created a script macro which would likely be only useful for that one particular drawing you have already processed by the time the script is recorded.

What is obvious for you (for example that you move a selection relatively close to another contour in your drawing) is incomprehensible for a script recorder. There is an infinite number of possible reasons why you've just moved a selection to the location you've moved it to.

Automatically selecting everything on a specific layer (for blocks) and then exploding and changing line weights etc.

In this case, the script recorder would for example record:
- Select everything on layer "MyLayer"
- Explode selection
- Change line weight of selection to "0.50mm"

Note that the resulting script would only work for drawings which have their blocks to explode and adjust on layer "MyLayer". Again, the script recorder does not know based on what criteria you have chosen that particular layer.

Automatically selecting entities and scaling to specific scales.

A whole bunch of routine things related to finding distances and areas ('Info' tools).

These are a bit too vague to comment on.

Another one I can think of is selecting all visible text within a drawing and changing the text size.

The recorded script would for example:
- Select all text entities (on visible, unlocked layers)
- Change property 'height' for all selected text entities to "2.5".

While I can see some limited use of such a recorder, I think that users generally tend to expect too much of such tools.

I also think there would need to be a whole lot of new, logical tools in QCAD to make a recorder useful. To make the blue line example possible, there would need to be for example the following set of tools which could then be recorded:
- Select everything that is blue (available)
- Deselect all elements with angle unequal to 0, 90, 180, 270 to rule our irregular quadrilaterals (available)
- Deselect all open contours
- Deselect all contours with number of elements unequal to 4
- Find entity which is left most in current selection
- Limit selection to entity found in previous step

Recording such a script would require low level, typically internal tools to be available as part of the user interface. It would also require a great deal of discipline from the user who records it. A user basically would have to think like a programmer and unambiguously define every step of the procedure.

I know (and love) macros from a text editor I use daily (vim). However, I think implementing something like that in QCAD would be a major undertaking with unknown outcome. Most importantly, I think the current tool set it not appropriate / sufficient for recording really useful scripts.

I would suggest to address some repetitive tasks with other tools:
- Import document to merge a drawing into the current drawing (can be used to add layers, blocks, etc from another drawing)
- Copy / paste properties, for example to harmonize the height of multiple text entities
- Possibly others (?)
User avatar
Site Admin
Posts: 4011
Joined: Fri Mar 30, 2007 6:07 am

Return to QCAD 3 Suggestions and Feedback

Who is online

Users browsing this forum: No registered users and 1 guest