.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable the acaddoc.lsp file

8 REPLIES 8
Reply
Message 1 of 9
hanchris
3412 Views, 8 Replies

Disable the acaddoc.lsp file

I could go into more detail if you want; but right now I am just interested if it is possible to disable the acaddoc.lsp, only while a .NET program is running?

Thanks.
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: hanchris

Hi hanchris,

The contents of the Acaddoc.lsp file are loaded into memory every time a
drawing opens. If you don't want it because you are opening drawings
with your .NET code and obvious possibility to to use the following
pseudo code.

Rename acaddoc.lsp acaddoc_not_needed_now.lsp
.... content of your program
Rename acaddoc_not_needed_now.lsp acaddoc.lsp


Regards,


Laurie Comerford
hanchris wrote:
> I could go into more detail if you want; but right now I am just interested if it is possible to disable the acaddoc.lsp, only while a .NET program is running?
>
> Thanks.
>
Message 3 of 9
Anonymous
in reply to: hanchris

Acaddoc.lsp is loaded when a drawing file is opened.

If your code is opening drawing files in AutoCAD, then
you have to find the applicable acaddoc.lsp file (which
can be complicated if there are more than one), and
rename it.

As soon as the file is opened you can rename it back
to acaddoc.lsp.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6322877@discussion.autodesk.com...
I could go into more detail if you want; but right now I am just interested if
it is possible to disable the acaddoc.lsp, only while a .NET program is running?

Thanks.
Message 4 of 9
_gile
in reply to: hanchris

Hi,

Just an idea.
When opening a drawing, AutoCAD searches for an acaddoc.lsp file and loads the first he finds.
The first location AutoCAD looks for an acaddoc.lsp file is the folder which contains the opening drawing.
So, if you create an empty acaddoc.lsp file in the same folder as the drawing you want open, only this empty acaddoc.lsp file should be loaded.


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 9
Anonymous
in reply to: hanchris

What happens if the drawing hasn't been saved yet? A new drawing, so to say.


<_gile> wrote in message news:6323357@discussion.autodesk.com...
Hi,

Just an idea.
When opening a drawing, AutoCAD searches for an acaddoc.lsp file and loads
the first he finds.
The first location AutoCAD looks for an acaddoc.lsp file is the folder which
contains the opening drawing.
So, if you create an empty acaddoc.lsp file in the same folder as the
drawing you want open, only this empty acaddoc.lsp file should be loaded.
Message 6 of 9
hanchris
in reply to: hanchris

Thanks, everyone for your help. And in our situation it sounds like a empty acaddoc.lsp file is the most promising since our acaddoc.lsp file is on a shared server.

However, after asking the question I continued to reseach different ways around this problem and I think I am going to use the EnteringQuiescentState for my current application. I was also looking into the IdleEvent; but I could not get that one to work. Is there a difference beween the trigger for an Idle event and InQuiescent state?

Here is the code I managed to put together in C#, if anyone is interested
{code}

public void AddAcadIdleEvent()
{

Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.EnteringQuiescentState += Application_Idle;

}
public void RemoveAcadIdleEvent()
{
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.EnteringQuiescentState -= Application_Idle;
}

void Application_Idle( object sender, System.EventArgs e )
{
try
{

RemoveAcadIdleEvent();
\\ You Code here
}
catch
{
\\ You error trapping code here
}

}

{code}

Note: My "Application" gets conflicted with various using statments that also use "Application", so I have to show the whole line.

Thanks again for your input.
Message 7 of 9
Jedimaster
in reply to: hanchris

I had the seme problem with vba. We also use a network acaddoc.lsp. Do no make the netwok acaddoc.lsp empty, instead make a local one

C:\Program Files\AutoCAD program folder\Support. AutoCAD read hear first and will ignore the network copy. I you have a local acaddoc.lsp just rename it bfore you create the blank one.

Message 8 of 9
norman.yuan
in reply to: Jedimaster

<QUOTE>"...make a local one C:\Program Files\AutoCAD program folder\Support. AutoCAD read hear[here] first..."</QUOTE> is NOT a correct statement. AutoCAD does not automatically load acaddoc.lsp FIRST from [Acad Install]/Support folder, not to mention that AutoCAD could be installed in location other than "C:\Program files\...". If any other support path that has acaddoc.lsp in the "Options->File" is ordered before that folder (one can user button "Move Up/Down" to change the order), then your claim is wrong.

 

One should really look into gile's suggestion, or do the renaming by search all the support paths.

Message 9 of 9
Jedimaster
in reply to: hanchris

AutoCAD will load the first acaddoc.lsp it sees. I am not using the latest AutoCAD so I do not know if AutoDesk has changed the startup order. It use to be on startup AutoCAD looked it the program folders then the search path (It may have changed). I know this because that is where I test out the acaddoc.lsp before I unleash it on to the network. You can place it the ROAMABLEROOTPREFIX or LOCALROOTPREFIX anywhere AutoCAD is going to find it before it reaches the network path.Granted I know that I am on a .NET forum and have a limited knowledge of .NET and C, here is how I did it in VBA (the concept is the same).

 

'Before the batch routine

Set objFSO = CreateObject("Scripting.FileSystemObject")
LocalLsp = AcadApplication.Path & "\Support\acaddoc.lsp"
Set objFile = objFSO.CreateTextFile(LocalLsp)
objFile.Close

 

'After the batch routine

If objFSO.FileExists(LocalLsp) Then
objFSO.DeleteFile (LocalLsp)
End If

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost