Message 1 of 5
Help - objects disappearing
Not applicable
07-18-2008
01:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following bit of code which changes the layer of an object. It works fine. However, after changing the layer I erroneously made the object invisible. I should have turned the layer off instead (but I don't know the code for that yet.)
Sub SelectOnScreen()
' This example adds objects to a selection set by prompting the user
' to select ones to add.
' Create the selection set
'On Error Resume Next
Dim ssetObj As AcadSelectionSet
Dim GridSelectionSet As AcadSelectionSet
Set ssetObj = ThisDrawing.SelectionSets.Add("GridSelectionSet")
' Add objects to a selection set by prompting user to select on the screen
ssetObj.SelectOnScreen
Dim objCount As Integer
Dim I As Integer
Dim PickedObj As AcadEntity
objCount = ssetObj.Count
For I = 0 To 19
Set PickedObj = ssetObj.Item(I)
PickedObj.Layer = ("Grid " & Right(Str(I + 210), 3))
PickedObj.Update
PickedObj.Visible = False
Next I
ssetObj.Clear
ssetObj.Delete
End Sub
The problem is is that I didn't notice what was going on until I was almost done with the project and I had already done a number of saves. Now I can't find the objects anywhere.
Are they still on the drawing somewhere? I made sure all layers are turned on and I've done Ctrl-A to select all but they seem to be gone. I'd hate to have to re-create a couple hundred objects all over again.
Sub SelectOnScreen()
' This example adds objects to a selection set by prompting the user
' to select ones to add.
' Create the selection set
'On Error Resume Next
Dim ssetObj As AcadSelectionSet
Dim GridSelectionSet As AcadSelectionSet
Set ssetObj = ThisDrawing.SelectionSets.Add("GridSelectionSet")
' Add objects to a selection set by prompting user to select on the screen
ssetObj.SelectOnScreen
Dim objCount As Integer
Dim I As Integer
Dim PickedObj As AcadEntity
objCount = ssetObj.Count
For I = 0 To 19
Set PickedObj = ssetObj.Item(I)
PickedObj.Layer = ("Grid " & Right(Str(I + 210), 3))
PickedObj.Update
PickedObj.Visible = False
Next I
ssetObj.Clear
ssetObj.Delete
End Sub
The problem is is that I didn't notice what was going on until I was almost done with the project and I had already done a number of saves. Now I can't find the objects anywhere.
Are they still on the drawing somewhere? I made sure all layers are turned on and I've done Ctrl-A to select all but they seem to be gone. I'd hate to have to re-create a couple hundred objects all over again.