Open AutoCad usina ruby

is there a way to open AutoCad using ruby ​​is a specific file

From within SketchUp ?


You might also use try a %x execute string.

%x{acad.exe "path/to/some.dwg"}

And then there is a Wscript command using the Win32OLE class.

Something like this (untested.) Correct the paths if need be.
(Also if the user has changed the AutoCAD directory name or install disk the normal paths will not work.)

module Author
  module SomePlugin

    require 'win32ole'

    ACAD = File.join( ENV['PROGRAMFILES'], 'AutoCad', 'acad.exe' )

    def open_in_acad(pathname)
      shell ="WScript.Shell")
      shell.Run( "#{ACAD} #{pathname}", 1, false)


REF: Run Method (Windows Script Host) | Microsoft Learn

1 Like