Author Topic: Start up help  (Read 1832 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Start up help
« on: April 19, 2005, 04:10:00 PM »
I have this lisp that I would like make the changes when the drawing is opened.  What the lisp does is to change the text style to simplex and sets the width of the text to .7.  How would I add this to the main lisp and have it automatically update the text.

Here is the end of the main lisp.
Code: [Select]

)
); end cond
); end while
(princ)
); end defun
;;
;;
(princ) ;;; end of PHCMain.lsp
;;
;;

Quote
Here is the lisp that I would like to add.

Code: [Select]

(defun C:fx ( / stylist txtstyle ss indx ent ent_alst str)
  (setvar "cmdecho" 0)
  (command "_.undo" "be")
  (setq stylist '("NOTES" "DWGTITLE" "HANDDWGTITLE" "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" '((-4 . "<AND")(-4 . "<OR")(0 . "TEXT")(0 . "MTEXT")(-4 . "OR>")
      (-4 . "<OR")(7 . "NOTES")(7 . "DWGTITLE")(7 . "HANDDWGTITLE")
      (7 . "RMNAMES")(-4 . "OR>")(-4 . "AND>"))))
  (setq indx 0)
  (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)
)
Quote

Thank you,

Brad

One Shot

  • Guest
Start up help
« Reply #1 on: April 19, 2005, 04:33:35 PM »
I have figured it out.  But trying to figure if it will work when you publish?  I will get back to you all to see if I need help!


Thank you for all your help!!!!

One Shot

  • Guest
Start up help
« Reply #2 on: April 19, 2005, 05:03:55 PM »
Okay, how can I get this routine to update drawing that are Xrefed and how to get it to update when you publish?