What code would you like to see? The code for the non working lisp or the code for ACAD.lsp?
Again, this works when it is apploaded. It just will not work after autocad loads a file until I appload. He is the code for the non functioning lisp:
;; This code takes the last 3 digits of the filename
;; and puts them on the tag SHT_NO_1 on tb supplied
;; by Ford
;; It writes the FILE_NAME tag from the
;; system variable dwgname
;; The rest of the variables are written
;; out from a sample sheet into a file
;; called ttlblk.txt written in the homedir of
;; the drawing file
;;for kits added 4/17/08
(defun C:NG_KFTBIN ( / unit)
(setq unit "1A10")
(FTB UNIT)
)
(defun C:NGK ( / unit)
(setq unit "1A10")
(FTB UNIT)
)
;;for pneumatics
(defun C:NG_PFTBIN ( / unit)
(setq unit "1A7")
(FTB UNIT)
)
(defun C:NGP ( / unit)
(setq unit "1A7")
(FTB UNIT)
)
;; for water
(defun C:NG_WFTBIN ( / unit)
(setq unit "1A8")
(FTB UNIT)
)
(defun C:NGW ( / unit)
(setq unit "1A8")
(FTB UNIT)
)
;; SHORTCUT FOR LEE
(defun C:NG_IN ()
(print " in in")
(C:FTBIN)
)
;; for electric
(defun C:NGFTBIN ( / unit)
(PRINT "IN FTBIN")
(setq unit "1A5")
(FTB UNIT)
)
(defun FTB (UNIT / dwgnme homedir desclgth dwglen startpnt dwgnm len_dwgnm)
(setq dwgnme (getvar "DWGNAME"))
(setq homedir (getvar "DWGPREFIX"))
(setq ttlfil (strcat homedir "NGtitleblk.txt")
f (open ttlfil "r")
)
(print "dwgname is ")(print dwgnme)
(print "homedir is ")(print homedir)
(print "ttfil is ")(print ttlfil)
; ;(setq len_dwgnm 3) ;; char needed for last digits to get drawing num -- 3 usually
; ;; 4 when you have an A, B or C in name
;
; ;(print "homedir is ")(print homedir)
; ;(print "ttfil is ")(print ttfil)
; ;(print "f is ") (print f)
; ;(command "style" "standard" "ford_ba" "" "" "" "" "" "") ;make sure that standard is set to Ford font
;
; (setq desclgth (strlen DWGNME))
; ;(PRINC DESCLGTH)
; (setq dwglen (- desclgth 4)) ; length without .dwg -- 4 digits
; (setq startpnt (- dwglen 2)) ; puts you at the start of the number part of drawing name
; (setq DWGNM (substr DWGNME startpnt 3)) ;sheet number digits are usually 3
;
; ; (setq len_unit 😎 ; puts you at the start of the number part of drawing name
; (setq len_unit 😎 ; puts you at the start of the number part of drawing name
; (setq unit_stpnt (- dwglen (- len_unit 1 ))) ; puts you at the start of the number part of drawing name
;
; ;(print "abefore first cond dwgnm is ")(print dwgnm)
; ;; ADDED THIS SECTION BECAUSE WE HAVE DRAWINGS WITH A,B,C - PER MIKE
;
; (cond
; ((= "A" (strcase (substr DWGNM 3 1)))(print (substr DWGNM 3 1))
; (setq len_dwgnm 4)(setq startpnt (- startpnt 1)))
; ((= "B" (strcase (substr DWGNM 3 1)))(print (substr DWGNM 3 1))
; (setq len_dwgnm 4)(setq startpnt (- startpnt 1)))
; ((= "C" (strcase (substr DWGNM 3 1)))(print (substr DWGNM 3 1))
; (setq len_dwgnm 4)(setq startpnt (- startpnt 1)))
; ((= "D" (strcase (substr DWGNM 3 1)))(print (substr DWGNM 3 1))
; (setq len_dwgnm 4)(setq startpnt (- startpnt 1)))
;
;
;
; );END COND
;; 12/2009 -- changed file name from the file name to just the last 8 digits with the .dwg extension
; (setq UNITNM (strcase (substr DWGNME unit_stpnt len_unit))) ;sheet number digits are usually 3
;
; (setq DWGNM (strcase (substr DWGNME startpnt len_dwgnm))) ;sheet number digits are usually 3
; (print "before strip dwgnm") (print DWGNM)
;
; ;;strip out leading zeros for entry into the sheet attribute
; (cond
; ((= "00" (substr DWGNM 1 2)) (setq DWGNM (substr DWGNM 3 (- len_dwgnm 2))))
; ((= "0" (substr DWGNM 1 1)) (setq DWGNM (substr DWGNM 2 (- len_dwgnm 1))))
;
; );end cond
;(setq DWGNM (strcat UNIT DWGNM)) ;add the 1A5 for electrical
(print "dwgnm after cat is ")(print dwgnm)
;call the tags that we choose to keep the
;same in all drawings that we wrote out to
;ttlblk.txt in Ford_TB_OUT
(print "before call to TAGFIND")
(setq newv (read-line f))
(print "first newv is")(print newv)
(TAGFIND "TITLE_LINE1" newv)
(setq newv (read-line f))
(print "2nd newv is")(print newv)
(TAGFIND "TITLE_LINE2" newv)
(setq newv (read-line f))
(TAGFIND "TITLE_LINE3" newv)
(setq newv (read-line f))
(TAGFIND "TITLE_LINE4" newv)
(setq newv (read-line f))
(TAGFIND "DESIGN_SOURCE" newv)
(setq newv (read-line f))
;(print "first newv before ttl_sht is")(print newv)
(TAGFIND "TTL_SHT" newv)
(setq newv (read-line f))
;(print "first newv before DES_BY is")(print newv)
(TAGFIND "DES_BY" newv)
(setq newv (read-line f))
(TAGFIND "DET_BY" newv)
(setq newv (read-line f))
(TAGFIND "DATE_TB" newv) ;GAVE A NEW TAG NAME -- MIGHT CONFLICT WITH SYSTEM NAME
;(TAGFIND "DATE" newv) ;GAVE A NEW TAG NAME -- MIGHT CONFLICT WITH SYSTEM NAME
(setq newv (read-line f))
(TAGFIND "PROGRAM_NAME" newv)
(setq newv (read-line f))
(TAGFIND "CHK_BY" newv)
(setq newv (read-line f))
(TAGFIND "ZF_NO_1" newv)
(setq newv (read-line f))
;;added variables 12/2009 for NextGen Titleblock
(print "before reading new variables and newv is ")(print newv)
(TAGFIND "BUILD_SOURCE" newv)
(setq newv (read-line f))
(TAGFIND "SAFETY" newv)
(setq newv (read-line f))
;(TAGFIND "DIV_NAME" newv)
;(setq newv (read-line f))
;(TAGFIND "PLANT_NAME" newv)
;(setq newv (read-line f))
;(TAGFIND "LOC_ACT" newv)
;(setq newv (read-line f))
(TAGFIND "BUILD_STATUS" newv)
(setq newv (read-line f))
(TAGFIND "SHOP_ORDER_RIGHT" newv)
(print "before last read ")
(setq newv (read-line f))
(print "after last Read newv is ")(print newv)
(TAGFIND "SHOP_ORDER_LEFT" newv)
(print "after last read newv is ")(print newv)
;;these 2 tags are taken from system variables
;(setq dwgnme (strcat homedir dwgnme))
(TAGFIND "FILE_NAME" dwgnme);dwgname
;(TAGFIND "FILE_NAME" UNITNM);dwgname
(TAGFIND "SHT_NO_1" dwgnm) ;;last 3 digits with leading zeros removed
(TAGFIND "DWGSECTION1" unit) ;;last 3 digits with leading zeros removed
;(print "at end of TAGFIND")
(close f)
) ; end dname
;;
;; Globally Modifies Tag Values, All Blocks
;;===========================================================
(defun TAGFIND (tagname newv / tagname ss1 len count bn en el found attstr)
;=================create selection set=======================
(setq ss1 (ssget "x" '((0 . "insert") (66 . 1)))
len (sslength ss1)
count 0
)
(repeat len
(setq bn (ssname ss1 count) ;Block Name
en (entnext bn) ;Entity Name
el (entget en)) ;Entity List
;=================loop thru block entities===================
(while (and (= "ATTRIB" (dxf 0 el))
(/= "SEQEND" (dxf 0 el)))
;(print "(dxf 2 el) before if is ")(print (dxf 2 el))
(if (= (dxf 2 el) (strcase tagname))
(progn
;print "(dxf 2 el) is ")(print (dxf 2 el))
(setq attstr (dxf 1 el))
;print "(dxf 1 el) is ")(print (dxf 1 el))
;(print "attstr is ")(print attstr)
(setq el (subst (cons 1 newv) (assoc 1 el) el))
(entmod el) ;Modify List
(entupd bn) ;Update Screen
(setq found "yes") ;Found Tag?
);progn
) ;if
(setq en (entnext en)
el (entget en))
);while
(setq count (1+ count))
;(print "before repeat")
) ;repeat
(if (/= found "yes")
(princ "\nTag Not Found.")
)
;(princ "at end of TAGFIND")
);defun TAGFINDt.lsp
;======================dxf function==========================
(defun dxf (code elist)
(cdr (assoc code elist))
);dxf
(princ)
;============================================================
QSAVE
and here is the code for acad.lsp:
;Revised 03/21/2023
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun s::startup ()
(load "InsertBlocks.lsp")
(load "revcloud.lsp")
(load "ac_bonus.lsp")
(print "after revcloud")
(load "BUB-NOTE.lsp")
(load "chspace.lsp")
(load "julian.lsp")
(load "METALSA_TB_OUT.lsp")
(print "after met tb out")
(load "Challenge_TB_In.lsp")
(print "after challenge tb in")
(load "Challenge_TB_Out.lsp")
(print "after challenge tb out")
(load "FD_NG_TB_IN.lsp")
(print "after ngftbin")
(load "FD_NG_TB_OUT.lsp")
(print "after ngftbout")
(load "METALSA_TB_IN.lsp")
(print "after metalsa tb in")
(load "LEN_LINE_FOR_CABLE.lsp")
(load "pl2.lsp")
(load "shortcut.lsp")
(load "anyplot.lsp")
;(load "maketags.lsp")
;(load "gmaketags.lsp")
(load "L:\\9-ControlsDesign\\TAGS\\LISP\\MAKETAGS.LSP" "MakeTagsLisp Failed to Load")
(load "L:\\9-ControlsDesign\\TAGS\\LISP\\GMAKETAGS.LSP" "GMakeTagsLisp Failed to Load")
;(defun c:MAKETAGS() ;DEFINITION OF COMMAND TO BE ENTERED, IN THIS CASE "MAKETAGS"
; (vl-vbarun "L:/9-ControlsDesign/TAGS/VB/StartTags.dvb!Module1.StartTags") ;CALLS THE .dvb FILE TO RUN FROM THE 'SUPPORT' FOLDER
; ;"Support" IS THE FOLDER
; ;"StartTags.dvb" IS THE ACTUAL VBA FILE
; ;"Module1" IS WHERE THE START SCRIPT IS LOCATED
; ;"StartTags" IS THE NAME OF THE FIRST SUB TO BE CALLED
; (princ))
(print "made it to the end")
)
Thanks,
RH