Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script works as .src but not as .lsp

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
QNashJSRL8
391 Views, 9 Replies

Script works as .src but not as .lsp

-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

9 REPLIES 9
Message 2 of 10
QNashJSRL8
in reply to: QNashJSRL8

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)

Message 3 of 10
pendean
in reply to: QNashJSRL8

@QNashJSRL8 You forgot to include the required file

LINK_VIEW_SCAL.dxf

 

Can you do that now please.

Message 4 of 10
QNashJSRL8
in reply to: QNashJSRL8

Here is the file

Message 5 of 10
pendean
in reply to: QNashJSRL8


@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
in reply to: QNashJSRL8

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



 

Message 7 of 10
paullimapa
in reply to: QNashJSRL8

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
in reply to: QNashJSRL8

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.

Message 9 of 10
paullimapa
in reply to: QNashJSRL8

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
in reply to: QNashJSRL8

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report