how to pass an array to a VB array via COM

Steve Holden steve at holdenweb.com
Tue Apr 26 08:37:50 EDT 2005


jelle wrote:
> 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?
> 
Have you tried wrapping them? One of the win32all modules lets you wrap 
a Python object so it can be accessed by COM interfaces. Not sure 
whether this will help, but it's a possibility.

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/




More information about the Python-list mailing list