Script works as .src but not as .lsp

Script works as .src but not as .lsp

QNashJSRL8
Contributor Contributor
700 Views
9 Replies
Message 1 of 10

Script works as .src but not as .lsp

QNashJSRL8
Contributor
Contributor

-INSERT "path to \LINK_VIEW_SCAL.dxf" 0,0 1 0
PSELECT L

BURST
-VPORTS L OFF ALL

MSPACE
ANNOALLVISIBLE 1
ZOOM E
PSPACE


here is the lsp counter part

(defun c:InsertLinkViewScale (/ old-cmdecho old-osmode)
 
  (command-s "-INSERT" "C:\\Test Environment\\LSP Scripts Dillion\\Converted To Lsp\\Custom_Lisp_ToolBars\\LINK_VIEW_SCAL.dxf" "0,0" "1" "1" "0")
  (command-s "PSELECT" "L" "")
  (command-s "BURST" "")
  (command-s "-VPORTS" "L" "OFF" "ALL")
  (command-s "MSPACE")
  (command-s "ANNOALLVISIBLE" "1")
  (command-s "ZOOM" "E")
  (command-s "PSPACE")
  (princ)
)



but this .lsp doesn't work gets an error on burst and also gets the 


Command: (if (not c:CUI_LISP_CUSTOM) (load (findfile "QuickAccess_Tools.lsp")))
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
Command: (c:InsertLinkViewScale)
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended

0 Likes
Accepted solutions (1)
701 Views
9 Replies
Replies (9)
Message 2 of 10

QNashJSRL8
Contributor
Contributor

I should also add that I attached this script to a toolbar button
with the macro as

^C^C(if (not c:CUI_LISP_CUSTOM) (load (findfile "QuickAccess_Tools.lsp")))
(c:InsertLinkViewScale)

0 Likes
Message 3 of 10

pendean
Community Legend
Community Legend

@QNashJSRL8 You forgot to include the required file

LINK_VIEW_SCAL.dxf

 

Can you do that now please.

0 Likes
Message 4 of 10

QNashJSRL8
Contributor
Contributor

Here is the file

0 Likes
Message 5 of 10

pendean
Community Legend
Community Legend

@QNashJSRL8 wrote:

Here is the file


Thank you for that. Did you test your LISP first if I may ask? For example, it never finishes in INSERT function so it gets stuck

pendean_1-1727299854405.png

 

And... is there a reason you don't wish to simply place your LISP is a folder in AutoCAD's search path and just call the LISP from your button instead of all that ^C^C(if (not c:CUI_LISP_CUSTOM) (load (findfile......

 

pendean_2-1727300053946.pngpendean_3-1727300091706.png

 

 

Message 6 of 10

QNashJSRL8
Contributor
Contributor

I had added the location to the support file search path, but it wasn't calling the function so the macro logic with load file was the work around I found. I will try adding to trusted locations to see if that makes everything simpler.

I have tested the lisp and and it hasn't shown me the command list beside 

QNashJSRL8_0-1727302981046.png

I changed all commands to command-s and add "" after each command to see if that moves it to the next command.

(command-s "-INSERT" "C:\\Test Environment\\LSP Scripts Dillion\\Converted To Lsp\\Custom_Lisp_ToolBars\\LINK_VIEW_SCAL.dxf" "0,0" "1" "1" "0" "")
  (command-s "PSELECT" "L" "")
  (command-s "BURST" "")
  (command-s "-VPORTS" "L" "OFF" "ALL" "")
  (command-s "MSPACE" "")
  (command-s "ANNOALLVISIBLE" "1" "")
  (command-s "ZOOM" "E" "")
  (command-s "PSPACE" "")
  (princ)


I still don't quite see why it would get hung on Pselect but not get hung up here?

-INSERT "..\LINK_VIEW_SCAL.dxf" 0,0 1 0
PSELECT L

BURST
-VPORTS L OFF ALL

MSPACE
ANNOALLVISIBLE 1
ZOOM E
PSPACE



 

0 Likes
Message 7 of 10

paullimapa
Mentor
Mentor
Accepted solution

Since Burst is actually an Express Tools Lisp routine, inside a lisp file you'll have to call a lisp command differently.

Try replacing this line:

(command-s "BURST" "")

With this line:

(c:burst)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 8 of 10

QNashJSRL8
Contributor
Contributor

Interesting that seemed to do the trick.

Is there a quick reference place you are able to hunt down stuff like this?

We just have an autolisp extension in vscode but c:burst didn't pop up in its IntelliSense.

0 Likes
Message 9 of 10

paullimapa
Mentor
Mentor

you can just look it up on line like "autolisp burst" and you'll get links like this one:

Burst in a lisp - Autodesk Community - AutoCAD


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 10

Sea-Haven
Mentor
Mentor

Another Extrim can be called from lisp. But you need to use function ETRIM.

 

(if (not etrim)(load "extrim"))
(etrim obj pt1)

You can look inside extrim, but not all express tools are visually available as a lisp.

0 Likes