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

transformby
transformby
an exception is thrown everytime "pent->transformby(blocktransformmatrix)" is called. does anybody know why? if it helps, pent is a oddbpolyline.
odgematrix3d blocktransformmatrix = pblockref->blocktransform();
oddbblocktablerecordptr pblocktablerecordptr = pblockref->blocktablerecord().safeopenobject();
oddbobjectiteratorptr pobjectiteratorptr = pblocktablerecordptr->newiterator();
oddbentityptr pent;
while(!pobjectiteratorptr->done())
{
pent = pobjectiteratorptr->entity();
pent->transformby(blocktransformmatrix);
...
pobjectiteratorptr->step();
}
the base class (oddbentity) definition of transformby is not to be used. you must use the derived method for that object as:
oddbentityptr pent;
while(!pobjectiteratorptr->done())
{
pent = pobjectiteratorptr->entity();
if(pent->iskindof(oddbpolyline::desc()))
{
oddbpolylineptr ppoly = pent;
ppoly->transformby(blocktransformmatrix);
}else ....
...
pobjectiteratorptr->step();
}
i still get an exception with this new code. "ppoly->transformby(blocktransformmatrix)" now throws the excpetion.
odgematrix3d blocktransformmatrix = pblockref->blocktransform();
oddbblocktablerecordptr pblocktablerecordptr = pblockref->blocktablerecord().safeopenobject();
oddbobjectiteratorptr pobjectiteratorptr = pblocktablerecordptr->newiterator();
oddbentityptr pent;
while(!pobjectiteratorptr->done())
{
pent = pobjectiteratorptr->entity();
if (pent->iskindof(oddbpolyline::desc()))
{
oddbpolylineptr ppoly = pent;
ppoly->transformby(blocktransformmatrix);
}
probably you haven't opened the entity for write -
pobjectiteratorptr->entity(); should be
pobjectiteratorptr->entity(oddb::kforwrite);
also be aware that in objecarx (i don't know how it is in dwgdirect), the block transform can have different scales for x, y, and z, while the transformby() function usually needs equal values for the scale.
i.e. a circle scaled x=1.5,y=3 as seen through a block reference, would be rendered as ellipse, but a oddbcircle cannot be transformed to oddbellipse in this way.
regards
chudomir
transformby() is virtual function so pent->transformby(matrix) is ok.
chudomir is absolutely right.
1. iterators entity() method has parameter open mode. default is for read. to modify entity piter->entity(oddb::kforwrite) should be used.
2. not all entities can be transformed by non-uniform scale matrix. sometimes gettransformedcopy() can be used. for example oddbtext can't be transformed by non-uniform scale matrix but gettransformedcopy() works for it.
oddbcircle can't be transformed non-uniformly but gettransformedcopy() returns oddbellipse.
as for oddbpolyline both functions fail if scale is non-uniform (because of possible bulges).
sergey slezkin
how can i treat nonuniform scaled block with "3d circle"?
hello.
i need help to read dwg-file (see into attachment).
in dwg-file i create cirlce with thickness = 100 (it looks as 3d surface).
put it into a block. then transorm block with nonuniform scale( scale x = 1.5, scale y = 1, scale z = 1).
gettransformedcopy() function return oddbellips object. but oddbellips haven't got thickness (it look as 2d curve, but i want to get 3d shape).
i have got other attempt. i use oddbentity.worlddraw();
but in odgiworldgeometrydumper class (derived from odgiworldgeometry) i have only one function call:
virtual void circle( const odgepoint3d & center, double radius, const odgevector3d & normal );
it is flat (plane) curve.
odamfc draw it excelent, so i throw into dismay.
what i may do wrong?
how can i treat nonuniform scaled block with 3d circle?
i'm using dwgdirect 2.6.3 and vc 6.0.
best regards,
andrey.
attached files (49.3 kb, 0 views)

the circle you get is not flat. at this moment thickness in traits is non-zero.
if you call base class circle() in this situation you'll get shell().
sergey slezkin
hello, sergey.
could you explain one thing, please.
i'm using odgiworldgeometrydumper class as an example (giworlddrawdumper.h & .cpp files)
"class odgiworldgeometrydumper : public odstaticrxobject<odgiworldgeometry>"
but odgigeometry class hasn't an implementation of circle().
which class should i use to inherit odgiworldgeometrydumper class from?
could you describe in detail?
best regards,
andrey
it seems you started from wrong sample (if you need vectorization).
look at odvectorizeex sample. it uses odgigeometrysimplifier as a base class.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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



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


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