Rhinocommon python rotate group points around plane z-axis

I cannot find the correct python code to let a group of points rotate around the z-axis of a plane.
Do you might know how I must do it?

Transform and translation?
I tried several things, but I think I am doing things incorrect.
Here is a clean version.

problem rotate group points 01.gh (8.2 KB)

ps.: Do you might know to place a # hastag at several rules? I remember it was shift+# but it does not work anymore.

problem rotate group points 02.gh (13.5 KB)

This works, making a vector from the plane to the points in order to be able to use Rotate.
However, does somebody might know why the #+shift does not work anymore?

import rhinoscriptsyntax as rs
import Rhino as rc

angle=rc.Geometry.Vector3d.VectorAngle(planea[1],planeb[1])
newpnts=[]
for p in pnts:
    vc=rc.Geometry.Vector3d((p-planea[0]))
    vc.Rotate(angle,planea[3])
    newp=planeb[0]+vc
    
    newpnts.append(newp)

Hi, in general, you need to make a transform object first and pass it to the Transform function under each object.

X=Rhino.Geometry.Transform.Rotation(something) # create a transform object

newpnts=
for p in pnts:
_p=Rhino.Geometry.Point3d§ #make a copy
_p.Transform(X) #transform the point
newpnts.append(_p)

Note that, technically, Rhino.Geometry.Transform and [some geometry].Transform(X) are two different things. There are a lot of functions under Rhino.Geometry.Transform that let you make an appropriate Transform object, then it is applied to each object through [some geometry].Transform(X)

1 Like

Thank you :smiley: