.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do i do SelectionFilter for Database

2 REPLIES 2
Reply
Message 1 of 3
hokrm
549 Views, 2 Replies

How do i do SelectionFilter for Database

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
2 REPLIES 2
Message 2 of 3
chiefbraincloud
in reply to: hokrm

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
Message 3 of 3
hokrm
in reply to: hokrm

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost