Grasshopper

algorithmic modeling for Rhino

This used to work before, but now I am getting the Data Conversion Failed from Goo to.... error. 

if this is my method for creating a Point3d: 

class MSPoint(object):

    def __init__( self, x= None, y= None, z =None):
        self.x = x
        self.y = y
        self.z = z
    def addData(self, data):
        self.data = data
    def toDSPoint(self):
         dsPoint = ds.Geometry.Point.ByCoordinates(self.x, self.y, self.z)
         return dsPoint
    def toRHPoint3d(self):
        return rc.Geometry.Point3d(self.x, self.y, self.z)

and this is my definition on GH side to read the points in: 

def toRHObject(item):
    if type(item) == ms.MSPoint:
        return item.toRHPoint3d()

This method used to work well in GH returning points. Now, since I started to get this error I tried to implement AddPoint() method since that's what most comments stated would be the solution to most conversion issues: 

def toRHObject(item):
    if type(item) == ms.MSPoint:
        return sc.doc.Objects.AddPoint(item.toRHPoint3d())

Now this throws an error that it expected a Point3d and got Point3d ...I am a little confused as to what is going on. sc is of course scriptcontext. 

Ideas? 

Thank you,

Views: 2133

Replies to This Discussion

Hi Konrad

  Check the attached file" I hope this helps"

Attachments:

like I said I already tried adding the point and that throws this exception: expected Point3d, got Point3d. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service