高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】proxy objects. compare odt and dwgdirec
proxy objects. compare odt and dwgdirect
proxy objects. compare odt and dwgdirect
we used odt to import/export projects to dwg/dxf. now we try to switch to dwgdirect.
please help me with backward compatibility proxy_entity. the simple sample:
we need store and read custom object with project preferences.
in odt we:
1. register class (classname, cclassname, appname) and store its number (500, 501 etc.).
2. register application (appname).
3. create new proxy entity with 損roxyent.appclassid?number from first step.
4. fill 損roxyent.entdatablob?and add entity to modelspace.
in dwgdirect we:
1. create and register custom class (classname, cclassname, appname) derived from oddbentity.
2. create new cclassname object and add it to modelspace. filling data implement in dwgoutfields and dxfoutfields.
so:
1. read old dwg file (created by odt) by dwgdirect pass normal.
2. read old dxf file (created by odt) by dwgdirect. first control get function dwgoutfields (why it抯 a load, not save). when control get function dwginfields and load pass normal.
3. read new dwg file (created by dwgdirect) by odt pass normal.
4. read new dxf file (created by dwgdirect) by odt failed. because 揺ntheader.enttype?store 498 (just proxy identifier) not 5xx (class number).
is any way to provide both way compatibility: odt and dwgdirect.
may be my latter is big and difficult for understanding, so i ready to give any additional information an comment.
below i copy parts of dxf files created by odt and dwgdirect (entity section):
odt dxf file:
acad_proxy_entity
5
2e
330
a
100
acdbentity
8
0
100
acdbproxyentity
90
498
91
519
95
917527
70
0
92
8
310
0800000000000000
93
21442
310
...
binary data here
...
94
0
0
dwgdirect dxf file. (class section is a same):
classname
5
35
330
1f
100
acdbentity
8
0
100
cclassname
93
2676
310
...
binary data here
...
0
note. if first save as dwg format, open in autocad 2002 and then save as dxf we get dxf-file looks like odt created.
best regards,
ivan obraztsov
since odt and autocad know nothing about your custom entity they save it as proxy.
dd "knows" your custom class and saves it as yourclass entity.
during file loading if proxy entity is of "known" class it is turned into original object. so autocad and odt load it as proxy and dd with your class registered - as yourclass.
does autocad load your dxf file?
sergey slezkin
autocad normaly load both odt and dwgdirect dxf files.
but after saving dwgdirect dxf file autocad add following codes to acdbentity section:
92
8
310
0800000000000000
best regards,
ivan obraztsov
>>>2. read old dxf file (created by odt) by dwgdirect. first control get function dwgoutfields (why it’s a load, not save). when control get function dwginfields and load pass normal.
it's ok. btw, you can optimize your code to work faster if in your dwgoutfields() function you check filer type and if it's idfiler you can skip writing all data except object ids. corresponding check must present in dwginfields() so that they could work together. surely base class function must be called.
dwgoutfields() and dwginfields() are called not only for file output, but for updating references between objects, cloning, writing undo/redo info etc.
>>>>4. read new dxf file (created by dwgdirect) by odt failed. because “entheader.enttype” store 498 (just proxy identifier) not 5xx (class number).
what is the problem? i think that after odt loads dxf or dwg created by odt entheader.enttype is 498 (proxy entity) too.
the difference maybe the following:
if in odt you always fill proxy binary data in dxf (or dwg) format, you'll get it in the same format after loading.
if file is saved by dwgdirect, after loading it in odt you will get proxy data in dxf or dwg format depending on file type.
to achieve compatibility you need to be able to interpret proxy data in odt in both dxf and dwg formats.
>>>>but after saving dwgdirect dxf file autocad add following codes to acdbentity section:
92
8
310
0800000000000000
it's ok. this data is proxy entity graphic representation. this sequence represents empty graphic data and can be skipped.
[ june 25, 2003: message edited by: sergey slezkin ]</p>
sergey slezkin
|