高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】nothing in my dwf file
nothing in my dwf file
nothing in my dwf file
there is nothing in my dwf file when i look at it in autocad's viewer.
i am getting multiple codeguard errors: bad parameter - a bad file or pipe stream (0x1623244) has been passed to the function. the call stack shows zipopen() any ideas?
my dwg/dxf export creates the files ok (it bombs on oduninitialize(), but that is another story.)
m_pdbw->layerid = 0;
delete m_pdbw;
m_pdbw = null;
if (m_filetype == ftdwf)
{
try
{
dwexportparams params;
params.binkedarea = false; // mku 1/21/2004
params.bcolormapoptimize = false; // mku 1/21/2004
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
if (!m_pdb.isnull())
{
params.pdb = m_pdb;
params.sdwffilename = m_filename.c_str();
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
}
}
catch (oderror& err)
{
odstring msg = m_svcs.geterrordescription(err.code());
// std(cout) << "dwgdirect error: " << msg.c_str() << std(endl) << std(endl);
return false;
}
catch (...)
{
// std(cout) << "unknown error." << std(endl) << std(endl);
return false;
}
}
else
{
try
{
odstreambufptr fb;
try
{
fb = m_svcs.createfile(
m_filename.c_str(),
oda::kfilewrite,
oda::ksharedenyno,
oda::kcreatealways);
}
catch(const oderror_fileexception& err)
{
qsmessage::error("unable to create file.\n is the file currently open in another program?");
bret = false;
}
if (fb != null)
{
if (m_filetype==oddb::kdxf)
{
m_pdb->writefile(fb, oddb::kdxf, oddb::vac18, false );
}
else
{
m_pdb->writefile(fb, oddb::kdwg, oddb::vac18, false );
};
}
}
catch (...)
{
int i = 1;
//bret = false; can't get rid of this exception, but the file still writes
}
}
// m_pdb->release(); generates an exception
//m_pdb = null;
return bret;
attached files
send, please, a source file.
misha kuzinets
in addition, did you try to run oddwfexportex with your file?
misha kuzinets
the file i am exporting...
the file i am exporting is not in an autocad format. it is a very simple file with two layers of a dozen or so 3d polylines. i am using the source above plus:
(see attached files for full .cpp and .h file)
//---------------------------------------------------------------------------
void qscadexport::exportpolylinebegin()
{
// add a 3d polyline with vertices.
m_pdbw->p3dpl = oddb3dpolyline::createobject();
m_pdbw->p3dpl->setlayer(m_pdbw->layerid, false);
}
//---------------------------------------------------------------------------
void qscadexport::exportpolylinevertex(const qspoint& p1)
{
oddb3dpolylinevertexptr pv3 = oddb3dpolylinevertex::createobject();
m_pdbw->p3dpl->appendvertex(pv3);
odgepoint3d pos(p1.x, p1.y, p1.z);
pv3->setposition(pos);
}
//---------------------------------------------------------------------------
void qscadexport::exportpolylineend()
{
oddbblocktablerecordptr pblock = m_pdb->getmodelspaceid().safeopenobject(oddb::kforwrite) ;
pblock->appendoddbentity(m_pdbw->p3dpl);
// m_pdbw->p3dpl->release(); generates an exception
m_pdbw->p3dpl = null;
}
//---------------------------------------------------------------------------
last edited by dan quinn; 11th august 2005 at 06:25 amfff">.
dan,
i've checked oddwfexportex sample for dd 1.13.02. it works.
i think you have an ability for getting dwg as intermediate result. i'd prefer to look at dwg at first. i hope it does not give a lot of troubles.
misha kuzinets
dwg attached
i don't know how to create the intermediate file, but here is the one i exported to .dwg format. note you have to zoom to the extents to see the drawing.
attached files (13.6 kb, 4 views)
attached files
the .cpp and .h did not attach, let me try again.
attached files (4.5 kb, 8 views)
last edited by dan quinn; 11th august 2005 at 06:50 amfff">.
the dwf file is not empty. this is a correct file. but none enty got into the file. it's happened because model space entites is cliped by active view. set view before export.
misha kuzinets
set the view?
what is the method for setting the view? is it in one of the sample projects?
quote:
originally posted by dan quinn
what is the method for setting the view? is it in one of the sample projects?
yes, samples keep some decisions.
for instance, you can execute zoomextents.
misha kuzinets
i am confused
how do you stop the active view from clipping?
does one of the sample projects show how to set the view dimensions?
zoomextents worked
zoomextents worked, thanks
m_pdb->settilemode(1); // 0 for paperspace, 1 for modelspace
oddbviewporttableptr pvptbl = m_pdb->getviewporttableid().safeopenobject();
oddbobjectid id = pvptbl->getactiveviewportid();
if (id)
{
oddbviewporttablerecordptr prec = id.safeopenobject(oddb::kforwrite);
prec->zoomextents();
}
|