Launch external Procces()


#1

Hello,
I’d like to fire up Autocad after a dwg export with Dynamo and open up the exported file. However I couldn’t manage to append file name after acad.exe correctly and it won’t open up the file. Can you take a quick look I think I’m lost in the simple syntax somewhere. Below simple code warns as it can not find specified file…

process

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

from System.Diagnostics import Process
#The inputs to this node will be stored as a list in the IN variables.

command = "C:\Program Files\Autodesk\AutoCAD 2017\acad.exe " + “D:\a.dwg”

proc = Process()
proc.StartInfo.FileName = command
proc.Start()

OUT = command


#2

It should be enough to provide the file path as the process will start with the default software for that file type.

import clr

from System.Diagnostics import Process

file = IN[0]

Process.Start(file) #or 'D:\a.dwg' as in your example

OUT = 0

Process.Start Method (String)


#3

Thank you for the tip, that works. Below is an alternate method also
proc.StartInfo.Arguments = file