When try to translate in z direction body deforms

when I try to translate surface in z direction it start deforming that surface

 transform = Transform.Translation(0.0, 0.0, 30.0);
 ApplyTransformToComponent(brepBody, componentIndices, transform, ActiveDoc.ModelAbsoluteTolerance);

Hi @Bhavita_Patil,

We will need more information in order to provide help.

Do you have an example file that contains what you are trying to modify?

Having files that show you have and also what you want is most helpful.

Also, RhinoCommon does not have a ApplyTransformToComponent method. So providing sample code that does not work for you is also helpful.

– Dale

Hello @dale ,

The highlighted part of the image is a brep face that I wish to translate  in x ,y and z direction. This works for x and y direction using this piece of code.

       RhinoDoc activeDoc = RhinoDoc.ActiveDoc;
        IEnumerable<RhinoObject> brepObjects = activeDoc.Objects.GetObjectList(ObjectType.Brep);
        RhinoObject object1 = brepObjects.FirstOrDefault();
        Brep brepBody = Brep.TryConvertBrep(object1.Geometry);
        BrepFace face1 = brepBody.Faces.ElementAt(5);
        ComponentIndex index = face1.ComponentIndex();
        IEnumerable<ComponentIndex> componentIndices = new List<ComponentIndex> { index };

        Transform transform;
        transform = Transform.Translation(0.0, 0.0, 30.0);            
        brepBody.TransformComponent(componentIndices, transform, 0.0, 0.0, false);


But when I try to do this same in z direction it forms gap between two surfaces

Hi @Bhavita_Patil,

You might review this sample and see if it helps.


Keep in mind that Rhino is not a parametric modeler and does not have “direct modeling”, although there is some new push-pull modeling capability available in the Rhino 8 WIP.

– Dale