Utilizing SelectionSet on non-opened drawings

Utilizing SelectionSet on non-opened drawings

Anonymous
Not applicable
633 Views
4 Replies
Message 1 of 5

Utilizing SelectionSet on non-opened drawings

Anonymous
Not applicable

Hi, I am trying to create a function or class can be used with the  MdiActiveDocument and also with the external Database. In order words the function or class should be able to access current Document and also non-opened Databases.

 

My difficulty is accessing the non-opened drawings and utilizing the SelectionSet to select blocks with  SelectionFilter like I could do with a MdiActiveDocument.

I would like to know if what I am trying to do is even possible, or would I have physically open the drawing to have the ability to utilize SelectionSet and filters.

 

Thank you in advance,

 

-Jay

0 Likes
634 Views
4 Replies
Replies (4)
Message 2 of 5

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I would like to know if what I am trying to do is even possible

No, as the SelectionSet is part if the Editor-Namespace it's only available for drawings in the editor.

To get the same functionality in drawings not opened in the editor you have to scan through the blocktables (ModelSpace and Layouts).


One help to that is that the ObjectID allready knows the DXF-Name of the object so it is not necessary to open each object (via transaction or via open). So to scan for Lines you can use

   if myObjectId.ObjectClass.DxfName = "LINE" then

 

The other option to look for BlockReferences is to find the BlockTableRecord with the name you look for and then use

   tBlockTabRec.GetBlockReferenceIds(directOnly As Boolean, forceValidity As Boolean)

to get the ObjectID's from all references inserted in the drawing.

 

- .alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 5

DiningPhilosopher
Collaborator
Collaborator

Try setting the HostApplicationServices.WorkingDatabase property to the database you want to do the filtered selection on just before you call GetSelection), and immediately set that same property to the active document's database as soon as GetSelection() returns.

Message 4 of 5

Anonymous
Not applicable

Thank you DiningPhilosopher and Alfred,

 

I ended useing something very similar to your proposal:  Database.CurrentSpaceId. Then just iterate all block in that space for the block name. That worked very well.

 

Again, thank you both very much.

 

-Jay

0 Likes
Message 5 of 5

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

I just learned something, thank you for the tip! (even my pessimistic feeling if that works really save raises up, but I will test).

 

Thx, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes