ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[ACAD2013] SCALE Command from ObjectARX

1 REPLY 1
Reply
Message 1 of 2
gatti.massimo
276 Views, 1 Reply

[ACAD2013] SCALE Command from ObjectARX

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.

1 REPLY 1
Message 2 of 2
nick83
in reply to: gatti.massimo

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();
}

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost