Here is an quick xample how to do it
{code}
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.GraphicsInterface;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
............................................
// credits Tony Tanzillo
public static void Scale(ObjectId id, Point3d basept, double scale)
{
Matrix3d transform = Matrix3d.Scaling(scale,basept);
Database db = id.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
try
{
Entity ent = (Entity)tr.GetObject(id, OpenMode.ForWrite);
if (ent != null)
{
ent.TransformBy(transform);
}
tr.Commit();
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
AcadApp.ShowAlertDialog(ex.Message);
}
}
}
[CommandMethod("SCE")]
public static void ScaleSelected()
{
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect an Entity: ");
PromptEntityResult res = ed.GetEntity(peo);
if (res.Status != PromptStatus.OK)
return;
PromptPointOptions ppo = new PromptPointOptions("\nPick Base Point: ");
PromptPointResult pres = ed.GetPoint(ppo);
if (pres.Status != PromptStatus.OK)
return;
PromptDoubleOptions pdo = new PromptDoubleOptions("\nSpecify Scale Factor: ");
PromptDoubleResult dres = ed.GetDouble(pdo);
if (dres.Status != PromptStatus.OK)
return;
ObjectId id = res.ObjectId;
Point3d basept =pres.Value;
double scale = dres.Value;
Scale(id, basept, scale);
}
{code}
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919