Okay so I have tried a bunch of different variations from what I could find. This time it will not go into the cond statement and as stated it is probably what I am doing wrong with this line.
Here is what I have tried. I got ride of the (strcase) because it seemed that I did not need it. I figure this cause the Xref file name is always "######-HC-XXXX" but as you where saying (strcase) makes it all uppercase so I removed it.
I have done some research and I am still not understanding the different ways you can call a string variable. And I tried these different ways which none worked.
(if (wcmatch (vlax-get lyr 'name) "'X_LAY*")
(if (wcmatch (vlax-get lyr 'name) "X_LAY*")
(if (wcmatch (vlax-get lyr 'name) 'X_LAY)
(if (wcmatch (vlax-get lyr 'name) X_LAY)
I believe this last one is the correct way to do it. Anyways then I thought to check what is in my variable X_LAY is a string that stores the file name of the xref? If so I should be able to print that variable X_LAY and it should show me what is stored in X_LAY. So to test I added this line in the code.
(defun c:xrlyrc ( / c_doc c_lyrs c_lst f_lst x_obj X_LAY); variables needed
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
c_lyrs (vla-get-layers c_doc)
);end_setq
(setq x_obj (vlax-ename->vla-object (car (entsel "\nSelect Xref Layer")))) ;end_setq
(setq X_LAY (vla-get-layer x_obj)) ;end_setq
(print X_LAY); this line added to see what was stored in X_LAY
(vlax-for lyr c_lyrs
(if (wcmatch (vlax-get lyr 'name) X_LAY)
(cond ( (wcmatch (strcase (vlax-get lyr 'name)) "*|CS-BLDG-OTLN,*|CS-BLDG-EAVE") (vlax-put lyr 'color 152)); Listed layers change color to 152
( (wcmatch (strcase (vlax-get lyr 'name)) "*|CS-BLDG-ANNO,*|CS-BLDG-CONC") (vlax-put lyr 'color 190)); Listed layers change color to 190
( (wcmatch (strcase (vlax-get lyr 'name)) "*|CS-BLDG,*|CS-BLDG-DOOR,*|CS-BLDG-WIND") (vlax-put lyr 'color 156)); Listed layers change color to 156
( (wcmatch (strcase (vlax-get lyr 'name)) "*|CS-BLDG-DWNS,*|CS-BLDG-NUM~") (vlax-put-property lyr 'plottable :vlax-false)); Listed layers to non-plottable
( (wcmatch (strcase (vlax-get lyr 'name)) "*|CS-BLDG-COLU,*|CS-BLDG-STEP") (vlax-put-property lyr 'freeze :vlax-true)); Listed layers are frozen.
);end_cond
);end_if
);end_for
(princ)
);end_defun
Once doing this I realized that X_LAY had the active layer doc that the xref was on. So if my xref was on layer1 it would spit out "layer1" or if it was on layer34 it printed out layer34. So that tells me that this line is also incorrect.
setq x_obj (vlax-ename->vla-object (car (entsel "\nSelect Xref Layer")))) ;end_setq
(setq X_LAY (vla-get-layer x_obj)) ;end_setq
So I need to figure this out before I figure out my syntax for calling a variable syntax. Right?
Thanks again for all the help.