Open AutoCad usina ruby


#1

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


#2

From within SketchUp ?

UI::openURL("path/to/some.dwg")

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 = WIN32OLE.new("WScript.Shell")
      shell.Run( "#{ACAD} #{pathname}", 1, false)
    end

  end
end

REF: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/d5fk67ky(v%3Dvs.84)