.NET

Reply
Active Member
Posts: 6
Registered: ‎04-03-2008
Message 1 of 6 (643 Views)

"acad.exe /Automations" does not start invisibly in 2009

643 Views, 5 Replies
01-10-2009 09:31 AM
Has anybody else seen this?
Is there some new way to achieve this effect?

Under autocad 2009, my com interop app is opening a full new autocad session window on every "new AcadApplication()"...
This did not happen in earlier versions. I can certainly do "app.Visible = false;" after it has started, but I am spawning many, many instances and it is really annoying to to see acad startup every time...

From a command line, earlier versions will run "acad /Automation" invisibly. But not 2009..

(This is on Vista..)

Thanx, Bert
*Norman Yuan
Message 2 of 6 (643 Views)

Re: "acad.exe /Automations" does not start invisibly in 2009

01-12-2009 06:37 AM in reply to: bswackha

Since you are doing Acad automation with COM API,
while this NG is mainly for .NET API, you may try VBA NG.

 

That said, if you can "certainly do
app.Visible=False", did you do it? If not, why?

 

I am certain this is not new issue with Acad2009. I
tried it with my Acad2009 (app=New AcadApplication in VB.NET and Set
app=AutoCAD.Application in VB6, both start Acad instance invisibly). However,
there are many things that will cause Acad instance to be visible, because so
many different command/process in Acad operation updates/refresh screen/view on
its own (meaning you cannot control it). So, even you used Visible=False, it is
not guaranteed that Acad instance would not show. It is always like that since
Acad COM API was available from Acad R14.01. That is, if you do Acad automation,
do not bet you on Acad instance being invisible.

 

On the other hand, visble or not, spawing
"many, many instances" of running Acad does not sound like a good
application to me when doing Acad automation.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Has
anybody else seen this? Is there some new way to achieve this effect? Under
autocad 2009, my com interop app is opening a full new autocad session window
on every "new AcadApplication()"... This did not happen in earlier versions. I
can certainly do "app.Visible = false;" after it has started, but I am
spawning many, many instances and it is really annoying to to see acad startup
every time... From a command line, earlier versions will run "acad
/Automation" invisibly. But not 2009.. (This is on Vista..) Thanx,
Bert
*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 3 of 6 (643 Views)

Re: "acad.exe /Automations" does not start invisibly in 2009

01-12-2009 07:44 AM in reply to: bswackha
I have the same issue on XP.
As far as the startup issues you can check if an instance is already working.

If you want to know if AutoCAD is running you can check the processes.

{code}
Public Function isAcadLoaded() As Boolean

Dim ProcessList As System.Diagnostics.Process()
Dim Proc As System.Diagnostics.Process

ProcessList = System.Diagnostics.Process.GetProcesses()
Try
For Each Proc In ProcessList
If UCase(CStr(Proc.ProcessName)) = UCase("acad") Then
Return True
End If
Next
Catch ex As Exception
End Try
Return False
End Function
{code}

Or you can Try and get the running instance and then a new one if it doesn't exist

Then set the visiblility to false.

{code}

Public Sub GetApplication(ByRef AcadApp As Autodesk.AutoCAD.Interop.AcadApplication)
If Not AcadApp Is Nothing Then
Try
AcadApp = GetObject(, "AutoCAD.Application.17.2")
Catch ex As Exception
AcadApp = Nothing
End Try
End If

While AcadApp Is Nothing
Try
AcadApp = GetObject(, "AutoCAD.Application.17.2")
Catch ex As Exception
Try
AcadApp = CreateObject("AutoCAD.Application.17.2")
Catch ex2 As Exception
Exit Sub
End Try
End Try
End While

End Sub

{code}
---------------------------



(defun botsbuildbots() (botsbuildbots))
Active Member
Posts: 6
Registered: ‎04-03-2008
Message 4 of 6 (643 Views)

Re: "acad.exe /Automations" does not start invisibly in 2009

01-21-2009 02:04 PM in reply to: bswackha
Thank-you for the response -- it is good to know that it starts invisibly for you.
You mentioned there are many things that can cause it to become or start visible -- can you suggest some to look at? Registry settings? Configured startup variables? Some auto-loading app.?

Regarding your question, " app.Visible= false;" does work and I do use it. But it only causes "invisibility" after the app has already started visibly.

I am aware I could (and have done in the past) detect a running instance and just re-use it. But this was an exercise to try running a few instances in differbent threads each processing different drawings concurrently. It was to try and improve overall performance of some processor intensive processing that was needed.

Thanx, Bert
Active Member
Posts: 6
Registered: ‎04-03-2008
Message 5 of 6 (643 Views)

Re: "acad.exe /Automations" does not start invisibly in 2009

01-29-2009 02:16 PM in reply to: bswackha
FWIW, this apparently was caused by a particuler "netload.." line in acad2009doc.lsp. And when that was removed, Autocad (/Automation) started invisibly.
*Expert Elite*
Posts: 895
Registered: ‎09-07-2004
Message 6 of 6 (643 Views)

Re: "acad.exe /Automations" does not start invisibly in 2009

03-02-2009 09:12 AM in reply to: bswackha
You can put the following in any startup LISP file:

{code}
; detect if AutoCAD is running in interactive mode
; if it is not visible then it is running as an Active-X object and no startup/menu code should be processed
(vl-load-com)
(setvar "cmdecho" 0)
(if (= :vlax-true (vlax-get-property (vlax-get-acad-object) 'Visible)) (progn
' your startup code here (including netload)
))
(princ)
{code}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community