QCAD scripting

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 7:49 am

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
Attachments
VeryCapture_202310191552421.jpg
VeryCapture_202310191552421.jpg (71.56 KiB) Viewed 6620 times

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

Re: QCAD scripting

Post by andrew » Fri Oct 20, 2023 8:14 am

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

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 8:41 am

Thank you, I will try this method and will reply with the results later.

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 8:53 am

andrew wrote:
Fri Oct 20, 2023 8:14 am
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
I tried this method but got this error
Attachments
VeryCapture_20231020155315.jpg
VeryCapture_20231020155315.jpg (85.67 KiB) Viewed 6609 times

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 9:29 am

andrew wrote:
Fri Oct 20, 2023 8:14 am
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
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?

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD scripting

Post by CVH » Fri Oct 20, 2023 9:38 am

Hi,
As explained, dwgexplode explodes everything but ...
You should then include a list of all entity types not to explode. :wink:

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.

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 9:49 am

CVH wrote:
Fri Oct 20, 2023 9:38 am
Hi,
As explained, dwgexplode explodes everything but ...
You should then include a list of all entity types not to explode. :wink:

Regards,
CVH
HI CVH
Where can I see all entities in DXF? ths very much

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD scripting

Post by CVH » Fri Oct 20, 2023 9:52 am

WildWolfCJ wrote:
Fri Oct 20, 2023 9:49 am
Where can I see all entities in DXF? ths very much
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.

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

Re: QCAD scripting

Post by andrew » Fri Oct 20, 2023 9:55 am

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

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
Note the quotes for the -t argument.

dwg2csv can list all entity type names:

Code: Select all

dwg2csv.bat -l

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD scripting

Post by WildWolfCJ » Fri Oct 20, 2023 10:05 am

andrew wrote:
Fri Oct 20, 2023 9:55 am
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):

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
Note the quotes for the -t argument.

dwg2csv can list all entity type names:

Code: Select all

dwg2csv.bat -l
Thank you very much, this answer is very important to me, I will follow this method to experiment

Post Reply

Return to “Chat”