View Full Version : Extracting text from a dwg file on a computer without AutoCAD
This is a little off topic and possibly in the wrong forum, but here goes.
I need to extract text entities from a dwg file, edit them and insert the edited text back into the dwg file. This is no problem on the computers with AutoCAD installed but I need to do this also on computers without AutoCAD installed on them. I appreciate that RealDWG is an option but the price is so exorbitant that it just cannot be justified for what will be a "one-off" job. It is also possible to do it in the cloud, but that needs a cloud based server, all of which are not appropriate here.
Does anyone know of a way to read the dwg into a database using VB.NET or C#, and then export just the various text entities from there?
Alternatively it looks like converting the dwg to dxf using a converter and extracting the text entities from the dxf file.
All suggestions will be gratefully considered.
Regards
Ben
BlackBox
2017-03-20, 09:21 PM
Welcome to AUGI, my friend.
It's been along time since we last spoke; I do hope you're doing well!? :beer:
To your post - If memory serves, without AutoCAD being installed on the workstation, your options are very limited, and come with some implicit steps that ultimately need to be done with AutoCAD where you do have a license available.
What I mean by that, is that you'd setup an internal service (WPF Browser Application?) that works with a 'watcher' located on a machine that has AutoCAD, to see when users need to query/write values. The user would need a means by which to specify a drawing through the Browser App, the 'watcher' would receive that at an ..\in\ folder location on the network, then extract, and write the original values to a coordinated location for that user session to read and display same. The Browser App would need to permit user to change the values, and apply, which would then write the new values to an appropriate location that the 'watcher' would then read them, make the necessary changes, and subsequently save the drawings.
As mentioned above, there are implicit steps needed, but this should be enough to determine viability for your environment. Important to note, that while in this scenario, user would be using a browser, the entire service (front/back ends) are internal to your network, which means they are as secure as your network is, if that is of concern.
Cheers
Hi BB my old buddy,
Yes it has been quite a while since we last spoke, I hope both you and your family are keeping well. I've gone into retirement and after first saying that was it with working I now find myself up to my neck in work. I've changed direction quite a bit and am now more involved with translation work than AutoCAD, but programming is still my main interest. I translate German -> English, specialising on AutoCAD, Revit, Laser scanning and surveying and I have more than enough to do.
To my problem: I was approached by a couple of translators about translating AutoCAD drawings and as there are a few programs out there that "can translate" the drawings I took a look at them, not wanting to reinvent the wheel. There are two types of software for translating AutoCAD drawings, one for DWG files and on for DXF files. The ones for DWG files all need AutoCAD installed on the computers and the ones for DXF files take an ascii DXF file. I was unable to find any software that did both, but that's by the way. I saw that the software was written by programmers without an in depth knowledge of AutoCAD. The basic principle of the software is that the program extracts all of the text entities from the AutoCAD file and exports it to a text file. This text file is then loaded into a CAT Tool (Computer Aided Translation) and after translation the text entities are reinserted into the AutoCAD file. But a lot of the text entities are not translated by the software that I tested, for example XData, XRecords, etc, all of the so called "invisible" text. But for GIS and BIM this text is important and must be translated.
I have an old VBA module that I wrote about 15 years ago that iterates all visible text entities on the screen allowing the checking of the text placement, to ensure there is no overlapping or over writing of text. This could be expanded to take care of "invisible" text and also written in .NET, thereby covering the DWG aspect. I also have a .NET program that can extract ALL of the text entities from an ascii DXF file, export it to a text file and reinsert it into the DXF file. So in essence I can do all that I need (or almost). But the biggest problem with the app that I have been asked to develop is that it will be used by translators without AutoCAD on there computers, absolutely no CAD experience (they are "language engineers") and with no access to a network with AutoCAD, and sitting anywhere in the world.
It would be possible to do what I need with RealDWG or in the cloud, but both are too expensive. I intend having two apps, a basic one that will be free and an advanced one for a small charge. It is not going to make me rich! I was hoping for a solution by reading the DWG into a database, but it looks like it is not possible. I think now the only solution is to use a DWG-DXF converter and save the DWG as DXF, extract the text, translate it, reinsert into the DXF and convert the DXF to DWG. I need to look on Source Forge for some converters, do you have any knowledge in this field. I am wary that the converters might not do a clean round robin conversion and cause a loss of information in the final DWG.
Any help would be greatly appreciated.
All the best,
Ben
BlackBox
2017-03-22, 07:32 PM
Hi BB my old buddy,
Yes it has been quite a while since we last spoke, I hope both you and your family are keeping well. I've gone into retirement and after first saying that was it with working I now find myself up to my neck in work. I've changed direction quite a bit and am now more involved with translation work than AutoCAD, but programming is still my main interest. I translate German -> English, specialising on AutoCAD, Revit, Laser scanning and surveying and I have more than enough to do.
Mrs. BB and I have much to be thankful for these days.
Congrats on retirement, mein freund! I must have missed the trinkpartei invitation, and gedenkstein? :beer: Haha
As for all of the post-retirement work, just remember that 'a body in motion, stays in motion'. :mrgreen:
To my problem: I was approached by a couple of translators about translating AutoCAD drawings and as there are a few programs out there that "can translate" the drawings I took a look at them, not wanting to reinvent the wheel. There are two types of software for translating AutoCAD drawings, one for DWG files and on for DXF files. The ones for DWG files all need AutoCAD installed on the computers and the ones for DXF files take an ascii DXF file. I was unable to find any software that did both, but that's by the way. I saw that the software was written by programmers without an in depth knowledge of AutoCAD. The basic principle of the software is that the program extracts all of the text entities from the AutoCAD file and exports it to a text file. This text file is then loaded into a CAT Tool (Computer Aided Translation) and after translation the text entities are reinserted into the AutoCAD file. But a lot of the text entities are not translated by the software that I tested, for example XData, XRecords, etc, all of the so called "invisible" text. But for GIS and BIM this text is important and must be translated.
I have an old VBA module that I wrote about 15 years ago that iterates all visible text entities on the screen allowing the checking of the text placement, to ensure there is no overlapping or over writing of text. This could be expanded to take care of "invisible" text and also written in .NET, thereby covering the DWG aspect. I also have a .NET program that can extract ALL of the text entities from an ascii DXF file, export it to a text file and reinsert it into the DXF file. So in essence I can do all that I need (or almost). But the biggest problem with the app that I have been asked to develop is that it will be used by translators without AutoCAD on there computers, absolutely no CAD experience (they are "language engineers") and with no access to a network with AutoCAD, and sitting anywhere in the world.
It would be possible to do what I need with RealDWG or in the cloud, but both are too expensive. I intend having two apps, a basic one that will be free and an advanced one for a small charge. It is not going to make me rich! I was hoping for a solution by reading the DWG into a database, but it looks like it is not possible. I think now the only solution is to use a DWG-DXF converter and save the DWG as DXF, extract the text, translate it, reinsert into the DXF and convert the DXF to DWG. I need to look on Source Forge for some converters, do you have any knowledge in this field. I am wary that the converters might not do a clean round robin conversion and cause a loss of information in the final DWG.
Any help would be greatly appreciated.
Interesting!
Never really worked on anything like this, but I am not immediately aware of any software that can read DWG without RealDWG or AutoCAD licensing. Even if you do not need a RealDWG license, the vendor of the app that can read DWG likely has one, which is why they charge a fee, AFAIK. This is just my limited understanding - hopefully someone smarter than I will be along to correct me where I may be wrong.
In very limited searching, it sounds like you're interested in something like AnyDWG's Any DWG DXF Converter (http://anydwg.com/dwg-dxf/), specifically the Pro version ($140/user, lifetime FREE future upgrades), which includes command line support.
That said, I have no idea if using this to convert DWG to DXF will expose the XData, XRecords, and Object Data that you want to cull, modify, and write back to (presumably a new) DWG (thereby preserving the original, likely after a simple rename?).
Hope this helps!
Prost
alexmg86780093
2019-03-18, 01:01 PM
This is a little off topic and possibly in the wrong forum, but here goes.
I need to extract text entities from a dwg file, edit them and insert the edited text back into the dwg file. This is no problem on the computers with AutoCAD installed but I need to do this also on computers without AutoCAD installed on them. I appreciate that RealDWG is an option but the price is so exorbitant that it just cannot be justified for what will be a "one-off" job. It is also possible to do it in the cloud, but that needs a cloud based server, all of which are not appropriate here.
Does anyone know of a way to read the dwg into a database using VB.NET or C#, and then export just the various text entities from there?
Alternatively it looks like converting the dwg to dxf using a converter and extracting the text entities from the dxf file.
All suggestions will be gratefully considered.
Regards
Ben
dwg2docx dot com - maybe this can help to you
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.