Results 1 to 4 of 4

Thread: New LISP has topped existing LISPs working

  1. #1
    Member
    Join Date
    2018-03
    Posts
    12
    Login to Give a bone
    0

    Default New LISP has topped existing LISPs working

    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.
    Attached Files Attached Files

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: New LISP has topped existing LISPs working

    You have to troubleshoot acaddoc.lsp file until you find where lisps fail... Open VLIDE and OPEN acaddoc.lsp, set break on error check and click load... It should fail and then click go to break... Then one of lisps that are listed should open assuming that CAD can find them in SFSP pointing on line where break occurs... Then you have 2 ways of resolving this - 1st correct error - errors all until loading passes entirely, or 2nd remove that lisp from loading and load acaddoc.lsp until you succeed to load it correctly... You can then see what to do with conflicting lisps - exclude some bad code and fix it so that particular lisp loads correctly, and finally decide where to put it again in acaddoc.lsp - before your new lsp or after which is my preference... Finally maybe your newly created lisp is failing, so check it also for load and errors...
    Good luck,
    HTH., M.R.

  3. #3
    Member
    Join Date
    2018-03
    Posts
    12
    Login to Give a bone
    0

    Default Re: New LISP has topped existing LISPs working

    I found the offender

    In the process of investigating I checked out the Commands.lsp


    Code:
    (defun c:AD	()	 (load "C:/CAD Custom/LISP/auto_depth.lsp")  (c:AD))
    (defun c:ADL	()	 (load "C:/CAD Custom/LISP/auto_depth_leader.lsp")  (c:ADL))
    (defun c:AS	()	 (load "C:/CAD Custom/LISP/auto_size.lsp")  (c:AS))
    (defun c:ASL	()	 (load "C:/CAD Custom/LISP/auto_size_leader.lsp")  (c:ASL))
    (defun c:AN	()	 (load "C:/CAD Custom/LISP/auto_note.lsp")  (c:AN))
    (defun c:ANL	()	 (load "C:/CAD Custom/LISP/auto_note_leader.lsp")  (c:ANL))
    (defun c:AI	()	 (load "C:/CAD Custom/LISP/auto_invert.lsp")  (c:AI))
    (defun c:AIL	()	 (load "C:/CAD Custom/LISP/auto_invert_Leader.lsp")  (c:AIL))
    
    (defun c:ALD	()	 (load "C:/CAD Custom/LISP/ALL_DEPTH.lsp")  (c:ALD))
    
    (defun c:AC	()	 (load "C:/CAD Custom/LISP/ALL_COPY.lsp")  (c:AC))
    (defun c:FJ	()	 (load "C:/CAD Custom/LISP/FLAT_JOIN.lsp")  (c:FJ))
    (defun c:ABL	()	 (load "C:/CAD Custom/LISP/ALL_BLOCKS_ALL.lsp")  (c:ABL))
    
    (defun c:PROV	()	 (load "C:/CAD Custom/LISP/PROV_POINT.lsp")  (c:PROV))
    (defun c:INTAB	()	 (load "C:/CAD Custom/LISP/INSERT_TABLE.lsp")  (c:INTAB))
    (defun c:UPTab	()	 (load "C:/CAD Custom/LISP/UPDATE_TABLE.lsp")  (c:UPT))
    (defun c:UPPT	()	 (load "C:/CAD Custom/LISP/UPDATE_PIT_TABLE.lsp")  (c:UPPT))
    (defun c:POUT	()	 (load "C:/CAD Custom/LISP/Survey_Extract.lsp")  (c:POUT))
    (defun c:PTPO	()	 (load "C:/CAD Custom/LISP/Insert_pit_point.lsp")  (c:PTPO))
    (defun c:PTTAB	()	 (load "C:/CAD Custom/LISP/Insert_PIT_Table.lsp")  (c:PTTAB))
    (defun c:NOTE	()	 (load "C:/CAD Custom/LISP/SWAP_TO_NOTE.lsp")  (c:NOTE))
    
    (defun c:INtaboff	()	 (load "C:/CAD Custom/LISP/Insert_Table_off.lsp")  (c:InTaboff))
    (defun c:Uptaboff	()	 (load "C:/CAD Custom/LISP/Update_Table_off.lsp")  (c:UpTaboff))
    (defun c:UptabPitOff	()	 (load "C:/CAD Custom/LISP/Update_Table_Pit_off.lsp")  (c:UptabPitOff))
    
    (defun c:FO	()	 (load "C:/CAD Custom/LISP/FO.lsp")  (c:FO))
    (defun c:COL	()	 (load "C:/CAD Custom/LISP/LAY_TAB_NAME.lsp")  (c:COL))
    (defun c:NL	()	 (load "C:/CAD Custom/LISP/LAY_TAB_NAME.lsp")  (c:NL))
    
    (defun c:COOR	()	 (load "C:/CAD Custom/LISP/ECoorE rev6.lsp")  (c:COOR))
    (defun c:COORT	()	 (load "C:/CAD Custom/LISP/ECoorE rev6.lsp")  (c:COORT))
    
    (defun c:TIT	()	 (load "C:/CAD Custom/LISP/Text_Angle.lsp")  (c:TIT))
    (defun c:FP	()	 (load "C:/CAD Custom/LISP/Final_Publish.lsp")  (c:FP))
    (defun c:JOBF	()	 (load "C:/CAD Custom/LISP/Job_Folder.lsp")  (c:JOBF))
    
    
    (load "C:/CAD Custom/LISP/Var.lsp")
    (load "C:/CAD Custom/LISP/TextRot.lsp")
    (load "C:/CAD Custom/LISP/Textmove.lsp")
    (load "C:/CAD Custom/LISP/Textentmake.lsp")
    (load "C:/CAD Custom/LISP/Mtextentmake.lsp")
    (load "C:/CAD Custom/LISP/Si_Mat_Text.lsp")
    (load "C:/CAD Custom/LISP/InvText.lsp")
    (load "C:/CAD Custom/LISP/InsPt.lsp")
    (load "C:/CAD Custom/LISP/GetAtts.lsp")
    (load "C:/CAD Custom/LISP/GetAng.lsp")
    (load "C:/CAD Custom/LISP/DepthText.lsp")
    (load "C:/CAD Custom/LISP/CurScaleText.lsp")
    (load "C:/CAD Custom/LISP/Coord.lsp")
    (load "C:/CAD Custom/LISP/GetAtts.lsp")
    
    
    
    
    (defun LM:copyfolder ( src des ovr / fso rtn )
        (if (setq fso (vlax-create-object "scripting.filesystemobject"))
            (progn
                (setq rtn
                    (not
                        (or (zerop (vlax-invoke fso 'folderexists src))
                            (vl-catch-all-error-p
                                (vl-catch-all-apply 'vlax-invoke
                                    (list fso 'copyfolder src des (if ovr :vlax-true :vlax-false))
                                )
                            )
                        )
                    )
                )
                (vlax-release-object fso)
                rtn
            )
        )
    )
    (vl-load-com)
    
    (LM:copyfolder "P:/CAD SURVEY/Custom" "C:/CAD Custom" T)
    I understand the last section allows each user to copy any revised LISPs down from the server but what is the purpose of having a LSIP that loads/defines the commands? If the acaddoc.lsp prompts the loading of the LISPS, each LISP defun's the command, is this double dipping on the LISP loading? Or is this LISP required for setting commands on custom ribbon entities?

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: New LISP has topped existing LISPs working

    Yes. The method in which your system is set appears to load the autolisp files, and then redefines those commands which then reloads those files when the command is executed. That appears to be true all the way up to the loading of your Commands.lsp file.

    Your system could be overhauled to utilize the Autoload function. You would need to know all of the commands contained in each file you intend to load. This would create the dummy command, which would then load the autolisp file and then execute it on demand.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. Lisp to call other lisps
    By Alcapone in forum AutoLISP
    Replies: 2
    Last Post: 2016-11-22, 07:43 PM
  2. Existing layer lisp
    By mitchellvoss in forum AutoLISP
    Replies: 3
    Last Post: 2016-10-24, 02:07 PM
  3. Lisps Stop Working
    By mbrandt5 in forum AutoLISP
    Replies: 21
    Last Post: 2015-09-25, 02:17 PM
  4. 2013: Help with existing LISP routine
    By KLH1969 in forum AutoLISP
    Replies: 9
    Last Post: 2013-02-21, 03:49 PM
  5. Working with Existing and New Grids
    By tstine in forum Revit Architecture - General
    Replies: 8
    Last Post: 2005-08-06, 11:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •