I am creating a VB .NET application that will launch Civil 3D with different profiles. I am having issue launching the application w/ parameters without a startup file.
Dim desProf As String
desProf = "<< C3D_Imperial >>"
Dim p As New ProcessStartInfo
p.FileName = "C:\Program Files\Autodesk\AutoCAD 2022\acad.exe"
p.Arguments = " /ld C:\Program Files\Autodesk\AutoCAD 2022\AecBase.dbx "
p.Arguments = "/p " & desProf & " /product C3D /language en-US"
p.UseShellExecute = True
p.WindowStyle = ProcessWindowStyle.Normal
Process.Start(p)
The code results in an AutoCAD Message stating: "Cannot file the specified drawing file. Please verify that the file exists."
If I just use: Process.Start("C:\Program Files\Autodesk\AutoCAD 2022\acad.exe") I can get AutoCAD to start w/o prompting the drawing file is missing.
Thanks for any help you can provide.
CodePudding user response:
You’re overwriting your first set of arguments with the second. Try
p.Arguments = p.Arguments & "/p " & desProf & " /product C3D /language en-US"
Also, are you sure you need the << and >> characters?
CodePudding user response:
@SteveTodd, you are correct. I fought with it for an hour and got it working. Here is the final code:
p.FileName = "C:\Program Files\Autodesk\AutoCAD 2022\acad.exe"
p.Arguments = " /ld ""C:\Program Files\Autodesk\AutoCAD 2022\AecBase.dbx"" /p
" & desProf & " /product C3D /language en-US"
p.UseShellExecute = True
Process.Start(p)