[ACAD2013] SCALE Command from ObjectARX

[ACAD2013] SCALE Command from ObjectARX

Anonymous
Not applicable
431 Views
1 Reply
Message 1 of 2

[ACAD2013] SCALE Command from ObjectARX

Anonymous
Not applicable

Hi Everybody,

I would like to call the SCALE command on a set of objects from ObjectARX and let the user select a base point and specify programmatically the scale factor.

 

Is there a way to do that?

 

Thank you guys so much!

 

Have a good day.

0 Likes
432 Views
1 Reply
Reply (1)
Message 2 of 2

nick83
Advocate
Advocate

try this:

AcDbObjectIdArray mas; // use for your set of entities
ads_point pPoint; // use it for base point
acdbUcs2Wcs(pPoint, pPoint, false); // must be in WCS. if you got it by acedGetPoint(), it must be converted.

double scaleCoef = 1.0;
acedInitGet( RSG_NOZERO | RSG_NONEG,NULL);
if (acedGetReal(_T("\nScale coeff: <1.0> "), &scaleCoef) != RTNORM) return;

AcGeMatrix3d m;
m.setToScaling(scaleCoef,AcGePoint3d(pPoint[X],pPoint[Y],pPoint[Z]));
for (int i = 0; i < mas.length(); i++)
{
  AcDbEntity * obj;
  if (acdbOpenObject(obj,mas.at(i),AcDb::kForWrite) != Acad::eOk) continue;
  obj->transformBy(m);
  obj->downgradeOpen();
  obj->draw();
  obj->close();
}