×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Automatic Layer Setting in A2K

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

Here is the code:

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

(OP)
WOW! Way to complicated, but thanks for the reply dsi. Just wanted a little routine to be executed, which would set the layer to say, layer DIM, before executing a dim command ie dimlinear etc.

   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

well what you are doing is called button macros which brocken down is the use of key combinations in order in which you would type the commands

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

the only problem i can for see is if the dim layer is not there then it cannot set it current
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

(OP)
Thanks shadow your right on the money. It work's just fine,
many thanks.

   Mark

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources