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

help on od?db?database::?insert
help on oddbdatabase::insert
hi,
i am trying to insert a file into another with the following code:
code:
bool codahelper::insert(lpctstr filename, double scale, double rotation )
{
oddbdatabaseptr pdb;
try
{
pdb = m_svcs.readfile( filename, false, false, oda::ksharedenyno );
}
catch(oderror& e)
{
m_strerror = e.description().c_str();
return false;
}
odgematrix3d xform;
// scale
xform = odgematrix3d::scaling(scale);
// rotation
xform.settorotation(rotation, odgevector3d(0,0,1));
// insertion point
xform.settranslation(odgevector3d(0,0,0));

m_pdb->insert(xform, pdb);
return true;
}
i have 2 problems:
1) the file is inserted but it's not scaled. what is the right way scale an insert?
2) when i insert a drawing with some dimensions, if i rotate this drawing (90 degrees for example), the dimansions of the inserted drawing change. it seems like they loose the origins. is it a bug?
thanks for any help,
vinicius
last edited by vinicius pontes; 30th june 2004 at 09:37 amfff">.
1. settorotation initializes the matrix to represent the rotation. previous values of the matrix are lost. to construct a matrix containing both scale and rotation you need multiply 2 matrixes.
2. when a drawing is inserted with non-zero rotation this is not equevalent to setting rotation to a block reference. transformby is applyied to entities (dimensions). definition points are transformed but if dimension text for example should be horizontal according to dimension variables (style or overrides) it remains horizontal. for ordinate dimensions even measured value will be changed.
during this operation dimension blocks (representing dimension appearence) are recomputed. this also may result in changed appearence.
to decide is it dd bug or not your specific case should be analized. (you can check it applying rotate command to your dimension in autocad - some dimensions would change their appearence).
sergey slezkin
thanks for your answer! but,
1) i understood that settoratation and also settoscaling initializes the matriz. i saw it when i reorder the calls, like the code below, and only the scaling was applyed. i just don't know yet how to apply both. could you give me a sample?
code:
odgematrix3d xform;
xform.settorotation(rotation, odgevector3d(0,0,1));
xform.settoscaling(scale);
2) i made some tests with autocad (r14) and also with dwgdirect. see the results in the file in attachment.
in the tests i made, first of all i create a drawing (drawing.dwg) which i used to insert in other drawings. this drawing is just a box with 2 dimensions: one horizontal and another vertical.
i inserted it into another drawing with 45 degrees of rotation using autocad and i also inserted it with 0 degrees and rotaded 45 degrees (using autocad rotate command). in both cases, nothing changed with my dimensions.
in a third case, i inserted it with a rotation of 45 degrees using dwgdirect. in this case the dimensions changed appearence.
vinicius
attached files (20.9 kb, 5 views)

1.
code:
odgematrix3d mtrans(
odgematrix3d::translation(origin) *
odgematrix3d::rotation(angle, odgevector3d::kzaxis) *
odgematrix3d::scaling(scale)
);
2. this is dd bug. it effects rotated dimensions.
sergey slezkin
thank you!
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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



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


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