![]() |
【转帖】dwfpath problem of oddwfexporte
dwfpath problem of oddwfexportex
dwfpath problem of oddwfexportex if the dwf file path contain word that is not english, oddwfexportex will catch "unknown error." for example, if the dwf file path contain chinese words, it happens. please give me a hand. with great appreciation. thank you very much. debug the sample, make sure that correct unicode string is set to dwexportparams.sdwffilename vladimir thank you. importer->properties()->putat( "database", pdb ); importer->properties()->putat( "dwfpath", odrxvariantvalue( odstring(dwgpath) ) ); importer->properties()->putat( "password", odrxvariantvalue( odstring("") ) ); importer->properties()->putat( "paperwidth", odrxvariantvalue( 297. ) ); importer->properties()->putat( "paperheight", odrxvariantvalue( 210. ) ); // if color indices are preserved, rgb color may differ importer->properties()->putat( "preservecolorindices", odrxvariantvalue(false) ); //importer->properties()->putat( "preservelineweightindices", odrxvariantvalue(false) ); // you may select which layout to import importer->properties()->putat( "layoutnumber", odrxvariantvalue(odint32(-1)) ); // enables importing hsf 3d model from new dwf files (beta version, use for testing) importer->properties()->putat( "importw3d", odrxvariantvalue(true) ); importer->import(); the error happens at "importer->import();" there may be problems opening files with unicode names from console application. to avoid them - open the file yourself and pass odstreambuf interface to dwf import. odrxsystemservices()->createfile() uses default file stream implementation, so, you may want to create your own wrapper, analagous to odfilebuf from extensions\exservices\odfilebuf.cpp . to pass the stream instead of the file to the dwf import - assign "stream" property of te importer, instead of "dwfpath". vladimir // documented properties are: // "database" - oddbdatabase object, where dwf is imported // "dwfpath" - string, path to the imported dwf file // "password" - string, (default empty), password to dwf if required // "paperwidth" - double, (default 297), paper width in millimeters // "paperheight" - double, (default 210), paper height in millimeters // "background" - odcolorref, (defaulf 0xffffff), (output parameter), paper color // but there is no "stream" assign. "stream" property is assigned the same way as "database". it has odstreambuf type. vladimir you mean " odrdfilebuf stream(argv[1]); importer->properties()->putat("stream", odrxvariantvalue(&stream));" ? but catch error "invalide input" at "importer->import();" you shouldn't wrap it in odrxvariantvalue, just assign it. does odrdfilebuf open the file? (it is used inside the importer, i wonder, what's the difference) vladimir thank you! you mean "odrdfilebuf stream(argv[1]); importer->properties()->putat("stream", &stream);" but still catch error "invalide input" at "importer->properties()->putat("stream", &stream);" and as for odreadex i change the follow codes " oddbdatabaseptr pdb = svcs.readfile( argv[1], true, false, oda::ksharedenyno); " as " odrdfilebuf stream(argv[1]); oddbdatabaseptr pdb; pdb = svcs.createdatabase(false); pdb->readfile(&stream); " it works. last edited by yeyunxiaopan; 29th april 2008 at 05:29 pmfff">. i can't reproduce that. what version do you use? vladimir dwgdirect_1.14 windowsxp + vc6.0 oddwfexportex.cpp modified " importer->properties()->putat( "dwfpath", odrxvariantvalue( odstring(argv[1]) ) ); " as " odrdfilebuf stream(argv[1]); importer->properties()->putat("stream", &stream); " then the error " invalide input" was cought at "importer->properties()->putat("stream", &stream);" 1.14 is very old, it is not even unicode. no wonder it's not working correctly. vladimir thank you very much! |
所有的时间均为北京时间。 现在的时间是 06:12 PM. |