vladthedog Posted April 2, 2009 Posted April 2, 2009 I did try to search the forum before posting, but since I'm not even sure what I'm looking for I gave up on that. Ok, so I'm playing around with lisps. i have multiple setq lines that are using ssget to select items in various layers. The lisp works just fine when every layer that i use ssget has something in it. However, if a layer has no items then my lisp will stop working and just say "select objects". What do I need to do for the lisp to say to itself "ok, i am selecting 0 objects, lets move on" ? Thanks. Quote
rkmcswain Posted April 2, 2009 Posted April 2, 2009 We are going to need to see the code Either attach as a file or paste it inline, using [noparse] [/noparse] tags, like this: (defun foo () (function) ) Quote
vladthedog Posted April 2, 2009 Author Posted April 2, 2009 don't laugh at it (defun c:danger (/ byby delcab deltext deldiv delsplash delsqft deldims) (setq byby (ssget)) (command "_.ERASE" "_All" "_Remove" byby "") (prin1) (command "-layer" "s" "0" "") (setq delcab (ssget "x" '((8 . "cab lines")))) (setq deltext (ssget "x" '((8 . "text")))) (setq deldiv (ssget "x" '((8 . "drawing divider")))) (setq delsplash (ssget "x" '((8 . "splash")))) (setq delsqft (ssget "x" '((8 . "sqft")))) (setq deldims (ssget "x" '((0 . "dimension")))) (command "_.ERASE" delcab deltext deldiv delsplash delsqft deldims "") ) Quote
Lee Mac Posted April 2, 2009 Posted April 2, 2009 Maybe: (defun c:danger (/ ss byby) (if (and (setq ss (ssget "x" '((8 . "cab lines,text,drawing divider,splash,sqft,dimension")))) (setq byby (ssget))) (progn (command "_.ERASE" "_All" "_Remove" byby "") (command "_.ERASE" ss"")) (princ "\n<!> Nothing Found <!>")) (princ)) Quote
rkmcswain Posted April 2, 2009 Posted April 2, 2009 Try replacing this... (setq delcab (ssget "x" '((8 . "cab lines")))) (setq deltext (ssget "x" '((8 . "text")))) (setq deldiv (ssget "x" '((8 . "drawing divider")))) (setq delsplash (ssget "x" '((8 . "splash")))) (setq delsqft (ssget "x" '((8 . "sqft")))) (setq deldims (ssget "x" '((0 . "dimension")))) (command "_.ERASE" delcab deltext deldiv delsplash delsqft deldims "") ...with this (if (setq sset (ssget "_X" '((8 . "cab lines,text,drawing divider,splash,sqft,dimension")))) (command "._ERASE" sset "") ) Quote
David Bethel Posted April 3, 2009 Posted April 3, 2009 If it is all dimension entities not a layer named dimension, then try this: [b][color=BLACK]([/color][/b]and [b][color=FUCHSIA]([/color][/b]setq ss [b][color=NAVY]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=MAROON]([/color][/b]list [b][color=GREEN]([/color][/b]cons -4 [color=#2f4f4f]"<OR"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons 0 [color=#2f4f4f]"DIMENSION"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons 8 [color=#2f4f4f]"cab lines,text,drawing divider,splash,sqft"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons -4 [color=#2f4f4f]"OR>"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.ERASE"[/color] ss [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] -David Quote
Lee Mac Posted April 3, 2009 Posted April 3, 2009 If it is all dimension entities not a layer named dimension, then try this: [b][color=BLACK]([/color][/b]and [b][color=FUCHSIA]([/color][/b]setq ss [b][color=NAVY]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=MAROON]([/color][/b]list [b][color=GREEN]([/color][/b]cons -4 [color=#2f4f4f]"<OR"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons 0 [color=#2f4f4f]"DIMENSION"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons 8 [color=#2f4f4f]"cab lines,text,drawing divider,splash,sqft"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cons -4 [color=#2f4f4f]"OR>"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.ERASE"[/color] ss [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] -David Thanks David - completely missed the "0" for the dimension - must be blind... Quote
rkmcswain Posted April 3, 2009 Posted April 3, 2009 Thanks David - completely missed the "0" for the dimension - must be blind... Same here. Good catch! Quote
David Bethel Posted April 4, 2009 Posted April 4, 2009 As bad as my eyes are getting, I'm surprised that I saw it. -David Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.