Page 1 of 1

Remove text from DXF/DWG files - command line tool/script

Posted: Sat Jan 13, 2018 9:02 am
by Reiska
Hello,

I just found the QCAD and I'm looking for a solution to automatically or by given mask/wildcards to remove text automatically from a bunch of DXF/DWG files.

Would you be able to help me with this? Would QCAD Command-line tools allow this, or would it require building own application using QCAD API?
Alternatively, GUI interface solution could work for this as well, if there's just solution to do the removal without using a mouse pointer to locate the text from the document.

Hope I didn't post this thread to wrong forum section?

Thanks,
Riku

Re: Remove text from DXF/DWG files - command line tool/script

Posted: Mon Jan 15, 2018 10:56 am
by andrew
A command line tool is not included out of the box (but could be created using the script interface with relatively little effort).

A GUI solution would be View > Selection Filter which supports regular expressions (much more powerful but also more complex than wildcards):
Screen Shot 2018-01-15 at 09.55.44.png
Screen Shot 2018-01-15 at 09.55.44.png (71.35 KiB) Viewed 4037 times
Here we are selecting all texts containing at least one capital letter (A-Z), followed by at least one number (0-9).

Re: Remove text from DXF/DWG files - command line tool/script

Posted: Mon Jan 15, 2018 12:40 pm
by Reiska
Thanks.

GUI solution would work quite nicely as well using Regexp. Thanks!

However, when modifying a bunch of CAD files, the command-line solution might be faster solution.
Can you tell me, how would I get in the beginning using the script interface?

- Riku

Re: Remove text from DXF/DWG files - command line tool/script

Posted: Wed Jan 17, 2018 11:20 am
by andrew
For the general structure of a command line tool in QCAD, please refer to the included merge tool:

Batch file (Windows):
https://github.com/qcad/qcad/blob/master/merge.bat

Bash file (macOS, Linux):
https://github.com/qcad/qcad/blob/master/merge

ECMAScript Implementation:
https://github.com/qcad/qcad/tree/maste ... geDrawings

You can find plenty of example code for iterating through all entities, etc. under the scripts folder of your QCAD installation or online at:
https://github.com/qcad/qcad/tree/master/scripts

Re: Remove text from DXF/DWG files - command line tool/script

Posted: Wed Jan 17, 2018 11:59 am
by Reiska
Great.

I will keep looking at these. Thanks!