.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

8 REPLIES 8
Reply
Message 1 of 9
cdinten
4500 Views, 8 Replies

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

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?

8 REPLIES 8
Message 2 of 9
augusto.goncalves
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
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 9
owenwengerd
in reply to: cdinten

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

--
Owen Wengerd
ManuSoft
Message 4 of 9
cdinten
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?

Message 5 of 9
owenwengerd
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
Message 6 of 9

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
Message 7 of 9
cdinten
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.

Message 8 of 9
StephenPreston
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
Message 9 of 9
cdinten
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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost