teknomatika Posted September 28, 2011 Posted September 28, 2011 With this simple routine I want to select entities from a range of options. Why not work with polylines? I appreciate the help to be able to also select polylines and hatch. I know it will be simple, but for a beginner ... ;select entities to delet (defun c:DELENT (/ gets sel) (initget 1 "T L C A P") (setq gets (getkword "\nSelect option: (T)ext; (L)line; (C)ircle; (A)rc; (P)olyline: ")) (cond ((= gets "T") (setq sel (ssget "x" '((0 . "TEXT" )))) (command "erase" sel) ) ((= gets "L") (setq sel (ssget "x" '((0 . "LINE" )))) (command "erase" sel) ) ((= gets "C") (setq sel (ssget "x" '((0 . "CIRCLE" )))) (command "erase" sel) ) ((= gets "A") (setq sel (ssget "x" '((0 . "ARC" )))) (command "erase" sel) ) ((= gets "P") (setq sel (ssget "x" '((0 . "POLYLINE" )))) (command "erase" sel) ) ) ;end_cond (princ) ) Quote
Lt Dan's legs Posted September 28, 2011 Posted September 28, 2011 Maybe this..? (setq sel (ssget "x" '((0 . "*POLYLINE" )))) Quote
teknomatika Posted September 28, 2011 Author Posted September 28, 2011 that's it. I also decided for the hatch. Tanks Quote
Lt Dan's legs Posted September 28, 2011 Posted September 28, 2011 Hope you don't mind (defun c:entdel ( / *error* gets ss id) (defun *error* ( msg ) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (princ) ) (initget 1 "Text Line Circle Arc Polyline") (if (and (setq gets (getkword "\nSelect option [Text/Line/Circle/Arc/Polyline]: ")) (setq ss (ssget "_x" (list (cons 0 (if (eq "Polyline" gets) (strcat "*" gets) gets ) ) ) ) ) ) (repeat (setq id (sslength SS)) (entdel (ssname ss (setq id (1- id)))) ) (prompt (strcat "\nNo " gets " found!")) )(princ) ) Quote
teknomatika Posted September 28, 2011 Author Posted September 28, 2011 Much better and more orderly. By the way, also wanted to include the option to entities hatch and bloks. Thank you. Quote
teknomatika Posted September 28, 2011 Author Posted September 28, 2011 Lee Mac, Yes, of course. I think this way is more direct. In addition, there's a learning component. Quote
Lee Mac Posted September 28, 2011 Posted September 28, 2011 Yes, of course. I think this way is more direct. In addition, there's a learning component. Ok, just making sure you were aware of the QSelect command Quote
alanjt Posted September 28, 2011 Posted September 28, 2011 Ok, just making sure you were aware of the QSelect command and SSX and Filter. 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.