.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
"acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
565 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
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
Re: "acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
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?
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.
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.
"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">
"bswackha" wrote in messageHas
href="news:6102260@discussion.autodesk.com">news:6102260@discussion.autodesk.com...
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
Re: "acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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}
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}
---------------------------

“We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”

“We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”
Re: "acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
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
Re: "acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: "acad.exe /Automatio ns" does not start invisibly in 2009
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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}
{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}
