Automatic Layer Setting in A2K
Automatic Layer Setting in A2K
(OP)
In R14 I was able to set the layer with a small macro? when using a button by inserting the following text into the command- Layer s `layername';command -but this does not work in 2000. Does anyone know how to write the macro? so it will work in 2000.





RE: Automatic Layer Setting in A2K
Public Sub MakeStdLayer()
Dim myLayer As AcadLayer, myLineType As AcadLineType
Dim vColor As Variant, vLineType As Variant
Dim sName As String
Dim bFound As Boolean
sName = "OBJ"
vColor = acGreen
vLineType = "Continuous"
'Verify that the Linetype is loaded
For Each myLineType In ThisDrawing.Linetypes
If myLineType.Name Like CStr(vLineType) Then
bFound = True
Exit For
End If
Next myLineType
If bFound = False Then ThisDrawing.Linetypes.Load vLineType, "acad.lin"
'Create the Layer
Set myLayer = ThisDrawing.Layers.Add(sName)
myLayer.Color = vColor
myLayer.Linetype = vLineType
myLayer.Lineweight = acLnWtByLwDefault
'Clean Up Objects
Set myLayer = Nothing
Set myLineType = Nothing
End Sub
Hope this helps!
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Automatic Layer Setting in A2K
layer s DIM;_dimlinear (layer set DIM;_dimlinear) is how it was done in R14, this sets the layer to Dim, before executing the dimlinear command, but this does not work in 2000. When you use this routine in 2000, it opens up the layer dialogue box and stops.
RE: Automatic Layer Setting in A2K
Here cut and past this into the macro area of your button
^C^C-layer s DIM; ;_dimlinear
now you need the 2 spaces between the;; cause they also emulate the enter command
RE: Automatic Layer Setting in A2K
if anyoen knows the if then statement to have it create the layer if its not there please post it here in this part of the forum
RE: Automatic Layer Setting in A2K
many thanks.
Mark