Script Macro Recorder

Please use this forum to post feedback and suggestions related to QCAD.

Moderator: andrew

Post Reply
User avatar
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Script Macro Recorder

Post by Clive » Tue Mar 11, 2014 1:37 pm

A feature request exists for this by J-J
http://www.ribbonsoft.com/bugtracker/in ... ask_id=408

J-J
I agree this would make a fantastic addition to QCAD, often I am repeating the same task, over and over again and as you point out in your feature request, to have a tool like this would be such a bonus.

Andrew
Would something like this be difficult to develop and introduce ? this kind of tool is already present in so many CAD programs and I would love to see this in QCAD and I know I'm not the only one (J-J :wink: ).

Edit ... and yes this would help those of us to get a grasp of some basic scripting know how.
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Script Macro Recorder

Post by 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
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Script Macro Recorder

Post by Clive » Tue Mar 11, 2014 2:43 pm

andrew wrote:Could you provide a use case for such a script macro recorder?
Definitely, for me personally I could use macros for cleaning up drawings before they are sent to the laser cutter.
I probably carry out the same routine methods without thinking about it, so I'm sure given time I would definitely use a tool like this for much more than I can think of right now :wink:
andrew wrote:What kind of operations would you typically like to record and subsequently repeat with such a tool? Thanks!
Well, here's a few for starters -

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

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).

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

Automatically selecting entities and scaling to specific scales.

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

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

I'm sure there are many more and I'm sure there will be a lot more QCAD users that can add to my few mentioned for their own local requirements on a daily basis.
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Script Macro Recorder

Post by 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
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Script Macro Recorder

Post by Clive » Tue Mar 11, 2014 3:59 pm

Andrew, wow, there's a lot more involved with this than I was aware of! now you've explained all this (thanks) maybe your suggestion of some dedicated tools might be the way forward 8) .
like this one, yes this would be useful.
andrew wrote:How about a tool that imports a drawing (including layers) into the current one for this task?
andrew wrote: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 (?)
Any additional tools to carry out repetitive tasks would be better than none at all.

Edit ... basically, all this means is that I have to continue to work hard :cry: :lol:
...and J-J :wink:
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...

Post Reply

Return to “QCAD Suggestions and Feedback”