Selection Filter to ignore XREF

Selection Filter to ignore XREF

chris_mills
Explorer Explorer
1,347 Views
4 Replies
Message 1 of 5

Selection Filter to ignore XREF

chris_mills
Explorer
Explorer

Hi All,

 

Does anyone know of a way to ignore XREF's when doing a Editor.SelectAll?

The reason I ask is purely based on efficiency. I am searching on polylines and circles in the current database, but don't care about any xref'd databases. Sometimes this can take a little while if there are quite a few xref'd drawings.

 

This is the code I'm using:

 

TypedValue[] types = new TypedValue[] { new TypedValue((int)DxfCode.Start, "LWPOLYLINE,CIRCLE") };
PromptSelectionResult selectionRes = ed.SelectAll(new SelectionFilter(types));

Thanks for any help,

Chris.

0 Likes
1,348 Views
4 Replies
Replies (4)
Message 2 of 5

BlackBox_
Advisor
Advisor

Unfortunately no, not directly through your selection filter, unless all of your external references are on a specific layer, etc. which you could exclude using (-4, "<NOT"), etc.

 

Instead, consider iterating the resultant ObjectIds, testing for ObjectId.ObjectClass.Name == "AcDbBlockReference", and then subsequently test for XrefStatus in order to exclude from your procedure(s).

 

HTH


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 3 of 5

norman.yuan
Mentor
Mentor

Wouldn't the filter value "CIRCLE,LWPOLYLINE" is good enough to only select circle and polyline, and exclude anything else, including Xref, which is an "INSERT" (BlockReference)?

 

Have you run your code? Did it not only select circles and polylines in the current drawing database, but also select those in the Xrefed drawing (I do not think so)?

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 4 of 5

BlackBox_
Advisor
Advisor

There does seem to be a bit of confusion between the first question asked, and the code, etc.


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 5 of 5

chris_mills
Explorer
Explorer

Appologies, I cannot repeat the issue. Originally inserting the XREF's dramatically slowed down the editor selection, and removing them much improved it, I can't even blame a network related slow-down. As norman.yuan quite rightly stated, the filter value doesn't include any of the nested entities within the blocks. I've thoroughly tested it and cannot repeat it.

Sorry guys, it's been a long week.

0 Likes