public void insBlok(string code)
{
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
Utils.SetFocusToDwgView();
Point3d ptPoint = new Point3d(0, 0, 0);
try
{
while (ptPoint != null)
{
PromptPointResult pPtRes;
PromptPointOptions pPtOpts = new PromptPointOptions("");
pPtOpts.AllowNone = true;
pPtOpts.Message = "\nSelect point: ";
pPtRes = doc.Editor.GetPoint(pPtOpts);
if (pPtRes.Status == PromptStatus.None || pPtRes.Status == PromptStatus.Cancel || pPtRes.Status == PromptStatus.Error)
{
return;
}
ptPoint = pPtRes.Value;
using (DocumentLock loc = doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
...................
using (BlockReference blockRef = new BlockReference(ptPoint, btr.ObjectId))
{
foreach (ObjectId id in btr)
{
//insert value in attribute,
}
}
tr.Commit();
}
}
}
}
catch (System.Exception x)
{
ed.WriteMessage("\nError: " + x.Message);
}
finally
{
ed.WriteMessage("\n");
}
}
private void cboBtn_ButtonClick(object sender, EventArgs e)
{
string buttonText = ((ComboBox1)sender).Text;
buttonText = buttonText.Substring(0, 3);
insBlok(buttonText);
}
@Grrr1337 it's my understanding the command is running from a palette, not a form.