Unexpected entity when using dwg2dwg.bat
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Unexpected entity when using dwg2dwg.bat
Hello everyone,
My QCAD version is QCAD Pro 3.30.1.0, and my OS is Windows 10.
When I use dwg2dwg.bat to convert DWG format drawings to DXF format, entities that do not exist in the DWG drawings appear in the DXF drawings.
The dwg drawing is as follows: The dxf drawing is as follows: The attached file is the dwg file with problem. Without modifying the original dwg drawing, how can I modify the .bat file or others to make the generated dxf entity consistent with the original drawing?
My QCAD version is QCAD Pro 3.30.1.0, and my OS is Windows 10.
When I use dwg2dwg.bat to convert DWG format drawings to DXF format, entities that do not exist in the DWG drawings appear in the DXF drawings.
The dwg drawing is as follows: The dxf drawing is as follows: The attached file is the dwg file with problem. Without modifying the original dwg drawing, how can I modify the .bat file or others to make the generated dxf entity consistent with the original drawing?
- Attachments
-
- test.dwg
- (49.77 KiB) Downloaded 540 times
-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Not really a topic for this sub-forum.
More a topic for: QCAD Troubleshooting and Problems
Opening the file with the QCAD GUI reports:
And that the original drawing looked as <dxf.png> in another CAD-application.
The additional data is probably an external reference.
See this reply or this reply.
From what you report the additional data is included in the export created by dwg2dwg.
That would mean that this command tool is capable of including external content.
Already beyond the expectations.
You did not attach such an external file, so it is impossible to test the outcome correctly.
There is no fix using the QCAD GUI for the moment, not for over 12 years now (FS#693).
You could include the external reference as a standard CAD block in the drawing file with the native application.
Remember that an external reference may use the same layer names with different attributes.
The same blocks by name with different content.
And so on ...
I presume that it is this possible duality that makes it hard to implement.
Regards,
CVH
More a topic for: QCAD Troubleshooting and Problems
Opening the file with the QCAD GUI reports:
- Unsupported XData type NOT imported: 1005
And that the original drawing looked as <dxf.png> in another CAD-application.
The additional data is probably an external reference.
See this reply or this reply.
From what you report the additional data is included in the export created by dwg2dwg.
That would mean that this command tool is capable of including external content.
Already beyond the expectations.

You did not attach such an external file, so it is impossible to test the outcome correctly.
There is no fix using the QCAD GUI for the moment, not for over 12 years now (FS#693).
You could include the external reference as a standard CAD block in the drawing file with the native application.
Remember that an external reference may use the same layer names with different attributes.
The same blocks by name with different content.
And so on ...
I presume that it is this possible duality that makes it hard to implement.
Regards,
CVH
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Re: Unexpected entity when using dwg2dwg.bat
Hi, CVH
I used the .bat file in the Windows CMD by typing
I didn't introduce any external references, and I don't understand why it generates unexpected entities 
I'm sorry. I'll pay attention next time. Or is there any way to move this topic to that sub-forum?
origin.png is the screenshot of the dwg file in my attachment opened using qcad.
dxf.png is the screenshot of the dwg file after I converted it to a dxf file using dwg2dwg.bat and then opened it using qcad.
I used the .bat file in the Windows CMD by typing
Code: Select all
dwg2dwg.bat -o test.dxf test.dwg

-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Hi,
A moderator is able to move the topic.
- I don't have the additional content of the XREF.
- The source is a DWG and is binary.
If that was a DXF and textual then we could look for the XREF specification.
Out of curiosity: Could you attach the exported DXF file?
Regards,
CVH
A moderator is able to move the topic.
I can not confirm that.
- I don't have the additional content of the XREF.
- The source is a DWG and is binary.
If that was a DXF and textual then we could look for the XREF specification.
Out of curiosity: Could you attach the exported DXF file?
Regards,
CVH
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Re: Unexpected entity when using dwg2dwg.bat
Hi,
When I open the file test.dwg with AutoCAD, the interface is the same as <origin.png>. And when I save it as a dxf file with AutoCAD, no extra entities appear.
Of course, this is the dxf file generated by the .bat file.
- Attachments
-
- test.dxf
- (141.52 KiB) Downloaded 584 times
-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Could it be that you opened the test.dwg file after saving it from within the QCAD GUI?
Using the GUI, the XREF is not loaded, when saved again it is no longer included.
The copy of the DWG on the forum still reports the exception.
Try to open that with AutoCAD.
Regards,
CVH
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Re: Unexpected entity when using dwg2dwg.bat
Hi,
When I opened test2.dwg, there was no Unsupported XData type NOT imported: 1005 error.
But there were still unexpected entities.
I used QCAD to save test.dwg as test2.dwg.
When I opened test2.dwg, there was no Unsupported XData type NOT imported: 1005 error.
But there were still unexpected entities.
- Attachments
-
- test2.dwg
- (22.58 KiB) Downloaded 529 times
-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Please specify: With the QCAD GUI or with the command line tool dwg2dwg
It is starting to be a chicken-egg conversation.
What came before what? What application is used for what?
Correct me if I am wrong:
- test.dwg posted [Tue Feb 25, 2025 10:14 am] was originally created with AutoCad.
- Converted to DXF with dwg2dwg it looked like dxf.png with additional content.
- Opening the source test.dwg within the QCAD GUI looks like origin.png ... There is an exception reported, additional content not loaded.
We can't replicate the export of dwg2dwg:
Code: Select all
08:41:23: Debug: Input file: ###Obscured###QCAD/QCAD_32.1/test(org).dwg
08:41:23: Debug: Output file: ###Obscured###QCAD/QCAD_32.1/test(conv).dxf
08:41:23: Debug: DXF/DWG Release: R27
08:41:23: Debug: addObject: block: "*Model_Space"
08:41:23: Debug: addObject: block: "*Paper_Space"
08:41:23: Debug: addObject: block: "*Model_Space"
08:41:23: Debug: addObject: block: "*Paper_Space"
Cannot import file: ###Obscured###QCAD/QCAD_32.1/test(org).dwg
Regards,
CVH
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Re: Unexpected entity when using dwg2dwg.bat
Hi,
When I save test.dwg as the dxf format with AutoCAD, the result is also like origin.png.
Sure, this is generated using the QCAD GUI.
Yes, your understanding is completely correct. And opening the source test.dwg within the AutoCAD also looks like origin.png.CVH wrote: ↑Wed Feb 26, 2025 8:49 amCorrect me if I am wrong:
- test.dwg posted [Tue Feb 25, 2025 10:14 am] was originally created with AutoCad.
- Converted to DXF with dwg2dwg it looked like dxf.png with additional content.
- Opening the source test.dwg within the QCAD GUI looks like origin.png ... There is an exception reported, additional content not loaded.
When I save test.dwg as the dxf format with AutoCAD, the result is also like origin.png.
This is the information printed out after I converted the dwg using the command line.CVH wrote: ↑Wed Feb 26, 2025 8:49 amWe can't replicate the export of dwg2dwg:Code: Select all
08:41:23: Debug: Input file: ###Obscured###QCAD/QCAD_32.1/test(org).dwg 08:41:23: Debug: Output file: ###Obscured###QCAD/QCAD_32.1/test(conv).dxf 08:41:23: Debug: DXF/DWG Release: R27 08:41:23: Debug: addObject: block: "*Model_Space" 08:41:23: Debug: addObject: block: "*Paper_Space" 08:41:23: Debug: addObject: block: "*Model_Space" 08:41:23: Debug: addObject: block: "*Paper_Space" Cannot import file: ###Obscured###QCAD/QCAD_32.1/test(org).dwg
Code: Select all
E:\QCad>dwg2dwg.bat -o test.dxf test.dwg
QCAD version 3.30.1
08:56:21: Debug: loading plugins...
08:56:21: Debug: RHelpPlugin::init
08:56:21: Debug: RPolygonPlugin::init
08:56:21: Debug: RProScriptsPlugin::init
08:56:21: Debug: RProxiesPlugin::init
08:56:21: Debug: RTracePlugin::init
08:56:21: Debug: RDwgPlugin::init
08:56:21: Debug: loading static plugins...
08:56:21: Debug: Input file: E:/QCad\test.dwg
08:56:21: Debug: Output file: E:/QCad\test.dxf
08:56:21: Debug: DXF/DWG Release: R27
08:56:21: Debug: calling odInitialize
Warning: cannot assign original handle to object "0x14"
Warning: collision with object of type: 2
Warning: new handle "0x39"
Warning: cannot assign original handle to object "0x15"
Warning: collision with object of type: 2
Warning: new handle "0x3a"
Warning: cannot assign original handle to object "0x16"
Warning: collision with object of type: 2
Warning: new handle "0x3b"
Warning: cannot assign original handle to object "0x10"
Warning: collision with object of type: 2
Warning: new handle "0x3c1"
Warning: cannot assign original handle to object "0x3c1"
Warning: collision with object of type: 3
Warning: new handle "0x3c2"
Warning: cannot assign original handle to object "0x22"
Warning: collision with object of type: 2
Warning: new handle "0x3c3"
Warning: cannot assign original handle to object "0x1f"
Warning: collision with object of type: 2
Warning: new handle "0x3c4"
08:56:21: Debug: dynamic block ref
Conversion finished.
If external reference refers to the missing information in test.dwg, then I don't actually have it. The only file I have is test.dwg.
-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Hi,
I can now replicate loading the DWG within the QCAD GUI and save it as DXF with the additional data.
As well with QCAD 3.32.1.0 version as with an older version 3.27.6.0
My fault before was to reopen the original.
With proper naming I did not make that mistake.
I have too many files called 'test' downloaded from the forums.
Near the end of the conversion process is another clue:
Block 13 and *U2 are representations of windows and how they open.
The additional data appears to be shutters ... Dynamically adjusted to both window sizes.
Something said to be unsupported.
I did encountered that before ... Searching ... Found it.
In this reply as answer to my own questions, under the second title [SOLVED]:
And that points to an open question ... Unanswered.
Bottom line: QCAD clears the invisible state of some objects.
Unfortunately, as a simple user I cannot help you any further than reporting this additionally.
Regards,
CVH
I can now replicate loading the DWG within the QCAD GUI and save it as DXF with the additional data.
As well with QCAD 3.32.1.0 version as with an older version 3.27.6.0
My fault before was to reopen the original.
With proper naming I did not make that mistake.

I have too many files called 'test' downloaded from the forums.

Near the end of the conversion process is another clue:
Code: Select all
08:56:21: Debug: dynamic block ref
The additional data appears to be shutters ... Dynamically adjusted to both window sizes.
Something said to be unsupported.
I did encountered that before ... Searching ... Found it.
In this reply as answer to my own questions, under the second title [SOLVED]:
- This tickle down to another level of visibility, the RObject itself being set 'Invisible'.
Supported by QCAD on load and an unknown property for QCAD users BUT also clearedwhile saving.
And that points to an open question ... Unanswered.
Bottom line: QCAD clears the invisible state of some objects.
Unfortunately, as a simple user I cannot help you any further than reporting this additionally.
Regards,
CVH
-
- Junior Member
- Posts: 22
- Joined: Fri Apr 19, 2024 2:31 am
Re: Unexpected entity when using dwg2dwg.bat
Thank you, CVH, I have seen the report you submitted: https://qcad.org/bugtracker/index.php?d ... sk_id=2146
Is there any way we can increase the priority of this bug? Actually, I have encountered similar problems with many of my drawings.
Is there any way we can increase the priority of this bug? Actually, I have encountered similar problems with many of my drawings.
-
- Premier Member
- Posts: 4943
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Unexpected entity when using dwg2dwg.bat
Yes,
You can vote it up ....
For that you need to be logged on as user.
You can apply for an account, it is independent of the QCAD forum account.
Not aware that trailing reports (5 years) are looked at or that additional comment is even considered.
It won't hurt, right?
Regards,
CVH
You can vote it up ....
For that you need to be logged on as user.
You can apply for an account, it is independent of the QCAD forum account.
Not aware that trailing reports (5 years) are looked at or that additional comment is even considered.
It won't hurt, right?

Regards,
CVH