how to pass an array to a VB array via COM

jelle jelleferinga at gmail.com
Tue Apr 26 07:31:24 EDT 2005


Hi,

I'm trying to script Rhino -the nurbs modeller, not the server soft-
via COM.
Which is good fun, except i cant seem to pass arrays to the program.
I suppose its expecting VB arrays, and is not to keen when i send a
tuple:

RS.AddCurve(((1,2,3),(4,5,6),(7,8,9)),3)
---
Traceback (most recent call last):
  File "<input> ", line 1, in ?
  File "c:\Python23\lib\site-packages\jf\interface\RhinoScript.py",
line 48,
in AddCurve
    return self._ApplyTypes_(77, 1, (12, 0), ((12, 0), (12, 16)),
'AddCurve', None,vaPoints, vaDegree)
  File "c:\Python23\lib\site-packages\win32com\client\__init__.py",
line
446, in _ApplyTypes_
    return self._get_good_object_(
com_error: (-2147352567, 'Exception occurred.', (6, 'RhinoScript_m',
'Type
mismatch in parameter.  One-dimensional array required.', 'C:\\Program
Files\\Rhinoceros 3.0\\RhinoScript_m.HLP', 393222, 0), None)
---

This is somewhat puzzling, since when i define points in the
application, these are returned as a tuple of tuples:


>>>s = RS.GetPoints()
>>>print s
((-7.0, -30.0, 0.0), (15.0, -24.0, 0.0), (-7.0, 12.0, 0.0), (14.0,
29.0,
0.0), (28.0, 10.0, 0.0), (20.0, 1.0, 0.0))

I've been searching this list for a solution, but didnt find anything i
could use. Any ideas?

Cheers,

Jelle




More information about the Python-list mailing list