Results 1 to 7 of 7

Thread: Layer Generator VBA Help

  1. #1
    Login to Give a bone
    0

    Question Layer Generator VBA Help

    I am working on the attached layer generator, but can't seem to get it to load the layers. I think I am missing something in the code. Can anyone help? Thanks!
    Attached Files Attached Files

  2. #2
    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 Generator VBA Help

    Quote Originally Posted by silvergraphite458961 View Post
    I am working on the attached layer generator, but can't seem to get it to load the layers. I think I am missing something in the code. Can anyone help? Thanks!
    What I've found at the quick glance:
    I changed declaration at the start of project:
    dim ColAr as Variant
    because of any colors is in format RGB, not integer
    - I see your layer names have an extrafluous blank spaces
    - I've changed your sub to avoid getting an empty string:

    Code:
    Public Sub UpdateLabels()
    
    On Error Resume Next
    Close #1
    For j = LBound(LayNameAr) To UBound(LayNameAr)
        If LayNameAr(j) = ListBox1.Text Then
            LTypLabel.Caption = "Linetype: " & vbCrLf & LTypeAr(j)
            Label4.Caption = "Layer Description :" & vbCrLf & LayDescAr(j)
            Open "C:\Windows\Temp\AugiLayerColors.txt" For Input As #1
                rw = 1
                    Do While Not (EOF(1))
                        Line Input #1, MyVar
                        SplitItemVariant = Split(MyVar, ",")
                        If MyVar <> "" Then
                        ReDim ColAr(j)
                            If SplitItemVariant(0) = ColAr(j) Then
                                TextBox2.BackColor = RGB(SplitItemVariant(1), SplitItemVariant(2), SplitItemVariant(3))
                                TextBox2.Text = ColAr(j)
                                GoTo LabelsUpdated
                            End If
                            End If
                    Loop
        End If
    Next
    LabelsUpdated:
    End Sub
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  3. #3
    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 Generator VBA Help

    Quote Originally Posted by silvergraphite458961 View Post
    This worked great! As soon as I clean up the extra spaces, I will repost so others may use it. Thanks!
    Glad to hear it
    Happy coding

    ~'J'~
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  4. #4
    Login to Give a bone
    0

    Default Re: Layer Generator VBA Help

    This worked great! As soon as I clean up the extra spaces, I will repost so others may use it. Thanks!

  5. #5
    Login to Give a bone
    0

    Default Re: Layer Generator VBA Help

    I have updated the file. (Attached) The layers load great, except for 2 problems:

    1. When I select all layers, the colors come in as white. When I select one of the subsets, the colors come in.
    2. The RGB colors are coming in as white (Index Color). Is there a way to use two different color modes (Index and True Color)?

    Any help is greatly appreciated!
    Attached Files Attached Files

  6. #6
    Login to Give a bone
    0

    Question Re: Layer Generator VBA Help

    I had a problem getting the All Layers to import with the new code, so I updated the code to fix the problem; however, I can't seem to get the "true" colors to come in RGB format. They translate to white. Any help is greatly appreciated! Thanks!
    Attached Files Attached Files

  7. #7
    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: Layer Generator VBA Help

    I guess you need to pass the RGB values to a color object (AcadAcCmColor) via SetRGB method. Then set the layer's Truecolor property to this object.

    Shielbern Bolalin
    Architectural 3D Renderer
    ----------------------------------------------------------------------
    “A clever person solves a problem. A wise person avoids it.”

    1879-1955

Similar Threads

  1. Ivy Generator
    By sittingbull86 in forum Français - 3ds Max / Maya
    Replies: 14
    Last Post: 2012-09-28, 09:02 AM
  2. NCS/ AIA Layer Name generator?
    By Liamnacuac in forum CAD Standards
    Replies: 0
    Last Post: 2011-11-01, 03:04 PM
  3. Replies: 0
    Last Post: 2010-09-16, 02:08 PM
  4. Semi-Automatic Layer Generator
    By aalderete in forum AutoLISP
    Replies: 1
    Last Post: 2005-10-27, 05:23 PM
  5. GUI id generator?
    By jgardner.79905 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2005-03-29, 04:06 PM

Tags for this Thread

Posting Permissions

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