Error, Malformed String on Input

Error, Malformed String on Input

raceharder
Enthusiast Enthusiast
1,875 Views
6 Replies
Message 1 of 7

Error, Malformed String on Input

raceharder
Enthusiast
Enthusiast

Autocad 2021.  I am getting a "exited:  malformed string on input" when my acad.lsp loads.  Acad.lsp contains the following:

 

(defun s::startup ()
(load "InsertBlocks.lsp")
(load "revcloud.lsp")
(load "METALSA_TB_OUT.lsp")
(load "Challenge_TB_In.lsp")
(load "Challenge_TB_Out.lsp")
(load "FD_NG_TB_IN.lsp")
(load "FD_NG_TB_OUT.lsp")
(load "METALSA_TB_IN.lsp")
)

 

I have searched the interwebs for an answer/solution, but I have been unable to determine my issue. 

 

Any help is greatly appreciated.

 

Thanks in advance.

 

RH

0 Likes
Accepted solutions (1)
1,876 Views
6 Replies
Replies (6)
Message 2 of 7

raceharder
Enthusiast
Enthusiast

I have determined that my error is within the Challenge_TB_Out.lsp.  I still am unable to determine what, exactly the issue is.

 

Here is a copy of the code:

 

(defun C:CHTBout ()
(print "you are in K: ftbout")
(setq dwgnme (getvar "DWGNAME"))
(setq homedir (getvar "DWGPREFIX"))
(print "looking for the next line")
(print homedir)
(setq ttlfil (strcat homedir "\\Challengetitleblk.txt"))
; (setq ttlfil (strcat homedir "Challengetitleblk.txt")
(setq ttlfil (open ttlfil "w"))
;THERE WAS AN EXTRA ")" AT THE BEGINNING OF THIS LINE THAT I REMOVED
;SO THAT THE LOAD_ALL_LISP FILE DOESN'T THROW A SYNTAX ERROR
;J.SHORT 05.13.19

(print "after setting ttfil and it is ") (print ttlfil)

; These are the tags that we want
; variables copied to each drawing the in package
;(print "before TAGSOUT")
(print "before TAGSOUT")
(TAGSOUT "Name")
(print "after title_line1 to TAGSOUT")
(TAGSOUT TITLE-CUSTOMER")
(TAGSOUT "TITLE-DESLDR1")
(TAGSOUT "TITLE-DESLDR2")
(TAGSOUT "TITLE-DESSRC1")
(TAGSOUT "TITLE-DESSRC2")
(TAGSOUT "TITLE-DIVISION")
(TAGSOUT "TITLE-DWGNUM")
;(TAGSOUT "DATE_TB")
(TAGSOUT "TITLE-ENG1")
;(print "calling tagsout with date ")
(TAGSOUT "PROGRAM_NAME")
(TAGSOUT "TITLE-ENG2")
(TAGSOUT "TITLE-PACKAGE-DESCRIPTION-LINE1")

;(print "after call to TAGSOUT")
;added 12/2009 for NextGen Titleblock
(TAGSOUT "TITLE-PACKAGE-DESCRIPTION-LINE2")
(TAGSOUT "TITLE-PROG-BOTTOMLINE")
;(TAGSOUT "DIV_NAME")
;(TAGSOUT "PLANT_NAME")
;(TAGSOUT "LOC_ACT")
(TAGSOUT "TITLE-PROGMIDDLELINE")
(TAGSOUT "TITLE-PROGTOPLINE")
(TAGSOUT "TITLE-RELDATE")
(TAGSOUT "TITLE-REVDATE")
(TAGSOUT "TITLE-REVLETTER")
(TAGSOUT "TITLE-SECTION")
(TAGSOUT "TITLE-SHEETNUM")
(TAGSOUT "TITLE-SHT-DESCRIPTION-LINE1")
(TAGSOUT "TITLE-SHT-DESCRIPTION-LINE2")
(TAGSOUT "TITLE-SYS/TOOL")
(TAGSOUT "TITLE-TOTSHEET")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(close ttlfil)


) ; end FTBout

 


;;
;;Finds Tag Values, All Blocks
;;===========================================================
(defun TAGSOUT (tagname / newv ss1 len count bn en el found attstr)
;(defun TAGSOUT (tagname)
;=================create selection set=======================
(print "at top of TAGSOUT tagname is ") (print tagname)
(setq ss1 (ssget "x" '((0 . "insert") (66 . 1)))
len (sslength ss1)
count 0
)
;(print "len is ")(print len)

(repeat len
;(print "in 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)

(write-line attstr ttlfil)
;(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 TAGSOUT")
);defun TAGSOUTout.lsp

 

 

 

;======================dxf function==========================
(defun dxf (code elist)
(cdr (assoc code elist))
);dxf
(princ)
;============================================================

 

Once again, any help is greatly appreciated.

 

Thanks,

 

RH

 

 

0 Likes
Message 3 of 7

dbroad
Mentor
Mentor
Accepted solution

(TAGSOUT TITLE-CUSTOMER")

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 4 of 7

raceharder
Enthusiast
Enthusiast

Thanks man........I've been looking at this for hours and never saw that.  All good now.  Thanks again.

0 Likes
Message 5 of 7

Sea-Haven
Mentor
Mentor

This reminds me of an old check brackets that I wrote for finding missing quotes etc I might revisit it and add look for "" pairs just a case of which character to look for. So { } () and ""

 

Its something I often get and would be handy.

 

; look for double qoutes
; By Alan H
(defun c:chkbrk ( / )
(setvar "cmdecho" 0)
(alert "\nlook at file\n\n to see how many open brackets\n\nlook for missing at end of lines")
(SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))
(setq opf (open chekdfile "r"))
(setq wkfile (open (strcat chekdfile "-copy.lsp") "w"))
(while
(setq currentln (read-line opf))
(setq x 1)
(setq bkt 0)
(while (< X (strlen currentln))
(repeat (strlen currentln)
(princ (strcat "\n" (setq ltr (substr currentln x 1))))
(if (= ltr "\"")(setq bkt (1+ bkt)))
(if (= bkt 2) (setq bkt 0))
(setq x (1+ x))
)
)
(setq ncln (strcat currentln "-" (rtos bkt 2 0)))
(princ (rtos bkt))
(write-line ncln wkfile)
)
(close wkfile)
(close opf)
(princ)
)
(c:chkbrk)

 

0 Likes
Message 6 of 7

dbroad
Mentor
Mentor

No worries. I have the same problem from time to time.  If you use vlide, the color coding can help find these errors since strings show up as a unique color.  It was easy to find on this thread. I just searched for " and it highlighted every quote.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

Thanks Dbroad, I rarely use Vlide but Notepad++ can do similar. Click on end of line.

 

SeaHaven_0-1679539848198.png

 

SeaHaven_1-1679539897031.png

Its a bit clunky.

 

0 Likes