Jump to content

Recommended Posts

Posted

The following code generates a Null Object Pointer error on the very last line. I copied this code right out of the help file, so I'm not sure why it crashes. I have tried a half dozen things like changing the declared type, but nothing has helped. What am I missing?

 

I'm trying to grab two selection sets with two different filters and combine them into one selection set.

 

Dim ssetObj As AcadSelectionSet
Dim ssetObj2 As AcadSelectionSet
Dim ssObjs(0 To 1000) As AcadEntity
Dim grpCode(0) As Integer
Dim dataVal(0) As Variant
Dim lngIdx As Long
Dim sglLength As Single

Set ssetObj = ThisDrawing.SelectionSets.Add("CopyItemNumbers")
Set ssetObj2 = ThisDrawing.SelectionSets.Add("CopyItemNumbers2")
intMode = acSelectionSetAll
 
grpCode(0) = 0                                                                'Only grab shapes
dataVal(0) = "KS_SHAPE"
ssetObj.Select intMode, , , grpCode, dataVal      'Grab matching entities
 
dataVal(0) = "KS_PLATE"                                              'Only grab plates
ssetObj2.Select intMode, , , grpCode, dataVal     'Grab matching entities

'CREATE ARRAY OF OBJECT FROM 2ND SET   
sglLength = ssetObj2.Count - 1
lngIdx = 0
For lngIdx = 0 To sglLength
  Set ssObjs(lngIdx) = ssetObj2.Item(lngIdx)
Next

ssetObj.AddItems ssObjs            '<-- WHY DOESN'T THIS LINE WORK?

Thanks!

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...