Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/17/2021 in all areas

  1. Wil it work if you just type in the Spanish words in the speaksapi lines? just tried similar with random text, "ahora esta es una historia sobre cómo mi vida se tuerce, se pone patas arriba" and she said it all but I have no idea if the pronunciation is good (and again no idea if google translate did it's thing to give me the text)
    2 points
  2. I found that sometimes you have to type a bit phonetically
    1 point
  3. Indeed, the function performs the translation, but the pronunciation is not very good. Thanks Steven.
    1 point
  4. Like this Command MBCH (abbreviation of your title, feel free to change this) ;; Split MText at a "(" character. Set the last part on a new line, and 60% smaller size ;; Mtext: adding a line Break and Changing text Height (defun c:mbch ( / mtexts i txt newTxt ent) ;; (setq mtexts (ssget "_x" (list (cons 410 "Model") (cons 0 "MTEXT") )) ) ;; All MText objects in Model (setq mtexts (ssget (list (cons 0 "MTEXT") )) ) ;; User selects MText objects ;; go through all found objects (setq i 0) (repeat (sslength mtexts) (setq txt (cdr (assoc 1 (entget (setq ent (ssname mtexts i)))))) (princ txt) ;; \\H0.60x means 60% text size ;; "\\P{" ... "}" means ... is on a next line ;; So substitute bracket by "\\P{\\H0.60x(" and add "}" at the end (setq newTxt (strcat (vl-string-subst "\\P{\\H0.60x(" "(" txt) "}")) (entmod (subst (cons 1 newTxt) (assoc 1 (entget ent)) (entget ent) )) (setq i (+ i 1)) ) (princ) )
    1 point
  5. oh that's what I missed, Thanks a lot
    1 point
  6. Updating to asking for the line # instead of text also needs the first changes done as well. ; mtext find remove (defun C:mtfr2 (/ ent strent ans newline x k ssmtxt removetxt) (setq ssmtxt (ssget '((0 . "Mtext")))) (setq x (getint "\nLine To Remove: ")) (repeat (setq k (sslength ssmtxt)) (setq strent (vlax-ename->vla-object (ssname ssmtxt (setq k (- k 1))))) (setq str (vla-get-textstring strent)) (setq ans (LM:csv->lst str "\\" 0)) (setq removetxt (nth (- x 1) ans)) (setq newline "") (setq x 0) (repeat (length ans) (if (= (wcmatch (strcase (nth x ans)) (strcase removetxt)) T) ;doesn't need a wild card. (princ) (setq newline (strcat newline "\\" (nth x ans))) ) (setq x (+ x 1)) ) (if (eq (vl-string-search "\\P" newline) 0) (setq newline (substr newline 3)) (setq newline (substr newline 2)) ) (vla-put-textstring strent newline) ) ; repeat (princ) )
    1 point
  7. update the following. (setq newline (nth 0 ans)) ;would automaticly add first line back in (setq x 1) ;starts @ 2nd item in list (repeat (- (length ans) 1) to (setq newline "") ;now blank to start (setq x 0) ;starts at first item in list (repeat (length ans) ;repeats/checks the whole list ... also add this (if (eq (vl-string-search "\\P" newline) 0) ;if first line is replaced. (setq newline (substr newline 3)) ;you need to remove //P from string or first line will be blank (setq newline (substr newline 2)) ;it will still have // in front and needs to be removed. ) (vla-put-textstring strent newline) --Edit-- You could also just ask what line to remove like this. Searching for words has the potential to delete more then just the line you want. (setq removetxt (getstring t "\Input text to remove : ")) replace above with (setq x (getint "\nRemove Line: ")) (setq ans (LM:csv->lst str "\\" 0)) (setq removetxt (nth (- x 1) ans)) ;add this line afetr ans is defined.
    1 point
  8. ; remove a line of mtext looking for a word in a line ; mtext version only ; By Alan H April 2017 ; remove s to make a variable ;; CSV -> List by - Lee Mac ;; Parses a line from a CSV file into a list of cell values. ;; str - [str] string read from CSV file ;; sep - [str] CSV separator token ;; pos - [int] initial position index (always zero) (defun LM:csv->lst ( str sep pos / s ) (cond ( (not (setq pos (vl-string-search sep str pos))) (if (wcmatch str "\"*\"") (list (LM:csv-replacequotes (substr str 2 (- (strlen str) 2)))) (list str) ) ) ( (or (wcmatch (setq s (substr str 1 pos)) "\"*[~\"]") (and (wcmatch s "~*[~\"]*") (= 1 (logand 1 pos))) ) (LM:csv->lst str sep (+ pos 2)) ) ( (wcmatch s "\"*\"") (cons (LM:csv-replacequotes (substr str 2 (- pos 2))) (LM:csv->lst (substr str (+ pos 2)) sep 0) ) ) ( (cons s (LM:csv->lst (substr str (+ pos 2)) sep 0))) ) ) (defun LM:csv-replacequotes ( str / pos ) (setq pos 0) (while (setq pos (vl-string-search "\"\"" str pos)) (setq str (vl-string-subst "\"" "\"\"" str pos) pos (1+ pos) ) ) str ) ; mtext find remove (defun C:mtfr2 ( / ent strent ans newline x k ssmtxt removetxt) (setq ssmtxt (ssget (list (cons 0 "Mtext")))) (setq removetxt (getstring t "\Input text to remove : ")) (repeat (setq k (sslength ssmtxt)) (setq strent (vlax-ename->vla-object (ssname ssmtxt (setq k (- k 1))))) (setq str (vla-get-textstring strent)) (setq ans (LM:csv->lst str "\\" 0)) (setq newline (nth 0 ans)) (setq x 1) (repeat (- (length ans) 1) (if (= (wcmatch (strcase (nth x ans)) (strcat (strcase removetxt) "*") ) T) (princ) (setq newline (strcat newline "\\" (nth x ans))) ) (setq x (+ x 1)) ) (vla-put-textstring strent newline) ) ; repeat ) like this? options if you want not allow space bar in text to find (can execute by space bar) (setq removetxt (getstring t "\Input text to remove : ")) -> (setq removetxt (getstring "\Input text to remove : ")) if you want to double wild card (if (= (wcmatch (strcase (nth x ans)) (strcat (strcase removetxt) "*") ) T) -> (if (= (wcmatch (strcase (nth x ans)) (strcat "*" (strcase removetxt) "*") ) T) this routine is great, but I found that cannot delete first row of mtext. I don't know why, that's too difficult for me
    1 point
  9. More like this (defun SpeakSapi ( s / sapi ) (if (eq (type s) 'STR) (progn (setq sapi (vlax-create-object "Sapi.SpVoice")) (vlax-put sapi 'SynchronousSpeakTimeout 1) (vlax-invoke-method sapi 'WaitUntilDone 0) (vlax-invoke sapi "Speak" s 0) (vlax-release-object sapi) ))) (defun c:sample ( ) (if (> (rtos (getvar "cdate") 2 0) "20180117") (progn (speaksapi "Welcome from BIG al the humour and respect you can expect here at Cad tutor") (speaksapi "PLEASE PAY YOUR MONEY") (speaksapi "I know you have wound the clock back" ) (speaksapi "Call me on 1234 5678 if you like the software") ) ) ; do your thing here )
    1 point
  10. Try something like this: (defun c:exnest ( ) (vlax-for blk (vla-get-blocks (LM:acdoc)) (if (and (= :vlax-false (vla-get-isxref blk)) (= :vlax-false (vla-get-islayout blk)) ) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-explode (list obj)))) ) (vl-catch-all-apply 'vla-delete (list obj)) ) ) ) ) (command "_.-purge" "_B" "*" "_N") (vla-regen (LM:acdoc) acallviewports) (princ) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc) )
    1 point
×
×
  • Create New...