public static void ChangeEntColour() { // // Get some user input: // _AcEd.Editor ed = _AcAp.Application.DocumentManager.MdiActiveDocument.Editor; _AcEd.PromptEntityResult res = ed.GetEntity("Select an entity to change its colour:"); if (res.Status == _AcEd.PromptStatus.OK) { var entId = res.ObjectId; var db = _AcDb.HostApplicationServices.WorkingDatabase; using (var tr = db.TransactionManager.StartTransaction()) { var ent = tr.GetObject(entId, Teigha.DatabaseServices.OpenMode.ForWrite) as _AcDb.Entity; // // Ask the user for the new colour number // _AcEd.PromptIntegerResult intres = ed.GetInteger("\nEnter new colorindex integer (0 -> 255): "); if (intres.Status == _AcEd.PromptStatus.OK) { ent.ColorIndex = intres.Value; } tr.Commit(); } } }
private string promptDiameter() { string userDiameter = ""; _Ed.PromptIntegerOptions promptOptions = new _Ed.PromptIntegerOptions("Diameter:"); promptOptions.AllowNone = true; _Ed.PromptIntegerResult promptResult = _c.ed.GetInteger(promptOptions); if (promptResult.Status == _Ed.PromptStatus.OK) { userDiameter = promptResult.Value.ToString(); } return(userDiameter); }