;;; Separate Layout objects to individual new layouts
;;; Created by Igal Averbuh 2018. Dedicated to Topaz LTD
(princ "\rType LS to Invoke")
(defun c:PB ()
(princ "\rPasteBase: (0.0,0.0,0.0) ")

(command "._pasteclip" "0,0,0")

)

(defun c:LS (/ i )

(defun *error* ( msg )
(foreach lay lck (vla-put-lock lay :vlax-true))
(if (= 'int (type cmd)) (setvar 'cmdecho cmd))
; (LM:endundo (LM:acdoc))
(setvar 'maxactvp 64)
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(princ (strcat "\nError: " msg))
(setvar 'maxactvp 64)
)
(princ)
)

;; Start Undo - Lee Mac
;; Opens an Undo Group.

(defun LM:startundo ( doc )
(LM:endundo doc)
(vla-startundomark doc)
)

;; End Undo - Lee Mac
;; Closes an Undo Group.

(defun LM:endundo ( doc )
(while (= 8 (logand 8 (getvar 'undoctl)))
(vla-endundomark doc)
)
)

;; Active Document - Lee Mac
;; Returns the VLA Active Document Object

(defun LM:acdoc nil
(eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
(LM:acdoc)
)

(while

(setvar 'maxactvp 2)

(princ "\rSelect Layout objects to separate: ")

(setq curtab (getvar 'ctab))

(setq sset (ssget))

(vl-cmdf "_cutclip" sset "")

(setq i (getstring "\nEnter New Layout Name: "))

(command "._layout" "_new" i)

(setvar "ctab" i)

(c:pb)

(setvar "ctab" curtab)

)

)

;(c:ls) ;; Don't invoke - program not working in this case

Advertisements