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

Cannot load custom Acad2014.lsp & Acad2014doc.lsp from custom directory

16 REPLIES 16
Reply
Message 1 of 17
Dave-Zivkovic
2781 Views, 16 Replies

Cannot load custom Acad2014.lsp & Acad2014doc.lsp from custom directory

I upgraded from Acad Electrical 2011 to 2014. I added a custom directory to the “Support File Search Path” and the “Trusted Locations”. The custom directory has a customized Acad2014.lsp & Acad2014doc.lsp, but my programs are not available. I have done this since Acad Release  2.1. I’m running on Win 7 64bit station.

 

Thanks,

Dave

16 REPLIES 16
Message 2 of 17
dgorsman
in reply to: Dave-Zivkovic

Leave AcadXXXX.lsp and AcaddocXXXX.lsp alone.  Use Acad.lsp and Acaddoc.lsp instead.  The switch is recommended by AutoDesk, starting shortly after the release you mentioned, others may be able to offer that bit of trivia (ie. its been that way for some time).

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 3 of 17

I was just trying that myself. Thanks for the info

Message 4 of 17
BlackBox_
in reply to: Dave-Zivkovic

Actually, Acad201#.lsp, and Acad201#Doc.lsp will only load from default install folder regardless of SecureLoad, and TrustedPaths setting:

 

 

"  Note - Beginning with AutoCAD 2013 SP1, the reserved acad2013.lsp and acad2013doc.lsp files and their successors are loaded only from their default installation folders: <install folder>\Support and <install folder>\Support\<language> respectively.  "



"How we think determines what we do, and what we do determines what we get."

Message 5 of 17
Dave-Zivkovic
in reply to: BlackBox_

I liked using the version named lisp files because I have a third party program that already uses the Acaddoc.lsp file. Now I'll have to join them.
Message 6 of 17
BlackBox_
in reply to: Dave-Zivkovic


@Dave-Zivkovic wrote:
I liked using the version named lisp files because I have a third party program that already uses the Acaddoc.lsp file. Now I'll have to join them.

No... You don't:

 

(vl-load-com)

(defun _LoadAllAcadFiles (files / bbox:Parser file)
  ;; BlackBox, TheSwamp.org
  ;; Example: (_LoadAllAcadFiles '("acad.lsp" "acaddoc.lsp"))

  (defun bbox:Parser (char string / i segments segment)
    ;; BlackBox, TheSwamp.org
    ;; Example: (bbox:Parser "-" "dd-mm-yyyy")
    ;; Returns: ("dd" "mm" "yyyy")
    (while (setq i (vl-string-search char string))
      (setq segments (cons (setq segment (substr string 1 i)) segments))
      (setq string (substr string (+ 2 i)))
    )
    (reverse (cons string segments))
  )

  (foreach path (bbox:Parser ";" (getenv "ACAD"))
    (foreach lsp files
      (if (setq file (findfile (strcat path "\\" lsp)))
        (load file)
      )
    )
  )
)

 



"How we think determines what we do, and what we do determines what we get."

Message 7 of 17
BlackBox_
in reply to: BlackBox_

... That said, you'd still be smart to not use Acad.lsp or AcadDoc.lsp more than once per version.

 

Instead, consider naming your startup files accordingly to the app/plug-in you've prepared (if internal), and use Autoloader, and\or MNL to load your custom code... The Autoload function is your friend.



"How we think determines what we do, and what we do determines what we get."

Message 8 of 17
Dave-Zivkovic
in reply to: BlackBox_

The vendor uses s::startup in their acaddoc.lsp file. Dosen't that have to stay in the acaddoc.lsp file. Meaning I would not be able to rename the vendor file and then autoload it thru my acaddoc.lsp file.

Message 9 of 17
BlackBox_
in reply to: Dave-Zivkovic


@Dave-Zivkovic wrote:

The vendor uses s::startup in their acaddoc.lsp file. Dosen't that have to stay in the acaddoc.lsp file. Meaning I would not be able to rename the vendor file and then autoload it thru my acaddoc.lsp file.


Acad.lsp and AcadDoc.lsp are loaded prior to S::STARTUP, which executes just prior to Scripts via /b startup switch... See this post for more on the startup sequence.

 

Any calls to S::STARTUP are simply appending to what will/needs to be run at that step in the startup sequence.

 

Case in point, your AcadDoc.lsp can be at the top of SFSP, and use my earlier offering (or an adaptation of), to load other AcadDoc.lsp files elsewhere in SFSP, and all will be loaded as normal, especially so given the limited information you have here.

 

 

 

That said, I still stand by the use of your own internally named file via Autoloader, or your own .NET autoloading mechanism if for no other reason than to avoid potential conflicts, so take from this what you like.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 10 of 17
dgorsman
in reply to: Dave-Zivkovic

Haven't used (S:STARTUP ...) in some time, but it should be doable inside any LSP file.  You can (append ...) your own functions to it instead of re-defining it, although I believe they require the (defun-q ...) rather than the usual (defun ...) in order to do that.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 11 of 17
scot-65
in reply to: Dave-Zivkovic

As long as you do not have any top level "(command..." in your library, you do not need to use S::STARTUP. My guess is the vendor wants to be sure his commands (keystroke declarations) overwrites any previous loaded keystrokes of the same name (which includes the PGP file) when the editor is first launched as S::STARTUP is the last item to execute before the user gains control.

I personally suggest the MNL route.

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 12 of 17
3wood
in reply to: BlackBox_

It seemed my acad.lsp was not allowed to be used in AutoCAD 2014. I had to rename it to acadDOC.lsp and added the folder contains this file into the trusted folder separatly (although its parent folder had been added) to make it run properly.

It is quite annoying because acad.lsp has been used for so long, and even there are malicious routines exist, the ball should be passed to customers. I suggest Autodesk develop better techniques to prevent malicious routines instead of ask users to change work flow, verify external routines, and set up protection all by themself. 

Message 13 of 17
Dave-Zivkovic
in reply to: scot-65

I wouldn't be using the the 3rd party program if it wasn't for this hole chart program they have. It allows you to select all the holes on a panle, then marks them with a letter & creates a chart.

 

A lot of good advice, I'll get it to work one way or another. Thanks everyone for the help !!!

 

Dave,

Message 14 of 17
BlackBox_
in reply to: 3wood


@scot-65 wrote:
S::STARTUP is the last item to execute before the user gains control.

Incorrect... Scripts loaded via /b switch are the last to execute... See post #9 (this thread) for reference.

 


@3wood wrote:

It seemed my acad.lsp was not allowed to be used in AutoCAD 2014. I had to rename it to acadDOC.lsp and added the folder contains this file into the trusted folder separatly (although its parent folder had been added) to make it run properly.

It is quite annoying because acad.lsp has been used for so long, and even there are malicious routines exist, the ball should be passed to customers. I suggest Autodesk develop better techniques to prevent malicious routines instead of ask users to change work flow, verify external routines, and set up protection all by themself. 


Are you sure you're not misunderstanding the purpose of Acad.lsp vs. AcadDoc.lsp?

If you're expecting Acad.lsp to load into each Drawing, rather than the default behavior of loading only once per session, then you might consider the AcadLspAsDoc System Variable.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 15 of 17
scot-65
in reply to: BlackBox_

/b is not present when editor is launched via double-click while in a file manager for a normal install of AutoCAD (the preferred method among most employees here).

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 16 of 17
BlackBox_
in reply to: scot-65


@scot-65 wrote:
/b is not present when editor is launched via double-click while in a file manager for a normal install of AutoCAD (the preferred method among most employees here).

Your prefered method also side steps the /p (Profile) switch, etc. by not first launching AutoCAD via the application icon, and then opening the required drawing(s).

 

That is not something that is acceptable for an environment (such as mine) where one has multiple internal, and client-specific Profile's, in addition to versions of Civil 3D, Map 3D, AMEP from 2011-2014, and Land Desktop Companion 2009 installed on each workstation.

 

Obviously, if that sort of situation is not applicable for you, or others, then double clicking the DWG may work perfectly fine... However, I'd venture a guess that that is not the majority, nor prefered by Autodesk as a generalization, thus, I stand by my statement.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 17 of 17
fenton.webb
in reply to: BlackBox_

As you mention SECURELOAD in this thread, I'm posting this white paper for you guys to checkout http://adndevblog.typepad.com/autocad/2013/07/all-you-need-to-know-about-autocad-secureload-au.html




Fenton Webb
AutoCAD Engineering
Autodesk

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

Post to forums  

Autodesk Design & Make Report

”Boost