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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 04:20 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】assertion in setplotpaperunits

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...
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 06:50 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多