TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MSTG007 on June 03, 2015, 04:55:47 PM

Title: lisp to Save Layer state by Date and Time
Post by: MSTG007 on June 03, 2015, 04:55:47 PM
Is there a routine that can save a layer state by Date and Time?
Title: Re: lisp to Save Layer state by Date and Time
Post by: snownut2 on June 04, 2015, 06:57:23 AM
unless I am missing something, could you explain how you would expect to create the layer state a bit more, ie. automatically at set intervals, upon the selection of a different pspace tab or other triggering event.  You could just incorporate the date and time in the name of the layer state.
Title: Re: lisp to Save Layer state by Date and Time
Post by: MSTG007 on June 04, 2015, 07:44:23 AM
Sure, I have created at macro that will toggle all the layers on and off with associated colors within the Tool Palette. I am trying to create a command that will backup the current layer state (Again by a time or whatever) then the layer change gets applied. I would like the layer state to be there; in case I need to roll back to the previous layers.
Title: Re: lisp to Save Layer state by Date and Time
Post by: roy_043 on June 04, 2015, 02:08:03 PM
There are a number of built-in layerstate functions including: layerstate-save. These functions handle most of the work, so you do not need a lot of code.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:LayStBu ()
  2.   (layerstate-save (strcat "Backup_" (rtos (getvar 'cdate) 2 8)) nil nil)
  3.   (princ)
  4. )
Title: Re: lisp to Save Layer state by Date and Time
Post by: MSTG007 on June 04, 2015, 02:15:41 PM
You saved the world for me! lol. Thank you,.