几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】problem with purging layers (http://www.dimcax.com/hust/showthread.php?t=18160)

yang686526 2009-05-06 11:31 PM

【转帖】problem with purging layers
 
problem with purging layers
problem with purging layers
i haven't used the purge feature in dwgdirect before, so i have had a go with this program i am writing.
i extracted some code from the examples provided with dwgdirect:
code:
// purges any unused layers from the passed in database
void cdgn2dwgdlg::purgelayers(oddbdatabase *pdb)
{
assert( pdb != null );
if( pdb != null )
{
oddbsymboltableptr ptable;
oddbobjectidarray idarray;
// get the layer table
ptable = pdb->getlayertableid().openobject();
// iterate the layers, getting their id values and
// storing them into our id array
oddbsymboltableiteratorptr iter = ptable->newiterator();
for( iter->start(); !iter->done(); iter->step() )
{
idarray.push_back( iter->getrecordid() );
}

// now purge this array, so that only the layers that
// need purging are left in the array
pdb->purge( idarray );
oddbobjectptr pobj;
uint i;
oddbobjectid *pid = idarray.begin();
// iterate the array and erase the unused layers
for( i = idarray.size(); i > 0; i--, pid++ )
{
pobj = pid->openobject( oddb::kforwrite );
if( !pobj.isnull() )
{
pobj->erase();
}
}
}
}
but when i run this, my resulting files, dwg or dxf will not open in autocad, saying that polylines refer to layers not found in the drawing.
why is this?
andrew
probably you are using 1.09? purge bug was fixed before 1.10 release.
sergey slezkin
yes, i think i am using 1.09. is this 1.10 ready yet then? or do i have to re-download 1.09 libraries?
andrew
quote:
originally posted by sergey slezkin
probably you are using 1.09? purge bug was fixed before 1.10 release.
i just downloaded version 1.10 and have tried doing a full recompile with it.. i get these errors:
code:
deleting intermediate files and output files for project 'dgn2dwg - win32 release'.
deleting intermediate files and output files for project 'dgn2dwg - win32 debug'.
--------------------configuration: dgn2dwg - win32 release--------------------
compiling resources...
compiling...
stdafx.cpp
compiling...
dgn2dwg.cpp
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : error c2385: 'cdgn2dwgapp::delete' is ambiguous
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: could be the 'delete' in base 'cobject' of base 'ccmdtarget' of base 'cwinthread' of base 'cwinapp' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: or the 'delete' in base 'odrxobject' of base 'oddbhostappservices' of base 'exhostappservices' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: or the 'delete' in base 'odrxobject' of base 'oddbsystemservices' of base 'exsystemservices' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(113) : error c2248: 'new' : cannot access protected member declared in class 'exgsbitmapdevicebase<class exgsgdidevice>'
c:\dwgdirect\exrender\exgsbitmapdevice.h(94) : see declaration of 'new'
c:\my programs\dgn2dwg\dgn2dwg.cpp(113) : error c2248: 'delete' : cannot access protected member declared in class 'exgsbitmapdevicebase<class exgsgdidevice>'
c:\dwgdirect\include\rxobject.h(453) : see declaration of 'delete'
dgn2dwgdlg.cpp
dibstatic.cpp
filtertabledlg.cpp
gridcell.cpp
gridcellbase.cpp
gridctrl.cpp
griddroptarget.cpp
inplaceedit.cpp
pathdialog.cpp
previewdib.cpp
previewfiledlg.cpp
titletip.cpp
warningsdlg.cpp
generating code...
error executing cl.exe.
dgn2dwg.exe - 3 error(s), 3 warning(s)
--------------------configuration: dgn2dwg - win32 debug--------------------
compiling resources...
compiling...
stdafx.cpp
compiling...
dgn2dwg.cpp
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : error c2385: 'cdgn2dwgapp::delete' is ambiguous
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: could be the 'delete' in base 'cobject' of base 'ccmdtarget' of base 'cwinthread' of base 'cwinapp' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: or the 'delete' in base 'odrxobject' of base 'oddbhostappservices' of base 'exhostappservices' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(34) : warning c4385: or the 'delete' in base 'odrxobject' of base 'oddbsystemservices' of base 'exsystemservices' of class 'cdgn2dwgapp'
c:\my programs\dgn2dwg\dgn2dwg.cpp(113) : error c2660: 'new' : function does not take 4 parameters
dgn2dwgdlg.cpp
dibstatic.cpp
filtertabledlg.cpp
gridcell.cpp
gridcellbase.cpp
gridctrl.cpp
griddroptarget.cpp
inplaceedit.cpp
pathdialog.cpp
previewdib.cpp
previewfiledlg.cpp
titletip.cpp
warningsdlg.cpp
generating code...
error executing cl.exe.
dgn2dwg.exe - 2 error(s), 3 warning(s)
why should i suddenly get these compile errors changing from 1.09 to 1.10 libraries?
andrew
classes that are multiply inherited from odrxobject now need to specify which new and delete to use, for example in odwriteex.cpp:
class myservices : public exsystemservices, public exhostappservices
{
protected:
using exsystemservices:perator new;
using exsystemservices:perator delete;
};
compile errors will result if these "using" declarations are not added.
this is extracted from release notes in dd 1.10 help.
best regards.
ok, i added those two protected members into my app class, since that is where the services class was inherited from, and now i get these errors:
code:
vertcheck.cpp
c:\my programs\vertcheck\vertcheck.cpp(710) : error c2248: 'new' : cannot access protected member declared in class 'exgsbitmapdevicebase<class exgsgdidevice>'
c:\dwgdirect\exrender\exgsbitmapdevice.h(94) : see declaration of 'new'
c:\my programs\vertcheck\vertcheck.cpp(710) : error c2248: 'delete' : cannot access protected member declared in class 'exgsbitmapdevicebase<class exgsgdidevice>'
c:\dwgdirect\include\rxobject.h(453) : see declaration of 'delete'
vertcheckdlg.cpp
c:\my programs\vertcheck\vertcheckdlg.cpp(1475) : error c2039: 'settdcreate' : is not a member of 'oddbdatabase'
c:\dwgdirect\include\dbdatabase.h(122) : see declaration of 'oddbdatabase'
c:\my programs\vertcheck\vertcheckdlg.cpp(1476) : error c2039: 'settdupdate' : is not a member of 'oddbdatabase'
c:\dwgdirect\include\dbdatabase.h(122) : see declaration of 'oddbdatabase'
error executing cl.exe.
vertcheck.exe - 4 error(s), 0 warning(s)
1. first 2 errors: odrxobjects should be created by createobject() function not by "new" operator:
code:
odgsdeviceptr pdev = 'exgsbitmapdevicebase<class exgsgdidevice>::createobject();
2. methods modifying database read-only variables are removed.
global functions are added (at the end of dbdatabase.h) to allow modification of "read-only" variable as a hack like:
code:
toolkit_export void oddbsettdupdate(oddbdatabase&pdb, oddbdate date);
sergey slezkin
ok, i have revised my method:
code:
// this will generate a bitmap preview for us using dwg direct.
odgsdeviceptr cvertcheckapp::gsbitmapdevice()
{
odgsdeviceptr pdevice;
pdevice = exgsbitmapdevicebase<class exgsgdidevice>::createobject();
// pdevice.attach( new odrxobjectimpl<exgsbitmapdevice<exgsgdidevice> > );
return pdevice;
}
and now i get these errors:
code:
vertcheck.cpp
c:\my programs\vertcheck\vertcheck.cpp(710) : error c2385: 'exgsbitmapdevicebase<class exgsgdidevice>::createobject' is ambiguous
c:\my programs\vertcheck\vertcheck.cpp(710) : warning c4385: could be the 'createobject' in base 'odgirasterimage' of class 'exgsbitmapdevicebase<class exgsgdidevice>'
c:\my programs\vertcheck\vertcheck.cpp(710) : warning c4385: or the 'createobject' in base 'exgsgdidevice' of class 'exgsbitmapdevicebase<class exgsgdidevice>'
concerning the datecreation, i can cremove my code if those values are set correctly by the dwgdirect system when the new dwg files is created. i assumed they needed setting...
andrew
sorry, should be:
code:--------------------------------------------------------------------------------
odgsdeviceptr pdev = 'exgsbitmapdevice<class exgsgdidevice>::createobject();
--------------------------------------------------------------------------------
(without "base")
sergey slezkin
i think i will stick with 1.09! i now get this stuff:
code:
linking...
exgsbitmapdevice.obj : error lnk2001: unresolved external symbol "public: static class odrxobjectptr __cdecl odexgirasterimage::pseudoconstructor(void)" (?pseudoconstructor@odexgirasterimage@@sa?avodrxobjectptr@@xz)
[snip]
error executing link.exe.
vertcheck.exe - 1325 error(s), 0 warning(s)
ok, at this point i can say i'm rebuilding my project with dd 1.10 and i have obtained very similar errors while linking:
linking...
exgsbitmapdevice.obj : error lnk2001: unresolved external symbol "public: static class odrxobjectptr __cdecl odexgirasterimage:seudoconstructor(void)" (?pseudoconstructor@odexgirasterimage@@sa?avodrxob jectptr@@xz)
exgsgdidevice.obj : error lnk2001: unresolved external symbol "public: static class odrxobjectptr __cdecl odexgirasterimage:seudoconstructor(void)" (?pseudoconstructor@odexgirasterimage@@sa?avodrxob jectptr@@xz)
exgsopengldevice.obj : error lnk2001: unresolved external symbol "public: static class odrxobjectptr __cdecl odexgirasterimage:seudoconstructor(void)" (?pseudoconstructor@odexgirasterimage@@sa?avodrxob jectptr@@xz)
..
..
..
..
..
debug/datosforjadosb.exe : fatal error lnk1120: 30 unresolved externals
error executing link.exe.
creating browse info file...
datosforjadosb.exe - 36 error(s), 0 warning(s)
example devices you used in your project (like exgsbitmapdevice)require linking with exgirasterimage.cpp (examples/exservices)
sergey slezkin
even adding that, i get loads of errors.
for example:
lved external symbol "public: virtual void __thiscall odgismartdrawobject::getstereoparameters(double &,double &)const " (?getstereoparameters@odgismartdrawobject@@ubexaan 0@z)
dd_vc6mt_gs.lib(gsbase.obj) : error lnk2001: unresolved external symbol "public: virtual void __thiscall odgismartdrawobject::getstereoparameters(double &,double &)const " (?getstereoparameters@odgismartdrawobject@@ubexaan 0@z)
exgsgdidevice.obj : error lnk2001: unresolved external symbol "public: virtual void __thiscall odgismartdrawobject::setstereoparameters(double,do uble)" (?setstereoparameters@odgismartdrawobject@@uaexnn@ z)
dd_vc6mt_gs.lib(gsbase.obj) : error lnk200
i simply don't understand why moving from 1.09 to 1.10 should give me thid headache, all for just a purging layers bug fix.
can you not provide an abc list of changes required, since there are evidently several additions needed that just what the chm file says..
are you sure you are linking with dd_vc6mt_gi.lib?
sergey slezkin


所有的时间均为北京时间。 现在的时间是 05:05 AM.