Layers

Layers

Anonymous
Not applicable
788 Views
4 Replies
Message 1 of 5

Layers

Anonymous
Not applicable
I need to be able to create a routine or reactor that will not allow my ADT
2006 users to create or change any layers. How can this be done. Any help
would be appreciated.
0 Likes
789 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Perhaps something like this would do the trick!

Joe
--

Option Explicit

Dim lngLayers As Long

Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
If UCase(CommandName) = "LAYER" Then lngLayers = ThisDrawing.Layers.Count
End Sub

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If UCase(CommandName) = "LAYER" And ThisDrawing.Layers.Count > 1 Then
Do While ThisDrawing.Layers.Count <> lngLayers
ThisDrawing.Layers(ThisDrawing.Layers.Count - 1).Delete
Loop
End If
End Sub


"Nate Hunter" wrote in message
news:[email protected]...
I need to be able to create a routine or reactor that will not allow my ADT
2006 users to create or change any layers. How can this be done. Any help
would be appreciated.
0 Likes
Message 3 of 5

Anonymous
Not applicable
I was acutally ahead of you. This is exactly what I did. thanks for the
input


"Joe Sutphin" wrote in message
news:[email protected]...
Perhaps something like this would do the trick!

Joe
--

Option Explicit

Dim lngLayers As Long

Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
If UCase(CommandName) = "LAYER" Then lngLayers = ThisDrawing.Layers.Count
End Sub

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If UCase(CommandName) = "LAYER" And ThisDrawing.Layers.Count > 1 Then
Do While ThisDrawing.Layers.Count <> lngLayers
ThisDrawing.Layers(ThisDrawing.Layers.Count - 1).Delete
Loop
End If
End Sub


"Nate Hunter" wrote in message
news:[email protected]...
I need to be able to create a routine or reactor that will not allow my ADT
2006 users to create or change any layers. How can this be done. Any help
would be appreciated.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Advice: Don't even think about using the code
Joe posted. It can easily erase all the layers
in your drawing.

Suppose for example, the user adds one layer and
deletes two or more others. In that case the number
of layers will never be equal to what it was at the
start of the command and so, Joe's code will just
start deleting all the layers.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Nate Hunter" wrote in message news:[email protected]...
I need to be able to create a routine or reactor that will not allow my ADT
2006 users to create or change any layers. How can this be done. Any help
would be appreciated.
0 Likes
Message 5 of 5

Anonymous
Not applicable
Good catch, didn't think of that ... but you're absolutely right.

Joe
--

"Tony Tanzillo" wrote in message
news:[email protected]...
Advice: Don't even think about using the code
Joe posted. It can easily erase all the layers
in your drawing.

Suppose for example, the user adds one layer and
deletes two or more others. In that case the number
of layers will never be equal to what it was at the
start of the command and so, Joe's code will just
start deleting all the layers.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Nate Hunter" wrote in message
news:[email protected]...
I need to be able to create a routine or reactor that will not allow my ADT
2006 users to create or change any layers. How can this be done. Any help
would be appreciated.
0 Likes