See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Loading .lsp error caused by palettes?

  1. #1
    Login to Give a bone
    0

    Default Loading .lsp error caused by palettes?

    I wrote a lisp routine and made a button to load and start the routine. It works fine on my computer, but doesnt work on my colleague's computer unless I load the routine manually in the command line. Once i do that, the button works as intended. The only difference i can tell is that i am using a "classic" style setup without palettes and using menus and toolbars, while my colleague is using palettes. We are both using Autocad 2019. Macro is ^c^c(load "dtlcallout.lsp");^c^cdtlcallout
    I dont recall the exact error message on my colleague's computer, but it says something like stringp nil unknown command. Any help is appreciated.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,665
    Login to Give a bone
    0

    Default Re: Loading .lsp error caused by palettes?

    The problem is probably your macro is canceling immediately after (load "dtlcallout.lsp") is called.
    The ^c^c that's in new macros by default is to cancel existing commands. I've never seen it used a second time in a macro before.
    Change the macro to ^c^c(load "dtlcallout.lsp");dtlcallout
    Maybe you're able to load the routine locally without issue and his PC is taking longer because it's being loaded from the network or deeper down in his support path.

  3. #3
    Login to Give a bone
    0

    Default Re: Loading .lsp error caused by palettes?

    Quote Originally Posted by Tom Beauford View Post
    The problem is probably your macro is canceling immediately after (load "dtlcallout.lsp") is called.
    The ^c^c that's in new macros by default is to cancel existing commands. I've never seen it used a second time in a macro before.
    Change the macro to ^c^c(load "dtlcallout.lsp");dtlcallout
    Maybe you're able to load the routine locally without issue and his PC is taking longer because it's being loaded from the network or deeper down in his support path.
    Hi Tom, That doesn't seem to be the issue. I had him change the macro, and it is still happening. We are both loading the file locally from our own computer. File path is C:\Program files\Autodesk\Autocad 2019\Support. We both have this path set up in our support file search path as the 2nd path in the list.

    The error message he is getting:
    Code:
    Command: (load “dtlcallout.lsp”)
    ; error: bad argument type: stringp nil
    Command: dtlcallout Unknown command "DTLCALLOUT".  Press F1 for help.
    
    Perhaps the lisp routine itself is faulty, but that doesn't explain why it works on my computer...  Here is the lisp itself...  Pretty basic, and I'm sure could be written more elegantly...
    
    (defun c:dtlcallout () ;1stosmode 1stlayer CASS pt1 pt3 pt2 pt4 LL UL UR LR dtlpt dtlnum dtlnumstring HBW HBH BCP DAP BOXO 
    	(setq 1stosmode nil 1stlayer nil CASS nil pt1 nil pt3 nil pt2 nil pt4 nil LL nil UL nil UR nil LR nil dtlpt nil dtlnum nil dtlnumstring nil HBW nil HBH nil BCP nil DAP nil BOXO nil)
    	(setq 1stosmode (getvar "osmode")) 							;get current osmode setting
    	(setq 1stlayer (getvar "clayer"))							;get current layer setting
    	(setq CASS (getvar "cannoscalevalue"))							;get current annotative scale setting
    	(setq pt1 (getpoint "\nSelect first corner of detail\n"))				;ask 1st corner
    	(setq pt3 (getpoint "\nSelect opposite corner of detail\n"))				;ask opposite corner
    	(setq BOXO 6)										;sets box offset distance
    	(setvar "osmode" 0)									;set osmode to 0
    	(setq pt2 (list (car pt1) (cadr pt3)))							;sets 2nd corner
    	(setq pt4 (list (car pt3) (cadr pt1)))							;sets 4th corner
    	(if (and (< (car pt1) (car pt3)) (< (cadr pt1) (cadr pt3)))				;if pt1 @ LL
    		(setq LL pt1 UL pt2 UR pt3 LR pt4)						;then set LL,UL,UR,LR
    		(if (and (< (car pt1) (car pt3)) (> (cadr pt1) (cadr pt3)))				;if pt1 @ UL
    			(setq UL pt1 UR pt4 LR pt3 LL pt2)						;then set LL,UL,UR,LR
    			(if (and (> (car pt1) (car pt3)) (> (cadr pt1) (cadr pt3)))				;if pt1 @ UR
    				(setq UR pt1 LR pt2 LL pt3 UL pt4)						;then set LL,UL,UR,LR 
    				(if (and (> (car pt1) (car pt3)) (< (cadr pt1) (cadr pt3)))				;if pt1 @ LR
    					(setq LR pt1 LL pt4 UL pt3 UR pt2)						;then set LL,UL,UR,LR
    					(alert "LLpositionerror")
    				)
    			)
    		)
    	)											;end if
    	(setq LL (list (- (car LL) BOXO) (- (cadr LL) BOXO))) 				;changes LL to -BOXO,-BOXO
    	(setq UL (list (- (car UL) BOXO) (+ (cadr UL) BOXO)))				;changes UL to -BOXO,+BOXO
    	(setq UR (list (+ (car UR) BOXO) (+ (cadr UR) BOXO)))				;changes UR to +BOXO,+BOXO
    	(setq LR (list (+ (car LR) BOXO) (- (cadr LR) BOXO)))				;changes LR to +BOXO,-BOXO
    	(setq HBW (* (distance LL LR) 0.5))						;sets box half width
    	(setq HBH (* (distance LL UL) 0.5))						;sets box half height
    	(setq BCP (list (+ (car LL) HBW) (+ (cadr LL) HBH)))				;sets center point of box
    	(setq dtlpt (getpoint "\nSelect detail note placement\n"))			;ask detail location
    	(if (and (< (car dtlpt) (car BCP)) (< (cadr dtlpt) (cadr BCP)))				;if dtlpt is LL of box center point
    		(setq DAP LL)										;then set detail arrow point to LL
    		(if (and (< (car dtlpt) (car BCP)) (> (cadr dtlpt) (cadr BCP)))			;if dtlpt is UL of box center point
    			(setq DAP UL)									;then set detail arrow point to UL
    			(if (and (> (car dtlpt) (car BCP)) (> (cadr dtlpt) (cadr BCP)))		;if dtlpt is UR of box center point
    				(setq DAP UR)								;then set detail arrow point to UR 
    				(if (and (> (car dtlpt) (car BCP)) (< (cadr dtlpt) (cadr BCP)))	;if dtlpt is LR of box center point
    					(setq DAP LR)							;then set detail arrow point to LR
    					(alert "finddetaillocation error")				;else error
    				)									;end if
    			)										;end if
    		)											;end if
    	)												;end if							
    	(setq dtlnum (getstring 2 "What detail number?"))	;ask detail number
    	(setq dtlnumstring (strcat "DETAIL #" dtlnum))		;string concatenate "DETAIL #" & detail number
    	(setvar "clayer" "4-dimension")				;set current layer to dimension	
    	(command "rectangle" LL UR)				;draws detail callout rectangle
    	(command "chprop" "l" "" "lt" "phantom2" "")			;change properties of last object to linetype phantom2	
    	(command "mleader" DAP dtlpt "" dtlnumstring)	;create multi leader starting at DAP, ending at dtlpt & entering detailnumstring
    	(setvar "osmode" 1stosmode)				;reverts to original osmode
    	(setvar "clayer" 1stlayer)				;reverts to original layer
    	(princ)
    )

    Thanks for your help!
    Last edited by BlackBox; 2019-07-10 at 05:51 PM. Reason: Please use [CODE] Tags

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,665
    Login to Give a bone
    1

    Default Re: Loading .lsp error caused by palettes?

    I get the same error he does. (load dtlcallout.lsp) wouldn't work on your PC either. Try (load "dtlcallout.lsp") on his PC.

    If that doesn't solve everything you need to edit your previous post to Wrap Code tags around the code.

    Clicking the [Go Advanced] button at the bottom puts a toolbar at the top and the # icon in that toolbar places code tags around selected text for you or simply paste your code inside.

  5. #5
    Login to Give a bone
    0

    Default Re: Loading .lsp error caused by palettes?

    Quote Originally Posted by Tom Beauford View Post
    I get the same error he does. (load dtlcallout.lsp) wouldn't work on your PC either. Try (load "dtlcallout.lsp") on his PC.

    If that doesn't solve everything you need to edit your previous post to Wrap Code tags around the code.

    Clicking the [Go Advanced] button at the bottom puts a toolbar at the top and the # icon in that toolbar places code tags around selected text for you or simply paste your code inside.
    Thank you Tom! That fixed the issue! Apparently, when I copied the macro from my computer and emailed it, Outlook must have changed the quotes. I've done this before and it worked just fine... Anyway, thanks again!

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: Loading .lsp error caused by palettes?

    Quote Originally Posted by aaronashley1977783620 View Post
    Thank you Tom! That fixed the issue! Apparently, when I copied the macro from my computer and emailed it, Outlook must have changed the quotes. I've done this before and it worked just fine... Anyway, thanks again!
    Ahhh..... Check this out >> http://cadpanacea.com/wp/?p=1465
    R.K. McSwain | CAD Panacea |

  7. #7
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    559
    Login to Give a bone
    0

    Default Re: Loading .lsp error caused by palettes?

    Just something I do if a lisp is more than likely to run only once I add the defun as a last line so it runs automatically after loading, it can be ran again using keyboard input.

    Code:
    (defun c:dtlcallout ( /
    
    …..
    …..
    )
    (c:dtlcallout)
    Code:
    ^c^c(If (not c:dtlcallout)(load "dtlcallout"))

Similar Threads

  1. Replies: 2
    Last Post: 2016-09-20, 02:10 PM
  2. Error - Reloading Family "caused deletion of non-editable workset"
    By lhanyok in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 3
    Last Post: 2009-01-29, 07:11 PM
  3. Replies: 20
    Last Post: 2008-07-09, 03:22 PM
  4. Replies: 8
    Last Post: 2007-01-03, 02:32 PM
  5. Fatal error, maybe caused by recent change in WhipArc
    By huuthu_nguyen82544 in forum AutoCAD LT - General
    Replies: 4
    Last Post: 2005-04-07, 11:55 AM

Posting Permissions

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