Results 1 to 5 of 5

Thread: Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

  1. #1
    I could stop if I wanted to
    Join Date
    2003-03
    Location
    Alberta
    Posts
    260
    Login to Give a bone
    0

    Default Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

    Can anybody tell me why I get an error in this code...
    Code:
    SomeLayerDef.Lock = False
    SomeLayerDef.Freeze = False
    SomeLayerDef.LayerOn = True
    The code executes fine until it hits the third line shown. Then I get Err.Number=-2145386348, Err.Description="Invalid layer".

    I don't understand how I can have an "Invalid layer" when I had just been able to make it unlocked and unfrozen.
    Last edited by bweir; 2006-09-27 at 08:11 PM.

  2. #2
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

    I don't know. Maybe something else in your code is changing the layer you are working with? I'm guessing you just have a typo in your post, as Locked is not a property....Lock is. Is it possible you have another typo in your code?

  3. #3
    I could stop if I wanted to
    Join Date
    2003-03
    Location
    Alberta
    Posts
    260
    Login to Give a bone
    0

    Default Re: Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

    Here's the exact snippet from my app...
    Code:
    Dim oTableLayer As AcadLayer
    Set oTableLayer = ThisDrawing.Layers.Item(oCordTable.Layer)
        oTableLayer.Lock = False
        oTableLayer.Freeze = False
        oTableLayer.LayerOn = True
    No typos that I can see.

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

    Quote Originally Posted by bweir
    Here's the exact snippet from my app...
    Code:
    Dim oTableLayer As AcadLayer
    Set oTableLayer = ThisDrawing.Layers.Item(oCordTable.Layer)
        oTableLayer.Lock = False
        oTableLayer.Freeze = False
        oTableLayer.LayerOn = True
    No typos that I can see.
    Maybe this layer is active?
    I have a got the same error message for this case

    Code:
    Sub test()
    Dim oTableLayer As AcadLayer
    Dim oCordTable As AcadTable
    Dim varpt
    ThisDrawing.Utility.GetEntity oCordTable, varpt, "Select a table"
    Set oTableLayer = ThisDrawing.Layers.Item(oCordTable.Layer)
    If Not ThisDrawing.ActiveLayer.Handle = oTableLayer.Handle Then
        oTableLayer.Lock = False
        oTableLayer.Freeze = False
        oTableLayer.LayerOn = True
        Else
        MsgBox "This is activelayer! Action was cancelled"
        End If
    End Sub
    ~'J'~

  5. #5
    I could stop if I wanted to
    Join Date
    2003-03
    Location
    Alberta
    Posts
    260
    Login to Give a bone
    0

    Default Re: Layer Error - Err.Number=-2145386348, Err.Description="Invalid layer"

    Thanks,

    Yeah I think the error is only occuring when the layer is active.

Similar Threads

  1. Replies: 0
    Last Post: 2011-03-15, 05:44 PM
  2. Label Styles - "Tick" exporting on Current Layer not General Layer
    By LeafRider in forum AutoCAD Civil 3D - Alignments
    Replies: 1
    Last Post: 2011-03-09, 05:34 AM
  3. layer "description" accessed by autolisp
    By colinawright in forum AutoLISP
    Replies: 20
    Last Post: 2010-10-19, 11:49 AM
  4. Replies: 26
    Last Post: 2008-10-21, 10:34 PM
  5. Delete Sweep Error - "Base sketch for roof is invalid"
    By slmaher in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-02-03, 12:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •