Author Topic: Text Lisp Help needed  (Read 7652 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Text Lisp Help needed
« Reply #15 on: April 22, 2005, 09:47:59 AM »
I created this if you need it
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

One Shot

  • Guest
Text Lisp Help needed
« Reply #16 on: April 22, 2005, 09:49:01 AM »
Quote from: CmdrDuh
So now you have the 2005doc back, do you need to create an Acaddoc.lsp?


I did a save as of my presnet Acaddoc.lsp and named it Acaddoc1.lsp.  Please look at this Acaddoc1.lsp and tell if I did it correctly.  If not, please show me how to properly create one.



Code: [Select]

;;  ==============================================================================
;;  ACADDOC1.LSP
;;  
;;
;;  ==============================================================================
;;
;;  ACADDOC1.LSP  ver. 2005
;;
;;  B.N. Crouse
;;  04/22/05  
;;  FUNCTION Defuns
;;  ==============================================================================
;;
(load "fixtextstyle.lsp")

;; This then runs the c:fx function as you have it defined
;; in the fixtextstyle.lsp file
(c:fx)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Text Lisp Help needed
« Reply #17 on: April 22, 2005, 09:53:34 AM »
As far as i know, that will work.  I posted a version of acaddoc.lsp which defined FX and ran it.

Not that you need to do that, I was just trying to help.  What I do see is this:  In your existing acaddoc.lsp, you will need to (load "acaddoc1.lsp")

ANY GURUs watching this PLEASE correct me if im wrong here
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

One Shot

  • Guest
Text Lisp Help needed
« Reply #18 on: April 22, 2005, 10:23:29 AM »
Quote from: CmdrDuh
As far as i know, that will work.  I posted a version of acaddoc.lsp which defined FX and ran it.

Not that you need to do that, I was just trying to help.  What I do see is this:  In your existing acaddoc.lsp, you will need to (load "acaddoc1.lsp")

ANY GURUs watching this PLEASE correct me if im wrong here


CmdrDuh,

Thank you for your help.  It is working now.  

Thank you,

Brad

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Text Lisp Help needed
« Reply #19 on: April 22, 2005, 10:24:42 AM »
Glad its working
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

One Shot

  • Guest
Text Lisp Help needed
« Reply #20 on: April 26, 2005, 06:54:58 PM »
I am running into a problem with this lisp.  What I am trying to is to have 2 Text styles changed from simplex.shx to swiss721 BT.  If you look at the lisp @ defun c:fx1.  This is where I would like to have it change.  Can some please point me in the right direction?

Thank you for all your help.

Code: [Select]

Date Modified: 04/22/05
By Whom: Bcrouse

(defun C:fx ( / stylist txtstyle ss indx ent ent_alst str)
  (setvar "cmdecho" 0)
  (command "_.undo" "be")
  (setq stylist '("NOTES" "DWGTITLES" "DWGTITLE" "HANDDWGTITLE" "HANDWGTITLES" "HANDWGTITLE" "RMNAMES"))
 
  (while (/= stylist nil)
    (setq txtstyle (car stylist))
    (if (= (tblsearch "STYLE" txtstyle) nil)
      (command "-style" txtstyle "simplex.shx" 0 0.7 0 "No" "No" "No")
      (fixtxtstyle txtstyle)
    )
    (setq stylist (cdr stylist))
  )
  (setq ss (ssget "X" '((0 . "TEXT,MTEXT")
                (7 . "NOTES,DWGTITLES,DWGTITLE,HANDWGTITLE,HANDDWGTITLEs,HANDWGTITLEs,RMNAMES"))))
  (setq indx 0)
  (if (/= ss nil)
    (while (<= indx (- (sslength ss) 1))
      (setq ent (ssname ss indx))
      (setq ent_alst (entget ent))
      (cond
        ((= (cdr (assoc 0 ent_alst)) "TEXT")
          (setq ent_alst (subst (cons 41 0.7) (assoc 41 ent_alst) ent_alst))
        )
        ((= (cdr (assoc 0 ent_alst)) "MTEXT")
          (setq str (cdr (assoc 1 ent_alst)))
          (if (/= (vl-string-position (ascii ";") str) nil)
     (progn
              (setq str (strcat "{" (substr str (+ (vl-string-position (ascii ";") str) 2))))
              (setq ent_alst (subst (cons 1 str) (assoc 1 ent_alst) ent_alst))
     )
   )
        )
      )
      (entmod ent_alst)
      (entupd ent)
      (setq indx (1+ indx))
    )
  )
  (command "_.regen")
  (command "_.undo" "end")
  (setvar "textstyle" "NOTES")
  (setvar "cmdecho" 1)
  (princ)
)

(defun fixtxtstyle (txtsty / txtsty)
  (setq txtsty (entget (tblobjname "STYLE" txtsty)))
  (setq txtsty (subst (cons 41 0.7) (assoc 41 txtsty) txtsty))
  (setq txtsty (subst (cons 3 "simplex.shx") (assoc 3 txtsty) txtsty))
  (entmod txtsty)
)
(defun C:fx1 ( / stylist txtstyle ss indx ent ent_alst str)
  (setvar "cmdecho" 0)
  (command "_.undo" "be")
  (setq stylist '("DWGTITLES" "RMNAMES"))
 
  (while (/= stylist nil)
    (setq txtstyle (car stylist))
    (if (= (tblsearch "STYLE" txtstyle) nil)
      (command "-style" txtstyle "Swis721 BT.shx" 0 0.7 0 "No" "No" "No")
      (fixtxtstyle txtstyle)
    )
    (setq stylist (cdr stylist))
  )
  (setq ss (ssget "X" '((0 . "TEXT,MTEXT")
                (7 . "DWGTITLES,RMNAMES"))))
  (setq indx 0)
  (if (/= ss nil)
    (while (<= indx (- (sslength ss) 1))
      (setq ent (ssname ss indx))
      (setq ent_alst (entget ent))
      (cond
        ((= (cdr (assoc 0 ent_alst)) "TEXT")
          (setq ent_alst (subst (cons 41 0.7) (assoc 41 ent_alst) ent_alst))
        )
        ((= (cdr (assoc 0 ent_alst)) "MTEXT")
          (setq str (cdr (assoc 1 ent_alst)))
          (if (/= (vl-string-position (ascii ";") str) nil)
     (progn
              (setq str (strcat "{" (substr str (+ (vl-string-position (ascii ";") str) 2))))
              (setq ent_alst (subst (cons 1 str) (assoc 1 ent_alst) ent_alst))
     )
   )
        )
      )
      (entmod ent_alst)
      (entupd ent)
      (setq indx (1+ indx))
    )
  )
  (command "_.regen")
  (command "_.undo" "end")
  (setvar "textstyle" "DWGTITLES")
  (setvar "cmdecho" 1)
  (princ)
)

(defun fixtxtstyle (txtsty / txtsty)
  (setq txtsty (entget (tblobjname "STYLE" txtsty)))
  (setq txtsty (subst (cons 41 0.7) (assoc 41 txtsty) txtsty))
  (setq txtsty (subst (cons 3 "Swis721 BT.shx") (assoc 3 txtsty) txtsty))
  (entmod txtsty)
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Text Lisp Help needed
« Reply #21 on: April 26, 2005, 07:34:45 PM »
Try This.
Code: [Select]
;;; Date Modified: 04/22/05
;;; By Whom: Bcrouse

(defun C:fx ( / stylist txtstyle ss indx ent ent_alst str fixtxtstyle)
  (defun fixtxtstyle (txtsty)
    (setq txtsty (entget (tblobjname "STYLE" txtsty)))
    (setq txtsty (subst (cons 41 0.7) (assoc 41 txtsty) txtsty))
    (setq txtsty (subst (cons 3 "simplex.shx") (assoc 3 txtsty) txtsty))
    (entmod txtsty)
  )
 
  (setvar "cmdecho" 0)
  (command "_.undo" "be")
  (setq stylist '("NOTES" "DWGTITLES" "DWGTITLE" "HANDDWGTITLE" "HANDWGTITLES" "HANDWGTITLE" "RMNAMES"))
 
  (while (/= stylist nil)
    (setq txtstyle (car stylist))
    (if (= (tblsearch "STYLE" txtstyle) nil)
      (command "-style" txtstyle "simplex.shx" 0 0.7 0 "No" "No" "No")
      (fixtxtstyle txtstyle)
    )
    (setq stylist (cdr stylist))
  )
  (setq ss (ssget "X" '((0 . "TEXT,MTEXT")
                (7 . "NOTES,DWGTITLES,DWGTITLE,HANDWGTITLE,HANDDWGTITLEs,HANDWGTITLEs,RMNAMES"))))
  (setq indx 0)
  (if (/= ss nil)
    (while (<= indx (- (sslength ss) 1))
      (setq ent (ssname ss indx))
      (setq ent_alst (entget ent))
      (cond
        ((= (cdr (assoc 0 ent_alst)) "TEXT")
          (setq ent_alst (subst (cons 41 0.7) (assoc 41 ent_alst) ent_alst))
        )
        ((= (cdr (assoc 0 ent_alst)) "MTEXT")
          (setq str (cdr (assoc 1 ent_alst)))
          (if (/= (vl-string-position (ascii ";") str) nil)
         (progn
              (setq str (strcat "{" (substr str (+ (vl-string-position (ascii ";") str) 2))))
              (setq ent_alst (subst (cons 1 str) (assoc 1 ent_alst) ent_alst))
         )
       )
        )
      )
      (entmod ent_alst)
      (entupd ent)
      (setq indx (1+ indx))
    )
  )
  (command "_.regen")
  (command "_.undo" "end")
  (setvar "textstyle" "NOTES")
  (setvar "cmdecho" 1)
  (princ)
)





(defun C:fx1 ( / stylist txtstyle ss indx ent ent_alst str fixtxtstyle)
  (defun fixtxtstyle (txtsty )
    (setq txtsty (entget (tblobjname "STYLE" txtsty)))
    (setq txtsty (subst (cons 41 0.7) (assoc 41 txtsty) txtsty))
    (setq txtsty (subst (cons 3 "Swis721 BT.shx") (assoc 3 txtsty) txtsty))
    (entmod txtsty)
  )
  (setvar "cmdecho" 0)
  (command "_.undo" "be")
  (setq stylist '("DWGTITLES" "RMNAMES"))
 
  (while (/= stylist nil)
    (setq txtstyle (car stylist))
    (if (= (tblsearch "STYLE" txtstyle) nil)
      (command "-style" txtstyle "Swis721 BT.shx" 0 0.7 0 "No" "No" "No")
      (fixtxtstyle txtstyle)
    )
    (setq stylist (cdr stylist))
  )
  (setq ss (ssget "X" '((0 . "TEXT,MTEXT")
                (7 . "DWGTITLES,RMNAMES"))))
  (setq indx 0)
  (if (/= ss nil)
    (while (<= indx (- (sslength ss) 1))
      (setq ent (ssname ss indx))
      (setq ent_alst (entget ent))
      (cond
        ((= (cdr (assoc 0 ent_alst)) "TEXT")
          (setq ent_alst (subst (cons 41 0.7) (assoc 41 ent_alst) ent_alst))
        )
        ((= (cdr (assoc 0 ent_alst)) "MTEXT")
          (setq str (cdr (assoc 1 ent_alst)))
          (if (/= (vl-string-position (ascii ";") str) nil)
         (progn
              (setq str (strcat "{" (substr str (+ (vl-string-position (ascii ";") str) 2))))
              (setq ent_alst (subst (cons 1 str) (assoc 1 ent_alst) ent_alst))
         )
       )
        )
      )
      (entmod ent_alst)
      (entupd ent)
      (setq indx (1+ indx))
    )
  )
  (command "_.regen")
  (command "_.undo" "end")
  (setvar "textstyle" "DWGTITLES")
  (setvar "cmdecho" 1)
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Text Lisp Help needed
« Reply #22 on: April 27, 2005, 11:52:21 AM »
I need to add the Text Style before I do a text style merge.  I would like to add this to the lisp that is associated with this thread.  How would I go about doing this.  I know that I need to ensure that the font sylte is found.  But I don't know how to do that.  Can someone please point me in the right direct?  

Code: [Select]
(command "-style" "DWGTITLES"  "swis721 BT.shx" 1.20 0 "No" "No" "No")