Delete Layer (second edition)

Delete Layer (second edition)

Anonymous
Not applicable
265 Views
2 Replies
Message 1 of 3

Delete Layer (second edition)

Anonymous
Not applicable
Hi,

I want to merge 2 Layers and delete the old layer from the drawing. I know,
that I only can delete a layer if there is no entity in the drawing that
references that layer and if it is not the current layer. So I wrote a
VB-Program that does the following (it works with some layers, but not with
others):

FIRST:
dxfCode1(0) = 8
dxfValue1(0) = OldLayerName
SS1.Select acSelectionSetAll, , , dxfCode1, dxfValue1
For Each Obj In SS1
Obj.Layer = NewLayerName
Next

SECOND:
For Each Blk In ThisDrawing.Blocks
If Blk.IsXRef Then
' Do nothing
ElseIf UCase(Blk.Name) = "*MODEL_SPACE" Then
' Do nothing - I think i have done this in the first step.
ElseIf UCase(Left(Blk.Name, 12)) = "*PAPER_SPACE" Then
' Do nothing - I think i have done this in the first step.
Else
For Each Obj In Blk
If Obj.Layer = OldLayerName Then
Obj.Layer = NewLayer
End If
Next
End If
Next

Where are this layers referenced? I try this in ACAD 2002
0 Likes
266 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Layers might be referenced by block definitions, frozen by floating
viewports, or SeqEnd bug.

--
R. Robert Bell, MCSE
www.AcadX.com


"Stefan" wrote in message
news:5DC64937CB125A69855AB89DC619549B@in.WebX.maYIadrTaRb...
| Hi,
|
| I want to merge 2 Layers and delete the old layer from the drawing. I
know,
| that I only can delete a layer if there is no entity in the drawing that
| references that layer and if it is not the current layer. So I wrote a
| VB-Program that does the following (it works with some layers, but not
with
| others):
|
| FIRST:
| dxfCode1(0) = 8
| dxfValue1(0) = OldLayerName
| SS1.Select acSelectionSetAll, , , dxfCode1, dxfValue1
| For Each Obj In SS1
| Obj.Layer = NewLayerName
| Next
|
| SECOND:
| For Each Blk In ThisDrawing.Blocks
| If Blk.IsXRef Then
| ' Do nothing
| ElseIf UCase(Blk.Name) = "*MODEL_SPACE" Then
| ' Do nothing - I think i have done this in the first step.
| ElseIf UCase(Left(Blk.Name, 12)) = "*PAPER_SPACE" Then
| ' Do nothing - I think i have done this in the first step.
| Else
| For Each Obj In Blk
| If Obj.Layer = OldLayerName Then
| Obj.Layer = NewLayer
| End If
| Next
| End If
| Next
|
| Where are this layers referenced? I try this in ACAD 2002
|
|
|
|
0 Likes
Message 3 of 3

Anonymous
Not applicable
The "frozen by floating viewports" was it. Thanks
0 Likes