Author Topic: Reactor Removal  (Read 2280 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Reactor Removal
« on: April 28, 2005, 03:44:07 PM »
I needed to remove the reactor in this lisp.  Here is the lisp before I removed it.:

Code: [Select]

;;; Date Modified: 04/26/05
;;; By Whom: Bcrouse

;;  To see the styles in a DWG enter -style at the command line, then ?


;;  This changes text & Mtest from one style to another
;;  The old style is still in the drawing

(defun c:BCtxtfix ()
  (command "_.undo" "begin")
  (StyleChange "DWGTITLE" "DWGTITLES")
  (StyleChange "HANDDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLES" "DWGTITLES")
  (StyleChange "HANSHTITLES" "RMNAMES")
  (command "_.-purge"
           "textstyles"
           "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLEs,HANSHTITLES"
           "N"
  )
  (command "_.regen")
  (command "_.undo" "end")
  (princ)
)


(defun StyleChange (OlSty NuSty / n ss entList NextEnt)
  (setq OlSty (strcase OlSty)) ; force upper case
  (setq NuSty (strcase NuSty))
  ;;build a filter to select only text with that style
  ;;Note: DXF group code 7 is the style of a text entity
  ;;     0 is the entity type

  (cond
    ((null (setq ss (ssget "X"
                           (list '(0 . "TEXT,MTEXT")
                                 (cons 7 OlSty)
                           )
                    )
           )
     ) ;put the text in a selection set.
     (alert (strcat "Found No text with style " OlSty))
    )
    ;;check and make sure NuSty exist
    ((tblsearch "STYLE" NuSty)
     (setq n 0) ;set a counter
     ;;loop until all ents changed
     (while (setq NextEnt (ssname ss n)) ;grab the first ent in the ss
       (setq EntList (entget NextEnt)) ;get the list
       (setq EntList (subst (cons 7 NuSty)
                            (assoc 7 EntList)
                            EntList)) ;replace it in the list  
       (entmod EntList) ;change the ent
       (entupd (cdr (assoc -1 EntList))) ;update the screen
       (setq n (1+ n)) ;increment
     ) ;_ end of while
     (alert (strcat (itoa n) " Items Changed "))
    )
    (T ;otherwise you blew it.
     (alert (strcat "Hey You,\n\n" NuSty " doesn't exist!"))
    )
  );_ end of cond
  (setvar "cmdecho" 1)
  (princ)
) ;_ end of defun



Here is the modified lisp with the reactors removed.  Did I do that correctly.  If not, please point me in the right direction.:

Code: [Select]

;;; Date Modified: 04/27/05
;;; By Whom: Bcrouse

;;  To see the styles in a DWG enter -style at the command line, then ?


;;  This changes text & Mtest from one style to another
;;  The old style is still in the drawing

(defun c:BCtxtfix ()
  (command "_.undo" "begin")
  (StyleChange "DWGTITLE" "DWGTITLES")
  (StyleChange "HANDDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLES" "DWGTITLES")
  (StyleChange "HANSHTITLES" "RMNAMES")
  (command "_.-purge"
           "textstyles"
           "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLEs,HANSHTITLES"
           "N"
  )
  (command "_.regen")
  (command "_.undo" "end")
  (princ)
)


(defun StyleChange (OlSty NuSty / n ss entList NextEnt)
  (setq OlSty (strcase OlSty)) ; force upper case
  (setq NuSty (strcase NuSty))
  ;;build a filter to select only text with that style
  ;;Note: DXF group code 7 is the style of a text entity
  ;;     0 is the entity type

  (cond
    ((null (setq ss (ssget "X"
                           (list '(0 . "TEXT,MTEXT")
                                 (cons 7 OlSty)
                           )
                    )
           )
     ) ;put the text in a selection set.
    )
    ;;check and make sure NuSty exist
    ((tblsearch "STYLE" NuSty)
     (setq n 0) ;set a counter
     ;;loop until all ents changed
     (while (setq NextEnt (ssname ss n)) ;grab the first ent in the ss
       (setq EntList (entget NextEnt)) ;get the list
       (setq EntList (subst (cons 7 NuSty)
                            (assoc 7 EntList)
                            EntList)) ;replace it in the list  
       (entmod EntList) ;change the ent
       (entupd (cdr (assoc -1 EntList))) ;update the screen
       (setq n (1+ n)) ;increment
     ) ;_ end of while
   );_ end of cond
  (setvar "cmdecho" 1)
  (princ)
) ;_ end of defun


Thank you for all of you help.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Reactor Removal
« Reply #1 on: April 28, 2005, 03:59:30 PM »
Are you referring to the lines that start with;
Code: [Select]
(alert...)
if so just add a ';' (semi-colon) in front of them and then run the program. Is that what you want?
TheSwamp.org  (serving the CAD community since 2003)

One Shot

  • Guest
Reactor Removal
« Reply #2 on: April 28, 2005, 04:19:49 PM »
Quote from: Mark Thomas
Are you referring to the lines that start with;
Code: [Select]
(alert...)
if so just add a ';' (semi-colon) in front of them and then run the program. Is that what you want?


Mark,


Yes that is correct.  Thank you for your help.

Brad