几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 08:15 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】oddbtable exception when trying to create table with 1 colu

oddbtable: exception when trying to create table with 1 colu
oddbtable: exception when trying to create table with 1 column
hi,
my dwgdirect version is 2.3.1. i am generating a dxf file for acad version 2004.
i am using the addtable() code from the examples (odwriteex/dbfiller.cpp) to draw a table.
drawing a table with 2 columns and 2 rows works perfectly. but when i set the number of columns to 1, then the function pacadtable->setnumcolumns(ncols)fff"> throws an oderror "invalid input" exception.
creating a table with only 1 column in autocad works. is there a bug related to this in dwgdirect?
the code i use:
int cdwgwrap::addtable(bool isrelative, int layid, double xpos, double ypos,
int ncols, int nrows, double height, double width,
double textsize, int textstyid, int cellalign) {
oddbobjectid id = dbmanager::getinstance()->getdb()->getmodelspaceid();
oddbblocktablerecordptr precord = id.safeopenobject(oddb::kforwrite);
/************************************************** ********************/
/* get the lower-left corner and center of the box */
/************************************************** ********************/
odgepoint3d point;
odgepoint3d center;
if(isrelative) {
xpos = layoutcornerpnt.x + layoutwidth*xpos;
ypos = layoutcornerpnt.y + layoutheight*ypos;
height = layoutheight*height;
width = layoutwidth*width;
}
point.x = xpos;
point.y = ypos + height;
point.z = 0.0;
center = point + odgevector3d( 0.5*width, 0.5*height, 0.0 );
/************************************************** ********************/
/* create the table */
/************************************************** ********************/
oddbtableptr pacadtable = oddbtable::createobject();
oddbobjectid tableid = precord->appendoddbentity(pacadtable);
/************************************************** ********************/
/* set the parameters */
/************************************************** ********************/
pacadtable->setdatabasedefaults(precord->database());
pacadtable->setnumcolumns(ncols);
pacadtable->setnumrows(nrows);
pacadtable->setheight(height);
pacadtable->setwidth(width);
pacadtable->generatelayout();
pacadtable->setcolumnwidth(width/pacadtable->numcolumns());
pacadtable->setrowheight(height/pacadtable->numrows());
oddb::lineweight linewt = oddb::lineweight(5);
pacadtable->setgridlineweight(linewt, oddb::khorzinside, oddb::kdatarow);
pacadtable->setgridlineweight(linewt, oddb::kvertinside, oddb::kdatarow);
pacadtable->setposition(point);
if(textstyid > 0)
pacadtable->settextstyle(dbmanager::getinstance()->getobjectidarray()->at(textstyid));
pacadtable->settextheight(textsize, oddb::kallrows);
pacadtable->setalignment(oddb::cellalignment(cellalign), oddb::kallrows);
pacadtable->setlayer(dbmanager::getinstance()->getobjectidarray()->at(layid));
return dbmanager::getinstance()->getobjectidarray()->append(tableid);
}
thanks a lot for any help,
christoph
hello christoph,
it is really bug in dwgdirect. it will be fixed in next release. thank you for report. as work around - table is created (oddbtable::createobject(); ) with 1 row and 1 column so you don't need to set this values.
best regards,
sergey z.
hi sergey,
your workaround works. thanks a lot.
christoph
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】limitation on adding blocks to block table yang686526 DirectDWG 0 2009-05-06 04:47 PM
【转帖】how do i create a link to an external database yang686526 DirectDWG 0 2009-05-05 12:26 PM
【转帖】exception exporting table with normal -1,0,0 yang686526 DirectDWG 0 2009-05-05 09:57 AM
【转帖】ado.net access操作方法 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-19 09:37 PM
【转帖】how can i create a table template yang686526 SolidWorks二次开发 0 2009-04-13 11:49 AM


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


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