高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】dwf export problem
dwf export problem
dwf export problem
hi,
i have problems with dwf export. i have built a database (pddb) which i am able to export either in dwg or in dxf formats. however, if i try to export in dwf format i got error messages related to the heap (then an unhandled exception), when i am using the following code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
i can avoid this using a hack: first export in dwg format, then import using a locally generated service object and then export in dwf format (i am not particularly fond of this solution, but at least it worked.)
the hacked code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
//hack
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
oddbdatabaseptr pdb;
//hack, there is a heap problem...
pdb = svcs1.readfile(gui::gettempfilepath( gui::getdoctitle()+ ".dwg" )); //this is tjhe previous exported file
params.pdb = pdb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
oduninitialize();
my main problem (i have many :-) now is that even this does not work in release mode.
any suggestions?
thanks, miklos
what i forgot ...
i forgot to mention that i am using the 1.13 version of the toolkit, windows xp, dd_vc6 and dd_vc6dbg and that the dwf file produced in release mode contains no data, only this (in debug the result seems ok):
(dwf v00.42)
(endofdwf)
thanks again, miklos
quote:
originally posted by erdelyiszabo
hi,
i have problems with dwf export. i have built a database (pddb) which i am able to export either in dwg or in dxf formats. however, if i try to export in dwf format i got error messages related to the heap (then an unhandled exception), when i am using the following code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
i can avoid this using a hack: first export in dwg format, then import using a locally generated service object and then export in dwf format (i am not particularly fond of this solution, but at least it worked.)
the hacked code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
//hack
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
oddbdatabaseptr pdb;
//hack, there is a heap problem...
pdb = svcs1.readfile(gui::gettempfilepath( gui::getdoctitle()+ ".dwg" )); //this is tjhe previous exported file
params.pdb = pdb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
oduninitialize();
my main problem (i have many :-) now is that even this does not work in release mode.
any suggestions?
thanks, miklos
i would advise you to have a look on oddwfexportex and odamfcapp samples once more.
oddwfexportex is the simplest sample using dwfexport.
misha kuzinets
thank you, that was really helpful. especially, since that was the code fragment i started with.
btw it was possible to eliminate the detour to dwg (that was a rather unfortunate effort to make things work ). still i cannot produce a dwf file in release mode, and i can in debug. what made things work in debug (i think, maybe wrong) is the construction of a local service object (a strange requirement...) and it seems less then enough in release mode.
but since you are not interested, i stop here.
miklos
quote:
originally posted by misha kuzinets
i would advise you to have a look on oddwfexportex and odamfcapp samples once more.
oddwfexportex is the simplest sample using dwfexport.
miklos,
your code looks like oddwfexportex. looking at this fragment of code i can't see whether your sample has all necessary things as odinitialize and others.
you could compare your sample with oddwfexportex for checking an environment around dwf export. the first idea is you miss something but i can't determine what from given fragment.
also you can send your sample wholly or complete part of dwf export code by private message. i could include this one into sample for checking.
misha kuzinets
misha,
sorry i sounded pissed, i was just frustrated. my code is now this (still works only in debug, and practically the same as the one i have sent, though i am through with lots of experimentations:-)
note: pdddb below is a member of the class gdxfview, and its content is ok when the execution reaches this point: i am able to export it in any formats (debug or release, dxf, dwg, dwf) except release dwf. the class here (gdxfview) already has a services member - that caused no problems before this (ie before i tried dwf export). that i needed a new object (svcs1) below was sort of a surprise - but without that even the 'debug dwf' did not work.
odinitialize and oduninitialize are your original functions - they were not overwritten, i don't know if that's even possible (or would have any use).
void gdxfview::writedwf( const char* version )
{
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
else if (!strcmp(version,"a6"))
{
params.format = dw_ascii;
params.version = ndwf_v60;
}
else if (!strcmp(version,"c5.5"))
{
params.format = dw_compressed_binary;
params.version = ndwf_v55;
}
else if (!strcmp(version,"b5.5"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v55;
}
else if (!strcmp(version,"a5.5"))
{
params.format = dw_ascii;
params.version = ndwf_v55;
}
else if (!strcmp(version,"c4"))
{
params.format = dw_compressed_binary;
params.version = ndwf_v42;
}
else if (!strcmp(version,"b4"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v42;
}
else if (!strcmp(version,"a4"))
{
params.format = dw_ascii;
params.version = ndwf_v42;
}
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pdddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
try
{
exportdwf(params);//opendwg function call
}
catch( oderror& e )
{
cstring err = svcs.geterrordescription(e.code()).c_str();
std(cout) << "error :" << err << std(endl);
}
pdddb.release();
oduninitialize();
}
thanks, miklos
quote:
originally posted by misha kuzinets
miklos,
your code looks like oddwfexportex. looking at this fragment of code i can't see whether your sample has all necessary things as odinitialize and others.
you could compare your sample with oddwfexportex for checking an environment around dwf export. the first idea is you miss something but i can't determine what from given fragment.
also you can send your sample wholly or complete part of dwf export code by private message. i could include this one into sample for checking.
|