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

oddbentity::transformby() does nothing?
oddbentity::transformby() does nothing?
hello,
i'm transforming some oddbentities (which are actually oddb3dsolids) using the transformby() function. i'm not using the mfcapp example, by the way. i've had to write my own cad editor. basically it boils down to this:
code:
void setmatrix( char* guid, matrix* m )
{
dictionarynode<guidentity>* ge = guidentities.get( guid );
if( !ge ) return;
printf( "carspacedd::setmatrix()\n" );
odgematrix3d xfm;
int i, j;
for( i = 0 ; i < 4 ; i++ )
for( j = 0 ; j < 4 ; j++ )
xfm.entry[ i ][ j ] = ( *m )( i, j );
odresult r = ( ( oddbentityptr )ge->data->entityid.safeopenobject( oddb::kforwrite ) )->transformby( xfm );
if( r == eok ) printf( "success\n" );
else printf( svcs.geterrordescription( r ) );
}i look up the oddbentity by guid from my guid dictionary (these are my own library functions and don't affect dwgdirect in any way). the dictionary object stores a oddbobjectid to the entity.
then i move the matrix data from my own matrix object into the dwgdirect matrix object.
then i open a write pointer and transform the object.
then i either output success or an error message.
the procedure seems to work correctly, as i'm getting a lot of "success" messages. however, if i save the database using ...
code:
pdb->writefile( filename, oddb::kdwg, oddb::vac21 );... and open it again, the entities haven't moved at all and are still in their original place. perhaps i need to "submit" the new transformations to the database? i'm working on the original database objects and not on copies, so this is a bit frustrating.
what am i doing wrong?
hello,
did your application use modelergeometry.drx? this module should be loaded for 3dsolids support.
quote:
originally posted by alexander rumyantsev
hello,
did your application use modelergeometry.drx? this module should be loaded for 3dsolids support.
yup, seems like it
i have this in one of my cpp files, if that's what you mean:
code:
/************************************************************************/
/* define a module map for statically linked modules: */
/************************************************************************/
#ifndef _toolkit_in_dll_
odrx_declare_static_module_entry_point(modelermodule);
odrx_declare_static_module_entry_point(odrecomputedimblockmodule);
odrx_begin_static_module_map()
odrx_define_static_application(dd_t("modelergeometry"), modelermodule)
odrx_define_static_application(dd_t("recomputedimblock"), odrecomputedimblockmodule)
odrx_end_static_module_map()
these sections are only for static library based application.
check return value of
odrxclassptr pservice = odrxgetmodelergeometrycreatorservice();
it should not be null.
and please, attach some test file, i'll check it with mfcapp.
i'm using static libraries (.lib), not the dlls. is that a problem?
i'll check my code in a second.
meanwhile, could it be because of my transformation matrices? i'm using regular translation matrices like so ...
code:
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1is dd expecting different kinds of matrices? the transformby() result is eok ...
i've checked my code and i never call odrxgetmodelergeometrycreatorservice(), probably because i'm using static libraries. is this wrong?
it happens with every dwg file though, so it can't be a problem with the file.
quote:
originally posted by peterc
i've checked my code and i never call odrxgetmodelergeometrycreatorservice(), probably because i'm using static libraries. is this wrong?
it is ok, but you should check the output of this function.
quote:
originally posted by peterc
it happens with every dwg file though, so it can't be a problem with the file.
ok, odgematrix3d has method settranslation. you can use it to prevent wrong matrix generation.
quote:
originally posted by alexander rumyantsev
it is ok, but you should check the output of this function.
ok, odgematrix3d has method settranslation. you can use it to prevent wrong matrix generation.
in which header is the function odrxgetmodelergeometrycreatorservice defined? i've checked both the dwgdirect help and the include files but then can't find anything on that function.
add declaration to your code
toolkit_export odrxclassptr odrxgetmodelergeometrycreatorservice();
code:
toolkit_export odrxclassptr odrxgetmodelergeometrycreatorservice()
{
odrxclassptr pservice = odrxservicedictionary()->getat(dd_t("odmodelergeometrycreator"));
if (pservice.isnull())
{
odrxmoduleptr pmodule = odrxdynamiclinker()->loadapp(rx_modeler_geometry_appname);
if (pmodule.get())
{
pservice = odrxservicedictionary()->getat(dd_t("odmodelergeometrycreator"));
}
}
return pservice;
okay, we're almost there
now it asks for rx_modeler_geometry_appname. i have the following rx_ related files in my dwgdirect include dir (see attachment). looks like i'm missing rxmodelergeometryservices.h or something.
attached images (15.1 kb, 7 views)

alexander? i don't have rx_modeler_geometry_appname in my dwgdirect headers. what should i do?
hi,
#define rx_modeler_geometry_appname dd_t("modelergeometry")
i add body of odrxgetmodelergeometrycreatorservice just as additional information. it is not necessary to insert function in your code. there is no header for odrxgetmodelergeometrycreatorservice. you should declare it in your .cpp file, for example like in examples\win\odamfcapp\acissavedialog.cpp
toolkit_export odrxclassptr odrxgetmodelergeometrycreatorservice();
it allow you to check return value of this function.

hi, i have analogous case with transformby() function.
i've checked result of odrxgetmodelergeometrycreatorservice() function and it isn't null.
when i do the rotation like this:
code:
odgematrix3d rotmatrix;
rotmatrix.settorotation(odatoradian(30), odgevector3d::kzaxis);
pentity->transformby(rotmatrix);everything is alright, object is rotated by 30 degrees. but when i write components of matrix by myself, and entry atttribute of odgematrix3d object is exactly the same as after calling settorotation() method, but transformby() does nothing.
code:
odgematrix3d mymatrix;

mymatrix[0][0] = 0.866;
mymatrix[0][1] = -0.499;
mymatrix[0][3] = 0;
mymatrix[1][0] = 0.499;
mymatrix[1][1] = 0.866;
mymatrix[1][3] = 0;
pentity->transformby(mymatrix);did i forget about something?
- rotmatrix {entry=0x0012d8b8 } odgematrix3d
- entry 0x0012d8b8 double [4][4]
- [0] 0x0012d8b8 double [4]
[0] 0.86602540378443871 double
[1] -0.49999999999999994 double
[2] 0.00000000000000000 double
[3] 0.00000000000000000 double
- [1] 0x0012d8d8 double [4]
[0] 0.49999999999999994 double
[1] 0.86602540378443871 double
[2] 0.00000000000000000 double
[3] 0.00000000000000000 double
- [2] 0x0012d8f8 double [4]
[0] 0.00000000000000000 double
[1] 0.00000000000000000 double
[2] 1.0000000000000000 double
[3] 0.00000000000000000 double
- [3] 0x0012d918 double [4]
[0] 0.00000000000000000 double
[1] 0.00000000000000000 double
[2] 0.00000000000000000 double
[3] 1.0000000000000000 double
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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



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


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