How do i do SelectionFilter for Database

How do i do SelectionFilter for Database

Anonymous
Not applicable
737 Views
2 Replies
Message 1 of 3

How do i do SelectionFilter for Database

Anonymous
Not applicable
I have created database via ReadDwgFile (i read external dwg) and i need select entities some of type.

Autodesk.AutoCAD.DatabaseServices.Database AcDatabase = new Database();
AcDatabase.ReadDwgFile(DwgPathFile, FileOpenMode.OpenForReadAndAllShare, false, "");

I know, that i can select entity some of type like this:

Document m_AcDocument = DocumentManager.MdiActiveDocument;
Database m_AcDatabase = m_AcDocument.Database;
Autodesk.AutoCAD.EditorInput.Editor m_AcEditor = m_AcDocument.Database;

I created SelectionFilter:
TypedValue[] typedValue = new TypedValue[] {new TypedValue((int)DxfCode.LayerName, "0")};
Autodesk.AutoCAD.EditorInput.SelectionFilter selectionFilter = new Autodesk.AutoCAD.EditorInput.SelectionFilter(typedValue);
Autodesk.AutoCAD.EditorInput.PromptSelectionResult psr = m_AcDocument.Editor.SelectAll(selectionFilter);

This way work good, bat i don't have access to Document, if i created database via ReadDwgFile. Exists path how do i create similar SelectionFilter for Database opened via ReadDwgFile?

Thank you very much
0 Likes
738 Views
2 Replies
Replies (2)
Message 2 of 3

chiefbraincloud
Collaborator
Collaborator
The editor methods are not available to a database that is not open in the editor.

You have to search the database for the objects you need.
Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thank you i thought it. One way is that, i have to browse all entities from database and read their property what i need.
0 Likes