I am trying to use WIN32OLE to automate Microstation
I have a function
I have an instantiated object
ole.ole_typelib // #<WIN32OLE_TYPELIB:Bentley MicroStation DGN 8.9 Object
app_type = .ole_type // #<WIN32OLE_TYPE:_Application>
method = WIN32OLE_METHOD.new(app,'Point3dFromXYZ')
method.params // [#<WIN32OLE_PARAM:Ax>, #<WIN32OLE_PARAM:Ay>,
#<WIN32OLE_PARAM:Az>]
meth.return_type_detail // ["USERDEFINED", "Point3d"]
(rdb:1) ole.ole_type
#<WIN32OLE_TYPE:_Application>
(rdb:1) app_type = ole.ole_type
#<WIN32OLE_TYPE:_Application>
(rdb:1) WIN32OLE_METHOD.new(app_type,'Point3dFromXYZ')
#<WIN32OLE_METHOD:Point3dFromXYZ>
(rdb:1) meth = WIN32OLE_METHOD.new(app_type,'Point3dFromXYZ')
(rdb:1) meth.params
[#<WIN32OLE_PARAM:Ax>, #<WIN32OLE_PARAM:Ay>, #<WIN32OLE_PARAM:Az>]
(rdb:1) meth.return_type_detail
["USERDEFINED", "Point3d"]
so it takes three values and returns a Point3d object. How can I call this?
if I do
ole.Point3dFromXYZ(3,3,2)
pt = WIN32OLE::ARGV
it gives me an array
(rdb:1) ole.Point3dFromXYZ(0,1,2)
nil
(rdb:1) pt = WIN32OLE::ARGV
[0, 1, 2]
(rdb:1) pt.class
Array
(rdb:1) pointClass = ole.ole_typelib.ole_classes.select{|c| c.name =~
/point3d/i}.first
#<WIN32OLE_TYPE:Point3d>
(rdb:1) point.guid
"{7B10D1D8-7A13-4AB2-8119-DFB0606C0C56}"
(rdb:1) WIN32OLE.new(point.guid)
WIN32OLERuntimeError Exception: failed to create WIN32OLE object from
`{7B10D1D8-7A13-4AB2-8119-DFB0606C0C56}'
HRESULT error code:0x80040154
Class not registered
(rdb:1)
Thanks,
Try the following.
pt = ole.Point3dFromXYZ(3,3,2)
Best Regards,
Masaki Suketa
pt = ole.Point3dFromXYZ(3,3,2)
-> nil
pt
-> nil
Hello,
Try the following.
>
> pt = ole.Point3dFromXYZ(3,3,2)
>
pt = ole.Point3dFromXYZ(3,3,2)
-> nil
pt
-> nil
Ooops, sorry.
I'm not sure, but you might specify parameter type
when you call Point3dFromXYZ.
What is the result of the following?
meth = WIN32OLE_METHOD.new(app_type,'Point3dFromXYZ')
meth.params.map{|e| e.ole_type_detail}
Best Regards,
Masaki Suketa
···
On Sat, Nov 19, 2011 at 02:11:18AM +0900, Dominic Sisneros wrote:
Ooops, sorry.
I'm not sure, but you might specify parameter type
when you call Point3dFromXYZ.
What is the result of the following?
meth = WIN32OLE_METHOD.new(app_type,'Point3dFromXYZ')
meth.params.map{|e| e.ole_type_detail}
(rdb:1) meth = WIN32OLE_METHOD.new(app_type, 'Point3dFromXYZ')
#<WIN32OLE_METHOD:Point3dFromXYZ>
(rdb:1) meth.params.map{|e| e.ole_type_detail}
[["R8"], ["R8"], ["R8"]
Thanks for your help
Hello,
(rdb:1) meth = WIN32OLE_METHOD.new(app_type, 'Point3dFromXYZ')
#<WIN32OLE_METHOD:Point3dFromXYZ>
(rdb:1) meth.params.map{|e| e.ole_type_detail}
[["R8"], ["R8"], ["R8"]
The all arguments of Point3dFromXYZ should be Float.
Try the following.
pt = ole.Point3dFromXYZ(3.0,3.0,2.0)
or
pt = ole.Point3dFromXYZ(3.to_f,3.to_f,2.to_f)
Best Regards,
Masaki Suketa
···
On Sat, Nov 19, 2011 at 03:36:28PM +0900, Dominic Sisneros wrote:
(rdb:1) pt = app.ole.Point3dFromXYZ(1.0,2.0,3.0)
nil
(rdb:1) pt
nil
···
2011/11/19 Masaki Suketa <masaki.suketa@nifty.ne.jp>
Hello,
On Sat, Nov 19, 2011 at 03:36:28PM +0900, Dominic Sisneros wrote:
> (rdb:1) meth = WIN32OLE_METHOD.new(app_type, 'Point3dFromXYZ')
> #<WIN32OLE_METHOD:Point3dFromXYZ>
> (rdb:1) meth.params.map{|e| e.ole_type_detail}
> [["R8"], ["R8"], ["R8"]
The all arguments of Point3dFromXYZ should be Float.
Try the following.
pt = ole.Point3dFromXYZ(3.0,3.0,2.0)
or
pt = ole.Point3dFromXYZ(3.to_f,3.to_f,2.to_f)
Hello,
>
> > (rdb:1) meth = WIN32OLE_METHOD.new(app_type, 'Point3dFromXYZ')
> > #<WIN32OLE_METHOD:Point3dFromXYZ>
> > (rdb:1) meth.params.map{|e| e.ole_type_detail}
> > [["R8"], ["R8"], ["R8"]
>
> The all arguments of Point3dFromXYZ should be Float.
> Try the following.
>
> pt = ole.Point3dFromXYZ(3.0,3.0,2.0)
>
> or
>
> pt = ole.Point3dFromXYZ(3.to_f,3.to_f,2.to_f)
>
>
(rdb:1) pt = app.ole.Point3dFromXYZ(1.0,2.0,3.0)
nil
(rdb:1) pt
nil
Try to use WIN32OLE_VARIANT
include WIN32OLE::VARIANT
a1 = WIN32OLE_VARIANT.new(1, VT_R8)
a2 = WIN32OLE_VARIANT.new(2, VT_R8)
a3 = WIN32OLE_VARIANT.new(3, VT_R8)
pt = app.ole.Point3dFromXYZ(a1, a2, a3)
Best Regards,
Masaki Suketa
···
On Tue, Nov 22, 2011 at 05:15:14PM +0900, Dominic Sisneros wrote:
Try to use WIN32OLE_VARIANT
include WIN32OLE::VARIANT
a1 = WIN32OLE_VARIANT.new(1, VT_R8)
a2 = WIN32OLE_VARIANT.new(2, VT_R8)
a3 = WIN32OLE_VARIANT.new(3, VT_R8)
pt = app.ole.Point3dFromXYZ(a1, a2, a3)
Best Regards,
Masaki Suketa
(rdb:1) include WIN32OLE::VARIANT
Object
(rdb:1) a1 = WIN32OLE_VARIANT.new(1,VT_R8)
#<WIN32OLE_VARIANT:0x1780818>
(rdb:1) a2 = WIN32OLE_VARIANT.new(2,VT_R8)
#<WIN32OLE_VARIANT:0x11aed90>
(rdb:1) a3 = WIN32OLE_VARIANT.new(3,VT_R8)
#<WIN32OLE_VARIANT:0x1a8b540>
(rdb:1) pt = app.ole.Point3dFromXYZ(a1,a2,a3)
nil
(rdb:1) pt
nil
No luck again. Thanks again for all your help
Dominic Sisneros
Hello,
(rdb:1) include WIN32OLE::VARIANT
Object
(rdb:1) a1 = WIN32OLE_VARIANT.new(1,VT_R8)
#<WIN32OLE_VARIANT:0x1780818>
(rdb:1) a2 = WIN32OLE_VARIANT.new(2,VT_R8)
#<WIN32OLE_VARIANT:0x11aed90>
(rdb:1) a3 = WIN32OLE_VARIANT.new(3,VT_R8)
#<WIN32OLE_VARIANT:0x1a8b540>
(rdb:1) pt = app.ole.Point3dFromXYZ(a1,a2,a3)
nil
(rdb:1) pt
nil
No luck again. Thanks again for all your help
Hmmm...
Sorry, but I have no idea what to do.
Maybe you must call other methods before you call Point3dFromXYZ.
Or can you call Point3dFromXYZ from VBScript(not VB)?
If so, it helps to solve this issue.
Best Regards,
Masaki Suketa
···
On Wed, Nov 23, 2011 at 03:08:10PM +0900, Dominic Sisneros wrote:
Luca_Email
(Luca (Email))
29 December 2011 06:46
11
-----Messaggio originale-----
···
Da: Dominic Sisneros [mailto:dsisnero@gmail.com]
Inviato: mercoledì 23 novembre 2011 07:08
A: ruby-talk ML
Oggetto: Re: WIN32OLE return type USERDEFINED
Try to use WIN32OLE_VARIANT
include WIN32OLE::VARIANT
a1 = WIN32OLE_VARIANT.new(1, VT_R8)
a2 = WIN32OLE_VARIANT.new(2, VT_R8)
a3 = WIN32OLE_VARIANT.new(3, VT_R8)
pt = app.ole.Point3dFromXYZ(a1, a2, a3)
Best Regards,
Masaki Suketa
(rdb:1) include WIN32OLE::VARIANT
Object
(rdb:1) a1 = WIN32OLE_VARIANT.new(1,VT_R8) #<WIN32OLE_VARIANT:0x1780818>
(rdb:1) a2 = WIN32OLE_VARIANT.new(2,VT_R8) #<WIN32OLE_VARIANT:0x11aed90>
(rdb:1) a3 = WIN32OLE_VARIANT.new(3,VT_R8) #<WIN32OLE_VARIANT:0x1a8b540>
(rdb:1) pt = app.ole.Point3dFromXYZ(a1,a2,a3) nil
(rdb:1) pt
nil
No luck again. Thanks again for all your help
Dominic Sisneros
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
Sponsor:
Conto Arancio al 4,20%. Soldi sempre disponibili, zero spese, aprilo in due minuti!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid 920&d)-12
I will try other things and if I get it to work I will update this post.
Thanks for all your attention and help
Dominic Sisneros
···
2011/11/23 Masaki Suketa <masaki.suketa@nifty.ne.jp>
Hello,
On Wed, Nov 23, 2011 at 03:08:10PM +0900, Dominic Sisneros wrote:
> (rdb:1) include WIN32OLE::VARIANT
> Object
> (rdb:1) a1 = WIN32OLE_VARIANT.new(1,VT_R8)
> #<WIN32OLE_VARIANT:0x1780818>
> (rdb:1) a2 = WIN32OLE_VARIANT.new(2,VT_R8)
> #<WIN32OLE_VARIANT:0x11aed90>
> (rdb:1) a3 = WIN32OLE_VARIANT.new(3,VT_R8)
> #<WIN32OLE_VARIANT:0x1a8b540>
> (rdb:1) pt = app.ole.Point3dFromXYZ(a1,a2,a3)
> nil
> (rdb:1) pt
> nil
>
> No luck again. Thanks again for all your help
Hmmm...
Sorry, but I have no idea what to do.
Maybe you must call other methods before you call Point3dFromXYZ.
Or can you call Point3dFromXYZ from VBScript(not VB)?
If so, it helps to solve this issue.
Best Regards,
Masaki Suketa