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

regression with dd 2.05.01
regression with dd 2.05.01
hi,
this code doesn't works correctly with the new version dd 2.05.01.
code:

oddbobjectid oddbobjid;
oddbobjid = oddbsymutil::gettextstyleid(_t("style4"), getdatabase());
oddbtextptr textptr = oddbtext::createobject();
textptr->setposition(odgepoint3d(10, 10, 0));
textptr->settextstring(_t("hello world"));
textptr->settextstyle(oddbobjid);
textptr->setheight(1.5);
oddbblocktablerecordptr btrptr = getdatabase()->getactivelayoutbtrid().openobject(oddb::kforwrite);
btrptr->appendoddbentity(textptr);
textptr->setdatabasedefaults(getdatabase());in older version dd 2.03.00, the height of the text was 1.5 and the textstyle was style4, in the new version his height is 2.5 and his style is standard.
it's due to the call of textptr->setdatabasedefaults(getdatabase()), why did you change this behavior ?
attached files
here is the dwgdirectc++ doc:
quote:
void oddbentity::setdatabasedefaults(oddbdatabase* pdb = 0,bool dosubents = false)
applies the default properties of the specified database to this entity.
parameters
pdb (i) pointer to the database whose default values are to be used.
dosubents (i) set to true if subentities should be processed
remarks
if pdb is null, the database containing this entity is used.
the following properties are set
color
layer
linetype
linetype scale
lineweight
plotstyle
visibility
i can't see textstyle in the properties set !
regards.
setdatabasedefaults should be called immediately after object creation.
if text style was not set in earlier versions, then it is a fixed bug.
vladimir
these properties are listed for oddbentity::setdatabasedefaults(). this is virtual function which can be overridden in derived classes to set more values.
previously oddbtext::setdatabasedefaults() was not implemented (it was a bug).
setdatabasedefaults() must be always called before setting properties explicitely. else it may reset them like in your case.
sergey slezkin

quote:
previously oddbtext::setdatabasedefaults() was not implemented (it was a bug).
good job !
but now we have an "incompatibility" with autocad.
look at this code in objectarx, setdatabasedefault doesn't reset properties after setting them.
code:

acdbdatabase *pdb = acdbcurdwg();
acdbobjectid objid;
const tchar *pstyle = _t("style4");
acad::errorstatus errorstatus;
acdbtextstyletable *ptextstyletable;

errorstatus = pdb->gettextstyletable(ptextstyletable, acdb::kforread);
if (errorstatus == acad::eok)
{
errorstatus = ptextstyletable->getat(pstyle, objid);
ptextstyletable->close();
}
acdbtext *ptext = new acdbtext(acgepoint3d(0,0,0), _t("hello world"), objid, 1.5);

acdbblocktable *pblocktable;
acdbblocktablerecord *pblocktablerecord;
pblocktable = null;
pblocktablerecord = null;

pdb->getblocktable(pblocktable, acdb::kforread);
if (pblocktable)
{
acad::errorstatus ret;
ret = pblocktable->getat(acdb_model_space, pblocktablerecord, acdb::kforwrite);
pblocktable->close();
}
errorstatus = pblocktablerecord->appendacdbentity(ptext);
ptext->setdatabasedefaults(ptext->database());
double height = ptext->height(); // return 1.5 not 2.5 (height of current textstyle)
ptext->close();
acdbline *pacdbline = new acdbline(acgepoint3d(0,0,0), acgepoint3d(10,10,0));
errorstatus = pblocktablerecord->appendacdbentity(pacdbline);
pacdbline->setlayer(_t("layer1"));
pacdbline->setdatabasedefaults(pacdbline->database());

tchar *playername = null;
playername = pacdbline->layer(); // return 'layer1' not '0' ('0' is current layer)
delete [] playername;
pacdbline->close();
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】query regarding oddbtext alignment and position yang686526 DirectDWG 0 2009-05-07 12:05 PM
【转帖】export to dwf v6.0 not working in oddwfexportex - dd rel 2.2 yang686526 DirectDWG 0 2009-05-05 10:27 AM
【转帖】dimension mtext regression in dd 2.5.1 yang686526 DirectDWG 0 2009-05-04 07:34 PM
【转帖】dd 2.1.0 does not handle text fit as expected yang686526 DirectDWG 0 2009-05-04 07:02 PM
【转帖】color conversion problem dd 1.14.01 yang686526 DirectDWG 0 2009-05-04 05:53 PM


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


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