Jump to content

Little changes in a lisp


sergiu_ciuhnenco

Recommended Posts

(defun c:CS ( / a d d1 num )
(defun *error* (msg) (setq a nil d nil d1 nil num nil)(princ) );end**
(if (not usercs) (setq usercs (getvar "textstyle")) );if
(setq a (strcase (getstring (strcat "Change Style (New style)["
                                    usercs "]: "))))
(if (> (strlen a) 0)
 (progn
  (while (not (tblsearch "style" a))
         (setq a (getstring "\nInvalid style. Enter style: ")) );while
  (setq usercs a)(setq a nil) );progn
);if
(if (setq d (ssget "X" '( (0 . "TEXT"))))
 (progn
  (setq num 0)
  (while (< num (sslength d))
         (setq d1 (entget (ssname d num)))
         (entmod (subst (cons 7 usercs) (assoc 7 d1) d1))
         (setq num (1+ num)) );while
  (princ (strcat (itoa num) " object(s) to style " usercs "."))
  (setq d nil d1 nil num nil) );progn
 (princ "None selected. ") );if
(princ)
);endCS

This is a lisp for changing text style for text ... could somebody help me to modify it , I need : to do not create a new style , just use : "usercs " (standard) style, without hitting enter ,I use it in combination with other lisps , sometimes I mix the consecutivity of them , thanks in advance

Edited by sergiu_ciuhnenco
Link to comment
Share on other sites

... to do not create a new style , just use : "usercs " (standard) style, without hitting enter ...

 

hi, just remove these

(setq a (strcase (getstring (strcat "Change Style (New style)["
                                    usercs "]: "))))
(if (> (strlen a) 0)
 (progn
  (while (not (tblsearch "style" a))
         (setq a (getstring "\nInvalid style. Enter style: ")) );while
  (setq usercs a)(setq a nil) );progn
);if

 

also, you've already localized these variables - a d d1 num

so not necessary for this

(setq d nil d1 nil num nil)

Link to comment
Share on other sites

Bear in mind that with "usercs" set to (getvar "textstyle") text will be set to the current style. If you want to change the text to "Standard" while disregarding the current style you would need to set "usercs" to "Standard".

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