Win32ole: Passing an Array to Autocad

Hi!

I am (again - tried the same thing 2 years ago) trying to use ruby for
automating Autocad.
Win32ole is a great tool and basically allows me to program Autocad to
the same extent as when using Visual Basic....

Unfortunately there's one thing that absolutely doesn't work:
I can't call any methods that take an array as an argument - as you can
imagine that applies to almost every method that creates
Autocad-Objetcs...
say I wanted to insert a Text-Object like that:
@model.AddText("test",[0.0,0.0,0.0],10)
This doesn't work, all I get is a WIN32OLERuntimeError...

Methods that take Strings and Integers as Arguments work like a charm.

I really would appreciate any idea on how to solve this problem.

Michael

Could you show me the result of the following script?

m = @model.ole_method_help('AddText')
puts m.name
puts " dispid:"
puts " #{m.dispid}"
puts " args:"
m.params.each do |p|
  puts " #{p.ole_type} #{p.name}"
end

  Regards,
  Masaki Suketa

···

In message "win32ole: Passing an Array to Autocad" on 05/11/04, "Michael Mueller" <muellerix@gmx.de> writes:

Unfortunately there's one thing that absolutely doesn't work:
I can't call any methods that take an array as an argument - as you can
imagine that applies to almost every method that creates
Autocad-Objetcs...
say I wanted to insert a Text-Object like that:
@model.AddText("test",[0.0,0.0,0.0],10)
This doesn't work, all I get is a WIN32OLERuntimeError...

Could you show me the result of the following script?

m = @model.ole_method_help('AddText')
puts m.name
puts " dispid:"
puts " #{m.dispid}"
puts " args:"
m.params.each do |p|
  puts " #{p.ole_type} #{p.name}"
end

Sure, the output is:

···

----------------
AddText
dispid:
   1572
args:
   BSTR TextString
   VARIANT InsertionPoint
   R8 Height
----------------

Regards,
Michael

Sorry for being too late to reply.

> Could you show me the result of the following script?
>
> m = @model.ole_method_help('AddText')
> puts m.name
> puts " dispid:"
> puts " #{m.dispid}"
> puts " args:"
> m.params.each do |p|
> puts " #{p.ole_type} #{p.name}"
> end

Sure, the output is:
----------------
AddText
dispid:
   1572
args:
   BSTR TextString
   VARIANT InsertionPoint
   R8 Height
----------------

Could you try _invoke method?

  @model._invoke(1572, ["test", [0.0,0.0,0.0], 10],
                       [WIN32OLE::VARIANT::VT_BSTR,
                        WIN32OLE::VARIANT::VT_ARRAY,
                        WIN32OLE::VARIANT::VT_R8])
or
  @model._invoke(1572, ["test", [0.0,0.0,0.0], 10],
                       [WIN32OLE::VARIANT::VT_BSTR,
                        WIN32OLE::VARIANT::VT_VARIANT,
                        WIN32OLE::VARIANT::VT_R8])

  Regards,
  Masaki Suketa

···

In message "Re: win32ole: Passing an Array to Autocad" on 05/11/11, "Michael Mueller" <muellerix@gmx.de> writes: