![]() |
【转帖】oddbdatabaselastsavedasversion returning 0
oddbdatabase::lastsavedasversion returning 0
oddbdatabase::lastsavedasversion returning 0 we are just migrating from dwgdirect 1.13.02 to version 2.06.03. now, in the current version, oddbdatabase::lastsavedasversion() no longer gives the expected result. regardless of the input file the function always returns oddb::kdhl_mc0_0. you can see this behavour, if you add these lines oddb::dwgversion version = pdb->lastsavedasversion(); if (oddb::kdhl_mc0_0 < version && version < oddb::kdhl_unknown) writeline(indent, dd_t("current file dwg version:"), tostring(version)); else writeline(indent, dd_t("current file dwg version:"), "unknown"); to dbdumper::dumpheader in dbdumper.cpp in the odreadex example. i need the correct file version info as input for oddbsymutil::isblockmodelspacename. is this a known problem? like in autocad after file loading the lastsavedasversion is 0 (unknown). after you call writefile() the lastsavedasversion gets the value. where is also originalfileversion, savedbyversion etc. after file loading the database is always converted to current (latest) version. so default parameter of isblockmodelspacename() is ok in most cases. sergey slezkin dear sergey, i can not agree with your for two reasons: 1. a method that gives the correct answer only in most cases is worthless. i need a method that gives me the correct answer under all circumstances. (you'd probably appreciate this if i tell you that among our products is an onboard flight system.) i have some dwg files that were originally created by r12, but later on were saved as acad2000. so the model space name in these files is "*model_space", but i can not use the 'originalfileversion' (which is r12), since it will give me wrong answer. but i have also some dwg files from r12 that were never altered, so their model space name is still "$model_space". so, here, the 'originalfileversion' is ok. but, as i stated before, it will only give the correct answer, if the file was never modified. a fact that i can not establish for sure. that is the reason, why i used 'lastsavedasversion', which gave always the correct answer back in version 1.13.02. probably a property like the savedbyversion you mentioned would do the trick, but i cannot find it in the the documentation. 2. now, i do not think that the described behaviour for 'lastsavedasversion' is in sync with autocad. may be, the 'version' of the database is unknown until it is saved for the first time. but the 'lastsavedasversion' is that version the file on the disk was last saved as. and this information is written into the file, so it should be available right after opening. for these reasons, i regard the current behaviour as a regression bug. kris. dear kris, if it's all about trying to acces the model space, as i wrote previously after file is loaded it's converted to the latest version. so model space block will always have "*model_space" name at run time. also note that where is oddbdatabase::getmodelspaceid() function which will return id of model space block table record. the change in behavior is not regression but the fix for 1.13 bug. here is brief overview of version-related oddbdatabase functions: version() - the version of database object. it's always the latest version because after loading the file is always converted to the latest one. lastsavedasversion() - returns the version that the current drawing was last saved as in the current session. if the current session has not yet done a save on this drawing, then it returns zero. it's used by application for example in such situation: you edited the drawing and saved it to r12. if you try to close the drawing's window you get a warning: "the drawing was not saved to the latest version. do you want to saved it (to the latest version)? yes/no/cancel. originalfileversion() - version of the file which was loaded. if a r12 file was loaded and saved to r15 than after reloading the file originalfileversion will be r15. originalfilesavedbyversion() - returns the version value of the last autocad product which saved the drawing file, not counting the current session. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 06:03 AM. |