查看单个帖子
旧 2009-05-06, 10:46 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem in oddbminsertblockexplode90

problem in oddbminsertblock::explode()
problem in oddbminsertblock::explode()
when reading the attached dxf file using dwgdirect 2.6.3, i have run into a problem with oddbminsertblock::explode().
i call oddbminsertblock::explode() on the minsertblock object with handle 177f0 (pointing to block "lrc"). then i iterate through the returned collection of objects. in this case, the only object in the collection is a oddbtext object. when i call oddbtextsition(), the coordinates in the returned point are the ones in the "lrc" block definition, and do not appear to have had the insert block's insertion point applied to them.
there are many oddbinsertblock objects in the file. most of them refer to blocks that contain oddbline objects, and did not have this problem when i called explode() on those, just the ones that refer to blocks that contain oddbtext objects.
i did not run into this problem in dwgdirect 2.5.2.
i am using windows xp and visual studio 2005.
thanks,
bob
attached files
this is a regression indeed. we'll investigate that, thanks for your report.
vladimir
thanks for the reply.
are you planning a bug fix release in the near future?
bob
bugfix release, no, but next major release is not far away.
version 2.7
beta: november 10, 2008
production: december 8, 2008
vladimir
is there a work-around we could use until the fix comes out? i have tried a couple of things:
1) when reading the original oddbminsertblock object, capture the oddbminsertblock::blocktransform() matrix and use it to transform the oddbtextsition() in the text object that results from the call to oddbminsertblock::explode(). in this case, the resulting point is correct, but the text is not rotated properly.
2) again using the oddbminsertblock::blocktransform() matrix, call oddbtext::transformby() on the text object that results from oddbminsertblock::explode(). this call fails with an odresult of ecannotscalenonuniformly.
is there something else i should be doing instead?
thanks,
bob
you may try gettransformedcopy() method.
vladimir
thanks for the tip...i missed that method in the documentation. unfortunately, the copy of oddbtext returned by oddbtext::gettransformedcopy() seems to be the same as the original...it doesn't seem to be transformed. when i run the following code, i get the same result as i did when i didn't call oddbtext::gettransformedcopy().
code:
// m_blockinsertmatrix is the matrix returned from minsertblock::blocktransform()
oddbtextptr pdwgtext = pentity; // pentity is an entity returned by minsertblock::explode()
if (!pdwgtext->isdbro())
{
// we are using entity that is result of explode() call...make a transformed copy.
oddbentityptr tempcopy;
odresult result = pdwgtext->gettransformedcopy(m_blockinsertmatrix, tempcopy);
if (result == eok)
{
pdwgtext = tempcopy;
}
}
odgepoint3d pos = pdwgtext->position();
if (pdwgtext->isdbro())
{
// store the point info from pos -- no transform needed
}
else
{
// put the point in the correct location based on info from the block reference.
// i have to do this even though i already called gettransformedcopy().
odgepoint3d loc = pos.transformby(m_blockinsertmatrix);
// store point info from loc
}am i doing something wrong?
bob
as a result of regression in 2.6.3 oddbtext::gettransformedcopy() does not work for non-uniscaled matrix.
this is fixed already (cr5439) the fix is available for founders at svn and will be included in next release.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)