Transformation of SubObject selected objects

Hello,
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);

thanks

For Breps you can use Brep.TransformComponent like this:

//C#
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");
  go.Get();
  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);
  doc.Views.Redraw();
  return Result.Success;
}
#python
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")
    go.Get()
    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)
    doc.Views.Redraw()

if __name__ == "__main__":
    TransformSubObj()

TransformSubObj.py (736 Bytes)
TransformSubObj.zip (94.4 KB)