<?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: Empty Void Null Selection Set in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125565#M50622</link>
    <description>If ThisDrawing.ActiveSelectionSet.Count &amp;gt; 0

-- 
----
Ed
----
"ndog" &lt;NOSPAM&gt; wrote in message
news:24754369.1094224510450.JavaMail.jive@jiveforum1.autodesk.com...
&amp;gt; How do you test if the Selection Set contains anything nothing
&amp;gt;
&amp;gt; In particular:
&amp;gt;
&amp;gt; Dim oEnt As AcadEntity
&amp;gt; For Each oEnt In ThisDrawing.ActiveSelectionSet
&amp;gt; Process (oEnt)
&amp;gt; Next
&amp;gt;
&amp;gt; I get an error if there is nothing in the active selection set
&amp;gt; I can't do
&amp;gt; ThisDrawing.ActiveSelectionSet.Count
&amp;gt; Because it also causes an error.
&amp;gt;
&amp;gt; Thanks!
&amp;gt; Nathan&lt;/NOSPAM&gt;</description>
    <pubDate>Fri, 03 Sep 2004 15:33:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2004-09-03T15:33:01Z</dc:date>
    <item>
      <title>Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125564#M50621</link>
      <description>How do you test if the Selection Set contains anything nothing&lt;BR /&gt;
&lt;BR /&gt;
In particular:&lt;BR /&gt;
&lt;BR /&gt;
Dim oEnt As AcadEntity&lt;BR /&gt;
For Each oEnt In ThisDrawing.ActiveSelectionSet&lt;BR /&gt;
Process (oEnt)&lt;BR /&gt;
Next&lt;BR /&gt;
&lt;BR /&gt;
I get an error if there is nothing in the active selection set&lt;BR /&gt;
I can't do &lt;BR /&gt;
ThisDrawing.ActiveSelectionSet.Count&lt;BR /&gt;
Because it also causes an error.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Nathan</description>
      <pubDate>Fri, 03 Sep 2004 15:14:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125564#M50621</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-03T15:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125565#M50622</link>
      <description>If ThisDrawing.ActiveSelectionSet.Count &amp;gt; 0

-- 
----
Ed
----
"ndog" &lt;NOSPAM&gt; wrote in message
news:24754369.1094224510450.JavaMail.jive@jiveforum1.autodesk.com...
&amp;gt; How do you test if the Selection Set contains anything nothing
&amp;gt;
&amp;gt; In particular:
&amp;gt;
&amp;gt; Dim oEnt As AcadEntity
&amp;gt; For Each oEnt In ThisDrawing.ActiveSelectionSet
&amp;gt; Process (oEnt)
&amp;gt; Next
&amp;gt;
&amp;gt; I get an error if there is nothing in the active selection set
&amp;gt; I can't do
&amp;gt; ThisDrawing.ActiveSelectionSet.Count
&amp;gt; Because it also causes an error.
&amp;gt;
&amp;gt; Thanks!
&amp;gt; Nathan&lt;/NOSPAM&gt;</description>
      <pubDate>Fri, 03 Sep 2004 15:33:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125565#M50622</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-03T15:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125566#M50623</link>
      <description>I tried your method&lt;BR /&gt;
&lt;BR /&gt;
If ThisDrawing.ActiveSelectionSet.Count &amp;gt; 0 Then&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
But get same error as before when there is no active selection:&lt;BR /&gt;
&lt;BR /&gt;
Run-time error '-2145320949 (8021000b)':&lt;BR /&gt;
Calling method AddItems of Interface IAcadSelectionSet failed&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the suggestion,&lt;BR /&gt;
&lt;BR /&gt;
Nathan</description>
      <pubDate>Fri, 03 Sep 2004 16:48:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125566#M50623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-03T16:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125567#M50624</link>
      <description>Hi,

While stepping through your code hold the cursor over the selection set and
you will see its current value - or nothing if it holds data.  Or do a quick
view of it.

You could decide to let the error occur and deal with it by using an "on
error resume next"


-- 


Laurie Comerford
CADApps
www.cadapps.com.au


-- 


Laurie Comerford
CADApps
www.cadapps.com.au

"ndog" &lt;NOSPAM&gt; wrote in message
news:24754369.1094224510450.JavaMail.jive@jiveforum1.autodesk.com...
&amp;gt; How do you test if the Selection Set contains anything nothing
&amp;gt;
&amp;gt; In particular:
&amp;gt;
&amp;gt; Dim oEnt As AcadEntity
&amp;gt; For Each oEnt In ThisDrawing.ActiveSelectionSet
&amp;gt; Process (oEnt)
&amp;gt; Next
&amp;gt;
&amp;gt; I get an error if there is nothing in the active selection set
&amp;gt; I can't do
&amp;gt; ThisDrawing.ActiveSelectionSet.Count
&amp;gt; Because it also causes an error.
&amp;gt;
&amp;gt; Thanks!
&amp;gt; Nathan&lt;/NOSPAM&gt;</description>
      <pubDate>Fri, 03 Sep 2004 21:40:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125567#M50624</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-03T21:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125568#M50625</link>
      <description>Do your drawing in which you are working uses a custome object? If yes then there is a changes that your object(dbx) is not loaded in the AutoCAD fully. Some times ago I had the same problem and I found that it worked properly after the dbx was loaded. I my case I was getting the error even if I was trying to access a valid item from the selection set. The probable solution to your problem is that if the custom object is yours the change the demand loading option so that it is automatically loaded when AutoCAD starts. Normally what happens that we program so that the arx or dbx is loaded if a command is invoked which defined in that arx or there is an entity defined by the dbx then it loads.&lt;BR /&gt;
&lt;BR /&gt;
I hope this will solve your problem.&lt;BR /&gt;
&lt;BR /&gt;
Manoj</description>
      <pubDate>Tue, 07 Sep 2004 05:42:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125568#M50625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-07T05:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Empty Void Null Selection Set</title>
      <link>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125569#M50626</link>
      <description>Try this texst:

Sub testAS()
    Dim ss As AcadSelectionSet
    Set ss = ThisDrawing.ActiveSelectionSet
    If ss.Count &amp;gt; 0 Then
      MsgBox "ss count = " &amp;amp; ss.Count
    Else
        MsgBox "There is no Acitive selection set."
        'create a new selection set.
        Set ss = AddSelectionSet "newSS"
        'ss.AddItems()
        'or
        'ss.SelectOnScreen()
    End If
End Sub

Public Function AddSelectionSet(SetName As String) As AcadSelectionSet
' This routine does the error trapping neccessary for creating selection
sets.
    On Error Resume Next
    Set AddSelectionSet = ThisDrawing.SelectionSets.Add(SetName)
    If Err.Number &amp;lt;&amp;gt; 0 Then
        Set AddSelectionSet = ThisDrawing.SelectionSets.Item(SetName)
    End If
End Function

Your error message does not say that there the problem is that there is no
selection set. It says you tried to use the AddItems method and it failed.
You need to properly handle the situation where no ActiveSelectionSet
exists. In the previous example, I used an If statement to decide what to do
based on the Count property. If there are items selected already, the Count
will be greater than 0. If it's zero, the selection set doesn't exist and
you can't go ahead and AddItems to a selection set that doesn't exist. So
create one and then add to it.

-- 
----
Ed
----
"ndog" &lt;NOSPAM&gt; wrote in message
news:814807.1094230128155.JavaMail.jive@jiveforum1.autodesk.com...
&amp;gt; I tried your method
&amp;gt;
&amp;gt; If ThisDrawing.ActiveSelectionSet.Count &amp;gt; 0 Then
&amp;gt; ..
&amp;gt;
&amp;gt; But get same error as before when there is no active selection:
&amp;gt;
&amp;gt; Run-time error '-2145320949 (8021000b)':
&amp;gt; Calling method AddItems of Interface IAcadSelectionSet failed
&amp;gt;
&amp;gt; Thanks for the suggestion,
&amp;gt;
&amp;gt; Nathan&lt;/NOSPAM&gt;</description>
      <pubDate>Tue, 07 Sep 2004 17:23:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/empty-void-null-selection-set/m-p/1125569#M50626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-09-07T17:23:05Z</dc:date>
    </item>
  </channel>
</rss>

