Can't run my selfmade .lsp in accoreconsole

Can't run my selfmade .lsp in accoreconsole

Anonymous
Not applicable
3,946 Views
6 Replies
Message 1 of 7

Can't run my selfmade .lsp in accoreconsole

Anonymous
Not applicable

Hi, I have been learning about accoreconsole, .lsp, .bat and .scr files since a week ago, so I'm a noob on this but I have read a lot of information and forums so now I made my own "Correlo.bat" that runs accoreconsole.exe that runs "TLEN.scr" that runs "TLEN.lsp"
Everything works fine but here's the issue: The TLEN.lsp works fine in regular Autocad.exe when I call it simply typing TLEN, but when I call it just TLEN in accoreconsole.exe it says:

 

"Unknown command "TLEN". Press F1 for Help

Command _quit"

 

;;;;;;;; This is my TLEN.scr file which I added a LINE and saved it just to make sure it's working and it does everything right at least that I add TLEN

 

TLEN
LINE
0,0,0
100,100,100
SAVE
y

 

This are some of my attempts to call it but none of them seem to work, ¿What am I doing wrong, is it possible to call a self made .lsp routine? Thank you experts for your help

 

;;;;;;;;;;;;;;;;;;;,,,,Failure Attempts:
(load C:\Program Files\Autodesk\AutoCAD 2015\TLEN.lsp)
(load C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp)
C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp
(load "TLEN.lsp")
TLEN
TLEN.lsp
NETLOAD TLEN
LOAD TLEN
PARTIALOAD TLEN
"(command <TLEN>)"
(command <TLEN>)

0 Likes
Accepted solutions (2)
3,947 Views
6 Replies
Replies (6)
Message 2 of 7

jerry.ford
Alumni
Alumni

I recommend using AutoCAD to get the script or LISP working correctly, then use them in AcCoreConsole.exe.

Run AcCoreConsole.exe with the /s option to specify a script.

 

For example,

 

AcCoreConsole.exe /s test.scr

 

 

Regarding the LISP loading errors:

 

;;;;;;;;;;;;;;;;;;;,,,,Failure Attempts:

(load C:\Program Files\Autodesk\AutoCAD 2015\TLEN.lsp)

(load C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp)

C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp

(load "TLEN.lsp")

TLEN

TLEN.lsp

NETLOAD TLEN

LOAD TLEN

PARTIALOAD TLEN

"(command <TLEN>)"

(command <TLEN>)


The LISP filename should be quoted in the (load) function.

Also, path delimiters should be doubled.

 

So this should work if that is where the file is found.

 

(load "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")

 

 


Jerry Ford

Senior Interaction Designer
0 Likes
Message 3 of 7

Anonymous
Not applicable

Thank you for your response I already made sure the TLEN.lsp works in AutoCad just calling it TLEN, so I'm shure it does what it must do, and I already tryed what you said calling it from the right adress as follows:

 

(load "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")
LINE
0,0,0
100,100,100
SAVE
y

 

Still does nothing, just jumps to create the LINE and saves it, I'll add it to the failure attempts just to have them listed

 

;;;;;;;;;;;;;;;;;;;;;;; Failure Attempts:
(load C:\Program Files\Autodesk\AutoCAD 2015\TLEN.lsp)
(load C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp)
(load "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")
C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp
(load "TLEN.lsp")
TLEN
TLEN.lsp
NETLOAD TLEN
LOAD TLEN
PARTIALOAD TLEN
"(command <TLEN>)"
(command <TLEN>)

 

Is there another option to call it? Thank you Jerry

 

0 Likes
Message 4 of 7

jerry.ford
Alumni
Alumni
Accepted solution

Is your script both loading the lisp file, and then calling it?

In you last reply I don't see it called:

 

  (load "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")
  LINE
  0,0,0
  100,100,100
  SAVE
  y

 

You might post the TLEN.LSP file in addition to the script so I can see what it does.

You might also try making it a function (TLEN)  instead of a command C:TLEN.

 

 

 

 


Jerry Ford

Senior Interaction Designer
Message 5 of 7

cadffm
Consultant
Consultant
Accepted solution

" The TLEN.lsp works fine in regular Autocad.exe when I call it simply typing TLEN, but when I call it just TLEN in accoreconsole.exe it says:"

 

Thats wrong, at first you have to load it in regular A(uto)CAD too! (appload/Startapp or drag&drop or by using lispfunctions load or autoload )

I guess you load yout *.lsp  Appload/Startapp?

 

After loading, the entire content was evaluated and your functions defined in the current namespace.

Example, if you defined a function as Autocad-command like this (defun c:TLEN nil (princ "How are you?"))

you can start it after loading the file with

TLEN

  or with Lisp in commandline

(c:TLEN)

 

====================

OSNAPCOORD 1

(load "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")
TLEN
_.LINE
0,0,0
100,100,100
_.QSAVE
_y

 

====================

 

Please try that Attachment for understanding (rename it from *.txt to *.lsp before)

Open a new DWG

load the lsp (appload or drag&drop the file)

type in

command: HEYU

open Textscreen[F2]

 

Open lsp in VLIDE (or Texteditor)

 

Compare [F2] and lsp-content

Now go through the whole process in the head, still questions? Ask!

 

 

 

 

 

 

Sebastian

Message 6 of 7

DannyNL
Advisor
Advisor

What does TLEN.lsp do? Can you post the code?

 

Please know that you cannot use any GUI commands (like i.e. ZOOM)  in the script or LISP as accoreconsole does not support those.

Message 7 of 7

Anonymous
Not applicable

@jerry.ford @cadffm Thank you, you got it, It's working now!! and I'll explain it so nobody has to get through this:

 

0- At this point I couldn't find full information about calling .lsp through .scr files in Accoreconsole so here I go with my investigation

1- AutoCad and Accoreconsole are just similar but they work differently

2- If you add your .lsp file to AutoCad with APPLOAD and add it to the "Startup Suite" so you don't have to LOAD it every time you open Autocad you'll still have to LOAD it every time in Accoreconsole or in your .lsp file (I wasn't doing that just loaded to AutoCad, that's wrong, there's where I realized the point 1)

3- LOAD a .lsp file is not the same as call the .lsp file (I was just calling it in Accoreconsole thinking that it was already loaded as in AutoCad, wrong, point 1 again)

4-If you create a .lsp file the right way to call it in Accoreconsole or .scr file is: (LOAD "C:\\The_adress_with_double_inverted_slashes\\YOUR_FILE.lsp") 

The right one for me was: 

 

(LOAD "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")

 

5-After you LOAD it then you can call it any time just typing: YOUR_FILE without any symbol

The right one for me was: 

 

TLEN

 

6-If you add a space after any command in your .scr file Accoreconsole will read as if you typed the "Enter key" (Is not the same TLEN than TLENspace)

 

7-Finally If you modify your .lsp and/or .scr files and saved it you can run immediately the Accoreconsole to make sure it works, but if you want to try it in AutoCad you must close AutoCad and open it again so the software replaces your old .lsp and .scr files, so every modification you make must close AutoCad to run it again.

 

;;;;;;;;;;;;;;;;If this were your .scr file this would be wrong:

YOUR_FILE

 

;;;;;;;;;;;;;;;;If this were your .scr file this would be right:

(LOAD "C:\\The_adress_with_double_inverted_slashes\\YOUR_FILE.lsp")

YOUR_FILE

 

;;;;;;;;;;;;;;This is my now working .scr file

(LOAD "C:\\Program Files\\Autodesk\\AutoCAD 2015\\TLEN.lsp")

TLEN

 

I learned a lot doing this and I'm grateful to all of you, any question about this please reply