Re: WIN32OLE_RECORD and WIN32OLE_VARIANT
Masaki Suketa <[email protected]> Thu, 24 Oct 2019 21:31:45 +0900
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <20191024123145.GA17732@tpx270> |
On Wed, Oct 23, 2019 at 03:13:33PM -0600, Dominic Sisneros wrote:
>
> ole_pts = pts.map{|pt| app.to_ole_point3d(pt)}
> => [#<WIN32OLE_RECORD(Point3d) {"X"=>0.0, "Y"=>0.0, "Z"=>0.0}>,
> #<WIN32OLE_RECORD(Point3d) {"X"=>10.0, "Y"=>0.0, "Z"=>0.0}>,
> #<WIN32OLE_RECORD(Point3d) {"X"=>10.0, "Y"=>10.0, "Z"=>0.0}>,
> #<WIN32OLE_RECORD(Point3d) {"X"=>0.0, "Y"=>10.0, "Z"=>0.0}>,
> #<WIN32OLE_RECORD(Point3d) {"X"=>0.0, "Y"=>0.0, "Z"=>0.0}>]
>
> When I try to convert it to a WIN32OLE_VARIANT array it gives an error
>
> [80] pry(main)> obj = WIN32OLE_VARIANT.new(ole_pts)
> TypeError: can not convert WIN32OLE_VARIANT from type WIN32OLE_RECORD
>
> I think I need to convert it to a VARIANT ARRAY because I have the
> following ole function - function signature from olegen.rb
>
> # _LineElement CreateLineElement1
> # _Element arg0 --- Template [IN]
> # Point3d arg1 --- Vertices [IN/OUT]
> def CreateLineElement1(arg0, arg1)
> ret = _invoke(1610743981, [arg0, arg1], [VT_BYREF|VT_DISPATCH,
> VT_BYREF|VT_ARRAY|VT_DISPATCH])
> @lastargs = WIN32OLE::ARGV
> ret
> end
Hmmm, I'm not sure,
Is ole_pts second argument of CreateLineElement1?
If so, How about calling CreateLineElement1(xxx, ole_pts)? (without
converting by WIN32OLE_VARIANT.new)
Regards,
Masaki Suketa
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>