Help - objects disappearing

Help - objects disappearing

Anonymous
Not applicable
482 Views
4 Replies
Message 1 of 5

Help - objects disappearing

Anonymous
Not applicable
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.
0 Likes
483 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
objCount = ssetObj.Count
For I = 0 To 19 <==You may want to replace "19" with "objCount-1"
Set PickedObj = ssetObj.Item(I)
PickedObj.Layer = ("Grid " & Right(Str(I + 210), 3))
PickedObj.Update
PickedObj.Visible = False <=== Does this "Visible=False" prompt
you something?
Next I



"bceng" wrote in message news:5985516@discussion.autodesk.com...
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.
0 Likes
Message 3 of 5

Anonymous
Not applicable
Yes, that's the line I used by mistake. If I knew the code to turn off the layer of the object I just modified I should have used that instead. But I don't know the code to do that.

But now that PickedObj.Visible = False has been used I don't seem to be able to go back from it. The objects made invisible are nowhere I can find. And as I mentioned I saved a few times before I noticed something was wrong.

So I guess I need 2 things: the code to turned off the modified object layers and how to find my invisible objects. Thanks.
0 Likes
Message 4 of 5

Anonymous
Not applicable
You can simply run a quick code to turn all entities' Visible to True
(assume the invisible entity is in ModelSpace):

Create a public SUB in a module as macro:

Public Sub ShowAllEnt()

Dim ent as AcadEntity
For Each ent in ThisDrawing.ModelSpace
ent.Visible=True
Next

End Sub

Then run the macro.


"bceng" wrote in message news:5985630@discussion.autodesk.com...
Yes, that's the line I used by mistake. If I knew the code to turn off the
layer of the object I just modified I should have used that instead. But I
don't know the code to do that.

But now that PickedObj.Visible = False has been used I don't seem to be able
to go back from it. The objects made invisible are nowhere I can find. And
as I mentioned I saved a few times before I noticed something was wrong.

So I guess I need 2 things: the code to turned off the modified object
layers and how to find my invisible objects. Thanks.
0 Likes
Message 5 of 5

Anonymous
Not applicable
Ah great! That worked. Thanks so much. I love doing code but it does make things so much easier and faster when I know what I'm allowed to write. The Help files are ok but sometimes you need a help file just to use the help file. 😉
0 Likes