0 Members and 1 Guest are viewing this topic.
BlockTableRecord btr = tr.GetObject(bt["BORDER-X"], OpenMode.ForRead, false) as BlockTableRecord;
What about a selection set? Or maybe you should ignore me
Quote from: Daniel on December 21, 2007, 10:25:41 AMWhat about a selection set? Or maybe you should ignore me I don't think there's any way of using a selection set to search a block table.If you want to use something like Editor.SelectAll(), then a selection filter would work for that.
[CommandMethod("test")] static public void test() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; //filter TypedValue[] values = new TypedValue[] { new TypedValue((short)DxfCode.BlockName, "BORDER-*") , }; SelectionFilter filter = new SelectionFilter(values); PromptSelectionResult result = ed.SelectAll(filter); if (result.Status == PromptStatus.OK) { ObjectId[] idarray = result.Value.GetObjectIds(); DBObjectCollection dbobjects = new DBObjectCollection(); AcDb.TransactionManager tm = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager; Transaction tr = tm.StartTransaction(); try { //do something foreach (ObjectId id1 in idarray) { dbobjects.Add(tr.GetObject(id1, OpenMode.ForRead, true)); } tr.Commit(); ed.WriteMessage(dbobjects.Count.ToString()); } catch (System.Exception ex) { ed.WriteMessage(ex.Message); } finally { tr.Dispose(); } } } }
Just a thoughts..Keep in mind the dynamicblocks,they will be use now very often
Quote from: sinc on December 21, 2007, 09:12:28 PMQuote from: Daniel on December 21, 2007, 10:25:41 AMWhat about a selection set? Or maybe you should ignore me I don't think there's any way of using a selection set to search a block table.If you want to use something like Editor.SelectAll(), then a selection filter would work for that.Yes, that’s what I had in mind. Maybe something like this
Where did you see that?All I saw was that it "selects all items from the screen", which implies that it filters on the currently-active space.It's a simple enough thing to test, though, by writing a little test program. I actually find myself doing that a lot, because the developer documentation is so sparse in so many areas.
Quote from: Fatty on December 22, 2007, 05:45:10 AMJust a thoughts..Keep in mind the dynamicblocks,they will be use now very often What about them?
Hello,Does anyone know of a regular expression or wildcard technique that could be used in the snippet below? Where, X is: A, B, C, D, E, or E1Code: [Select]BlockTableRecord btr = tr.GetObject(bt["BORDER-X"], OpenMode.ForRead, false) as BlockTableRecord;
"BORDER-[A-E],BORDER-[E#]*"
"BORDER-[A-E],BORDER-E1"