Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/05/2018 in all areas

  1. Thank you very much Emmanuel Delay The lisp works as I want and well Thanks again
    1 point
  2. Again, I do want to say thank you for sharing your ideas and time on this! I greatly appreciate it!
    1 point
  3. Emmanuel, This works an absolute treat. It's now doing what I wanted and freezing off the correct plot layers by sheet title and I'm very thankful for your help. It's also freezing off all other layers (ie. layers that don't start with 'Plot-*') but that was an issue I could skirt around with the VPLAYER command so it's not a major issue. But again, thank you very much for your help. Your annotated LISP code has really given me an insight and knowledge of how the code works and hopefully soon I will be able to edit these properly myself. G
    1 point
  4. freeze_by_layout.dwg Okay, plan B. All layers one by one Notice: now integers are evaluated. So leading zeros will be disregarded, for example 001 = 1 ;; for example: layername = "Plot-123ABC" => return = 123. prefix is chopped of (the "Plot-"), ;; then atoi returns the longest possible integer of the string, and chopps off everything on the right of that (the "ABC") (defun get_number (layername prefixlength / ) (atoi (substr layername (+ 1 prefixlength))) ) (defun all_layers ( / a layers) (setq layers (list)) (while (setq a (tblnext "LAYER" (null a))) (setq layers (append layers (list (cdr (assoc 2 a))))) ) layers ) (defun c:layfrz (/ _ctab num ss layers layer oldosmode oldcmdecho) ;; suppress messages in the command (setq oldosmode (getvar "osmode")) (setq oldcmdecho (getvar "cmdecho")) (setvar "osmode" 0) (setvar "cmdecho" 0) (setq _ctab (getvar 'CTAB)) (setq layers (all_layers)) (foreach x (layoutlist) (setvar 'CTAB x) (if (setq ss (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 x) (cons -4 "!=") (cons 69 1)))) (progn (if (not (and (= 0 (getvar "tilemode")) (>= (getvar "cvport") 2))) (command "_.mspace") ) (if (= "Plot-" (substr x 1 5)) (progn (setq num (substr x 6)) ;; "Plot-" is 5 characters, so the number stars at 6 (foreach layer layers (if (= (atoi num) (get_number layer 5)) (command "_.vplayer" "_T" layer "_S" (ssname ss 0) "" "") ;; Thaw (command "_.vplayer" "_F" layer "_S" (ssname ss 0) "" "") ;; Freeze ) ) (command "_.pspace") )) ) ) ) (setvar 'CTAB _ctab) (command "_.qsave") ;; set variables back (setvar "osmode" oldosmode) (setvar "cmdecho" oldcmdecho) (princ) )
    1 point
×
×
  • Create New...