Jump to content

Enclose the Text, the Text in brackets ( ), [ ], { }...


Nikon

Recommended Posts

7 hours ago, Isaac26a said:

But you can Modify it with numbers

@Isaac26a

Thanks, it works great!

Now I can add my numbers...

??? Is it possible in this lisp to switch the keyboard layout from English to another language and then bring it back???

Edited by Nikon
Link to comment
Share on other sites

I add square brackets [ ] to highlight the letters. 

backlight.png.fbdf68ee2c3e9fc9214a9f375ea75af4.png

;;; Enclose Texts with Round(), Square[], Curly{}, sTraight||, Forward//, Backward\\
;;; Isaac A 20240208  09.02.2024
(vl-load-com)
(defun c:entN2 (/ a b c d dw e f g o oe)
   (setq oe (getvar 'cmdecho)
         o  (getvar 'osmode)
   )
   (setvar 'cmdecho 0)
   (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object))))
   (setvar 'osmode 0)
   (princ "\nSelect the texts.")
   (if (setq a (ssget (list (cons 0 "TEXT,MTEXT"))))
      (progn
         (initget "Round Square Curly sTraight Forward Backward frQuotes")
         (setq b 0
               c (sslength a)
               d (getkword "Round(), [Square[]/Curly{}/sTraight||/Forward///Backward\\\\/frQuotes«»] <R>: ")
         )
         (while (< b c)
            (setq e (entget (ssname a b))
                  f (cdr (setq g (assoc 1 e)))
            )
            (cond
               ((= d "Round")    (setq f (strcat "("f")")))
               ((= d "Square")   (setq f (strcat "["f"]")))
               ((= d "Curly") (if (= (cdr (assoc 0 e)) "TEXT")
                                 (setq f (strcat "{"f"}"))
                                 (setq f (strcat "\\{"f"\\}"))
                              )
               )
               ((= d "sTraight") (setq f (strcat "|"f"|")))
               ((= d "Forward")  (setq f (strcat "/"f"/")))
               ((= d "Backward") (setq f (strcat "\\"f"\\")))
               ((= d "frQuotes") (setq f (strcat "«"f"»")))
               (T                (setq f (strcat "("f")")))
            )
            (setq e (subst (cons 1 f) g e))
            (entmod e)
            (setq b (1+ b))
         )
      )
      (princ "\nNo texts selected")
   )
   (setvar 'cmdecho oe)
   (setvar 'osmode  o)
   (vla-endundomark dw)
   (princ)
)

d (getkword "Round(), [Square[]/Curly{}/sTraight||/Forward///Backward\\/ frQuotes«»] <R>: ")

 

 

Edited by Nikon
Link to comment
Share on other sites

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