I got this function but don´t know how to call it!
Sometimes when you load a lisp it runs by itself sometimes one should call it.
I understand if it says (defun C:xxx ( ) ) you just call it after loading by whatever stands after C: here "xxx".
But what is ax: ?
;;; Change all text styles on all objects to specified text style
;;; (ax:ChangeTextStyleName "ISOCPEUR")
(defun ax:ChangeTextStyleName (style / sset ename i)
(vl-load-com)
(setq i 0)
(setq sset (ssget "X" '((-4 . "<OR") (0 . "MTEXT") (0 . "TEXT") (-4 . "OR>"))))
(if sset
(repeat (sslength sset)
(setq ename (ssname sset i))
(setq i (1+ i))
(vla-put-stylename (vlax-ename->vla-object ename) style)
)
)
(setq sset nil)
)
Solved! Go to Solution.
I got this function but don´t know how to call it!
This a lisp function which need one argument (style) should pass to this function to work.
Even if you chage ax:ChangeTextStyleName to C:ChangeTextStyleName , you need to provide the style argument
But what is ax: ?
Its just a naming convention somebody used for naming their function.
This function will work even if the name is just ChangeTextStyleName.
Only thing is you need to call the function with the name you defined with defun.
To work this command you need to uncomment this line and keep this line at the end of the lisp.
Because the function needs to be defined before calling.
;;; (ax:ChangeTextStyleName "ISOCPEUR")
So once you load this lisp, it will run by itself.
Thanks!
But I can´t make it work!
Could you be nice enough to write two versions:
One runs by itself if the text style is given in the file.
And one waits for the user to to call the lisp and the style as a argument, for example (CHANGETEXTSTYLE ISO)
Cheers!
Sure.
One runs by itself if the text style is given in the file.
And one waits for the user to to call the lisp and the style as a argument, for example (CHANGETEXTSTYLE ISO)
Hi,
To have this code working as a command, the 'style' argument may be replaced by an user input.
(defun c:ChangeTextStyleName (/ style sset ename i) (vl-load-com) (while (not (and (setq style (getstring "\nEnter the style name: ")) (tblsearch "style" style) ) ) (princ (strcat "\nThe style '" style '" do not exist.")) ) (setq i 0) (setq sset (ssget "X" '((-4 . "<OR") (0 . "MTEXT") (0 . "TEXT") (-4 . "OR>")))) (if sset (repeat (sslength sset) (setq ename (ssname sset i)) (setq i (1+ i)) (vla-put-stylename (vlax-ename->vla-object ename) style) ) ) (setq sset nil) )
Thanks all!
If I understand it right using C: indicates that the program can be run as a bulit in function at Command Prompt.
That is why I thought ax: had some similar mening!
(Defun ax:ChangeTextStyleName...) is kind of confusing because the routine can be run with just (Defun ChangeTextStyleName...).
Or am I wrong???
(Defun changetextstylename ()... will have to be called like a lisp function
command: (changetextstylename)
(defun C:changetextstylename can be run as as command
command: changetextstylename
As Ajilal Vijayan explained earlier.. the ax: is just a naming convention that someone used for their lisp. I use TLF- for functgions TLC- for commands TLV- for variables.. that way in the (lsp) commands it is easy to find which functions, commands, and variables I have saved by using TLF* tlv* etc to display them. Also, in the command line all my commands are grouped together since they all start with tlc-