Author Topic: Command Line Switches  (Read 4093 times)

0 Members and 1 Guest are viewing this topic.

NirantarVidyarthee

  • Guest
Command Line Switches
« on: May 30, 2013, 03:29:21 AM »
How can I open AutoCAD 2011 with command line switches using VB.Net Express 2008 in an external application?

I have AutoCAD Mechanical installed and when I open it programmatically it opens with a profile which was last used interactively (<<ACADMPP>> or <<VANILLA>>). But I want to make sure that it opens with <<VANILLA>> profile only. Programmatically switching the profile does not work and my program crashes.

The program otherwise works fine on a machine where vanilla AutoCAD is installed.

Please help.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Command Line Switches
« Reply #1 on: May 30, 2013, 07:36:35 AM »
Ther /p [ProfileName] switch will load a profile from the command line.

Look at Process.Start() to start an application from code.
Revit 2019, AMEP 2019 64bit Win 10

nekitip

  • Guest
Re: Command Line Switches
« Reply #2 on: May 30, 2013, 07:43:36 AM »
If you do want to start nonrunning acad from external app that is running, you can always start the program with switch.
It is the same as if you have shortcut icon on desktop, or to type it in "run" of windows start menu.
in your case it may be something like "C:\Program Files\AutoCAD 2011\acad.exe /p VANILLA"
to start it in VB, you can use Shell as in: http://www.dotnetperls.com/shell
list of other ACAD switches http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=2894625&linkID=9240617


NirantarVidyarthee

  • Guest
Re: Command Line Switches
« Reply #3 on: May 30, 2013, 01:18:10 PM »
Thank you.

Process.Start more net-ish than shell.

Assuming I get the process name or processID or handle. How do I get AcadApplication from that.

BlackBox

  • King Gator
  • Posts: 3770
Re: Command Line Switches
« Reply #4 on: May 30, 2013, 02:55:13 PM »
Assuming I get the process name or processID or handle. How do I get AcadApplication from that.

Here's an old example, using Excel, in this post.
"How we think determines what we do, and what we do determines what we get."

hugha

  • Newt
  • Posts: 103
Re: Command Line Switches
« Reply #5 on: May 30, 2013, 08:16:16 PM »


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Command Line Switches
« Reply #7 on: May 31, 2013, 02:20:08 AM »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.