ccowgill
2007-02-28, 01:43 PM
I need to reduce the number of selection sets that this routine creates, or figure a way to delete the extra ones. It is designed to add "removal" notes to our station and offset notes. It works fine for a couple of drawings, but if I have several open that I am running this on, it runs out of selection sets and I get this error:
Error: U:developglobalsrccoreappsetlibutility.h@72 Could not create an new selection set
(vl-load-com)
(defun c:rem ()
(remove "REMOVE")
)
(defun c:rl ()
(remove "RELOCATE")
)
(defun c:RBO ()
(remove "RELOCATEBYOTHERS")
)
(defun c:A1 ()
(remove "ADJ1")
)
(defun c:A2 ()
(remove "ADJ2")
)
(defun c:SA ()
(remove "SALVAGE")
)
(defun c:PRS ()
(remove "PRESERVE")
)
(defun remove (rmvsty / removes listobj originalobj TH insertpoint textobj ss pointstart rmvtxt rmvtxtw)
(cond
((= (strcase rmvsty) "REMOVE")
(setq rmvtxt "- REMOVE"
rmvtxtw "@0,-0.71"
)
)
((= (strcase rmvsty) "RELOCATE")
(setq rmvtxt "- RELOCATE"
rmvtxtw "@0,-0.83"
)
)
((= (strcase rmvsty) "RELOCATEBYOTHERS")
(setq rmvtxt "- RELOCATE BY OTHERS"
rmvtxtw "@0,-1.62"
)
)
((= (strcase rmvsty) "ADJ1")
(setq rmvtxt "- ADJ, CASE 1"
rmvtxtw "@0,-1.00"
)
)
((= (strcase rmvsty) "ADJ2")
(setq rmvtxt "- ADJ, CASE 2"
rmvtxtw "@0,-1.03"
)
)
((= (strcase rmvsty) "SALVAGE")
(setq rmvtxt "- SALVAGE"
rmvtxtw "@0,-0.77"
)
)
((= (strcase rmvsty) "PRESERVE")
(setq rmvtxt "- PRESERVE"
rmvtxtw "@0,-0.83"
)
)
)
(setq removes (ssget (list (cons 0 "text"))))
(while (setq listobj (ssname removes 0))
(setq originalobj (vlax-ename->vla-object listobj))
(if (= (vla-get-Alignment originalobj) 11)
;;if middle right
(progn
(setq TH 0.08
insertpoint (vla-get-TextalignmentPoint originalobj)
textObj (vla-addtext
acadPaperSpace
rmvtxt
Insertpoint
TH
) ;end vla-addtext
) ;end setq
(vla-put-color textobj 1) ;change color
(vla-put-alignment textobj 11) ;change justification
(vla-put-textalignmentpoint textobj insertpoint)
;change insetion point
(vla-put-rotation textobj (* pi (/ 90.0 180.0)))
;change rotation
(vla-put-layer textobj "Offset Notes")
;change to proper layer
(command "move" listobj "" "0,0" rmvtxtw)
;move original text down .72
) ;end progn
(progn
;;if middle left
(setq ss (vlax-vla-object->ename originalobj))
;change back to ename obj
(command "justifytext" ss "" "mr") ;tjust mr
(setq originalobj (vlax-ename->vla-object ss))
;change back to vla
(setq pointstart (vla-get-textalignmentpoint originalobj))
;get insertpoint
(command "justifytext" listobj "" "ml")
;change justification back
(vla-put-alignment originalobj 9) ;put alignment back
(setq TH 0.08
textObj (vla-addtext
acadPaperSpace
rmvtxt
pointstart
TH
) ;end vla-addtext
) ;end setq
(vla-put-color textobj 1) ;change color
(vla-put-alignment textobj 9) ;change justification
(vla-put-textalignmentpoint textobj pointstart)
;move to right location
(vla-put-rotation textobj (* pi (/ 90.0 180.0)))
;rotate to 90
(vla-put-layer textobj "Offset Notes")
;change to proper layer
(setq textobj (vlax-vla-object->ename textobj))
;convert to ename
(command "move" textobj "" "0,0" "@0,0.08 (%220,0%22%20%22@0,0.08)")
;move away from offset note
) ;end progn
) ;end if
(ssdel listobj removes) ;delete item from selection set
) ;end while
(setq listobj nil
removes nil
textobj nil
ss nil
originalobj nil
)
) ;end defun c:remove
Error: U:developglobalsrccoreappsetlibutility.h@72 Could not create an new selection set
(vl-load-com)
(defun c:rem ()
(remove "REMOVE")
)
(defun c:rl ()
(remove "RELOCATE")
)
(defun c:RBO ()
(remove "RELOCATEBYOTHERS")
)
(defun c:A1 ()
(remove "ADJ1")
)
(defun c:A2 ()
(remove "ADJ2")
)
(defun c:SA ()
(remove "SALVAGE")
)
(defun c:PRS ()
(remove "PRESERVE")
)
(defun remove (rmvsty / removes listobj originalobj TH insertpoint textobj ss pointstart rmvtxt rmvtxtw)
(cond
((= (strcase rmvsty) "REMOVE")
(setq rmvtxt "- REMOVE"
rmvtxtw "@0,-0.71"
)
)
((= (strcase rmvsty) "RELOCATE")
(setq rmvtxt "- RELOCATE"
rmvtxtw "@0,-0.83"
)
)
((= (strcase rmvsty) "RELOCATEBYOTHERS")
(setq rmvtxt "- RELOCATE BY OTHERS"
rmvtxtw "@0,-1.62"
)
)
((= (strcase rmvsty) "ADJ1")
(setq rmvtxt "- ADJ, CASE 1"
rmvtxtw "@0,-1.00"
)
)
((= (strcase rmvsty) "ADJ2")
(setq rmvtxt "- ADJ, CASE 2"
rmvtxtw "@0,-1.03"
)
)
((= (strcase rmvsty) "SALVAGE")
(setq rmvtxt "- SALVAGE"
rmvtxtw "@0,-0.77"
)
)
((= (strcase rmvsty) "PRESERVE")
(setq rmvtxt "- PRESERVE"
rmvtxtw "@0,-0.83"
)
)
)
(setq removes (ssget (list (cons 0 "text"))))
(while (setq listobj (ssname removes 0))
(setq originalobj (vlax-ename->vla-object listobj))
(if (= (vla-get-Alignment originalobj) 11)
;;if middle right
(progn
(setq TH 0.08
insertpoint (vla-get-TextalignmentPoint originalobj)
textObj (vla-addtext
acadPaperSpace
rmvtxt
Insertpoint
TH
) ;end vla-addtext
) ;end setq
(vla-put-color textobj 1) ;change color
(vla-put-alignment textobj 11) ;change justification
(vla-put-textalignmentpoint textobj insertpoint)
;change insetion point
(vla-put-rotation textobj (* pi (/ 90.0 180.0)))
;change rotation
(vla-put-layer textobj "Offset Notes")
;change to proper layer
(command "move" listobj "" "0,0" rmvtxtw)
;move original text down .72
) ;end progn
(progn
;;if middle left
(setq ss (vlax-vla-object->ename originalobj))
;change back to ename obj
(command "justifytext" ss "" "mr") ;tjust mr
(setq originalobj (vlax-ename->vla-object ss))
;change back to vla
(setq pointstart (vla-get-textalignmentpoint originalobj))
;get insertpoint
(command "justifytext" listobj "" "ml")
;change justification back
(vla-put-alignment originalobj 9) ;put alignment back
(setq TH 0.08
textObj (vla-addtext
acadPaperSpace
rmvtxt
pointstart
TH
) ;end vla-addtext
) ;end setq
(vla-put-color textobj 1) ;change color
(vla-put-alignment textobj 9) ;change justification
(vla-put-textalignmentpoint textobj pointstart)
;move to right location
(vla-put-rotation textobj (* pi (/ 90.0 180.0)))
;rotate to 90
(vla-put-layer textobj "Offset Notes")
;change to proper layer
(setq textobj (vlax-vla-object->ename textobj))
;convert to ename
(command "move" textobj "" "0,0" "@0,0.08 (%220,0%22%20%22@0,0.08)")
;move away from offset note
) ;end progn
) ;end if
(ssdel listobj removes) ;delete item from selection set
) ;end while
(setq listobj nil
removes nil
textobj nil
ss nil
originalobj nil
)
) ;end defun c:remove