<?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: how to select rectangle and polygonal viewport. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2846528#M62769</link>
    <description>&lt;P&gt;Check out the attached C# code, will give you the idea. In AutoCAD 2011 you have to be aware of the 'SELECTIONCYCLING' system variable as well.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Dec 2010 02:45:59 GMT</pubDate>
    <dc:creator>cadMeUp</dc:creator>
    <dc:date>2010-12-08T02:45:59Z</dc:date>
    <item>
      <title>how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2845514#M62767</link>
      <description>&lt;P&gt;The following allows you to select a rectangle viewport&lt;/P&gt;&lt;P&gt;objVP .AddAllowedClass(GetType(Viewport), True)&lt;/P&gt;&lt;P&gt;how do you allow the user to select a rectangle viewport as well as a Polygonal viewport&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Dim objVP As PromptEntityOptions
        objVP = New PromptEntityOptions(vbCrLf &amp;amp; "Select a viewport: ")
        objVP .AllowNone = False
        objVP .SetRejectMessage(vbCrLf &amp;amp; "Need to select a viewport!")
        objVP .AddAllowedClass(GetType(Viewport), True)
        Dim er As PromptEntityResult = ed.GetEntity(objVP )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2010 15:27:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2845514#M62767</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-07T15:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2846414#M62768</link>
      <description>&lt;P&gt;That is how you would select it, but the problem is that when a viewport is associated with an other object, the other object is on top of it within the drawing.&amp;nbsp; I'm not sure in .Net how to see the relationship, but in Lisp you can see it pretty easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Entget of entity selected:&lt;BR /&gt;(-1 . &amp;lt;Entity name: -4af86ce8&amp;gt;)&lt;BR /&gt;(0 . "LWPOLYLINE")&lt;BR /&gt;(5 . "113")&lt;BR /&gt;(102 . "{ACAD_REACTORS")&lt;BR /&gt;(330 . &amp;lt;Entity name: -4af86cd8&amp;gt;)&amp;nbsp; &amp;lt;-&amp;nbsp; This is a viewport entity.&lt;BR /&gt;(102 . "}")&lt;BR /&gt;(330 . &amp;lt;Entity name: -4af8d2c0&amp;gt;)&lt;BR /&gt;(100 . "AcDbEntity")&lt;BR /&gt;(67 . 1)&lt;BR /&gt;(410 . "Layout1")&lt;BR /&gt;(8 . "0")&lt;BR /&gt;(100 . "AcDbPolyline")&lt;BR /&gt;(90 . 5)&lt;/P&gt;&lt;P&gt;&amp;lt;snip&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not much help, but hope it helps a little.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 00:37:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2846414#M62768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-08T00:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2846528#M62769</link>
      <description>&lt;P&gt;Check out the attached C# code, will give you the idea. In AutoCAD 2011 you have to be aware of the 'SELECTIONCYCLING' system variable as well.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 02:45:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2846528#M62769</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2010-12-08T02:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847626#M62770</link>
      <description>&lt;P&gt;Thanks, once again for pointing me in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what I gather is that a Poly VP is both a Pline and a viewport linked.&lt;/P&gt;&lt;P&gt;thus I need to set both types in my filter selection list (if I have the correct terminology)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so this is what I have&lt;/P&gt;&lt;PRE&gt;        Dim eo As PromptEntityOptions
        eo = New PromptEntityOptions(vbCrLf &amp;amp; "Select a viewport: ")
        eo.AllowNone = False
        eo.SetRejectMessage(vbCrLf &amp;amp; "Need to select a viewport!")
        eo.AddAllowedClass(GetType(Viewport), False)
        eo.AddAllowedClass(GetType(Polyline), False)

        Dim er As PromptEntityResult = ed.GetEntity(eo)
        If er.Status &amp;lt;&amp;gt; PromptStatus.OK Then
            Exit Sub
        End If


        If er.GetType() =  typeof(Viewport) then
            Dim vpId As ObjectId = er.ObjectId
        Else
            Dim vpId = LayoutManager.Current.GetNonRectangularViewportIdFromClipId(er.ObjectId)
        End If&lt;/PRE&gt;&lt;P&gt;However I do not have the correct code to determine if the selection is a rectangle VP or a Pline VP.&lt;/P&gt;&lt;P&gt;If er.GetType() =&amp;nbsp; typeof(Viewport) then (this does not compile)&lt;BR /&gt;forgive a newbie question, but I am just migrating from VBA.&lt;/P&gt;&lt;P&gt;So how do I check the type, and if you are inclined to comment on my codeing structure, please feel free to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        If er.GetType() =  typeof(Viewport) then
            Dim vpId As ObjectId = er.ObjectId
        Else
            Dim vpId = LayoutManager.Current.GetNonRectangularViewportIdFromClipId(er.ObjectId)
        End If&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 20:04:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847626#M62770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-08T20:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847794#M62771</link>
      <description>&lt;P&gt;An easier way might be to go with a selection set ( GetSelection ), with setting the PromptSelectionOptions propertys of SelectEverythingInAperture to true, and SinglePickInSpace to true, and set the filter like to do to only allow Viewports.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I'm not more helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 21:54:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847794#M62771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-08T21:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847942#M62772</link>
      <description>&lt;P&gt;The line:&lt;/P&gt;&lt;P&gt;If er.GetType() =&amp;nbsp; typeof(Viewport) then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is checking if er is a Viewport, but er is a PromptEntityResult object:&lt;/P&gt;&lt;P&gt;Dim er As PromptEntityResult = ed.GetEntity(eo)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it could never equal a Viewport type. You have to get the object from the ObjectId returned from GetEntity() and then make the type comparison from there, something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim entId As ObjectId = er.ObjectId&lt;BR /&gt;Dim selEnt As Entity = entId.GetObject(OpenMode.ForRead)&lt;BR /&gt;If selEnt.GetType() Is GetType(Viewport) Then&lt;BR /&gt;&amp;nbsp;'Viewport&lt;BR /&gt;ElseIf selEnt.GetType() Is GetType(Polyline) Then&lt;BR /&gt;&amp;nbsp;'Polyline&lt;BR /&gt;End If&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the equivalent code in VB...&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2010 00:27:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847942#M62772</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2010-12-09T00:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847992#M62773</link>
      <description>&lt;P&gt;I am going to have to get used to this idea of every time I want to examine an object, I have to start a transition etc&lt;/P&gt;&lt;P&gt;Cheers thanks for all your help&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2010 01:54:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/2847992#M62773</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T01:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to select rectangle and polygonal viewport.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/12665057#M62774</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Can anyone assist getting the viewport selection for the attached sample?&lt;/P&gt;&lt;P&gt;It seems that the viewport in this case is a Polyline and not a LWPolyline which is generally the case.&lt;/P&gt;&lt;P&gt;When I use the code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim eo As PromptEntityOptions
        eo = New PromptEntityOptions(vbCrLf &amp;amp; "Select a viewport: ")
        eo.AllowNone = False
        eo.SetRejectMessage(vbCrLf &amp;amp; "Need to select a viewport!")
        eo.AddAllowedClass(GetType(Viewport), False)
        eo.AddAllowedClass(GetType(Polyline), False)&lt;/LI-CODE&gt;&lt;P&gt;All I get is:&lt;/P&gt;&lt;PRE&gt;Need to select a viewport!&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 23:36:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-select-rectangle-and-polygonal-viewport/m-p/12665057#M62774</guid>
      <dc:creator>Rockit_for_Revit</dc:creator>
      <dc:date>2024-03-25T23:36:19Z</dc:date>
    </item>
  </channel>
</rss>

