![]() |
【转帖】querying the file type
querying the file type
querying the file type in one of my functions, i just want to check whether a file is a dxf/dwg file or not(information in header section of dxf/dwg file should be sufficient to asnwer this). how can i accomplish this using dd. do i have to read the file partially using svcs.readfile() and then catch the exception thrown by dd. the exception thrown ("invalid group code")in case of a non-dxf/dwg file here is too generic to detect whether the file is malformed or is not a dxf/dwg file altogether. tia alex to detect it using dd the only way is trying to load it (partial loading helps to do it faster for dwg but not for dxf). dwg files start with symbols "acxxxx" where xxxx are 4 digits representing format version. examples: ac1009 - r12 ac1015 - r15 ac1018 - ac 2004-2006 binary dxf files start with string "autocad binary dxf" ascii dxf files have no magic string at the beginning so if check for dwg or binary dxf fails dd tries to load file as ascii dxf. sergey slezkin reading version hello sergey, i'm puzzeld about the same thing. i open a drawing but i can't determine the version of the drawing. i tried to read te variable acadver with getvariable()but that gives an error. then i tried to use dim stype as variant odahost.originalfiletype odadoc, stype originalfiletype = stype but that generates answers like 12, 24 and 25??? am i looking the right way or is there a simple method? thanks for helping! hollman quote: originally posted by hollman but that generates answers like 12, 24 and 25??? have a look at oddb:: dwgversion ... kdhl_1005 = 12, ... kdhl_1800a = 24, // r18 beta kdhl_1800 = 25, vac18 = kdhl_1800, // r18 release ... strange values quote: originally posted by joerg have a look at oddb:: dwgversion ... kdhl_1005 = 12, ... kdhl_1800a = 24, // r18 beta kdhl_1800 = 25, vac18 = kdhl_1800, // r18 release ... hi joerg we found the file which is part of dwg direct. we use dwgdirectx version 1.13.05 when using odahost.originalfiletype odadoc, stype the values returned acad2004 => 24 acad2000 => 12 some files even return -3, 8 and 4 but these are r12 files. when looking in the file odadefs.h the returned values are associated with no correct acad versions does anyone know how to retrieve the correct version of a dwg. or convert the returned stype to a sensible number releated to a acad version. thanks this is dwgdirect topic not ddx. for ddx you can find version numbers looking at acsaveastype enum in odax.h misha kuzinets |
所有的时间均为北京时间。 现在的时间是 03:29 PM. |