Problem:Whether command line supports identifying and exporting different layers?
Current command: ./dwg2bmp -platform offscreen -zoom-all -width=6000 -height=6000 -flat -f A.dwg
How can I use command line to complete the conversion?
Expected output: Export different BMP/PNG files for each layer.
Environment
Linux Centos7
Qcad 3.23.3
Whether command line supports identifying and exporting different layers?
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.
-
- Junior Member
- Posts: 20
- Joined: Wed Jun 11, 2025 2:33 am
Whether command line supports identifying and exporting different layers?
- Attachments
-
- Expected output
- 1.png (274.07 KiB) Viewed 18554 times
-
- A.dwg
- CAD source file
- (7.66 MiB) Downloaded 186 times
-
- Premier Member
- Posts: 4920
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Whether command line supports identifying and exporting different layers?
Please refer to my answer on this partially related topic.
Or this post with an identical title.
All depends if geometry is neatly arranged in a few layers were you can filter on.
Sorry to say but the file doesn't load in QCAD using the GUI on my system.
The application simply crashes after a few minutes. (Hatch rendering timeout 1000ms per Hatch)
Command Line tools use QCAD just the same but typically without GUI.
In this case it may be possible to set the individual windows size and origin.
Using 5 Command Line instructions.
bbox returns the overall size, divide that by 5 vertically and adapt lower left origin for each.
Pass those numbers on using a batch file.
Typically we arrange parts of the main design that must be represented on one page in Layout Blocks.
Then you can export page layouts per Layout Block using the -block= switch.
Again 5 Command Line instructions or per batch file.
Your 'Expected output' displays all 5 pages.
If it is the intention to include them all in one bitmap then remind that the bitmap size is limited to 2'147'483'647 bytes.
In color requires 4 bytes per pixel or about 537Mpx.
Your instruction line does not include how many pixels per drawing unit, presumed to default to 1px/unit.
Regards,
CVH
Or this post with an identical title.

All depends if geometry is neatly arranged in a few layers were you can filter on.
Sorry to say but the file doesn't load in QCAD using the GUI on my system.
The application simply crashes after a few minutes. (Hatch rendering timeout 1000ms per Hatch)
Command Line tools use QCAD just the same but typically without GUI.
In this case it may be possible to set the individual windows size and origin.
Using 5 Command Line instructions.
bbox returns the overall size, divide that by 5 vertically and adapt lower left origin for each.
Pass those numbers on using a batch file.
Typically we arrange parts of the main design that must be represented on one page in Layout Blocks.
Then you can export page layouts per Layout Block using the -block= switch.
Again 5 Command Line instructions or per batch file.
Your 'Expected output' displays all 5 pages.
If it is the intention to include them all in one bitmap then remind that the bitmap size is limited to 2'147'483'647 bytes.
In color requires 4 bytes per pixel or about 537Mpx.
Your instruction line does not include how many pixels per drawing unit, presumed to default to 1px/unit.
Regards,
CVH
-
- Junior Member
- Posts: 20
- Joined: Wed Jun 11, 2025 2:33 am
Re: Whether command line supports identifying and exporting different layers?
Thank you for your reply. Could you provide some command line examples?




-
- Premier Member
- Posts: 4920
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Whether command line supports identifying and exporting different layers?
Hi,
Yes, a standard installation includes some very basic examples.
Visit the tutorial: Command Line Tool Scripts on the QCAD site.
The example given is also found in the open source of QCAD on Github > ExTool.js
Line 59-64 loads the given file in an RDocumentInterface.
Line 66-69 is the JS code that adds a line to the document using the QCAD Simple API.
Line 71-76 then exports the RDocumentInterface to the given output file.
For more complex stuff you would be better of using the full API.
See reference. (Generated in 2021: A bit outdated by now)
Expect a steep learning curve.
Almost every QCAD GUI tool is implemented in JS, tons of examples on Github.
The Command Line tools included in QCAD pro are proprietary and not listed in the open source.
Under Windows they are called with a batch file: e.g. dwg2bmp.bat found in your installation folder.
This starts QCAD without GUI and initiates the JS script passing on parameters from your instruction line.
Dwg2Bmp.js is typically not found on your system, it is only present as compiled for Pro or Trial users.
3 other examples are found here: CreatingDrawing ; ExPdfExport ; ExSvgExport.
And how to launch them: LaunchCommandLineTool.dox
Regards,
CVH
Yes, a standard installation includes some very basic examples.
Visit the tutorial: Command Line Tool Scripts on the QCAD site.
The example given is also found in the open source of QCAD on Github > ExTool.js
Line 59-64 loads the given file in an RDocumentInterface.
Line 66-69 is the JS code that adds a line to the document using the QCAD Simple API.
Line 71-76 then exports the RDocumentInterface to the given output file.
For more complex stuff you would be better of using the full API.
See reference. (Generated in 2021: A bit outdated by now)
Expect a steep learning curve.

Almost every QCAD GUI tool is implemented in JS, tons of examples on Github.
The Command Line tools included in QCAD pro are proprietary and not listed in the open source.
Under Windows they are called with a batch file: e.g. dwg2bmp.bat found in your installation folder.
Code: Select all
@echo off
qcadcmd.com -no-gui -allow-multiple-instances -autostart scripts\Pro\Tools\Dwg2Bmp\Dwg2Bmp.js %0 %*
Dwg2Bmp.js is typically not found on your system, it is only present as compiled for Pro or Trial users.
3 other examples are found here: CreatingDrawing ; ExPdfExport ; ExSvgExport.
And how to launch them: LaunchCommandLineTool.dox
Regards,
CVH
-
- Junior Member
- Posts: 20
- Joined: Wed Jun 11, 2025 2:33 am
Re: Whether command line supports identifying and exporting different layers?
I’m using the personal edition of QCAD Pro and cannot find the scripts\Pro\Tools\Dwg2Bmp\Dwg2Bmp.js file in the installation path. How can I obtain the Dwg2Bmp.js script?
Do I need to download the community edition from GitHub?
hank you for your time. I look forward to your reply.
Do I need to download the community edition from GitHub?
hank you for your time. I look forward to your reply.
-
- Premier Member
- Posts: 4920
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Whether command line supports identifying and exporting different layers?
Hi,
To start with, most tool scripts are only present as compiled in a standard installation (Pro, Trial or CE).
That includes proprietary or QCAD Pro related besides those of the open source.
Open source can be referenced on Github.
It seems I must repeat myself as it is not read in detail ...
With './dwg2bmp' this batch file is started that starts QCAD and executes the JS script.
The content of Dwg2Bmp.js is very similar as any other Command Line tool script, only extended to fit the job. (See examples)
Several more parameters and more conditions must be met, opening the drawing file and so on.
It won't do you any good to know the content because it calls the same resource as when using 'Bitmap Export...' (BX) in the GUI.
That is open source, see BitmapExport.js
In Line 38-46 we see that without a guiAction the parameters of the Command Line instruction are loaded.
It is also possible that a Command Line tool calls a Pro resource.
In that case the Pro resource is again not listed ... Because it is proprietary.
Open source scripts can be overruled or enhanced by Pro scripts in the Pro or Trial version.
Little to no information and documentation exist on Pro resources ... Because these are proprietary.
Regards,
CVH
To start with, most tool scripts are only present as compiled in a standard installation (Pro, Trial or CE).
That includes proprietary or QCAD Pro related besides those of the open source.
Open source can be referenced on Github.
Remark the Pro in the path.

It seems I must repeat myself as it is not read in detail ...
You should be able to locate 'dwg2bmp' directly under the QCAD installation path.
With './dwg2bmp' this batch file is started that starts QCAD and executes the JS script.
The content of Dwg2Bmp.js is very similar as any other Command Line tool script, only extended to fit the job. (See examples)
Several more parameters and more conditions must be met, opening the drawing file and so on.
It won't do you any good to know the content because it calls the same resource as when using 'Bitmap Export...' (BX) in the GUI.
That is open source, see BitmapExport.js
In Line 38-46 we see that without a guiAction the parameters of the Command Line instruction are loaded.
It is also possible that a Command Line tool calls a Pro resource.
In that case the Pro resource is again not listed ... Because it is proprietary.
Open source scripts can be overruled or enhanced by Pro scripts in the Pro or Trial version.
Little to no information and documentation exist on Pro resources ... Because these are proprietary.
Regards,
CVH
-
- Premier Member
- Posts: 4920
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Whether command line supports identifying and exporting different layers?
Because I am unable to open your drawing over here ...
Could you attach a screen capture of how your file is displayed in the QCAD GUI.
When failing QCAD does not add the file to the files to open on startup.
Forced that in the config file.
I can now start QCAD in GUI mode from the OS command line with:
"C:\Program Files\QCAD\qcad.exe" 2> "C:[Undisclosed]\error.log"
That creates the content of the error.log file below before it crashes.
It issues 5631 warnings to begin with, many are similar as what is presented in an earlier post.
The first warning is seen often ... Would not know what the default EUDC font EUDC.TTE stands for.
A summary:
- link #F is undefined! ... ?!
- cannot assign original handle to object -> collision with object of type: X
- dynamic block ref ... These are not supported by QCAD
- hatch pattern too dense ... 36x
- Boundary loop not closed ... 118x ... The reported gaps are definitely much larger as some accuracy issue
- arc or line not connected to polyline ... 4503x ... Importing data on opening and here not with the nan-nan RVectors
- Pattern not of even length for QPen ... 948x
Too dense Hatch patterns are often seen as an attempt to fill the boundary(ies) with many pattern lines so that it resembles a solid filled area.
In that case use a Solid fill instead of a pattern.
Also set the Hatch timeout to moderate or low otherwise QCAD will attempt to render every of these Hatches for a longer period.
Generating a vast amount of pattern line segments, flooding the memory.
But the main issues are not closed Boundary loops, the not connecting polyline segments.
And QPen expects a length of a gap after each length of a visible stroke.
May I ask what the source application is that generated the file in R15(2000) format?
I think that the main issue sits there.
Regards,
CVH
Could you attach a screen capture of how your file is displayed in the QCAD GUI.
When failing QCAD does not add the file to the files to open on startup.
Forced that in the config file.
I can now start QCAD in GUI mode from the OS command line with:
"C:\Program Files\QCAD\qcad.exe" 2> "C:[Undisclosed]\error.log"
That creates the content of the error.log file below before it crashes.
It issues 5631 warnings to begin with, many are similar as what is presented in an earlier post.
The first warning is seen often ... Would not know what the default EUDC font EUDC.TTE stands for.
A summary:
- link #F is undefined! ... ?!
- cannot assign original handle to object -> collision with object of type: X
- dynamic block ref ... These are not supported by QCAD
- hatch pattern too dense ... 36x
- Boundary loop not closed ... 118x ... The reported gaps are definitely much larger as some accuracy issue
- arc or line not connected to polyline ... 4503x ... Importing data on opening and here not with the nan-nan RVectors
- Pattern not of even length for QPen ... 948x
Too dense Hatch patterns are often seen as an attempt to fill the boundary(ies) with many pattern lines so that it resembles a solid filled area.
In that case use a Solid fill instead of a pattern.
Also set the Hatch timeout to moderate or low otherwise QCAD will attempt to render every of these Hatches for a longer period.
Generating a vast amount of pattern line segments, flooding the memory.
But the main issues are not closed Boundary loops, the not connecting polyline segments.
And QPen expects a length of a gap after each length of a visible stroke.
May I ask what the source application is that generated the file in R15(2000) format?
I think that the main issue sits there.
Regards,
CVH