JimYuan's Blog

Sharing the things I learned

0%

BrepTransformation

Along my way of developing with RhinoCommon, I noticed that I have some certain patterns which I feel them handy and keep using from time to time.
This note is for the skill/ function I recently learned and implemented.


Readers may refer to this QA
https://discourse.mcneel.com/t/moveface-in-rhinocommon/129818

So basically, in RhinoCommon, we have this Brep.TransformComponent function, this can allow developer to change(apply xform) on a certain component(vertice/ edge/ face) and the other components will changed accordingly as well.

You could see the example code I provide here and also in the QA section page

1
2
3
4
5
List<ComponentIndex> ci = new List<ComponentIndex>();
ci.Add(x.Faces[0].ComponentIndex());
Transform moveDown = Transform.Rotation(y, Vector3d.YAxis, x.Faces[0].GetBoundingBox(true).Center);
x.TransformComponent(ci, moveDown, 0.0001, 0.1, true);
A = x;

And the result:
screenShot