Author Topic: Changing color of Xref layer causes unexpected results  (Read 3005 times)

0 Members and 1 Guest are viewing this topic.

Dave M

  • Newt
  • Posts: 196
Changing color of Xref layer causes unexpected results
« on: March 11, 2016, 06:34:24 PM »
I recorded an action macro that changes the color of a number of xref layers.  The result is that the layers do change to the color I selected, but layers in the xref which were turned off are subsequently turned on.  I have visretain set to 1.  Here is exactly what I recorded in the macro:


-layer
color
250
mthome*
enter
enter
regenall


Has anyone experienced this? 


BTW I am using Civil 3D 2014


Thanks
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Jeff_M

  • King Gator
  • Posts: 4100
  • C3D user & customizer
Re: Changing color of Xref layer causes unexpected results
« Reply #1 on: March 11, 2016, 07:16:29 PM »
Dave, when a layer is turned off it's color is set to the negative of the color. So by changing all of those layers to color 250 it would turn on any that were off.

Dave M

  • Newt
  • Posts: 196
Re: Changing color of Xref layer causes unexpected results
« Reply #2 on: March 11, 2016, 08:01:15 PM »
I did not know that.  What would be the best way to accomplish what I want in a macro or script without turning layers on?
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Jeff_M

  • King Gator
  • Posts: 4100
  • C3D user & customizer
Re: Changing color of Xref layer causes unexpected results
« Reply #3 on: March 12, 2016, 10:46:22 AM »
I think that you will need to load and run a small lisp file to set the color. Using ActiveX you can specify the color and it won't change the on/off status:

Code - Auto/Visual Lisp: [Select]
  1. (defun layers2color (layer color / doc lay)
  2.   (vlax-for lay (vla-get-layers doc)
  3.     (if (wcmatch (strcase (vla-get-name lay)) (strcase layer))
  4.       (vla-put-color lay color)
  5.       )
  6.     )
  7.   (princ)
  8.   )
  9.  
  10. ;;sample usage
  11. ;; (layers2color "M-ANNO*" 3)
  12.  

Add that to your acaddoc.lsp file, then your script would look like this:

(layers2color "mthome*" 250)

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Changing color of Xref layer causes unexpected results
« Reply #4 on: March 12, 2016, 10:48:52 AM »
or perhaps export a layerstate


open and edit the *.las file


Import that file and set it current
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Dave M

  • Newt
  • Posts: 196
Re: Changing color of Xref layer causes unexpected results
« Reply #5 on: March 14, 2016, 10:48:28 AM »
I think that you will need to load and run a small lisp file to set the color. Using ActiveX you can specify the color and it won't change the on/off status:

Code - Auto/Visual Lisp: [Select]
  1. (defun layers2color (layer color / doc lay)
  2.   (vlax-for lay (vla-get-layers doc)
  3.     (if (wcmatch (strcase (vla-get-name lay)) (strcase layer))
  4.       (vla-put-color lay color)
  5.       )
  6.     )
  7.   (princ)
  8.   )
  9.  
  10. ;;sample usage
  11. ;; (layers2color "M-ANNO*" 3)
  12.  

Add that to your acaddoc.lsp file, then your script would look like this:

(layers2color "mthome*" 250)


I like that idea because I can use wildcards, thanks!
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Dave M

  • Newt
  • Posts: 196
Re: Changing color of Xref layer causes unexpected results
« Reply #6 on: March 14, 2016, 10:49:36 AM »
or perhaps export a layerstate


open and edit the *.las file


Import that file and set it current


I considered using a layer state, except this file is still evolving, and new layers are being created.
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Changing color of Xref layer causes unexpected results
« Reply #7 on: March 16, 2016, 04:11:00 PM »
or perhaps export a layerstate


open and edit the *.las file


Import that file and set it current


I considered using a layer state, except this file is still evolving, and new layers are being created.
sorry for that....
Be your Best


Michael Farrell
http://primeservicesglobal.com/