Article | 60001531 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 11/3/2011 |
Submitted by | Luca Mancusi |
Keywords |
VectorDraw.Professional.vdObjects.vdDocument vdDoc = vdFramedControl1.BaseControl.ActiveDocument; vdSelection sel = new vdSelection(); sel.SetUnRegisterDocument(vdDoc); sel.Name = "ents"; vdDoc.Prompt("Select Entities to keep: "); gPoints pts = vdDoc.ActionUtility.getUserPerigramViewCS(true, true); vdDoc.Prompt(null); sel.Select(VectorDraw.Render.RenderSelect.SelectingMode.CrossingWindowPolygon, pts); // or WindowPolygon if you like entities to be completely inside the polygon if (sel.Count > 0) { MessageBox.Show("Keep " + sel.Count.ToString() +" entities."); // the selection now has the entities you want to keep vdDoc.CommandAction.CmdErase("ALL"); // delete all including the entities to keep foreach (VectorDraw.Professional.vdPrimaries.vdFigure item in sel) { item.Deleted = false; // but set the previously selected entities as not deleted } vdDoc.Redraw(true); } else { MessageBox.Show("Nothing selected, nothing deleted."); }