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

oddbfcf and explodegeometry and getboundingpoints
oddbfcf and explodegeometry and getboundingpoints
i have exploded an oddbfcf entity using explodegeometry and i have noticed that the oddbtext entities which result do not handle getboundingpoints properly. all the points (i.e. upper-left and lower-left) are the same.
this seems to happen when escape sequences are used, for instance {\\fgdt;r} explodes to a piece of text with a string of "r" and that one's text returns the unusual bounding points.
a drawing which exhibits this behavior happens to be the one produced by the odwriteex sample.
is there anything i can call which will calculate the extents for these characters?
hello moe,
i can't reproduce your situation. could you explain more detail problem?
here is code which i use for test your problem. possible it will help for you.
code:

oddbcommandcontextptr pdbcmdctx(pcmdctx);
oddbdatabaseptr pdb = pdbcmdctx->database();
oddbuserio* pio = pdbcmdctx->dbuserio();
for ( oddbselectionsetiteratorptr piter = pio->select()->newiterator();
!piter->done(); piter->next() )
{
oddbentityptr pent = oddbentity::cast( piter->objectid().openobject() );
if ( pent.isnull() )
continue;
oddbtextptr text = oddbtext::cast(pent);
if ( text.isnull() )
continue;
odgepoint3darray points;
text->getboundingpoints(points);
odstring msg;
pio->putstring(text->textstring());
msg.format(dd_t("x - %-10.4f y - %-10.4f"), points[0].x, points[0].y);
pio->putstring(msg);
msg.format(dd_t("x - %-10.4f y - %-10.4f"), points[1].x, points[1].y);
pio->putstring(msg);
msg.format(dd_t("x - %-10.4f y - %-10.4f"), points[2].x, points[2].y);
pio->putstring(msg);
msg.format(dd_t("x - %-10.4f y - %-10.4f"), points[3].x, points[3].y);
pio->putstring(msg);
}here is result (
m
x - 21.8575 y - 22.6975
x - 22.1275 y - 22.6975
x - 21.8575 y - 22.4275
x - 22.1275 y - 22.4275
3.2
x - 21.4204 y - 22.6525
x - 21.7804 y - 22.6525
x - 21.4204 y - 22.4725
x - 21.7804 y - 22.4725
n
x - 21.2275 y - 22.6954
x - 21.4075 y - 22.6954
x - 21.2275 y - 22.4254
x - 21.4075 y - 22.4254
r
x - 20.7775 y - 22.6975
x - 21.0475 y - 22.6975
x - 20.7775 y - 22.4275
x - 21.0475 y - 22.4275
best regards,
sergey z.
more info
sergey,
i haven't worked with oddbuserio pointers so i am not sure i understand your example. it looks as if the pio pointer represents an oddbfcf entity which you are iterating through.
however, at the point you have an oddbentityptr which is known to be an oddbfcf entity you might try this:
code:

odrxobjectptrarray::size_type i;
odrxobjectptrarray entities;
odresult res;
odcmcolor clr;
res = pent->explodegeometry(entities);
if ( res == eok )
{
for (i = 0; i < entities.length(); i++)
{
oddbtextptr text = oddbtext::cast(entities[i]);
if ( text.isnull() )
continue;
continue on with getboundingpoints code here
}my results are:
m
x = 21.84029 y = 22.4725
x = 21.84029 y = 22.4725
x = 21.84029 y = 22.4725
x = 21.84029 y = 22.4725
3.2
x = 21.4488 y = 22.65448
x = 21.8124 y = 22.65448
x = 21.4488 y = 22.47052
x = 21.8124 y = 22.47052
n
x = 21.2146 y = 22.4725
x = 21.2146 y = 22.4725
x = 21.2146 y = 22.4725
x = 21.2146 y = 22.4725
r
x = 20.76035 y = 22.4725
x = 20.76035 y = 22.4725
x = 20.76035 y = 22.4725
x = 20.76035 y = 22.4725
i hope this helps and thank you for your efforts so far.
hello moe,
there is strange such behaviour your application. location points of text is right so text extents is calculated correctly during explode. what version of dwgdirect do you use?
best regards,
sergey z.
my version
sergey,
i am working with version 2.4.2.0.
the problem seems only to strike the escape sequences of the feature control frame, whereas the other text, for instance "3.2" in our example, seems fine.
thanks again for taking a look.
- moe -
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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



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


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