Message 1 of 6
Not applicable
03-13-2019
09:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm curently developing an AutoCAD plugin which need to retrieve a BlockReference from the layer "SNIE_BETON". Being the only object on that layer, i tried to use a SelectionFilter for the Editor.SelectAll() method. But when i try to execute the code, AutoCAD crashes and throw an "Unhandled Access Violation Reading 0x0000 Exception" error before closing.
I used the example on this website
Any ideas?
I'm on AutoCAD 2018 and developing in C#
Here's the code :
TypedValue[] tvs = new TypedValue[1] { new TypedValue( (int)DxfCode.LayoutName, "SNIE_BETON" ) };
SelectionFilter sf = new SelectionFilter(tvs);
PromptSelectionResult psr = DOC.Editor.SelectAll(sf);
ObjectIdCollection oic = new ObjectIdCollection(psr.Value.GetObjectIds());
DOC.Editor.WriteMessage("\nFound {0} entity on SNIE_BETON", oic.Count);
concrete_plan = (BlockReference)Trans.GetObject(oic[0], OpenMode.ForWrite);
Solved! Go to Solution.