Grasshopper

algorithmic modeling for Rhino

I do have a point cloud and want to get the Object Name as well as the Point3d coordinates. 

I'm new to using Python in Grasshopper. I do have two lists as input. An ID's list and a Point3d list. Could someone tell me how to get the object name?

Also, if I have the Point3d, how to get the Guid of this point?

Thanks.

Views: 1132

Replies to This Discussion

Ok, now I found a way to get the names from the ID's list. Like this:

import Grasshopper as gh
import os
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

for i in range(len(ids)):
rhinoObj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(ids[i])
if 'Point' in str(rhinoObj):
print(rhinoObj.Geometry.)
print('name %s, coordinates'%(rhinoObj.Name))

How to extract now the coordinates? Could someone give me an example how to get the name and the coordinates directly from the points list?

Also, if I have the Point3d, how to get the Guid of this point?

This is not possible. The coordinate does not contain sufficient information to reverse engineer what object it originally came from, unless of course you're willing to iterate over all objects in the Rhino document to see which one if a point at the same location. And then hope you won't find more than one.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service