<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SelectCrossingWindow only selects objects currently visible on the screen in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5104800#M43626</link>
    <description>&lt;P&gt;I figured it out! &amp;nbsp;It really is recognizing xrefs. &amp;nbsp;It was my own windowing that was skipping it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you mcicognani for all your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jun 2014 13:16:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-06-19T13:16:39Z</dc:date>
    <item>
      <title>SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5089724#M43615</link>
      <description>&lt;P&gt;SelectCrossingWindow only selects objects currently visible on the screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this expected behavior? &amp;nbsp;I would prefer not to be required to zoom extents before running the command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;Detroit, MI&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 22:21:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5089724#M43615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-11T22:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5089888#M43616</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, it's the expected behavior (no matter if is crossing or window, fence, etc) , it's the same in Autolisp, so you have to zoom out enough to fit the objects on the screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 00:20:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5089888#M43616</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2014-06-12T00:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091040#M43617</link>
      <description>&lt;P&gt;Then is there a better method for selecting objects?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is it that &lt;SPAN&gt;creating a selection set on a closed drawing&lt;/SPAN&gt;&amp;nbsp;works?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just wondering if I'm barking up the wrong tree...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jeff&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 13:06:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091040#M43617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T13:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091078#M43618</link>
      <description>&lt;P&gt;You can use filters using dxf properties codes. This works on database, thus selecting also objects not visible.&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;TypedValue[]&amp;nbsp;tvs1&amp;nbsp;=&amp;nbsp;new&amp;nbsp;TypedValue[4]&amp;nbsp;
{&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&amp;nbsp;TypedValue((int)DxfCode.Operator,&amp;nbsp;"&amp;lt;and"),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&amp;nbsp;TypedValue((int)DxfCode.Start,&amp;nbsp;"INSERT"),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&amp;nbsp;TypedValue((int)DxfCode.LayerName,&amp;nbsp;szLayerCell),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&amp;nbsp;TypedValue((int)DxfCode.Operator,&amp;nbsp;"and&amp;gt;")
}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PromptSelectionResult&amp;nbsp;psr&amp;nbsp;=&amp;nbsp;doc.Editor.SelectAll(new&amp;nbsp;SelectionFilter(tvsd));&lt;BR /&gt;&lt;/SPAN&gt;if&amp;nbsp;(psr.Status&amp;nbsp;==&amp;nbsp;PromptStatus.OK&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;psr.Value.Count&amp;nbsp;&amp;gt;&amp;nbsp;0)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used those in the beginning, thinking that an internal function was the fastest way to filter a database, but I soon discovered that traversing a drawing in .NET is quite fast, so recently I prefer to traverse the database by myself and filter whatever entities I need.&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;// get block table, here you'll find *modelspace, *paperspace and block definitions&lt;BR /&gt;BlockTable&lt;/SPAN&gt;&amp;nbsp;bt&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTable&lt;/SPAN&gt;)tr.GetObject(dwg.BlockTableId,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
 
&lt;SPAN&gt;foreach&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN&gt;ObjectId&lt;/SPAN&gt;&amp;nbsp;btrId&amp;nbsp;&lt;SPAN&gt;in&lt;/SPAN&gt;&amp;nbsp;bt)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;&amp;nbsp;btr&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;)tr.GetObject(btrId,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
&lt;BR /&gt;    // here you may want to filter which space you need&lt;BR /&gt;    if (!btr.Name.StartsWith("*")) continue;&lt;BR /&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN&gt;ObjectId&lt;/SPAN&gt;&amp;nbsp;o&amp;nbsp;&lt;SPAN&gt;in&lt;/SPAN&gt;&amp;nbsp;btr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;DBObject&lt;/SPAN&gt;&amp;nbsp;dbo&amp;nbsp;=&amp;nbsp;tr.GetObject(o,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if&lt;/SPAN&gt;&amp;nbsp;(!dbo.IsErased&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;!dbo.IsDisposed&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;(dbo&amp;nbsp;&lt;SPAN&gt;is&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;Entity&lt;/SPAN&gt;))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Entity&lt;/SPAN&gt;&amp;nbsp;ent&amp;nbsp;=&amp;nbsp;dbo&amp;nbsp;&lt;SPAN&gt;as&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;Entity&lt;/SPAN&gt;;&lt;BR /&gt;
            // valid entity, check whatever you need 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if&lt;/SPAN&gt;&amp;nbsp;(ent.LayerId&amp;nbsp;==&amp;nbsp;idLayerSource)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;                // open entity for change and do whatever you need
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ent.UpgradeOpen();
 &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jun 2014 13:25:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091078#M43618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T13:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091714#M43619</link>
      <description>&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;I am currently using the selection method with dxf filters and it does not select objects off screen. &amp;nbsp;I was hoping maybe I was missing a flag or option somewhere.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&lt;SPAN&gt;I may have to switch over to looping through the db as well.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&lt;SPAN&gt;Thanks everyone for the feedback,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 16:42:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5091714#M43619</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T16:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5093672#M43620</link>
      <description>&lt;P&gt;You said you were using SelectCrossWindow(), in the example reported I used SelectAll().&lt;/P&gt;&lt;P&gt;In my experience, SelectAll() works on the db directly and allows to select entities not visible on screen, even on hidden layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 12:39:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5093672#M43620</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-13T12:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5101170#M43621</link>
      <description>&lt;P&gt;I finally had time to test this out and you are correct SelectAll() finctions differently than SelectCrossingWindow(). &amp;nbsp;Thank you, I beleive this puts me on a better path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this new direction would you recommend I also abandon selection filters? &amp;nbsp;I was already having issues filtering for block names when the blocks were dynamic anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I'm already stepping through each BTR looking for criteria I could just filter there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 21:58:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5101170#M43621</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-17T21:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5101672#M43622</link>
      <description>&lt;P&gt;Given that you're looking for blocks and the database provide a neat BlockTable to traverse, I'd suggest you'd go through this path, it's also a lot faster than filtering or traversing the whole database.&lt;/P&gt;&lt;P&gt;From BlockTable is also easy to collect the BlockReference instances, both for standard and dynamic blocks, so it seems to have lot of advantages and no downsides.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may want to traverse the db starting from ModelSpace/Paperspace if you need some hierarchy information, like blocks inside blocks or inside xrefs. In this case you may want a recursive function looking for blockreferences and step in for blocktablerecords.&lt;/P&gt;&lt;P&gt;I have plenty of this C# working code, let me know if you need something like this.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2014 06:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5101672#M43622</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-18T06:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5102294#M43623</link>
      <description>&lt;P&gt;I've tried two methods. &amp;nbsp;The first was to look through the entire database for blockreferences then verify their names. &amp;nbsp;Then I modified it to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Using myTrans As Transaction = DbIn.TransactionManager.StartTransaction
                    Dim thisSpaceBTR As BlockTableRecord = DbIn.CurrentSpaceId.GetObject(OpenMode.ForRead)
                    For Each thisOID As ObjectId In thisSpaceBTR
                        Dim thisEnt As Entity = thisOID.GetObject(OpenMode.ForRead)
                        If TypeOf thisEnt Is BlockReference Then
                            Dim thisBlockRef As BlockReference = thisOID.GetObject(OpenMode.ForRead)
                            Dim thisBTR As BlockTableRecord = thisBlockRef.BlockTableRecord.GetObject(OpenMode.ForRead)
                            Dim blockName As String = Tools.Blocks.GetBlockName(thisBTR)
                            If blockName.StartsWith("Anno-Keyn-Hedr-") Or blockName.StartsWith("Anno-Keyn-Rows-") Or blockName = "Anno-Keyn-Endr" Then
                                thisBlockRef.UpgradeOpen()
                                thisBlockRef.Erase()
                            End If
                        End If
                    Next
                    myTrans.Commit()
                End Using&lt;/PRE&gt;&lt;P&gt;It only bothers with the current space. &amp;nbsp;I'd imagine this is more efficient since my current need is only for the current space. &amp;nbsp;The GetBlockName sub simply gets the effective name so that I can include dynamic blocks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I originally tried to erase the BTR, but I kept receiving an exception error. &amp;nbsp;Instead I erase the blockreference and it seems to work fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next steps are going to be to step into blocks and xrefs so I could use your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2014 13:10:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5102294#M43623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-18T13:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5102444#M43624</link>
      <description>&lt;P&gt;You can erase the BlockTableRecord only if there is no BlockReference, quite understandable, I'd say...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to recurse inside blocks or XREFs, keep in mind that a block definition and the current space (ModelSpace or PaperSpace) are just of the same type: BlockTableRecord. So you may create a recursive function that accept a BlocktableRecord to analyze, the first call would be made passing the current space and check every entity like you already do. When you find a BlockReference you can get the linked BlockTableRecord and you may call the same function recursively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this (sorry, just C#):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;private&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;void&lt;/SPAN&gt;&amp;nbsp;ParseBlocksDb(&lt;SPAN&gt;Database&lt;/SPAN&gt;&amp;nbsp;db,&amp;nbsp;&lt;SPAN&gt;String&lt;/SPAN&gt;&amp;nbsp;szFormat,&amp;nbsp;System.Data.&lt;SPAN&gt;DataTable&lt;/SPAN&gt;&amp;nbsp;dt,&amp;nbsp;&lt;SPAN&gt;int&lt;/SPAN&gt;&amp;nbsp;iRound)
{
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Transaction&lt;/SPAN&gt;&amp;nbsp;tr&amp;nbsp;=&amp;nbsp;db.TransactionManager.StartTransaction();
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;try&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;BlockTable&lt;/SPAN&gt;&amp;nbsp;bt&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTable&lt;/SPAN&gt;)tr.GetObject(db.BlockTableId,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;String&lt;/SPAN&gt;&amp;nbsp;szFilename&amp;nbsp;=&amp;nbsp;&lt;SPAN&gt;Path&lt;/SPAN&gt;.GetFileNameWithoutExtension(db.Filename);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;browse&amp;nbsp;modelspace&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;&amp;nbsp;ms&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;)tr.GetObject(bt[&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;.ModelSpace],&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_ParseBlocksBtr(ms,&amp;nbsp;tr,&amp;nbsp;szFormat,&amp;nbsp;dt,&amp;nbsp;iRound,&amp;nbsp;szFilename);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;browse&amp;nbsp;paperspace&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ms&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;)tr.GetObject(bt[&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;.PaperSpace],&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_ParseBlocksBtr(ms,&amp;nbsp;tr,&amp;nbsp;szFormat,&amp;nbsp;dt,&amp;nbsp;iRound,&amp;nbsp;szFilename);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;catch&lt;/SPAN&gt;&amp;nbsp;(System.&lt;SPAN&gt;Exception&lt;/SPAN&gt;&amp;nbsp;ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.Show(&lt;SPAN&gt;"Unexpected error:&amp;nbsp;"&lt;/SPAN&gt;&amp;nbsp;+&amp;nbsp;ex.Message);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;finally&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tr.Dispose();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
 
&lt;SPAN&gt;private&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;void&lt;/SPAN&gt;&amp;nbsp;_ParseBlocksBtr(&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;&amp;nbsp;ms,&amp;nbsp;&lt;SPAN&gt;Transaction&lt;/SPAN&gt;&amp;nbsp;tr)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;int&lt;/SPAN&gt;&amp;nbsp;p;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;BlockReference&lt;/SPAN&gt;&amp;nbsp;br;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;&amp;nbsp;btr;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN&gt;ObjectId&lt;/SPAN&gt;&amp;nbsp;o&amp;nbsp;&lt;SPAN&gt;in&lt;/SPAN&gt;&amp;nbsp;ms)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;DBObject&lt;/SPAN&gt;&amp;nbsp;dbo&amp;nbsp;=&amp;nbsp;tr.GetObject(o,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead, false);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if&lt;/SPAN&gt;&amp;nbsp;((dbo&amp;nbsp;&lt;SPAN&gt;is&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;BlockReference&lt;/SPAN&gt;)&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;(!dbo.IsErased))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;br&amp;nbsp;=&amp;nbsp;dbo as BlockReference;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;retrieve blockdefinition, regardless if standard or dynamic&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;btr&amp;nbsp;=&amp;nbsp;(&lt;SPAN&gt;BlockTableRecord&lt;/SPAN&gt;)tr.GetObject(br.IsDynamicBlock&amp;nbsp;?&amp;nbsp;br.DynamicBlockTableRecord&amp;nbsp;:&amp;nbsp;br.BlockTableRecord,&amp;nbsp;&lt;SPAN&gt;OpenMode&lt;/SPAN&gt;.ForRead);
 &lt;BR /&gt;            // even XRefs have a BlockTableRecord, you can check the property &lt;SPAN style="line-height: 15px;"&gt;btr.IsFromExternalReference&amp;nbsp;||&amp;nbsp;btr.IsFromOverlayReference&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;//&amp;nbsp;recurse inside block/xref, if needed&lt;SPAN style="line-height: 15px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;            _ParseBlocksBtr(btr,&amp;nbsp;tr); &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt;            // do whatever you want with current reference&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2014 13:47:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5102444#M43624</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-18T13:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5103772#M43625</link>
      <description>&lt;P&gt;I have re-written the remainder of my code to completely abandon the concept of selection sets and I am relying solely on stepping through the BTRs. &amp;nbsp;I have also adopted the idea of passing &lt;SPAN&gt;along&amp;nbsp;&lt;/SPAN&gt;the transaction to use only one per command - very efficient. &amp;nbsp;I have considered trying this in the past, but your example showed me it is possible. &amp;nbsp;Lastly, I am using bounds of blockrefs to establich location - giving me the ability to concentrate on a particular area defined like a window.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is going well, with one exception. &amp;nbsp;It ignores xrefs. &amp;nbsp;No errors, just seems to disregard them. &amp;nbsp;Here is where I am at:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;VB.NET&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;Sub DeepDive(ByVal TransIn As Transaction, ByVal BTRin As BlockTableRecord, Optional ByVal windowPt1 As Point3d = Nothing, Optional ByVal windowPt2 As Point3d = Nothing)
        For Each thisOID As ObjectId In BTRin
            Dim thisEnt As Entity = thisOID.GetObject(OpenMode.ForRead)
            If TypeOf thisEnt Is BlockReference Then
                Dim thisBlockRef As BlockReference = DirectCast(TransIn.GetObject(thisOID, OpenMode.ForRead), BlockReference)
                Dim thisBTR As BlockTableRecord = DirectCast(TransIn.GetObject(thisBlockRef.BlockTableRecord, OpenMode.ForRead), BlockTableRecord)

                'If a window is provided make sure the block is within it...
                If windowPt1 &amp;lt;&amp;gt; Nothing And windowPt2 &amp;lt;&amp;gt; Nothing Then
                    If Tools.IsWithin(thisBlockRef.Bounds.Value.MinPoint, windowPt1, windowPt2) And Tools.IsWithin(thisBlockRef.Bounds.Value.MaxPoint, windowPt1, windowPt2) Then
                        'Check for KN data
                        gatherKNdata(thisBlockRef, thisBTR)
                        'Then dive inside to look for more blockrefs
                        DeepDive(TransIn, thisBTR)
                    End If
                Else
                    'If no window is provided everything is allowed...
                    'Check for KN data
                    gatherKNdata(thisBlockRef, thisBTR)
                    'Then dive inside to look for more blockrefs
                    DeepDive(TransIn, thisBTR)
                End If
            ElseIf TypeOf thisEnt Is Viewport Then
                Dim myVP As Viewport = DirectCast(TransIn.GetObject(thisOID, OpenMode.ForRead), Viewport)

                'If a window is provided make sure the block is within it...
                If windowPt1 &amp;lt;&amp;gt; Nothing And windowPt2 &amp;lt;&amp;gt; Nothing Then
                    'If any of the viewports four corners are within the drawing area, include it
                    If Tools.IsWithin(myVP.Bounds.Value.MinPoint, windowPt1, windowPt2) Or _
                        Tools.IsWithin(myVP.Bounds.Value.MaxPoint, windowPt1, windowPt2) Or _
                        Tools.IsWithin(New Point3d(myVP.Bounds.Value.MinPoint.X, myVP.Bounds.Value.MaxPoint.Y, 0), windowPt1, windowPt2) Or _
                        Tools.IsWithin(New Point3d(myVP.Bounds.Value.MaxPoint.X, myVP.Bounds.Value.MinPoint.Y, 0), windowPt1, windowPt2) Then

                        Dim scaleFactor As Double = myVP.ViewHeight / myVP.Height
                        Dim myVPviewLL As New Point3d(myVP.ViewCenter.X - ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y - (myVP.ViewHeight / 2), 0)
                        Dim myVPviewUR As New Point3d(myVP.ViewCenter.X + ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y + (myVP.ViewHeight / 2), 0)
                        Dim myVPviewUL As New Point3d(myVP.ViewCenter.X - ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y + (myVP.ViewHeight / 2), 0)
                        Dim myVPviewLR As New Point3d(myVP.ViewCenter.X + ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y - (myVP.ViewHeight / 2), 0)

                        Dim myBT As BlockTable = DirectCast(TransIn.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead), BlockTable)
                        Dim msBTR As BlockTableRecord = DirectCast(TransIn.GetObject(myBT(BlockTableRecord.ModelSpace), OpenMode.ForRead), BlockTableRecord)

                        DeepDive(TransIn, msBTR, myVPviewLL, myVPviewUR)
                    End If
                End If
            End If
        Next
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;C#&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;private void DeepDive(Transaction TransIn, BlockTableRecord BTRin, Point3d windowPt1 = null, Point3d windowPt2 = null)
{
	foreach (ObjectId thisOID in BTRin) {
		Entity thisEnt = thisOID.GetObject(OpenMode.ForRead);
		if (thisEnt is BlockReference) {
			BlockReference thisBlockRef = (BlockReference)TransIn.GetObject(thisOID, OpenMode.ForRead);
			BlockTableRecord thisBTR = (BlockTableRecord)TransIn.GetObject(thisBlockRef.BlockTableRecord, OpenMode.ForRead);

			//If a window is provided make sure the block is within it...
			if (windowPt1 != null &amp;amp; windowPt2 != null) {
				if (Tools.IsWithin(thisBlockRef.Bounds.Value.MinPoint, windowPt1, windowPt2) &amp;amp; Tools.IsWithin(thisBlockRef.Bounds.Value.MaxPoint, windowPt1, windowPt2)) {
					//Check for KN data
					gatherKNdata(thisBlockRef, thisBTR);
					//Then dive inside to look for more blockrefs
					DeepDive(TransIn, thisBTR);
				}
			} else {
				//If no window is provided everything is allowed...
				//Check for KN data
				gatherKNdata(thisBlockRef, thisBTR);
				//Then dive inside to look for more blockrefs
				DeepDive(TransIn, thisBTR);
			}
		} else if (thisEnt is Viewport) {
			Viewport myVP = (Viewport)TransIn.GetObject(thisOID, OpenMode.ForRead);

			//If a window is provided make sure the block is within it...
			if (windowPt1 != null &amp;amp; windowPt2 != null) {
				//If any of the viewports four corners are within the drawing area, include it

				if (Tools.IsWithin(myVP.Bounds.Value.MinPoint, windowPt1, windowPt2) | Tools.IsWithin(myVP.Bounds.Value.MaxPoint, windowPt1, windowPt2) | Tools.IsWithin(new Point3d(myVP.Bounds.Value.MinPoint.X, myVP.Bounds.Value.MaxPoint.Y, 0), windowPt1, windowPt2) | Tools.IsWithin(new Point3d(myVP.Bounds.Value.MaxPoint.X, myVP.Bounds.Value.MinPoint.Y, 0), windowPt1, windowPt2)) {
					double scaleFactor = myVP.ViewHeight / myVP.Height;
					Point3d myVPviewLL = new Point3d(myVP.ViewCenter.X - ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y - (myVP.ViewHeight / 2), 0);
					Point3d myVPviewUR = new Point3d(myVP.ViewCenter.X + ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y + (myVP.ViewHeight / 2), 0);
					Point3d myVPviewUL = new Point3d(myVP.ViewCenter.X - ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y + (myVP.ViewHeight / 2), 0);
					Point3d myVPviewLR = new Point3d(myVP.ViewCenter.X + ((myVP.Width * scaleFactor) / 2), myVP.ViewCenter.Y - (myVP.ViewHeight / 2), 0);

					BlockTable myBT = (BlockTable)TransIn.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead);
					BlockTableRecord msBTR = (BlockTableRecord)TransIn.GetObject(myBT(BlockTableRecord.ModelSpace), OpenMode.ForRead);

					DeepDive(TransIn, msBTR, myVPviewLL, myVPviewUR);
				}
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your example leads me to believe that you can step into an xref just like a block - even though it is technically another DB. &amp;nbsp;Am I approaching this incorrectly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2014 22:31:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5103772#M43625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-18T22:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: SelectCrossingWindow only selects objects currently visible on the screen</title>
      <link>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5104800#M43626</link>
      <description>&lt;P&gt;I figured it out! &amp;nbsp;It really is recognizing xrefs. &amp;nbsp;It was my own windowing that was skipping it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you mcicognani for all your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2014 13:16:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selectcrossingwindow-only-selects-objects-currently-visible-on/m-p/5104800#M43626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-19T13:16:39Z</dc:date>
    </item>
  </channel>
</rss>

