高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】otally New To All Of This
totally new to all of this
totally new to all of this
maybe someone can help get me on the right track...
we have a need to extract some data from our customer's autocad files. (i personally have very little experience with this). up until now, we have always done our extraction from the dxf, and have not dealt with the dwg directly.
however, now one of our customers has "hidden" data in the dwg, which i'm not sure of the terminology... from the reading i've been doing here, i'm guessing this is entity object data. it does not exist in the dxf. i installed autocad map, and the customer sent me a lisp script which i can run, select an object, and it then lists all of the table data. for example, from one item, this is what i get back:
(("facility" ("fp" "01101001.0023601" 0) ("ts" "" 0)
("copco" "" 0)) ("circuit" ("circuit" "5p478" 0)) ("phase" ("phase" "b" 0))
("xfmroh" ("co_no" "22-32476" 0) ("kva" 50.0 0)))
facility, circuit, phase, xfmroh are examples of these "hidden" tables for which i want to extract the data.
running the lisp script proves to me that this data does all exist in the dwg file. (not being familiar with this, for awhile we were suspicious this data was in a separate database).
so it is in the dwg, so now how can i find and extract this? ideally using c++. maybe dwgdirect isn't even the best way to go. it is just a tool that i'm aware of. or maybe i need this object arx i've seen mentioned?
at least help get me going in the right direction. please try to be very specific. i don't know dwgdirect at all, and my knowledge of dwg/dxf is also extremely limited. if you can at least give me the correct terminology for what i am describing, that will help me in my search for further information.
thank you very much,
amy
what kind of item you selected to get the dump from lisp script? does the information you need exists in dxf file if the dxf is saved by autocad map?
sergey slezkin
quote:
originally posted by sergey slezkin
what kind of item you selected to get the dump from lisp script? does the information you need exists in dxf file if the dxf is saved by autocad map?
i selected an item which is a block including an overhead transformer symbol and the text "22-32476 b 50". the information i need to extract, like circuit information, is not in the dxf. i searched the dxf for the circuit number, 5p478, and it is not found.
this is the problem. we have our own libraries that we use for extracting from dxf, which have always been sufficient. we have never had to worry about reading dwg format.
thanks,
amy
you extracted the information from dxf previously and you wrote that the information is absent in dxf. you task changed?
could you post (or e-mail me) a sample file and some tips to understand what you need to extract (lisp script and item handle or some in-word description).
dxf and dwg files store exactly the same information.
sergey slezkin
here's a sample dwg and the lisp script. if you do a 'find' for text 22-32476 and then 'zoom to', this is the item in question. i was unable to get at the circuit information, like circuit number 5p478, anywhere in autocad. i can get at it in autocad map by either running the attached lisp script and selecting this text, or i've discovered i can also get this information by doing on "edit object data" (from map menu - object data - edit object data). this also shows the tables and their information. this information doesn't seem to be accessible from within autocad??? i know the customer uses something different, oms viewer, for viewing this information.
if i save the map as dxf, then viewing the dxf map, i can see the same information. but if i open the dxf in a text editor and search for the circuit number 5p478, it is not found. so our dxf parsing cannot find it. i do not know how to get at the circuit number programmatically without using the lisp script. and we need the circuit extraction to be built into a larger data processing operation, which is run on all their data on a regular basis, so it needs to be clean and fast.
thank you so much for helping me!
attached files (431.3 kb, 5 views)
it seems that the data you need to extract is stored in "custom" objects implemented in autocad map application.
if writing a programm working in map environment works for you - its the easiest way.
if you need a stand-alone programm working without autocad and map dwgdirect is possible to use. but in such case you need know how the information you need to extract is stored - some reverse engineering is required.
sergey slezkin
this is more or less the conclusion i was coming to...
we already have a big c++ program that the customer runs on their full autocad data set to do a whole bunch of conversion and extraction (in which we use opendwg or dwgdirect to create the dxf, and then work with that). this extraction of the "custom" objects is just one more thing i need to add in to the whole process. so i don't think i'll be able to do it in the map environment. at least i don't know how i would do that. (let me know)
so i probably need to try to figure out how the information is stored, which is what i've been trying unsuccessfully to do... any suggestions on how to proceed?
thank you!
amy
i should add...
if this was just a one-time process to extract data, i could consider using lisp.
however, this data extraction is run on a regular basis by the customer to keep their data up to date, as often as they feel is necessary. could be monthly, weekly, or even daily. so i don't think using lisp is a viable option.
any information about how these custom objects are stored, or any information about tools that may be useful for me, or any good books or websites... i've been doing lots of searching and have learned some things, but nothing that is going to actually help me get at the data.
some of information as you probably figured out is stored in block insertion attributes but some - in "object data".
block insertion has extension dictionary containing items pointing to cirdobjrecord (ird_obj_record) objects.
for pure autocad (not autocad map) and dwgdirect this object data is simply a binary chunk and only appropriate application (a part of autocad map) knows how to interprete it. this binary data is not easy to crack. it's a stream of integers, doubles, strings etc. in some specific order. the worst thing is that autocad's data stream is bit (not byte) stream - even integer or double values depending on their value may have various length and may start not on byte boundary so you can't see the values in memory dump - they may be shifted from byte boundary.
the key thing is to know how an object writes itself to dwg - the sequence of calling functions like wrint16(), wrdouble(), wrstring() etc.
sergey slezkin
thank you for the information.
this sounds like way more fun than i want to have!
maybe i'll try to get by with lisp after all.
|