CString Dialog::gettextforblock (acdbblockreference *pref, Acgepoint3d pickpoint)
{
Acdbentity *pent;
CString str=_t ("");
Acdbvoidptrarray Ptarr = NULL;
Acad::errorstatus Es=pref->explode (Ptarr);
int ilen = Ptarr.length ();
for (int i = 0; i < ilen;i++)
{
Pent = static_cast<acdbentity*> (Ptarr[i]);
Acdbextents ext;
Pent->getgeomextents (EXT);
Auto MINPT = acadutils::convertto2d (Ext.minpoint ());
Auto MAXPT = acadutils::convertto2d (Ext.maxpoint ());
Acgepoint2darray pts;
Pts.append (MINPT);
Pts.append (ACGEPOINT2D (Minpt.x, Maxpt.y));
Pts.append (MAXPT);
Pts.append (ACGEPOINT2D (Maxpt.x, Minpt.y));
if (Xfuntion (). Ptinregioninxyplate (Pickpoint, pts) && xfuntion (). Ptinregioninxyplate (Pickpoint, pts))//Hit the bounding box
{
if (Pent->iskindof (acdbtext::d ESC ()))
{
Acdbtext *ptext = NULL;
Ptext = Acdbtext::cast (pent);
str = ptext->textstring ();
Ptext->close ();
return str;
}
if (Pent->iskindof (acdbmtext::d ESC ()))
{
Acdbmtext *pmtext = NULL;
PMText = Acdbmtext::cast (pent);
str = pmtext->contents ();
Pmtext->close ();
return str;
}
if (Pent->iskindof (acdbblockreference::d ESC ()))
{
Acdbblockreference *pref = acdbblockreference::cast (pent);
Str=gettextforblock (PRef, pickpoint);
Pref->close ();
}
}
Pent->close ();
}
return str;
}
Get text in block