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