assertion in setplotpaperunits
assertion in setplotpaperunits
hello,
i am using dwglib 2.4.1 and visual c++ 6.0. i patterned the code from the odamfcapp pagesetupdialog sample.
my app is getting an assertion error in the following statement when i attempt to change the plot units shown in the dialog box from inches to mm.
oda_verify(m_pvalidator->setplotpaperunits( &m_params, plotpaperunits ) == eok);
plotpaperunits is set correctly to kmillimeters going into the call.
when doing a debug trace, it goes thru dbtransactionimpl.cpp and crashes on oddbobject::assertwriteenabled:
the pagesetupdialog box is called by the following code in my document class:
oddbdatabasedoc::setdoctoassign(this);
m_pdb = theapp.openfile(lpszpathname);
.....
oddbobjectid idlayout = oddbblocktablerecordptr(m_pdb->getactivelayoutbtrid().safeopenobject())->getlayoutid();
oddblayoutptr playout = idlayout.safeopenobject(oddb::kforwrite);
oddbplotsettings *pplotsettings = playout.get();
cpagesetupdlg dlgpagesetup(*pplotsettings);
if (dlgpagesetup.domodal() == idok)
{
m_pdb->starttransaction();
}
else
{
m_pdb->aborttransaction();
}
the normal call from odamfcapp included a pointer to a pio which i omitted from my code. that is, cpagesetupdlg dlgpagesetup(*pplotsettings, pio);
could this be the cause of the problem?
i need a solution please as soon as possible.
thanks
last edited by
robertpantangco@hotmail.com; 13th september 2007 at 07:56 pmfff">. reason: additional code
hello,
pio uses in window coordinates selection. it can be omitted.
can problem be reproduced in mfcapp? it will be very helpful.
please, check your code. i am not sure, but may be m_pdb->starttransaction(); should be changed to pdb->endtransaction(); like in mfcapp.
alex,
using m_pdb should be okay. odamfcapp uses pdb because it gets it from command context. i do not use. command context
i also use cdocument instead of coledocument. it should not make any difference.
my call to m_pvalidator->setplottype works but not the setplotpaperunits. i only use kdisplay.
can you please send me the portion of the code in oddbplotsettingsvalidatorimpl::setplotpaperunits. i will try to figure out a work around.
my crashes at oddbobject::assertwriteenabled: and stops there.
i cannnot duplicate it in odamfcapp.
odamfcapp executes:
oddbobject::assertwriteenabled:
oddbobject::iswriteenabled:
oddbobjectimpl::iswriteenabled:
oddbobjectid::isnull:
help!
last edited by
robertpantangco@hotmail.com; 14th september 2007 at 07:40 amfff">. reason: additional info
did you test other plotsetting functiion calls? for example setplotrotation... setplotrotation is very similar to setplotpaperunits.
the first string in 'write' methods is pplotset->assertwriteenabled();
please, test m_params->assertwriteenabled();
what is a full dump of call stack ?
my pdb note is not in m_pdb -> pdb, but in changing of starttransaction(); to endtransaction();
alex,
i think i found the problem.
it is not simple to change paper plot units. whether validator accepts it or not or whether write is enabled depends on other plot settings!
for example, i think the plot type whether klayout, kextents, or kdisplay affects validity of units!
hi,
did you really find the problem? could you please give me more information about.
setplotunits makes next steps :
1. pplotset->assertwriteenabled();
2. updateactivedevicemediaindexes - update list of system installed printers and papers, if not updated yet.
3. m_plotpaperunits = (odint16)units - set units
4. recalculateplotdata - recalculate viewport parameters (uses scale, center flag, rotation information and display mode)
i think that problem can be in recalculateplotdata. only recalculateplotdata depends on display mode. but the begining of function is
code:
pplotset->assertwriteenabled();
try
{
oddbplotsettingsimpl* pimpl = oddbplotsettingsimpl::getimpl(pplotset);
plottype pt = pplotset->plottype();
bool ismodelspace = pplotset->modeltype();
oddbdatabaseptr pdb = pplotset->database();
if (pdb.isnull())
return enodatabase;
bool bscaledtofit, bplotcentered;
bscaledtofit = pplotset->usestandardscale() && (oddbplotsettings::kscaletofit == pplotset->stdscaletype());
bplotcentered = pplotset->plotcentered();
if (!bscaledtofit && !bplotcentered)
return eok;
so if flags (!bscaledtofit && !bplotcentered) are not enabled, function will not work.
last edited by sslezkin; 17th september 2007 at 12:09 amfff">.
alex,
i did some overrides in the plot settings including plottype, bscaledtofit and bplotcentered.
i noticed that in some drawings i can set paper plot units but crashes in other drawings.
i will try to isolate the problem but i think you are correct in that the assertion error occurs in recalculateplotdata.
thanks...