I want to erase all entities in a rectangular area, I tried to use the follow statement to get these objects in the area.
PromptSelectionResult acSSPrompt = acDocEd.SelectWindow (new Point3d (-500, 400, 0), new Point3d (-10, -150, 0));
But the disadvantage of SelectWindow() is that if the current window is not within this area, then the acSSPrompt will be null, so the program get nothing in that arae and it's won't erase the entities in that area, it's not match the actual situation
I also try to conver all objectIds in the current BlockTableRecord into Entity, but not every one has a Position property.
How can I solve this problem?
I hope someone can help me, very thanks.
Solved! Go to Solution.
Solved by Ajilal.Vijayan. Go to Solution.
@Anonymous wrote:
But the disadvantage of SelectWindow() is that if the current window is not within this area, then the acSSPrompt will be null, so the program get nothing in that arae and it's won't erase the entities in that area, it's not match the actual situation
Then how about changing the current view of drawing to include the required area
acDoc.Editor.SetCurrentView(acView)
You may want to use code like this,
change points , entity name and other items in
Selection filter:
// code snop string tab = (string)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CTAB"); TypedValue[] tvs = new TypedValue[] { new TypedValue((int) DxfCode.Start, "TEXT"), new TypedValue(410, tab), new TypedValue((int) DxfCode.Operator, "<AND"), new TypedValue((int) DxfCode.Operator, ">,>,*"), new TypedValue((int) 10, minpt), new TypedValue((int) DxfCode.Operator, "<,<,*"), new TypedValue((int) 10, maxpt), new TypedValue((int) DxfCode .Operator, "AND>") }; SelectionFilter sf = new SelectionFilter(tvs); PromptSelectionResult psr = ed.SelectAll(sf); if (psr.Status == PromptStatus.OK) { count = psr.Value.GetObjectIds().Length; ed.WriteMessage("\nSelected: " + count.ToString()); } else { ed.WriteMessage("\nBad selection"); return; }
This is a easy way, just set the current view to zoom all, and then call SelectWindows method, so it won't get null.
Thanks.
Can't find what you're looking for? Ask the community or share your knowledge.