How to rotate objects in Rhino SDK

Dear Reader,

I want to Rotate my shapes to fix by some angles.
I have get the Surface like this :

Surface sr = obj_ref.Surface();

then for example i want to rotate it like this:

Point3d P = new Point3d(0, 0, 0);
Vector3d D = new Vector3d(10, 10, 10);
sr.Rotate(30,D,P);
doc.Objects.AddSurface(sr);
doc.Views.Redraw();

but noting happened in rotation and the Surface just duplicate.
Can you help me to rotate my shape ?

Hi Hamidi.

RhinoCommon methods use radians(30*pi/180). Also use Replace method instead of “AddSurface”.

There is a lot of code in this example. But it might be helpful…

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsRotate.cs