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

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

5 REPLIES 5
Reply
Message 1 of 6
bswackha
902 Views, 5 Replies

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

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
5 REPLIES 5
Message 2 of 6
Anonymous
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
Message 3 of 6
arcticad
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))
Message 4 of 6
bswackha
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
Message 5 of 6
bswackha
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.
Message 6 of 6
GTVic
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}

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