<?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 VB .NET Select entities glitch in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12637677#M5053</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am exporting entities properties to excel. A key command to get entities in a region.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It all works well at first, but then as the code loops through deferent regions (Move UCS), the selection return nothing at random times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code to select all objects under a certain layer within a range, please help why would it glitch to works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Function GetObjectsLayer(objType As String, layerName As String) As SelectionSet&lt;BR /&gt;Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;Dim edt As Editor = doc.Editor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Selection Criteria&lt;BR /&gt;'Additional typed value to include filter; now totaling = 2&lt;BR /&gt;Dim tv As TypedValue() = New TypedValue(2) {}&lt;BR /&gt;tv.SetValue(New TypedValue(CInt(DxfCode.Start), objType), 0) ' object type&lt;BR /&gt;tv.SetValue(New TypedValue(67, 0), 1) 'Select only from model space&lt;BR /&gt;tv.SetValue(New TypedValue(CInt(DxfCode.LayerName), layerName), 2) 'layer name&lt;/P&gt;&lt;P&gt;'Selection Range&lt;BR /&gt;' Define the corners of the selection window&lt;BR /&gt;Dim pt1 As Point3d = New Point3d(0, 4000, 0)&lt;BR /&gt;Dim pt2 As Point3d = New Point3d(5000, 0, 0)&lt;/P&gt;&lt;P&gt;'Convert points to WCS (world coordinate system)&lt;BR /&gt;Dim ucs As Matrix3d = edt.CurrentUserCoordinateSystem&lt;BR /&gt;' Transform points from UCS to WCS&lt;BR /&gt;Dim pt1Wcs As Point3d = pt1.TransformBy(ucs)&lt;BR /&gt;Dim pt2Wcs As Point3d = pt2.TransformBy(ucs)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim filter As SelectionFilter = New SelectionFilter(tv)&lt;BR /&gt;Dim psr As PromptSelectionResult = edt.SelectCrossingWindow(pt2, pt1, filter)&lt;BR /&gt;Dim ss As SelectionSet = psr.Value&lt;/P&gt;&lt;P&gt;Return ss&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 12:48:36 GMT</pubDate>
    <dc:creator>gjurkaitisU5KVU</dc:creator>
    <dc:date>2024-03-13T12:48:36Z</dc:date>
    <item>
      <title>VB .NET Select entities glitch</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12637677#M5053</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am exporting entities properties to excel. A key command to get entities in a region.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It all works well at first, but then as the code loops through deferent regions (Move UCS), the selection return nothing at random times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code to select all objects under a certain layer within a range, please help why would it glitch to works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Function GetObjectsLayer(objType As String, layerName As String) As SelectionSet&lt;BR /&gt;Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;Dim edt As Editor = doc.Editor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Selection Criteria&lt;BR /&gt;'Additional typed value to include filter; now totaling = 2&lt;BR /&gt;Dim tv As TypedValue() = New TypedValue(2) {}&lt;BR /&gt;tv.SetValue(New TypedValue(CInt(DxfCode.Start), objType), 0) ' object type&lt;BR /&gt;tv.SetValue(New TypedValue(67, 0), 1) 'Select only from model space&lt;BR /&gt;tv.SetValue(New TypedValue(CInt(DxfCode.LayerName), layerName), 2) 'layer name&lt;/P&gt;&lt;P&gt;'Selection Range&lt;BR /&gt;' Define the corners of the selection window&lt;BR /&gt;Dim pt1 As Point3d = New Point3d(0, 4000, 0)&lt;BR /&gt;Dim pt2 As Point3d = New Point3d(5000, 0, 0)&lt;/P&gt;&lt;P&gt;'Convert points to WCS (world coordinate system)&lt;BR /&gt;Dim ucs As Matrix3d = edt.CurrentUserCoordinateSystem&lt;BR /&gt;' Transform points from UCS to WCS&lt;BR /&gt;Dim pt1Wcs As Point3d = pt1.TransformBy(ucs)&lt;BR /&gt;Dim pt2Wcs As Point3d = pt2.TransformBy(ucs)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim filter As SelectionFilter = New SelectionFilter(tv)&lt;BR /&gt;Dim psr As PromptSelectionResult = edt.SelectCrossingWindow(pt2, pt1, filter)&lt;BR /&gt;Dim ss As SelectionSet = psr.Value&lt;/P&gt;&lt;P&gt;Return ss&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 12:48:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12637677#M5053</guid>
      <dc:creator>gjurkaitisU5KVU</dc:creator>
      <dc:date>2024-03-13T12:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: VB .NET Select entities glitch</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12638288#M5054</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The Editor.SelectWindow method (as other Editor methods) works with UCS coordinates. So, if you "move the UCS", you should not transform the pt1 and pt2 points to WCS.&lt;/P&gt;
&lt;P&gt;That said, most of the time when using code in AutoCAD, we do not "move UCS" as do end users. In this case, I'd prefer "moving pt1 ans pt2".&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 16:24:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12638288#M5054</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-03-13T16:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: VB .NET Select entities glitch</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12638887#M5055</link>
      <description>&lt;P&gt;Besides what&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;has said, since you call Editor.SelectCrossing[Window/Polygon...], you MUST MAKE SURE the window/polygon is WITHIN the current view. If the point defining the window/polygon is beyond current view, the selection would not be done as expected.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 20:31:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-select-entities-glitch/m-p/12638887#M5055</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-03-13T20:31:25Z</dc:date>
    </item>
  </channel>
</rss>

