.NET

Reply
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 1 of 9 (457 Views)

how to get binary data of a dwg file in autocad?

457 Views, 8 Replies
03-25-2014 05:13 AM

due to some reasons, dwg files(as well as dxf files) was encrypted when saved onto disk, but once try to open the encrypted dwg file,it will decrypted and ready for the autocad, that means for autocad, the file was raw dwg file that according to autodesk's dwg file specification, so can i dump the binary data of decrypted dwg file by using ObjectARX?

ADN Support Specialist
augusto.goncalves
Posts: 370
Registered: ‎04-30-2009
Message 2 of 9 (424 Views)

Re: how to get binary data of a dwg file in autocad?

03-26-2014 11:48 AM in reply to: cdinten

AutoCAD APIs, including ObjectARX, will only allow access to DWG data though controlled APIs, meaning you cannot read raw/binary data using these APIs (unless for specific custom objects hosted on the file).

Regards,



Augusto Goncalves
Autodesk Developer Network
Distinguished Mentor
owenwengerd
Posts: 645
Registered: ‎08-06-2002
Message 3 of 9 (416 Views)

Re: how to get binary data of a dwg file in autocad?

03-26-2014 03:37 PM in reply to: cdinten

You can call Database.SaveAs() to dump to a normal binary .dwg file. See e.g. here.

--
Owen Wengerd
ManuSoft
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 4 of 9 (386 Views)

Re: how to get binary data of a dwg file in autocad?

03-29-2014 12:08 AM in reply to: owenwengerd

thanks for your replay. yes, i know that, but still could not get the decrypted data, even i changed the extension of file name.

i thoughr if i could get the stream of the decrypted file?

Distinguished Mentor
owenwengerd
Posts: 645
Registered: ‎08-06-2002
Message 5 of 9 (360 Views)

Re: how to get binary data of a dwg file in autocad?

03-30-2014 02:57 PM in reply to: cdinten

I understood from your earlier post that AutoCAD can open the file. If AutoCAD can open the file, then it can save it as well.

--
Owen Wengerd
ManuSoft
Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 6 of 9 (319 Views)

Re: how to get binary data of a dwg file in autocad?

04-02-2014 06:21 AM in reply to: owenwengerd

Your problem description is unclear, but it sounds like you're asking how to read a DWG format file and then somehow convert this into a different (possibly plain text) format file (what you call a 'decrypted file'). Owen's answer was correct that AutoCAD does not expose an API that will give you low level access into the data within a DWG file. But I think the APIs for querying data from a DWG once its opened in AutoCAD or RealDWG are pretty comprehensive.

 

And you can, of course, save a DWG to DXF format. That is a text file format you can easily open and read using Notepad or similar.

 

Perhaps if you described why you wanted to access to this low level data, then someone can suggest an approach for which suitable APIs do exist.

Cheers,

Stephen Preston
Autodesk Developer Network
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 7 of 9 (303 Views)

Re: how to get binary data of a dwg file in autocad?

04-02-2014 08:33 PM in reply to: StephenPreston

thanks, Stephen. My situation is complicate, which i could not describe in a word. it's a problem that once a computer has install a encrypted software that encrypted all dwg and dxf files when saving them. if you use this computer to open the encrypted dwg files, the encrypt software can monitor this event and decrypt the file to the original file(which is according to autodesk's dwg spec.) So to AutoCAD, file is all ok. but when we use a computer that does not install the encrypt software, you can guess what will happen, AutoCAD try to open an encrypted dwg file, which is not according to autodesk's dwg spec.it will definiately fail to open it.
so my idea is like this:
when i open a dwg file successfully on a computer that has install the encrypt software, i know for sure that the data of this opened dwg file in AutoCAD is unencrypted(the raw data, i mentioned before), and at this moment, if i could access the binary data, i can copy the data to somewhere and save them in another format(ie. *.gwd) which would ignore by the encrypt software. then i copy the gwd file to another computer that has not installed the encrypted software, and rename the extension to dwg to open it.

Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 8 of 9 (276 Views)

Re: how to get binary data of a dwg file in autocad?

04-04-2014 04:37 AM in reply to: cdinten

Sorry - I dont think I can help you with that. As Owen said, you can use SaveAs, or you can WBLOCK the DWG contents to another drawing and save that, or you can save as DXF. But if your encryption software is intercepting those saves, then I don't see an easy way around it.

 

If you have a legitimate reason for needing to bypass the encryption software installed on that computer, then I recommend you contact the vendor of the encryption software for assistance.

Cheers,

Stephen Preston
Autodesk Developer Network
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 9 of 9 (271 Views)

Re: how to get binary data of a dwg file in autocad?

04-04-2014 06:33 AM in reply to: StephenPreston
it's the problem that our pre-IT admin has fired and password is not avaiable, we contact the vendor but make no chance,all we could do is dispatching encrypt software every computer. But this still could a time bomb. Thank you anyhow.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.