Transformation of SubObject selected objects

i try to perform a transformation on several SubObjects, but transformation is done to the whole object and not the subobject… do i have to get an ObjRef for all possible cases? If so can they all be stored in one list?

GetObject go = new Rhino.Input.Custom.GetObject();
go.SubObjectSelect = true;
go.GetMultiple(1, 0);


doc.Objects.Transform(go.Object(i), xform, true);


For Breps you can use Brep.TransformComponent like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var go = new GetObject {GeometryFilter = Rhino.DocObjects.ObjectType.Surface, SubObjectSelect = true};
  go.SetCommandPrompt("Select brep-face to transform");
  if (go.CommandResult() != Result.Success) return go.CommandResult();
  var objref = go.Object(0);
  var brep = objref.Brep();
  var xform = Transform.Scale(Plane.WorldXY, 1.2, 1.2, 1.2);
  brep.TransformComponent(new []{objref.GeometryComponentIndex},xform, doc.ModelAbsoluteTolerance, 0, true);
  doc.Objects.Replace(objref.ObjectId, brep);
  return Result.Success;
import Rhino
from scriptcontext import doc
def TransformSubObj():
    go = Rhino.Input.Custom.GetObject()
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Surface
    go.SubObjectSelect = True
    go.SetCommandPrompt("Select brep-face to transform")
    if go.CommandResult()!=Rhino.Commands.Result.Success:
        return go.CommandResult()
    objref = go.Object(0)
    brep = objref.Brep()
    xform = Rhino.Geometry.Transform.Scale(Rhino.Geometry.Plane.WorldXY, 1.2,1.2,1.2)
    brep.TransformComponent([objref.GeometryComponentIndex],xform, doc.ModelAbsoluteTolerance, 0, True)
    doc.Objects.Replace(objref.ObjectId, brep)

if __name__ == "__main__":
    TransformSubObj() (736 Bytes) (94.4 KB)

thank you!