algorithmic modeling for Rhino
I am trying to move a point in python. I tried newpoint=mypoint.translate(myvector) and it did not work. It does not matter to me if it moves mypoint or copies mypoint to the new position (but i'd like to know how to do both).
In general, are transformation commands different than commands like evaluate and split? My experience with python has mostly involved commands like "Rhino.Geometry.BrepFace.Split(myface,mycurve,.001)" where the objects executed upon are within the parenthesis.
Tags:
"Hi Lawrence Yun
Thanks
So xform defines the transformation and then I have to use scriptcontext.doc.objects.Transform() to actually move the point. And this will work for all other transformations (rotate,mirror,scale) as long as I set up xform correctly?
One problem I am having is that my point does not have a Guid. I noticed that you set the type hint for your point input to ghdoc object. The points I am trying to move originates from inside the python script. Is there anyway I can give it a Guid? Or maybe there is another way to move it? What I don't want to do is to generate it in the Rhino window and then delete it. There has got to be an easier way to move objects.
My script is a short one (just a test) where I have a point on a mesh and repeatedly copy it along the mesh to create a polyline that flows on the mesh.
Check the attached files
Thanks.
So no matter what, for me to transform geometry, it must be Rhino geometry. And "coerce" turns my grasshopper/python generated geometry into Rhino geometry.Why is it still necessary to "AddPoint" after the point has already been "coerced"?
You could also just add the point with a translation vector, like so:
import Rhino as rc
# Make point and vector
myPoint = rc.Geometry.Point3d(0,0,0)
myVector = rc.Geometry.Vector3d(1,1,0)
#"Move" point
myPoint = myPoint + myVector
Does this work for other geometry? Like curves and breps?
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by