|
高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|