trying to create a sphere on a layer based off of the layer of a specific point then move it to another layer based of the layer name “audio evaluation”
Trying to create a sphere on a layer based off of a specific point (on the same layer) the move it to another layer
Please clarify a little. Is the “specific point” in the center of the sphere or what are their relation? Should the sphere be created on the same layer as the point or elsewhere? How far have you got and what does your code look like as of now?
the point is at the center of the sphere, i need to create it on the same layer as the point because im drawing information from a csv file ive attached to the layer, but then i need to move all the spheres I create to a different layer. preferably by the name “audio evaluation”
If you have the point guid already, maybe try something like this:
doc = Rhino.RhinoDoc.ActiveDoc def create_sphere(point_guid, radius): point = doc.Objects.Find(point_guid).Geometry.Location sphere_layer = Rhino.DocObjects.Layer() sphere_layer.Name = 'layerName' sphere_attrs = Rhino.DocObjects.ObjectAttributes() sphere_attrs.LayerIndex = doc.Layers.Add(sphere_layer) Rhino.RhinoDoc.ActiveDoc.Objects.AddSphere( Rhino.Geometry.Sphere(point, radius), sphere_attrs)
Maybe you also need to search for the points in a given layer? Not sure how to do that, but sure you can find something in the LayerTable documentation in the SDK:
thank you! any idea how i would get the guid of all the points in a project
Try modding the function above to accept point instead of guid by deleting the first row in create_sphere() function and change first arg to ‘point’. You can then call
Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.Point) to give you an array that I think you could iterate through using the function. Note that it will give you all points in the document, not just in some layer.
It will return an array of PointObjects not point3D. to get at the point3D that you want, do:
PointObject.Geometry.Location, then you can go on as before.