.NET

Reply
Distinguished Contributor
junoj
Posts: 116
Registered: ‎02-26-2009
Message 1 of 5 (226 Views)

Utilizing SelectionSet on non-opened drawings

226 Views, 4 Replies
08-30-2012 01:02 PM

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

*Expert Elite*
Alfred.NESWADBA
Posts: 8,865
Registered: ‎06-29-2007
Message 2 of 5 (203 Views)

Re: Utilizing SelectionSet on non-opened drawings

08-31-2012 08:41 AM in reply to: junoj

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
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 3 of 5 (197 Views)

Re: Utilizing SelectionSet on non-opened drawings

08-31-2012 09:35 AM in reply to: junoj

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.

Distinguished Contributor
junoj
Posts: 116
Registered: ‎02-26-2009
Message 4 of 5 (168 Views)

Re: Utilizing SelectionSet on non-opened drawings

09-01-2012 09:08 PM in reply to: junoj

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

*Expert Elite*
Alfred.NESWADBA
Posts: 8,865
Registered: ‎06-29-2007
Message 5 of 5 (161 Views)

Re: Utilizing SelectionSet on non-opened drawings

09-02-2012 01:23 AM in reply to: DiningPhilosopher

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
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community