HELP!! this list uses a script file to add a Slot around dimension text... Only problem is we can only get it to run on A2k4... A2k5 gets the error: ; error: bad argument type: lselsetp nil here is the code... (defun c:Iso (/ callents ncallents viewportents nviewportents a n rcallents nrcallents nentdel nstartentdel nendentdel n1) (setq callents (ssget "x")) (setq ncallents (sslength callents)) (setq viewportents (ssget "x" '((0 . "Viewport")))) (setq nviewportents (sslength viewportents)) (setq a (ssget '((0 . "Dimension")))) (setq n (sslength a)) (if (> n 1)(exit))(princ) (if (< n 1)(exit))(princ) (command "copy" a "" "0,0" "0,0") (command "explode" "l") (command "script" "R:\BBraun CAD Standards\iso.scr") (setq rcallents (ssget "x")) (setq nrcallents (sslength rcallents)) (setq nentdel (- nrcallents (1+ ncallents))) (setq nstartentdel (1+ nviewportents)) (setq nendentdel (+ nstartentdel nentdel)) (setq n1 "w") (while n1 (entdel (ssname rcallents nstartentdel)) (setq nstartentdel (1+ nstartentdel)) (if (= nstartentdel nendentdel) (setq n1 nil) ) ) )
We have since removed the file path from the script line since it's in our custom paths... any ideas... Thanks! noit
Hi, i dont know much about 2005, but maybe you have there a drawing withaout any viewport. Then viewportents is nil an sslength reports the error. The sam can happen by all other ssget function, ig var callents. So you should always test ob a ssget was sucessfull or not. bob.at
Added some error checking but not sure of the intended flow. Code: (defun c:Iso (/ callents ncallents viewportents nviewportents a n rcallents nrcallents nentdel nstartentdel nendentdel n1 ) (if (and ;skip on first nil (setq callents (ssget "x")) (setq ncallents (sslength callents)) (setq viewportents (ssget "x" '((0 . "Viewport")))) (setq nviewportents (sslength viewportents)) ) (progn ;; not sure what is going on here, if there are no dimension ;; objects then a = nil, not 0, so the test (>n 1) ? (if ; always test the ss before getting its length ;; if a is empty it abort (setq a (ssget '((0 . "Dimension")))) (progn ;; ?? what is this for? ;;(setq n (sslength a)) ;;(if (> n 1) (exit)) ;;(princ) ;;(if (< n 1) (exit)) ;;(princ) (command "copy" a "" "0,0" "0,0") (command "explode" "l") (command "script" "R:\BBraun CAD Standards\iso.scr") (if (setq rcallents (ssget "x")) (progn ; if rcallents empty skip (setq nrcallents (sslength rcallents)) (setq nentdel (- nrcallents (1+ ncallents))) (setq nstartentdel (1+ nviewportents)) (setq nendentdel (+ nstartentdel nentdel)) (setq n1 "w") (while n1 (entdel (ssname rcallents nstartentdel)) (setq nstartentdel (1+ nstartentdel)) (if (= nstartentdel nendentdel) (setq n1 nil) ) ) ) ) ; endif rcallents empty skip ) ); endif a is empty ) ); endif callents or viewportents is empty (princ) ; quiet exit, else change this line to n1 ;; n1 ; return result ); end defun
maybe (command "script" "R:\\BBraun CAD Standards\\iso.scr") or (command "script" "R:/BBraun CAD Standards/iso.scr")