Passing array of doubles to COM object?
Mark Hammond
mhammond at skippinet.com.au
Tue Apr 4 20:02:45 EDT 2000
This definately _should_ work. VB _may_ pass it as an array of
byref doubles tho?
Can you run makepy over the object? If so, it definately should
work from there.
In the meantime, I will add arrays of doubles to the COM test
suite (specifically, to the VB test interfaces)
Mark.
"Martin Keefe" <martink at cix.co.uk> wrote in message
news:memo.20000404125544.208A at martink.compulink.co.uk...
>
> I am trying to use an Automation server that has the following
method (among
> others):
>
> VARIANT_BOOL LoadFeature(
> BSTR code,
> BSTR label,
> long size,
> VARIANT xArray,
> VARIANT yArray);
>
> Its documentation assumes that the client will be written in VB
and says that
> xArray and yArray are arrays of Doubles. And true enough,
passing arrays of
> Doubles from VB works fine.
>
> In Python, after creating the object with:
>
> mx = win32com.client.Dispatch("Maplex.Application")
>
> I've tried the following:
>
> xa = [100000.0, 600000.0, 600000.0, 100000.0]
> ya = [100000.0, 100000.0, 900000.0, 900000.0]
> mx.LoadFeature( 'AREA', 'Simple', 4, xa, ya )
>
> and:
>
> xa = buffer( array('d',[100000.0, 600000.0, 600000.0,
100000.0]) )
> ya = buffer( array('d',[100000.0, 100000.0, 900000.0,
900000.0]) )
> mx.LoadFeature( 'AREA', 'Simple', 4, xa, ya )
>
> without success. Both ran without errors or exceptions but the
data didn't
> appear to get to the server intact. I've tried both dynamic and
static dispatch
> with the same results. Can anybody shed some light on this
please?
>
> The system is NT4 Server SP3, Python 1.5.2, win32all-128.
Thanks,
>
> ]\/[artin Keefe ][ Dorking,Surrey,UK ][ martink at cix.co.uk
>
More information about the Python-list
mailing list