SSGET Error "*Invalid Selection*"

SSGET Error "*Invalid Selection*"

drew_dewit
Advocate Advocate
2,060 Views
1 Reply
Message 1 of 2

SSGET Error "*Invalid Selection*"

drew_dewit
Advocate
Advocate

All,

I am suddenly getting an error when I use the following function:

 

(defun removetext ()
(command "_.erase" (ssget "X" '((0 . "TEXT,MTEXT"))))
(princ "\nText removed from drawing")
)

The error is:

*Invalid selection*
Expects a point or Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/Remove/Multiple/Previous/Undo/AUto/SIngle/SUbobject/Object
1 found

 

I believe it to be the ssget function. It had worked before but now it only seems to work in a specific drawing. Any idea why it is suddenly generating this error?

0 Likes
Accepted solutions (1)
2,061 Views
1 Reply
Reply (1)
Message 2 of 2

cadffm
Consultant
Consultant
Accepted solution

The message comes from the started command (ERASE)
and only when no valid selection has been made.

No
1. TEXTS and MTEXT exist
2. on unlocked layers
3. in the current space

 

 

offtopic
Should the command automatically delete (M) text? Then you forgot to finish the object selection.

 

 

Better, but still without layer handling

(defun removetext (/ ss)
(if (setq ss (ssget "_X" (list '(0 . "TEXT,MTEXT")(cons 410 (getvar 'CTAB)))))

     (progn

         (command "_.ERASE" ss "")

         (princ "\nText removed from drawing")

     )

)

(princ)

)

 

handle layer (locked/unlocked) an use ENTDEL would be the next evolution..

Sebastian

0 Likes