We have a suite of LISPS we use for auto-populating MLEADERs that I've customized for different things and they've always worked as-is. I was handed the suite by the previous CAD op and haven't altered the main body of the code. Yesterday I finished writing a new LISP for INSERTing a block and prompting for the population of the block tags. After running the the new LISP none of the old suite of LISPS work.
So here's one of the original LISP sets for making a multileader:
Code:
(defun c:AIL ( / )
(varopen)
(setq Blname (car(entsel "\nSelect Suvrvey point:")))
(setq DEPTH () CODE () ELEVATION () SIZE () MATERIAL () NOTE () FLOW () )
(GA Blname)
(Coordw Blname)
(InvText Depth flow size material)
(COMMAND "-LAYER" "M" (strcat lay "_txt") "")
(COMMAND "_MLEADER" coord PAUSE TX)
(Varclose)
(prin1)
)
Code:
(defun InvText ( DEPTH Flow Size Material / )
(SETQ DIA "%%C") ; sets %%c (the diameter symbol) to the variable DIA used later in the code. this makes more sense of the variable names that contain dia ;
(IF (/= FLOW "UKN") (SETQ FFLOW (STRCAT FLOW " - ")) (SETQ FFLOW "") ) ; removes UKN direction from the variable FFlow and sets FFLOW as ["FLOW" + " - "] ;
(IF (/= SIZE "UKN") (setq Si_dia (strcat Size DIA " ")) (SETQ Si_dia "")) ; removes UKN size from the variable si_dia and replaces it with a null value "" ;
(if (/= Material "UKN") (setq Mat Material) (setq mat "") ) ; removes UKN material from the callouts and replaces it with a null value "" ;
(SETQ FLOW_SI_DIA_MAT (STRCAT FFLOW SI_DIA MAT) ) ; creates a variable string that is the total content of flow size dia and material ;
(setq H (atof depth))
(Setq G (rtos H 2 2))
(IF (/= FLOW_SI_DIA_MAT "") (setq Tx (strcat FLOW_si_dia_mat "\n\U+0028INV. -" G "\U+0029")) (SETQ TX (STRCAT "\U+0028INV. -" G "\U+0029"))) ; removes 1st line of callout if there's no data in the variable string ;
(princ)
This has always worked, inserting the MLEADERS into the correct layer for the point. This is the new LISP
Code:
; if this lisp isn't working make sure you haven't "flatten/joined" the data and check you're snapping to the insertion point of the lid points your trying to use ;
(DEFUN C:AVPOINT (/ XAV YAV ZAV COORD PITNUM PITSERV)
(setq ceho (getvar "CMDECHO"))
(setvar "CMDECHO" 1)
(setq blm (getvar "blipmode"))
(setvar "blipmode" 0)
(setq atd (getvar "attdia"))
(setvar "attdia" 0)
(setq OSM (getvar "osmode"))
(setvar "osmode" 64)
(setq cl (getvar "clayer"))
(setvar "clayer" "ELS_PIT_REPORT") ; sets the layer for the insertion point of the block to els_pit_report so it can be read by the pit table lisp ;
(SETQ PITNUM (GETREAL "PIT NUMBER: ")) ; prompts user for text input at the command bar for the pit number
(INITGET "STORMWATER,ST SEWER,SEW") ; sets the keywords and their abreviations appear after the , ;
(SETQ PITSERV (GETKWORD "\n[(STO)RMWATER/(SEW)ER:] ")) ; asks the user for command bar entry and shows abbreviations (STO)/(SEW) ;
(SETQ PT1 (GETPOINT "\nPick first point: ")) ; prompt for picking the first point on the screen ;
(SETQ PT2 (GETPOINT "\nPick second point: ")) ; prompt for picking the 2nd point on the screen ;
(SETQ XAV (RTOS (/ (+ (car pt1) (car pt2)) 2.0) 2 3) ) ; these three lines retieve the cordinates of the point in 3 different variables, average them and turn them into 3dec places numbers ;
(SETQ YAV (RTOS (/ (+ (cadr pt1) (cadr pt2)) 2.0) 2 3) )
(SETQ ZAV (RTOS (/ (+ (caddr pt1) (caddr pt2)) 2.0) 2 3) )
(SETQ COORD (STRCAT XAV "," YAV "," ZAV)) ; sets the coord variable to x,y,z for command line input during the command line entry below ;
(COMMAND "-INSERT" "PIT" COORD "0.5" "0.5" "0.000" PITNUM PITSERV) ; writes the command to insert the pit block i the order required as though you where doing it manually on the command line ;
(setvar "attdia" atd) ; these lines return the system variables back to the pre-function settings ;
(setvar "blipmode" blm)
(setvar "osmode" osm)
(setvar "CMDECHO" ceho)
(setvar "clayer" cl)
(PRINC)
)
This LISP works for inserting the block at the midpoint of 2 selected points, prompts the user for input and populates the tags in the block. However, when I returned to running the MLEADER LISPs now :
a) They fail at the layer definition point of the routine with "Enter name for new layer (becomes the current layer) <XXXXXXX>: ; error: bad argument type: stringp nil"" where XXXXXX is returned as the current layer ticked in the layer properties manager.
b) any of the newer LISPS I've created from the basic suite don't load through the acaddoc.lsp but they will load through appload and run the defun but as a) above.
This is the acaddoc.lsp
Code:
(load "C:\\CAD Custom\\LISP\\Affix.lsp")
(load "C:\\CAD Custom\\LISP\\All_BLOCKS_ALL.lsp")
(load "C:\\CAD Custom\\LISP\\ALL_COPY.lsp")
(load "C:\\CAD Custom\\LISP\\All_Depth.lsp")
(load "C:\\CAD Custom\\LISP\\All_Depth_circle.lsp")
(load "C:\\CAD Custom\\LISP\\ATVP.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Depth.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Depth_leader.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Invert.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Invert_leader.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Note.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Note_leader.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Size.lsp")
(load "C:\\CAD Custom\\LISP\\Auto_Size_leader.lsp")
(load "C:\\CAD Custom\\LISP\\Commands.lsp")
(load "C:\\CAD Custom\\LISP\\Coord.lsp")
(load "C:\\CAD Custom\\LISP\\CurScaleText.lsp")
(load "C:\\CAD Custom\\LISP\\DepthText.lsp")
(load "C:\\CAD Custom\\LISP\\ECoorE rev6.lsp")
(load "C:\\CAD Custom\\LISP\\final_publish.lsp")
(load "C:\\CAD Custom\\LISP\\FLAT_JOIN.lsp")
(load "C:\\CAD Custom\\LISP\\FO.lsp")
(load "C:\\CAD Custom\\LISP\\GetANG.lsp")
(load "C:\\CAD Custom\\LISP\\GetAtts.lsp")
(load "C:\\CAD Custom\\LISP\\Insert_pit_point.lsp")
(load "C:\\CAD Custom\\LISP\\Insert_PIT_Table.lsp")
(load "C:\\CAD Custom\\LISP\\Insert_Table.lsp")
(load "C:\\CAD Custom\\LISP\\Insert_Table_off.lsp")
(load "C:\\CAD Custom\\LISP\\InsPt.lsp")
(load "C:\\CAD Custom\\LISP\\InvText.lsp")
(load "C:\\CAD Custom\\LISP\\Job_Folder.lsp")
(load "C:\\CAD Custom\\LISP\\LAY_TAB_NAME.lsp")
(load "C:\\CAD Custom\\LISP\\MtextEntmake.lsp")
(load "C:\\CAD Custom\\LISP\\Multi_leader.lsp")
(load "C:\\CAD Custom\\LISP\\Prov_Point.lsp")
(load "C:\\CAD Custom\\LISP\\Si_Mat_Text.lsp")
(load "C:\\CAD Custom\\LISP\\Survey_Extract.lsp")
(load "C:\\CAD Custom\\LISP\\SWAP_TO_NOTE.lsp")
(load "C:\\CAD Custom\\LISP\\TextEntmake.lsp")
(load "C:\\CAD Custom\\LISP\\Textmove.lsp")
(load "C:\\CAD Custom\\LISP\\TextRot.lsp")
(load "C:\\CAD Custom\\LISP\\Text_Angle.lsp")
(load "C:\\CAD Custom\\LISP\\Update_PIT_TABLE.lsp")
(load "C:\\CAD Custom\\LISP\\Update_Table.lsp")
(load "C:\\CAD Custom\\LISP\\Update_Table_off.lsp")
(load "C:\\CAD Custom\\LISP\\Update_Table_Pit_off.lsp")
(load "C:\\CAD Custom\\LISP\\Var.lsp")
(load "C:\\CAD Custom\\LISP\\Pit_Entry_Text.lsp")
(load "C:\\CAD Custom\\LISP\\Pit_Entry.lsp")
(load "C:\\CAD Custom\\LISP\\Line_End.lsp")
(load "C:\\CAD Custom\\LISP\\Line_End_Text.lsp")
The customized ones are the last 4 entries in the list and require manual loading, the original suite MLEADER LISPs load from the acaddoc.lsp but fail as in a).
I'm at a total loss as to what the "ZZavpoint with layer etc.lsp" has done, have I reset a sysvar globally? or is it possible I've inadvertently changed something and it's coincidence that it's happened at the same time as adding the new lisp?
I've attached the relevant files and a sample drawing.
Any help will much appreciated.