.NET

Reply
Distinguished Contributor
hanchris
Posts: 308
Registered: ‎10-24-2007
Message 1 of 9 (1,397 Views)

Disable the acaddoc.lsp file

1397 Views, 8 Replies
01-22-2010 05:34 AM
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.
*Laurie
Message 2 of 9 (1,396 Views)

Re: Disable the acaddoc.lsp file

01-22-2010 12:19 PM 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.
>
*Tony Tanzillo
Message 3 of 9 (1,396 Views)

Re: Disable the acaddoc.lsp file

01-22-2010 03:15 PM 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.
*Expert Elite*
_gile
Posts: 2,125
Registered: ‎04-29-2006
Message 4 of 9 (1,396 Views)

Re: Disable the acaddoc.lsp file

01-23-2010 04:32 AM 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
*Guido Rooms
Message 5 of 9 (1,396 Views)

Re: Disable the acaddoc.lsp file

01-24-2010 02:50 AM 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.
Distinguished Contributor
hanchris
Posts: 308
Registered: ‎10-24-2007
Message 6 of 9 (1,396 Views)

Re: Disable the acaddoc.lsp file

01-25-2010 06:11 AM 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.
Distinguished Contributor
Jedimaster
Posts: 162
Registered: ‎03-11-2009
Message 7 of 9 (450 Views)

Re: Disable the acaddoc.lsp file

02-12-2014 07:15 AM 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.

*Expert Elite*
norman.yuan
Posts: 1,063
Registered: ‎04-27-2009
Message 8 of 9 (440 Views)

Re: Disable the acaddoc.lsp file

02-12-2014 09:13 AM 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.

Distinguished Contributor
Jedimaster
Posts: 162
Registered: ‎03-11-2009
Message 9 of 9 (436 Views)

Re: Disable the acaddoc.lsp file

02-12-2014 09:45 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.