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!
Printable View
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
This worked great! As soon as I clean up the extra spaces, I will repost so others may use it. Thanks!
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!
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!
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.