Delete button doesn't work while using lisp

Delete button doesn't work while using lisp

Sandervp
Advocate Advocate
832 Views
4 Replies
Message 1 of 5

Delete button doesn't work while using lisp

Sandervp
Advocate
Advocate

Hello everybody,

 

I have problems with my delete button;

I've read different posts about changing PICKFIRST to 1 and this works, but;

If I want to delete something and I put the PICKFIRST to 1, which is the normal setting for me, and I delete this object. The delete button respond.

But when I'm using this lisp:

(defun C:FST (/ str ss) ; = Find String(s) by Content
  (setq str (getstring "\nVoer een deel van, of de complete mtext/text in: "))
  (if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 (strcat "*" str "*")) (cons 410 (getvar 'ctab)))))
    (sssetfirst nil ss); select/highlight/grip
  ); if
); defun

(defun C:FT (/ str ss) ; = Find text(s) by Content
  (setq str (getstring "\nVoer de complete mtext/text in: "))
  (if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 str) (cons 410 (getvar 'ctab)))))
    (sssetfirst nil ss); select/highlight/grip
  ); if
); defun

it doesn't....

This lisp is for selecting text or textstrings in the drawing. If I use the command "FT", I need to insert the text/ word I want to select. But if this text is selected, I can't delete it by using the delete button.
Oddly enough, I use this command, all texts, equal to the entered text, are selected. The delete button doesn't work right after in AutoCad. But if these text is selected and I go to another program, I click once with my mousebutton, and go back to AutoCad again, the delete button works again....

 

Anybody knows how this can be solved?

 

The PICKFIRST value isn't changed to 0, this is still 1

0 Likes
833 Views
4 Replies
  • Lisp
Replies (4)
Message 2 of 5

cadffm
Consultant
Consultant

Which program? Older version?

Product name & version: Command ABOUT 

 

Try 

(sssetfirst ss ss)

If this is working, Use [F1] and learn about sssetfirst.

 

 

EDIT:

I see you are using 2018 or newer (not an old version),

so i guess your problem is just the focus.

 

Type in

Command: FT

Voer de complete mtext/text in: SearchWord

 

Click with your Mouse one time in the editor window, hit [DEL]

Is it working?

 

 

Sebastian

0 Likes
Message 3 of 5

Sandervp
Advocate
Advocate

Hello @cadffm 

 

I'm using AutoCAD 2018 (version O.161.0.0 AutoCAD 2018.1.2. Update)

 

(sssetfirst ss ss) doesn't work --> (nil nil)

 

"Click with your Mouse one time in the editor window, hit [DEL]" works, but why not directly?

Why do I have to do something (clicking) else first befor I can delete the text?

 

If I do not use the lisp, I select something and I use the delete button, it works. But if I select 1 or multiple texts, equal to my input, by using this lisp it doesn't.

In the past, when using AutoCad 2018 already or an older version AutoCad, it wasn't a problem.
@Kent1Cooper helped me with this lisp in 2015: Post : Lisp needed for select specific text objects 

0 Likes
Message 4 of 5

pbejse
Mentor
Mentor

Does it behaves the same on ANY drawing? But the objects are highlighted after invoking the lsp programs?

Maybe do a "Reset Settings to Default" will fix that. Cannot duplicate that behaviour on any of Autocad versionjs i have.

 

 



0 Likes
Message 5 of 5

roland.r71
Collaborator
Collaborator

Your problem is 'focus', as CADffm implied already.

Windows uses that to know what 'window' is active.

 

When you edit a tekst by hand, it automatically has the focus.

when using lisp, it doesn't. So somehow the focus needs to be set to the selection / acad editor window.

so windows knows what to delete.

That's what happens if you click something first.

 

A solution... i don't have (yet)

0 Likes