查看单个帖子
旧 2009-05-04, 03:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】access to proxy data

access to proxy data
access to proxy data
hello!
there are functions adreadproxydataxxx in odt to read proxy data from proxy objects. is there analog in directdwg?
how to read/write proxy data in directdwg?
best regards,
ivan obraztsov

using adreadproxydataxxx() in odt makes sence only if you know the data structure - if it's a known object for you.
in dwgdirect you can implement your own custom class and such objects will be loaded by dwgdirect not as oddbproxyobject or oddbproxyentity but as yourobject. see examplecustomobject.* in odamfcapp sample.
you need to implement methods dwginfields(), dwgoutfields(), dxfinfields(), dxfoutfields().
if your application is a viewer you need to implement worlddraw() to render your entity.
sergey slezkin

thank you.
but i could not implement this mechanism.
1. i create my own class. (copy the sample) change the dxf and app name in cpp-file.
2. call rxinit after initialization and rxuninit before uninitialization.
but i don抰 get me objects. i get the proxy objects.
what i have to do else?
best regards,
ivan obraztsov

you need to change rx class name too (first parameter of macro) it must be the same as the string under group code 2 in dxf file classes section:
0
class
1
examplecustobject - dxf name
2
examplecustobject - rx class name
3
odamfcapp - app name
sergey slezkin

i wonder, if i must use a derived class of od lib to be loaded automaticly.
can i read the data from the proxy entity directly? or, can i write the data out to another dwgfiler?
i tried to use my own dwgfiler and call the entity's dwgoutfields() method, but i failed with access deny. i think the odlib has too many internal mechanism, just like autocad. or, there is something i have done wrong.

custom objects must be derived from oddbobject or one of its inheritors.
custom entities must be derived from oddbentity or one of its inheritors.
there is no direct access to proxy data. dwgoutfields() should work with copy filer but not with file filer. but you may get a binary chunk as it is stored in dwg file and have to extract bit-coded values from it.
sergey slezkin
try
try and try by susheng
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)