Jump to content

Recommended Posts

Posted

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)
)

Posted

Maybe this..?

 
(setq sel (ssget "x" '((0 . "*POLYLINE" ))))

Posted

that's it. I also decided for the hatch.

Tanks

Posted

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)
)

Posted

Much better and more orderly.

By the way, also wanted to include the option to entities hatch and bloks.

Thank you.

Posted

Lee Mac,

Yes, of course. I think this way is more direct. In addition, there's a learning component.

Posted
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 ;)

Posted
Ok, just making sure you were aware of the QSelect command ;)

and SSX and Filter.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...