QCAD scripting
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
QCAD scripting
QCAD script
A script is required to implement this function. QCAD can accept the dxf file path transmitted by an external program, then open the dxf, select the text entity in the dxf, perform the explosion operation, and save the dxf file.
Also, is there any information about the script that I can refer to? thks
A script is required to implement this function. QCAD can accept the dxf file path transmitted by an external program, then open the dxf, select the text entity in the dxf, perform the explosion operation, and save the dxf file.
Also, is there any information about the script that I can refer to? thks
- Attachments
-
- VeryCapture_202310191552421.jpg (71.56 KiB) Viewed 6604 times
Re: QCAD scripting
If you want to explode all text entities in the file (or there is only a single text entity), you can use the QCAD command line tool dwgexplode:
https://qcad.org/en/qcad-command-line-tools#dwgexplode
https://qcad.org/en/qcad-command-line-tools#dwgexplode
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
Re: QCAD scripting
Thank you, I will try this method and will reply with the results later.
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
Re: QCAD scripting
I tried this method but got this errorandrew wrote: ↑Fri Oct 20, 2023 8:14 amIf you want to explode all text entities in the file (or there is only a single text entity), you can use the QCAD command line tool dwgexplode:
https://qcad.org/en/qcad-command-line-tools#dwgexplode
- Attachments
-
- VeryCapture_20231020155315.jpg (85.67 KiB) Viewed 6593 times
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
Re: QCAD scripting
The above answer is that I made a mistake, and I have been able to successfully execute the explode function. But there is still a question. I need to execute the explode operation on all text entities, while other entities remain unchanged. How should I do this?andrew wrote: ↑Fri Oct 20, 2023 8:14 amIf you want to explode all text entities in the file (or there is only a single text entity), you can use the QCAD command line tool dwgexplode:
https://qcad.org/en/qcad-command-line-tools#dwgexplode
Re: QCAD scripting
Hi,
As explained, dwgexplode explodes everything but ...
You should then include a list of all entity types not to explode.
Type names to omit can be sourced from this list:
https://github.com/qcad/qcad/blob/maste ... y.js#L1349
Regards,
CVH
As explained, dwgexplode explodes everything but ...
You should then include a list of all entity types not to explode.
Type names to omit can be sourced from this list:
https://github.com/qcad/qcad/blob/maste ... y.js#L1349
Regards,
CVH
Last edited by CVH on Fri Oct 20, 2023 9:50 am, edited 1 time in total.
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
Re: QCAD scripting
Was looking for it, see edited post above.
Remark that not all are visible things. e.g: a layer, a block (but a block reference might), ...
And that not everything can be exploded. e.g.: a lineType, an arc, ...
Regards,
CVH
Last edited by CVH on Fri Oct 20, 2023 9:58 am, edited 1 time in total.
Re: QCAD scripting
dwgexplode is geared towards exploding everything.
You'd have to provide a list of all entity types that are acceptable (i.e. don't need to be exploded):
Note the quotes for the -t argument.
dwg2csv can list all entity type names:
You'd have to provide a list of all entity types that are acceptable (i.e. don't need to be exploded):
Code: Select all
dwgexplode.bat -t "Block Reference,Dimension,Aligned Dimension,Angular Dimension,Angular Dimension (2 Line),Angular Dimension (3 Point),Arc Dimension,Diametric Dimension,Ordinate Dimension,Rotated Dimension,Radial Dimension,Ellipse,Hatch,Leader,Tolerance,Polyline,Solid,Trace,Face,Spline" -o d:\explode.dxf D:\testfiles\New2.dxf
dwg2csv can list all entity type names:
Code: Select all
dwg2csv.bat -l
-
- Full Member
- Posts: 84
- Joined: Fri Oct 20, 2023 7:21 am
Re: QCAD scripting
Thank you very much, this answer is very important to me, I will follow this method to experimentandrew wrote: ↑Fri Oct 20, 2023 9:55 amdwgexplode is geared towards exploding everything.
You'd have to provide a list of all entity types that are acceptable (i.e. don't need to be exploded):
Note the quotes for the -t argument.Code: Select all
dwgexplode.bat -t "Block Reference,Dimension,Aligned Dimension,Angular Dimension,Angular Dimension (2 Line),Angular Dimension (3 Point),Arc Dimension,Diametric Dimension,Ordinate Dimension,Rotated Dimension,Radial Dimension,Ellipse,Hatch,Leader,Tolerance,Polyline,Solid,Trace,Face,Spline" -o d:\explode.dxf D:\testfiles\New2.dxf
dwg2csv can list all entity type names:
Code: Select all
dwg2csv.bat -l