the only ones i've noticed the problem occuring on so far is these three but i haven't tested them all. I did test most of the ones i have which gather information about the drawing like layer or layout based on these two and all the others seem to be ok. i also modified plottabs for creating plt files recently so i have suspiscions it may be that one. here they are:
(defun c:SL
(/ layer_string ent enlay entlst ename olderr selset enum objlen dent layent layset lay pt1 pt2 ss ss1 ss2 en osm)
(vl-load-com)
(if (null myerr)(load "myerr"))
(setq olderr *error* *error* myerr)
(setq osm (getvar "osmode"))
(if (null setvars)(load "setvars"))
(setq syslst
(setvars '(("cmdecho" . 0) ("osmode" . 0) ("trimmode" . 1)) )
)
(while (setq ent (entsel "\nSelect entity on layer..."))
(setq layer_string
(if layer_string
(strcat layer_string ","
(vla-get-layer (vlax-ename->vla-object (car ent)))
)
(vla-get-layer (vlax-ename->vla-object (car ent)))
)
)
)
(princ "\nSelect objects to stretch by crossing-window or crossing-polygon...")
(command "._stretch" (ssget (list (cons 8 layer_string))) "")
(setvars syslst)
(setq *error* olderr)
(princ)
)
(defun myerr (msg)
(if (or (= msg "quit / exit abort")
(= msg "Function cancelled"))
(if (and ctl undo_err) ; if undo_start used and returned value saved
(undo_err ctl)) ; in ctl then undo everything done so far.
(princ msg))
(if (and setvars syslst) ; if usual system var handler and variable exist
(setvars syslst)) ; then restore system vars
(setq *error* OLDERR ctl nil)
(princ)
)
(defun setvars (syslst / oldlst)
(foreach dp syslst
(setq oldlst (cons
(cons (car dp) (getvar (car dp)))
oldlst)))
(foreach dp syslst
(setvar (car dp) (cdr dp))
)
oldlst
)
(princ)
;;;
;;; PlotTabs.lsp
;;; Created by C. Alan Butler
;;; Version 1 12/04/2003
;;; Version 1.01 12/17/2003 Bug repairs
;;; Requires PlotTabs.dcl file to run
;;; Routine to plot paperspace tabs
;;; Pick Page Set Up to use
;;; Sort by Alpha, Numeric, or Tab order
;;; Reverse sort order
;;; Ignore Tabs with flag character
;;; Enter quantity of copies
;;; Option to collate
;;; Enter PLotTabs to run from the command line
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; ---------------------------------------------------------------------------
(defun c:Plottabs (/ plo_list plo_layout
config-list Plot-config Plot-order
Plot-qty order-list order#
config# RevOrder
)
;; ---------------------------------------------------------------------------
;; Function: init_vars
;; Purpose : Sets up variables prior to invoking dialogue box.
;; ---------------------------------------------------------------------------
(defun init_vars ()
(if (not Plot-Config)
(setq Plot-Config "Current")
)
(if (not Plot-QTY)
(setq Plot-QTY 1)
)
(if (not Plot-order)
(setq Plot-order "Tab")
)
(setq config-list (Plot_config_list) ;get list of page setups
RevOrder nil ; Reverse the order
Quantity Plot-QTY ; number of sets
SaveLayout T
CollateSets T
ExcludeTab T ; Flag to exclude tabs
ExcludeChr "~" ; Character marker for exclude tabs
PlotToFile F
) ;_ end of setq
(if (and Plot-config (member Plot-config PlotConfigs))
(setq config#
(- (length config-list)
(length (member Plot-Config config-list))
) ;_ end of -
) ;_ end of setq
(setq config# 0)
) ;_ end of if
) ; end defun init_vars
;; ---------------------------------------------------------------------------
;; Function: init_tiles
;; Purpose : Sets up dialogue box tiles prior to invoking dialogue box.
;; ---------------------------------------------------------------------------
(defun init_tiles ()
(setq yes "1")
(action_tile "accept" "(call_ok)")
(start_list "PlotConfigs")
(foreach one config-list
(add_list one)
) ;_ end of foreach
(end_list)
(set_tile "PlotConfigs" (itoa config#))
(action_tile "SaveLayout" "(setq SaveLayout (= $value \"1\"))")
(action_tile "rb1" "(setq Plot-order \"Alpha\")")
(action_tile "rb2" "(setq Plot-order \"Numeric\")")
(action_tile "rb3" "(setq Plot-order \"Tab\")")
(action_tile "reverse" "(setq RevOrder (= $value \"1\"))")
(action_tile "quantity" "(QuanCtrl)")
(action_tile "CollateSets" "(setq CollateSets (= $value \"1\"))")
(action_tile "ExcludeTab" "(ExTab)")
(set_tile "ExcludeChr" ExcludeChr)
(action_tile "ExcludeChr" "(setq ExcludeChr $value)")
(action_tile "PlotToFile" "(setq PlotToFile (= $value \"0\"))")
) ; End init_tiles
(defun ExTab() ; enable/disable flag character input
(setq ExcludeTab (if(= (get_tile "ExcludeTab")"0")T nil)); get current value
(if ExcludeTab
(mode_tile "ExcludeChr" 1);enabled
(mode_tile "ExcludeChr" 0);disabled
)
) ; end defun ExTab
(defun QuanCtrl()
(if (> (setq quantity (atoi (get_tile "quantity"))) 1)
(mode_tile "CollateSets" 0);enabled
(mode_tile "CollateSets" 1);disabled
)
)
;; ---------------------------------------------------------------------------
;; Function: call_ok
;; Purpose : Callback function for OK button. Ensures a quantity greater than
;; 0 and a device other than "None".
;; ---------------------------------------------------------------------------
(defun call_ok ()
(if (> (setq quantity (atoi (get_tile "quantity"))) 0)
(progn
(setq
config# (atoi (get_tile "PlotConfigs"))
Plot-cfg (nth config# config-list)
Plot-QTY quantity
) ;_ end of setq
(done_dialog 1)
) ;_ end of progn
(set_tile "error" "Quantity must be 1 or more")
) ;_ end of if
) ; End call_ok
;; ---------------------------------------------------------------------------
;; Function: Plot_Config_list
;; Purpose : Returns list of strings of all user page set ups.
;; Local : curdwg: current drawing object
;; pslayout: paper space layout object
;; ---------------------------------------------------------------------------
(defun Plot_config_list (/ curdwg pslayout names x)
(vl-load-com)
(setq
curdwg (vla-get-ActiveDocument (vlax-get-Acad-Object))
DwgName (vl-string-right-trim ".dwg" (vla-get-fullname curdwg))
pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
) ;_ end of setq
; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
(vla-RefreshPlotDeviceInfo pslayout)
(cons '"Current" ; add Current as a choice
(reverse
(vlax-for x (vla-get-Plotconfigurations curdwg)
(setq names (cons (vla-get-name x) names))
) ;_ end of vlax-for
) ;_ end of reverse
) ;_ end of cons
) ; End Plot_config_list
;; ---------------------------------------------------------------------------
;; Function: plot_tab
;; Purpose : plot one lauout tab
;; Params : tab: name of the layout tab to plot
;; Local :
;; Returns : nil
;; ---------------------------------------------------------------------------
(defun Plot_Tab (TabToPLot)
(cond
((= TabToPLot "Model")
nil ; skip Model Space
) ; end cond 1
((and ExcludeTab (vl-string-search ExcludeChr TabToPLot))
nil ; skip if ~ in tab name
) ; end cond 2
(T
(cond
(PlotToFile
(command "-Plot"
"n"
TabToPLot ; tab name
(if (= Plot-cfg "Current") "" Plot-cfg); page setup name
"" ; output device name <current>
"N" ; plot to file
(strcat Dwgname "-" TabToPLot) ;; not used if no plot to file
(if SaveLayout "Y" "N") ; save page setup to layout
"Y" ; yes do the plot
) ;_ end of command
) ; end cond 1
(T
(command "-Plot"
"n"
TabToPLot ; tab name
(if (= Plot-cfg "Current") "" Plot-cfg); page setup name
"" ; output device name <current>
"N" ; plot to file
; File Name not used if no plot to file
(if SaveLayout "Y" "N") ; save page setup to layout
"Y" ; yes do the plot
) ;_ end of command
) ;end cond T
) ; end cond
) ; end cond 3
) ; end cond
) ; end defun
;; ---------------------------------------------------------------------------
;; Function: num_sort
;; Purpose : sort list of strings by the first numbers found in them
;; Params : lst: list of strings to sort
;; Local :
;; Returns : sorted list
;; ---------------------------------------------------------------------------
(defun Num_Sort
(lst / begin elist end estr n ndx newstring rval strlist)
(setq numlst (list)) ; empty list
(foreach one lst
(setq ndx 1
rval nil
strlist (list)
) ;_ end of setq
(if (/= one nil)
(repeat (strlen one)
(setq strlist (append strlist (list (substr one ndx 1))))
(setq ndx (1+ ndx))
) ;_ end of repeat
) ;_ end of if
(setq begin nil
end nil
ndx 1
) ;_ end of setq
(foreach n strlist
(cond
((and (not begin) (not end))
(if (/= nil (distof n))
(setq begin ndx
rval n
) ;_ end of setq
) ;_ end of if
)
((and begin (not end))
(if (= nil (distof n))
(setq end ndx)
(setq rval (strcat rval n))
) ;_ end of if
)
) ;_ end of cond
(setq ndx (1+ ndx))
) ;_ end of foreach
(if (not rval)
(setq rval "0")
) ;_ end of if
(setq numlst (cons (cons rval one) numlst))
) ; end foreach
(setq lst (vl-sort numlst '(lambda (E1 E2) (< (car E1) (car E2)))))
(setq lst (mapcar 'cdr lst)) ;remove the numbers
lst
) ; end defun
;;; Start C:PlotTabs -----------------------------------------------------------
(cond
((not (findfile (setq dclfile "PlotTabs.dcl")))
(alert "Cannot find PlotTabs.dcl")
)
((< (setq dcl# (load_dialog dclfile)) 0) ; Error
(prompt (strcat "\nCannot load " dclfile "."))
)
((not (new_dialog "PlotTabs" dcl#)) ; Error
(prompt (strcat "\nProblem with " dclfile "."))
)
(T ; No DCL problems: fire it up
(init_vars)
(init_tiles)
(setq action (start_dialog))
(unload_dialog dcl#)
(if (= action 1) ; Ok to Plot
(progn
(setq plo_layouts
(vla-get-layouts
(vla-get-activedocument (vlax-get-acad-object))
) ;_ end of vla-get-layouts
) ;_ end of setq
(vlax-for plo_layout plo_layouts ; get list of layout tabs
(if (= Plot-Order "Tab") ; create with TabOrder numbers
(setq plo_list (cons (cons (vla-get-TabOrder plo_layout)
(vla-get-name plo_layout)
) ;_ end of cons
plo_list
) ;_ end of cons
) ;_ end of setq
(setq plo_list (cons (vla-get-name plo_layout) plo_list))
) ;_ end of if
) ;_ end of vlax-for
(cond
((= Plot-Order "Alpha")
(setq plo_list (vl-sort plo_list '<))
) ; end cond 1
((= Plot-Order "Numeric")
(setq plo_list (Num_Sort plo_list))
) ; end cond 2
((= Plot-Order "Tab")
(setq plo_list
(vl-sort plo_list
'(lambda (E1 E2) (< (car E1) (car E2)))
) ;_ end of vl-sort
) ;_ end of setq
(setq plo_list (mapcar 'cdr plo_list)) ;remove the taborder numbers
) ; end cond 3
) ; end cond
(if Plot-REV (Reverse plo_list)) ;_ end of if
(if CollateSets
(repeat Plot-QTY
(foreach tab plo_list ; plot one complete set at a time
(Plot_Tab tab)
) ;_ end of foreach
) ;_ end of repeat
(foreach tab plo_list
(repeat Plot-QTY ; plot the quantity of each sheet
(Plot_Tab tab)
) ;_ end of repeat
) ;_ end of foreach
) ; endif
(prompt "\nPlot Sets Complete")
) ; end progn
;; ELSE
(alert " Plot aborted.")
) ;_ end of if
) ; end cond T
) ; end cond
(princ)
) ; End defun C:PlotTabs
(princ)
(prompt "Plot Tabs is loaded, Enter PLotTabs to run.")
;;; End C:PlotTabs -----------------------------------------------------------
;;;
;;; Plt.lsp
;;; Created by C. Alan Butler
;;; Version 1 12/04/2003
;;; Version 1.01 12/17/2003 Bug repairs
;;; Requires plt.dcl file to run
;;; Routine to plot paperspace tabs
;;; Pick Page Set Up to use
;;; Sort by Alpha, Numeric, or Tab order
;;; Reverse sort order
;;; Ignore Tabs with flag character
;;; Enter quantity of copies
;;; Option to collate
;;; Enter plt to run from the command line
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; ---------------------------------------------------------------------------
(defun c:plt (/ plo_list plo_layout
config-list Plot-config Plot-order
Plot-qty order-list order#
config# RevOrder
)
;; ---------------------------------------------------------------------------
;; Function: init_vars
;; Purpose : Sets up variables prior to invoking dialogue box.
;; ---------------------------------------------------------------------------
(defun init_vars ()
(if (not Plot-Config)
(setq Plot-Config "Current")
)
(if (not Plot-QTY)
(setq Plot-QTY 1)
)
(if (not Plot-order)
(setq Plot-order "Tab")
)
(setq config-list (Plot_config_list) ;get list of page setups
RevOrder nil ; Reverse the order
Quantity Plot-QTY ; number of sets
SaveLayout F
CollateSets T
ExcludeTab T ; Flag to exclude tabs
ExcludeChr "~" ; Character marker for exclude tabs
PlotToFile T
) ;_ end of setq
(if (and Plot-config (member Plot-config PlotConfigs))
(setq config#
(- (length config-list)
(length (member Plot-Config config-list))
) ;_ end of -
) ;_ end of setq
(setq config# 0)
) ;_ end of if
) ; end defun init_vars
;; ---------------------------------------------------------------------------
;; Function: init_tiles
;; Purpose : Sets up dialogue box tiles prior to invoking dialogue box.
;; ---------------------------------------------------------------------------
(defun init_tiles ()
(setq yes "1")
(action_tile "accept" "(call_ok)")
(start_list "PlotConfigs")
(foreach one config-list
(add_list one)
) ;_ end of foreach
(end_list)
(set_tile "PlotConfigs" (itoa config#))
(action_tile "SaveLayout" "(setq SaveLayout (= $value \"0\"))")
(action_tile "rb1" "(setq Plot-order \"Alpha\")")
(action_tile "rb2" "(setq Plot-order \"Numeric\")")
(action_tile "rb3" "(setq Plot-order \"Tab\")")
(action_tile "reverse" "(setq RevOrder (= $value \"1\"))")
(action_tile "quantity" "(QuanCtrl)")
(action_tile "CollateSets" "(setq CollateSets (= $value \"1\"))")
(action_tile "ExcludeTab" "(ExTab)")
(set_tile "ExcludeChr" ExcludeChr)
(action_tile "ExcludeChr" "(setq ExcludeChr $value)")
(action_tile "PlotToFile" "(setq PlotToFile (= $value \"1\"))")
) ; End init_tiles
(defun ExTab() ; enable/disable flag character input
(setq ExcludeTab (if(= (get_tile "ExcludeTab")"0")T nil)); get current value
(if ExcludeTab
(mode_tile "ExcludeChr" 1);enabled
(mode_tile "ExcludeChr" 0);disabled
)
) ; end defun ExTab
(defun QuanCtrl()
(if (> (setq quantity (atoi (get_tile "quantity"))) 1)
(mode_tile "CollateSets" 0);enabled
(mode_tile "CollateSets" 1);disabled
)
)
;; ---------------------------------------------------------------------------
;; Function: call_ok
;; Purpose : Callback function for OK button. Ensures a quantity greater than
;; 0 and a device other than "None".
;; ---------------------------------------------------------------------------
(defun call_ok ()
(if (> (setq quantity (atoi (get_tile "quantity"))) 0)
(progn
(setq
config# (atoi (get_tile "PlotConfigs"))
Plot-cfg (nth config# config-list)
Plot-QTY quantity
) ;_ end of setq
(done_dialog 1)
) ;_ end of progn
(set_tile "error" "Quantity must be 1 or more")
) ;_ end of if
) ; End call_ok
;; ---------------------------------------------------------------------------
;; Function: Plot_Config_list
;; Purpose : Returns list of strings of all user page set ups.
;; Local : curdwg: current drawing object
;; pslayout: paper space layout object
;; ---------------------------------------------------------------------------
(defun Plot_config_list (/ curdwg pslayout names x)
(vl-load-com)
(setq
curdwg (vla-get-ActiveDocument (vlax-get-Acad-Object))
DwgName (vl-string-right-trim ".dwg" (vla-get-fullname curdwg))
pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
) ;_ end of setq
; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
(vla-RefreshPlotDeviceInfo pslayout)
(cons '"Current" ; add Current as a choice
(reverse
(vlax-for x (vla-get-Plotconfigurations curdwg)
(setq names (cons (vla-get-name x) names))
) ;_ end of vlax-for
) ;_ end of reverse
) ;_ end of cons
) ; End Plot_config_list
;; ---------------------------------------------------------------------------
;; Function: plot_tab
;; Purpose : plot one layout tab
;; Params : tab: name of the layout tab to plot
;; Local :
;; Returns : nil
;; ---------------------------------------------------------------------------
(defun Plot_Tab (TabToPLot)
(cond
((= TabToPLot "Model")
nil ; skip Model Space
) ; end cond 1
((and ExcludeTab (vl-string-search ExcludeChr TabToPLot))
nil ; skip if ~ in tab name
) ; end cond 2
(T
(cond
(PlotToFile
(command "-Plot"
"n"
TabToPLot ; tab name
(if (= Plot-cfg "Current") "" Plot-cfg); page setup name
"" ; output device name <current>
"Y" ; plot to file
(strcat Dwgname "-" TabToPLot) ;; not used if no plot to file
(if SaveLayout "Y" "N") ; save page setup to layout
"N" ; yes do the plot
) ;_ end of command
) ; end cond 1
(T
(command "-Plot"
"n"
TabToPLot ; tab name
(if (= Plot-cfg "Current") "" Plot-cfg); page setup name
"" ; output device name <current>
"Y" ; plot to file
; File Name not used if no plot to file
(if SaveLayout "Y" "N") ; save page setup to layout
"Y" ; yes do the plot
) ;_ end of command
) ;end cond T
) ; end cond
) ; end cond 3
) ; end cond
) ; end defun
;; ---------------------------------------------------------------------------
;; Function: num_sort
;; Purpose : sort list of strings by the first numbers found in them
;; Params : lst: list of strings to sort
;; Local :
;; Returns : sorted list
;; ---------------------------------------------------------------------------
(defun Num_Sort
(lst / begin elist end estr n ndx newstring rval strlist)
(setq numlst (list)) ; empty list
(foreach one lst
(setq ndx 1
rval nil
strlist (list)
) ;_ end of setq
(if (/= one nil)
(repeat (strlen one)
(setq strlist (append strlist (list (substr one ndx 1))))
(setq ndx (1+ ndx))
) ;_ end of repeat
) ;_ end of if
(setq begin nil
end nil
ndx 1
) ;_ end of setq
(foreach n strlist
(cond
((and (not begin) (not end))
(if (/= nil (distof n))
(setq begin ndx
rval n
) ;_ end of setq
) ;_ end of if
)
((and begin (not end))
(if (= nil (distof n))
(setq end ndx)
(setq rval (strcat rval n))
) ;_ end of if
)
) ;_ end of cond
(setq ndx (1+ ndx))
) ;_ end of foreach
(if (not rval)
(setq rval "0")
) ;_ end of if
(setq numlst (cons (cons rval one) numlst))
) ; end foreach
(setq lst (vl-sort numlst '(lambda (E1 E2) (< (car E1) (car E2)))))
(setq lst (mapcar 'cdr lst)) ;remove the numbers
lst
) ; end defun
;;; Start C:plt -----------------------------------------------------------
(cond
((not (findfile (setq dclfile "plt.dcl")))
(alert "Cannot find Plt.dcl")
)
((< (setq dcl# (load_dialog dclfile)) 0) ; Error
(prompt (strcat "\nCannot load " dclfile "."))
)
((not (new_dialog "plt" dcl#)) ; Error
(prompt (strcat "\nProblem with " dclfile "."))
)
(T ; No DCL problems: fire it up
(init_vars)
(init_tiles)
(setq action (start_dialog))
(unload_dialog dcl#)
(if (= action 1) ; Ok to Plot
(progn
(setq plo_layouts
(vla-get-layouts
(vla-get-activedocument (vlax-get-acad-object))
) ;_ end of vla-get-layouts
) ;_ end of setq
(vlax-for plo_layout plo_layouts ; get list of layout tabs
(if (= Plot-Order "Tab") ; create with TabOrder numbers
(setq plo_list (cons (cons (vla-get-TabOrder plo_layout)
(vla-get-name plo_layout)
) ;_ end of cons
plo_list
) ;_ end of cons
) ;_ end of setq
(setq plo_list (cons (vla-get-name plo_layout) plo_list))
) ;_ end of if
) ;_ end of vlax-for
(cond
((= Plot-Order "Alpha")
(setq plo_list (vl-sort plo_list '<))
) ; end cond 1
((= Plot-Order "Numeric")
(setq plo_list (Num_Sort plo_list))
) ; end cond 2
((= Plot-Order "Tab")
(setq plo_list
(vl-sort plo_list
'(lambda (E1 E2) (< (car E1) (car E2)))
) ;_ end of vl-sort
) ;_ end of setq
(setq plo_list (mapcar 'cdr plo_list)) ;remove the taborder numbers
) ; end cond 3
) ; end cond
(if Plot-REV (Reverse plo_list)) ;_ end of if
(if CollateSets
(repeat Plot-QTY
(foreach tab plo_list ; plot one complete set at a time
(Plot_Tab tab)
) ;_ end of foreach
) ;_ end of repeat
(foreach tab plo_list
(repeat Plot-QTY ; plot the quantity of each sheet
(Plot_Tab tab)
) ;_ end of repeat
) ;_ end of foreach
) ; endif
(prompt "\nPlot Sets Complete")
) ; end progn
;; ELSE
(alert " Plot aborted.")
) ;_ end of if
) ; end cond T
) ; end cond
(princ)
) ; End defun C:plt
(princ)
(prompt "Plt is loaded, Enter PLT to run.")
;;; End C:Plt -----------------------------------------------------------