Results 1 to 2 of 2

Thread: Create layer from files

  1. #1
    Member
    Join Date
    2001-11
    Posts
    8
    Login to Give a bone
    0

    Default Create layer from files

    Hi



    I need some help



    I try to create list of layer from a files, but I don't understand the Do /While and I have a message error like missing information for the creation of layer



    Ex. of my list files

    ;Layername, colour,linetype

    *Layer1
    layer1a,7,continuous
    Layer1b,12,hidden

    *layer2
    layer2a,70,continous
    Layer2b,82,hidden


    The code I have from now

    Code:
    Dim sTemp As String
    Dim sTemp1 As String
    Dim nFile As Integer
    Dim sLAYER As String
    Dim sColor As String
    Dim sLinetype As String
    
    Dim objLayer As AcadLayer
    
    sTemp = ListBox1.Text
    
    nFile = FreeFile
     
    Open sFile For Input As #nFile
        While Not EOF(nFile)
            Line Input #nFile, sTemp1
             If sTemp1 = "*" & sTemp Then
             Input #nFile, sLAYER, sColor, sLinetype
                 Set objLayer = ThisDrawing.Layers.Add(sLAYER)
                 objLayer.color = sColor
                 objLayer.Linetype = sLinetype
            End If        
        Wend

    So is there someone could tell me how fix it



    Thanks!
    Last edited by BlackBox; 2014-03-11 at 12:07 PM. Reason: Please use [CODE] Tags

  2. #2
    All AUGI, all the time arshiel88's Avatar
    Join Date
    2005-02
    Location
    Off the Grid
    Posts
    560
    Login to Give a bone
    0

    Default Re: Create layer from files

    Its simply generating an error on the 2nd entry because Acad can't find the "continous"...its mispelled. And also, it will generate an error if the linetype isn't loaded, so you might want to add the code below. (taken from Help)

    Code:
    Dim entry As AcadLineType
        Dim found As Boolean
        found = False
        For Each entry In ThisDrawing.Linetypes
            If StrComp(entry.Name, "DASHDOT", 1) = 0 Then
                found = True
                Exit For
            End If
        Next
        If Not (found) Then ThisDrawing.Linetypes.Load "DASHDOT", "acad.lin"

Similar Threads

  1. LISP to create layer, hatch and set layer back to original.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 1
    Last Post: 2013-12-11, 07:22 PM
  2. Using layer info to create a new layer?
    By ReachAndre in forum AutoLISP
    Replies: 23
    Last Post: 2013-10-29, 08:43 PM
  3. Ability to Create a Layer that Acts Similar to Layer 0
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2008-05-28, 06:58 PM
  4. Replies: 3
    Last Post: 2007-03-14, 01:33 PM
  5. Replies: 19
    Last Post: 2006-02-12, 11:06 PM

Posting Permissions

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