几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-05, 12:11 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】hot to get the data stored in dxfinfields of a custom obje

hot to get the data stored in dxfinfields of a custom object
hot to get the data stored in dxfinfields of a custom object
i want to read ase links from the drawing file. i have implemented the custom class with the name casedlpntablerecord and am correctly reading the linkage data in dxfinfields function. now the problem - how do i get this data back in my program. my code calls readfile which is calling dxfinfields function of my custom class. after the readfle is done, i want the data that was interpreted correctly in the dxfinfields function.
i am running out of time for a solution to this problem. any help would be greatly appeciated. i did get lot of info from the forum regarding custom objects - but no one seemed to ever try doing what i am doing now. or am i missing something very obvious?
thanks,
saroja
if you implemented a custom class which correcly reads and stores object data you can access the data using your own accessors to the data you store.
sergey slezkin
sergey, i am glad you are online.
i am storing the data as member variables of the custom class - is this what you mean by storing the data? if so, where can i get the object pointer to this class? sorry, if i am asking too basic question - but i have spent lot of time trying to do it myself and gave up..
how do i read this custom data (xdata) associated with every entity? does anyone have a sample code?
thanks,
saroja
last edited by suppu@india.ingr.com; 28th october 2004 at 07:40 amfff">.
i do not know how asedlpntablerecords are stored. if they are linked with entities probably they are attached to entity via xdictionary. if they contain information not associated with particular entities but with the drawing they may reside in some dictionary owned by the root named objects dictionary.
try to examine the file with odamfcapp using tree control.
btw, object with known handle can be found via ctrl/f.
sergey slezkin
the odamfcapp shows the object as "ase_index_dictionary" under acdbdictinary node, but some of the data is missing. i have a class a that uses dwgdirect's readfile which in turn calls dxfinfields. now after i read the file, i need the data stored in my custom class object - but my class a does not have a way to get the custom object. when are getvalue, getstring methods of the custom object called by dwgdierct? i have attached the code below that i used with odt. thanks.
code:
adstartobjectget(dwghandle);
while ( adgetobject(dwghandle, &adobhd, &adob) && !blinktemplatefound )
{
if ( adobhd.objtype == adobjectptrobjtype(dwghandle) )
{
if ( adobhd.xdblob != ad_vmnull )
{
bcptr = adstartblobread(adobhd.xdblob);
while ( adreadextendeddata(bcptr, &adxd) && !blinktemplatefound )
{
if ( ad_xd_appobjhandle == adxd.xddxfnumber )
{
adbinaryobjhandletoascii(adxd.xddata.xdappobjhandle, szobjhandle);
{
// read the link table name
if (adreadextendeddata(bcptr, &adxd))
{
if ( ad_xd_string == adxd.xddxfnumber )
{
// read the link template data
}
// read the link field name
if (adreadextendeddata(bcptr, &adxd))
{
if ( ad_xd_string == adxd.xddxfnumber )
{
// cache the link field
blinktemplatefound = true;
}
}
}
}
} // if ad_xd_appobjhandle
}
adendblobread(bcptr);
}
}
} // end of while adgetobject
dictionary is a list pairs name-objectid.
ase_index_dictionary is name of entry in the root dictionary. objectid stored in this entry is id of another dictionary. in sample files i have this dictionary contains only one item - xrecord under aseblockhierarhyindexrecord name. probably your object id is in this dictionary too under another name.
if this does not help send me a sample dwg/dxf file containing your object, please.
code:
oddbdictionaryptr prootdict = pdb->getnamedobjectsdictionaryid().safeopenobject();
oddbdictionaryptr pasedict = prootdict->getat("ase_index_dictionary");
oddbxrecordptr pxrec = pasedict->getat("aseblockhierarchyindexrecord");
myobjectptr pmyobject = pasedict->getat("somemyname");
sergey slezkin
sergey, that doesn't help. i am currently using global variables to store the data in dxfinfields and using that data in my main class. i know it is a very bad way of reading the data, but i can't see any other option.
now, i ran into a different problem. in dwginfields, i cannot do a nextrb on oddbdwgfiler object. any special reason for this seperation between dxf and dwg? how do i iterate through the oddbdwgfiler object to read the data?
i have attached the sample file.
thanks,
saroja
attached files (31.3 kb, 5 views)

both dwginfields() and dxfinfields() are not intended to load xdata. the xdata is loaded by common code for oddbobject.
btw, if all you need is xdata you need not implement your custom class.
code:
oddbdictionaryptr prootdict = pdb->getnamedobjectsdictionaryid().safeopenobject();
oddbdictionaryptr pconldict = prootdict->getat("conldefdictionary");
oddbobjectptr pdlpntablerec = pconldict->getat("keyintegerlink");
odresbufptr pxdata = pobj->xdata();
attached images (72.0 kb, 8 views)

sergey slezkin
problem resolved
sergey,
i need the custom class to read the obj_ptr - to get the name keyintegerlink in this case. anyway, got the solution from ken's code in another post.
thanks,
saroja
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】custom objects yang686526 DirectDWG 0 2009-05-04 06:56 PM
【转帖】custom data - proxy yang686526 DirectDWG 0 2009-05-04 06:55 PM
【转帖】binary data custom objects yang686526 DirectDWG 0 2009-05-04 04:42 PM
【转帖】adding custom objects to a custom dictionary yang686526 DirectDWG 0 2009-05-04 03:43 PM
【转帖】custom properties yang686526 SolidWorks二次开发 0 2009-04-13 10:09 AM


所有的时间均为北京时间。 现在的时间是 07:51 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多