win32ole error -- method_missing

J

Jack_Rabbit

I'm just learning Ruby. I'd like to be able to control AutoCAD but
I get a "method_missing" error. I did a search on this group and on the
web but couldn't find a solution. Does anyone know of a solution or a
workaround?

#------------------------- ERROR -------------------------------

bash-2.05b$ ruby ./act.rb
../act.rb:16:in `method_missing': AddLine (WIN32OLERuntimeError)
OLE error code:80070057 in <Unknown>
<No Description>
HRESULT error code:0x80020009
Exception occurred. from ./act.rb:16
bash-2.05b$

#------------------------- CODE --------------------------------

require 'win32ole'

acad = WIN32OLE.new("autocad.application.16")
acad.Visible = true
thisDrawing = acad.Application.Documents.Add("acad.dwt")
thisDrawing.Application.ZoomAll

thisDrawing.Layers.Add("GEOMETRY_BOTTOM")
thisDrawing.Layers.Add("GEOMETRY_SIDE")
thisDrawing.Layers.Add("CENTERLINE_BOTTOM")

p1 = [0.0, 0.0, 0.0]
p2 = [10.0, 10.0, 0.0]
# Error occurs here...
thisDrawing.PaperSpace.AddLine(p1, p2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top