Here is a code to access a Brep body from Rhino through a script in c#. I have got the brep body->then a certain circular edge->now I wish to scale it and expect the whole object to modify accordingly as it happens when I select an edge and scale in using tools in Rhino. But the edge.scale(2) opeartion return False why. How can I modify objects geometry?
RhinoDoc activedoc = RhinoDoc.ActiveDoc;
IEnumerable<RhinoObject> B = activedoc.Objects.GetObjectList(ObjectType.Brep);
RhinoObject object1 = B.ElementAt(0);
//obejct1dup = object1.DuplicateGeometry();
bool hasBrepform = object1.Geometry.HasBrepForm;
GeometryBase obj_dup = object1.DuplicateGeometry();
Brep Brep_body = Brep.TryConvertBrep(obj_dup);
BrepFace face1 = Brep_body.Faces.ElementAt(0);
ComponentIndex index = face1.ComponentIndex();
IEnumerable<Rhino.Geometry.ComponentIndex> componentIndices = new List<Rhino.Geometry.ComponentIndex>();
componentIndices.Append(index);
Point3d point = new Point3d(0, 0, 0);
Transform transform = Transform.Scale(point, 3);
double tolerance = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;// Use the document's default tolerance
double timeLimit = 10.0; // Set a time limit of 10 seconds
bool useMultipleThreads = true;
Brep_body.TransformComponent(componentIndices, transform, tolerance, timeLimit, useMultipleThreads);
ObjRef objRef = new ObjRef(object1);
A = activedoc.Objects.Replace(objRef,Brep_body);
object1.CommitChanges();
activedoc.Views.Redraw();
Tried this code. It is returning True at A but no changes in object, also it has given IsDocumnentControlled to be True, for which document suggest that it is the object is read only.
But also I am able to scale the whole Brep body but not one face of it.
It looks the same
I checked IsDocumentControlled and it is returning true,
for this documentation says file could be just readonly
but I could scale whole Brep object but not a surface of it, the way we can do it by tools.