高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】nested blocks
nested blocks
nested blocks
given below is my function to read a block reference/insert entity
bool readblockreference(oddbentityptr pentityptr)
{
oddbblockreferenceptr pblockreferenceptr = pentityptr;
odgematrix3d blocktransformmatrix = pblockreferenceptr->blocktransform();
odgepoint3d position = pblockreferenceptr->position();
oddbblocktablerecordptr pblocktablerecordptr = pblockreferenceptr->blocktablerecord().safeopenobject();
oddbobjectiteratorptr pobjectiteratorptr = pblocktablerecordptr->newiterator();
oddbentityptr pentity;
while(!pobjectiteratorptr->done())
{
pentity = pobjectiteratorptr->entity();
pentity->transformby(blocktransformmatrix);
readentity(pentity);
pobjectiteratorptr->step();
}
return true;
}
the function readentity() calls readblockreference() when the entity is a block reference/insert. the above code works fine for simple blocks. i have a problem for nested blocks (blocks containing blocks). the nested blocks are placed incorrectly in space. i know that the problem lies with the fact that i am doing something wrong with the blocktransformationmatrix variable and i am not doing anything with the position variable. just dont know what.
please help.
deelip
# 17th november 2003, 01:38 am
moderator join date: mar 2002
posts: 2,994
blocktransform matrix contains translation so position should not be applied together with blocktransform matrix.
you get wrong results for nested blocks because
1. transforms of all levels should be applied. each block insertion has it's own transform and for nested blocks a transformation stack should be used.
2. not all entities can be transformed using transformby(). for example text can't be transformed non-uniformly (if x and y scales are different for example).
3. block's base point should be taken into account.
sergey slezkin
sslezkin
# 17th november 2003, 04:40 am
registered user join date: sep 2003
location: goa, india
posts: 16
thanks
thanks for your quick reply
deelip
none
? | ?
thread tools
display modes
linear mode
search this thread
rate this thread
excellent
good
average
bad
terrible
posting rules
you may post new threads
you may post replies
you may post attachments
you may edit your posts
is on
are on
code is off
html code is off
forum jump
user control panel private messages subscriptions who's online search forums forums home general topics news questions and remarks business issues industry commentary general software issues documentation issues future directions dwg libraries dwgdirect.net dwgdirect, c++ version dwgdirectx, activex version adtdirect/c3ddirect opendwg toolkit/viewkit dgn libraries dgndirect, c++ version (2.x+) dgndirect libraries (legacy 0.99xx)
all times are gmt -7. the time now is 01:49 amfff">.
- - -
copyright ?2000 - 2009, jelsoft enterprises ltd.
copyright 1998-2008 open design alliance inc.
blocktransform matrix contains translation so position should not be applied together with blocktransform matrix.
you get wrong results for nested blocks because
1. transforms of all levels should be applied. each block insertion has it's own transform and for nested blocks a transformation stack should be used.
2. not all entities can be transformed using transformby(). for example text can't be transformed non-uniformly (if x and y scales are different for example).
3. block's base point should be taken into account.
sergey slezkin
thanks
thanks for your quick reply
|