- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
We have drawings with some kind of custom entities from third party and a plugin arx to show them. I want to change some properties like layer, text style in these custom entities. Here is my code snippet:
ads_point pt;
int ret = acedEntSel(_T("Select an entity:\n"), ent, pt);
struct resbuf *ebuf = acdbEntGet(ent);
if (ebuf)
{
struct resbuf *eb = ebuf;
while (eb)
{
if (eb->restype == 7) // text style
{
ACHAR *pStyle = eb->resval.rstring;
eb->resval.rstring = (ACHAR*)acad_malloc(20);
_tcscpy(eb->resval.rstring, _T("test")); // assume a text style named 'test' already exists
int ret;
if ((ret=acdbEntMod(ebuf)) != RTNORM)
{
acutRelRb(ebuf);
return ; // Error
}
}
eb = eb->rbnext;
}
acutRelRb(ebuf);
}
My problem is, if I select the custom entity, as soon as I call acdbEntMod, acad crashes... But if I select a standard entity like dbtext, the code runs ok. So what's wrong with it?
BTW, I notice acad has a standard checking function, which can successfully change the text style of that custom entity. So it's feasible. But how does acad change it?
Solved! Go to Solution.

