Here's a simple example.
It's C# but you should be able to convert it to VB or, better, learn C# instead of VB.
[CommandMethod("CMD")]
public static void Cmd()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
// prompt the user to select objects
var psr = ed.GetSelection();
if (psr.Status != PromptStatus.OK)
return;
// prompt the user to specify the base point
var ppo = new PromptPointOptions("\nSpecify base point: ");
var ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
var basePt = ppr.Value;
// prompt the user to specify the desination point
ppo.Message = "\nSpecify destination point: ";
ppo.BasePoint = basePt;
ppo.UseBasePoint = true;
ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
var destPt = ppr.Value;
// compute the displacement matrix
var vect = basePt.GetVectorTo(destPt).TransformBy(ed.CurrentUserCoordinateSystem);
var disp = Matrix3d.Displacement(vect);
using (var tr = db.TransactionManager.StartTransaction())
{
// copy the selected entities
var ids = new ObjectIdCollection(psr.Value.GetObjectIds());
var idMap = new IdMapping(); ;
db.DeepCloneObjects(ids, db.CurrentSpaceId, idMap, false);
// displace the copied entities
foreach (IdPair pair in idMap)
{
if (pair.IsPrimary && pair.IsCloned)
{
Entity ent = (Entity)tr.GetObject(pair.Value, OpenMode.ForWrite);
ent.TransformBy(disp);
}
}
tr.Commit();
}
}