Automatically Load Lisp Routine Issues

Automatically Load Lisp Routine Issues

CAD-Geek
Advocate Advocate
2,630 Views
17 Replies
Message 1 of 18

Automatically Load Lisp Routine Issues

CAD-Geek
Advocate
Advocate

I created an .exe file that extract acad.lsp file in Autocad Directory 

%appdata%\Autodesk\AutoCAD 2014\R19.1\enu\support

and it extract another folders and files in C:/CAD/....

in acad.lisp file (load "C:/CAD/Support/POS.vlx") the pos.vlx file it extract by .exe

but not loaded Automatically

0 Likes
2,631 Views
17 Replies
Replies (17)
Message 2 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:

I created an .exe file that extract acad.lsp file in Autocad Directory 

%appdata%\Autodesk\AutoCAD 2014\R19.1\enu\support

and it extract another folders and files in C:/CAD/....

in acad.lisp file (load "C:/CAD/Support/POS.vlx") the pos.vlx file it extract by .exe

but not loaded Automatically


Hi BKKAr_drafter,

AutoCAD will load the first acad.lsp file found.

Will load only in the first dwg, if ACADLSPASDOC = 0

 

Test if the new acad.lsp file is the one AutoCAD finds

 

(if (findfile "acad.lsp")
    (startapp "notepad" (findfile "acad.lsp"))
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 18

CAD-Geek
Advocate
Advocate
if i understand you right.
i add your code into my acad.lsp
again it also don't work
0 Likes
Message 4 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:
if i understand you right.
i add your code into my acad.lsp
again it also don't work

No, just copy/paste that bit of code in the command line, it will open the acad.lsp AutoCAD finds, or nil if none...just for testing...

 

Henrique

EESignature

0 Likes
Message 5 of 18

Kent1Cooper
Consultant
Consultant

@BKKAr_drafter wrote:

....

in acad.lisp file (load "C:/CAD/Support/POS.vlx") the pos.vlx file it extract by .exe

but not loaded Automatically


If that (load) function is in acad.lsp, with ACADLSPASDOC set to the default value of 0, it will [as @hmsilva pointed out] load only in the first drawing when AutoCAD is opened, but not in later drawings you open in the same AutoCAD session.  Is that what happens?  Or does it not load even in the first drawing?  That's what @hmsilva's suggestion is to test for, by opening the one that it finds if there's more than one, so you can check whether it is the one that contains the (load) function.  It's not something you should add to your file(s) anywhere.

 

If it loads in the first drawing only, but you want it to load in every drawing, either change ACADLSPASDOC to 1 to make it do that, or [what most people do instead] put that (load) function into your acaddoc.lsp file.  If you don't have one, make one, even if that's the only thing in it -- you'll find other things to put in it.

Kent Cooper, AIA
0 Likes
Message 6 of 18

CAD-Geek
Advocate
Advocate

there is my acad.lsp

the issue is the Profile (cad_user) load well but the POS.vlx not load 

@hmsilva i test your code i restart autocad and open multiple drawing and the code open acad.lsp well is that what you asking about ?

 

;Load Visual Lisp
(vl-load-com)
;Import the "CAD_User" Profile from the network
(vl-catch-all-apply 'vla-importprofile (list
(vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))
"CAD User"
"C:/POS CAD Standard/CAD/Support/CAD_User.arg"
1)
)
;Set "CAD_User" Profile current
(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))"CAD User")
;Set the "modemacro" sysvar to report the latest profile
(SETVAR "modemacro""POS")
(setvar "layereval"0)
(setvar "layernotify"0)
(setvar "dispsilh"1)
(setvar "intersectiondisplay"1)
(setvar "hideprecision"1)
(load "C:/POS CAD Standard/CAD/Support/POS.vlx")
0 Likes
Message 7 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:

there is my acad.lsp

the issue is the Profile (cad_user) load well but the POS.vlx not load 

@hmsilva i test your code i restart autocad and open multiple drawing and the code open acad.lsp well is that what you asking about ?

 


Yes, that was what I was asking.

How there are spaces in the path, try

 

(load "\"C:/POS CAD Standard/CAD/Support/POS.vlx\"")

 

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 8 of 18

CAD-Geek
Advocate
Advocate

I replace the spaces with (_) and load failed 

 

load.JPG

0 Likes
Message 9 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:

I replace the spaces with (_) and load failed 

 

load.JPG


If you copy/paste

(findfile "C:/POS_CAD_Standard/CAD/Support/POS.vlx")

in the command line, what is the return?

 

 

Henrique

EESignature

0 Likes
Message 10 of 18

CAD-Geek
Advocate
Advocate

 

Autocad return this

 

(findfile "C:/POS_CAD_Standard/CAD/Support/POS.vlx")
"C:\\POS_CAD_Standard\\CAD\\Support\\POS.vlx"

 

 

0 Likes
Message 11 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:

 

Autocad return this

 

(findfile "C:/POS_CAD_Standard/CAD/Support/POS.vlx")
"C:\\POS_CAD_Standard\\CAD\\Support\\POS.vlx"

 

 


Try

 

(load (findfile "C:/POS_CAD_Standard/CAD/Support/POS.vlx"))

 

Henrique

EESignature

0 Likes
Message 12 of 18

CAD-Geek
Advocate
Advocate

I tried your code and again 

 

load.JPG

@hmsilva this is the pos.vlx properies 

Capture.JPG

0 Likes
Message 13 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:

I tried your code and again 

 

load.JPG

 

 


Weird....

With appload command, can you load POS.vlx file?

 

Henrique

EESignature

0 Likes
Message 14 of 18

CAD-Geek
Advocate
Advocate
Yes i can load it by appload and that's is make me mad
When i tried to copy POS.vlx file the original one and paste it it (c:\pos_cad_standard\.....) and run load code it's loaded well too
0 Likes
Message 15 of 18

CAD-Geek
Advocate
Advocate
I had a doubt the Properties of pos.vlx file (Read only and hidden)
0 Likes
Message 16 of 18

hmsilva
Mentor
Mentor

@BKKAr_drafter wrote:
I had a doubt the Properties of pos.vlx file (Read only and hidden)

I made that path im my box, file Read only and Hidden, and the vlx file loads as expected...

 

pos_vlx.PNG

 

Henrique

 

 

EESignature

0 Likes
Message 17 of 18

Kent1Cooper
Consultant
Consultant

If it finds the file, but loading it fails, it seems there must be something wrong in the file itself.  One other thing you can try to find out:  rather than doing it in a (load) function, try the APPLOAD command, navigate to the file location, and Load it.  [Never mind -- didn't see some subsequent messages.]

Kent Cooper, AIA
0 Likes
Message 18 of 18

Anonymous
Not applicable

Hi BKKAr_drafter,

 

If i understand your post correctly (and correct me if i'm wrong) - are you trying to load multiple custom LISP routines at once or as they are invoked?

 

If so, have you tried creating an ACADDOC file?

 

You can see my example of an ACADDOC file attached.

 

Thanks,

Bevan

0 Likes