Из helpa ARX рабочий код
//
// ObjectARX defined commands
#include "StdAfx.h"
#include "StdArx.h"
// This is command 'T1'
resbuf *entitem (resbuf*, int);
void dec4textt1()
{
// TODO: Implement the command
ads_name tname;
struct resbuf *textent, *tent;
ads_point origin, lowleft, upright, p1, p2, p3, p4;
ads_real rotatn;
char rotatstr[15];
if (acedEntSel("\nSelect text: ", tname, p1) != RTNORM) {
acdbFail("No Text entity selected\n");
// return BAD;
}
textent = acdbEntGet(tname);
if (textent == NULL) {
acdbFail("Couldn't retrieve Text entity\n");
//return BAD;
}
tent = entitem(textent, 10);
origin[X] = tent->resval.rpoint[X]; //ECS coordinates
origin[Y] = tent->resval.rpoint[Y];
tent = entitem(textent, 50);
rotatn = tent->resval.rreal;
// acdbAngToS() converts from radians to degrees.
if (acdbAngToS(rotatn, 0, 8, rotatstr) != RTNORM) {
acdbFail("Couldn't retrieve or convert angle\n");
acutRelRb(textent);
// return BAD;
}
if (acedTextBox(textent, lowleft, upright) != RTNORM) {
acdbFail("Couldn't retrieve text box coordinates\n");
acutRelRb(textent);
// return BAD;
}
acutRelRb(textent);
// If not currently in the WCS, at this point add
// acedTrans() calls to convert the coordinates
// retrieved from acedTextBox().
p1[X] = origin[X] + lowleft[X]; // UCS coordinates
p1[Y] = origin[Y] + lowleft[Y];
p2[X] = origin[X] + upright[X];
p2[Y] = origin[Y] + lowleft[Y];
p3[X] = origin[X] + upright[X];
p3[Y] = origin[Y] + upright[Y];
p4[X] = origin[X] + lowleft[X];
p4[Y] = origin[Y] + upright[Y];
if (acedCommand(RTSTR, "pline", RTPOINT, p1,
RTPOINT, p2, RTPOINT, p3,RTPOINT, p4, RTSTR, "c",
0) != RTNORM) {
acdbFail("Problem creating polyline\n");
// return BAD;
}
if (acedCommand(RTSTR, "rotate", RTSTR, "L", RTSTR, "",
RTPOINT, origin, RTSTR, rotatstr, 0) != RTNORM) {
acdbFail("Problem rotating polyline\n");
// return BAD;
}
// return GOOD;
}
// Program return DXF code
resbuf *entitem (resbuf *ent, int code)
{
resbuf *p;
for (p = ent; p!=NULL; p=p->rbnext) // DXF code search
{
if (p->restype==code)
return p;
}
}