I wan't to move a line with color red and linetype continuous on layer Kader to another layer called Plaatuitslag.
Which code must I use to select the specific line and move it to the other layer Plaatuitslag?
Is it something like If line has color red and linetype continuous then move etc??
At the end i wan't to select all objects in the drawing which aren't on layer Plaatuitslag and delete all those objects.
Regards,
Ruud-Jan
Here is an example. You can easy select all objects from one layer by using filters when create selectionset. Then I use If statement (as you propose, but there is another way), to get desired object and then changing the layer of object. For deleting all objects from one layer you can use again filters for selectionset.
For specifying multiple criteria in selection set you can use array like this:
ftype(0) = 8 ' filter type = Layer
lay(0) = "Kader" ' name of the layer
ftype(1) = 62 ' filter type = Color
lay(1) = 1 ' 1=Red
ftype(2) = 6 ' filter type = Linetype
lay(2) = "Continuous" ' name of the linetype
Dim sset As AcadSelectionSet
Dim lay(0) As Variant ' name of the layer
Dim ftype(0) As Integer ' type of filter
Dim oLWP As AcadLWPolyline
Dim i As Long
Dim var As Variant
Set sset = ThisDrawing.SelectionSets.Add("ss4")
ftype(0) = 8 ' filter type = Layer
lay(0) = "Kader" ' name of the layer
' select all objects from layer "Kader"
sset.Select acSelectionSetAll, , , ftype, lay
For Each var In sset
If TypeOf var Is AcadLWPolyline Then
Set oLWP = var
If (oLWP.Linetype = "Continuous") And (var.color = 1) Then
LWP.Layer = "Plaatuitslag"
' changing the layer for the object _
if color of the object is 1 - Red and _
linetype is "Continuous"
End If
End If
Next var
sset.Delete