BoundingBox of Brep


(Karol Wierzbicki) #1

I am trying to get bounding box for brep after translation, and each
time I translate brep, I get bounding box in exactly the same location, what do I do wrong?

ObjRef obj_ref = go.Object(0);
            var list = new List < BoundingBox > ();
            for (int i = 0; i < 3; i++)
            {
                var transformVector = Transform.Translation(new Vector3d(0, 0, i));

var brep = obj_ref.Brep();
                brep.Transform(transformVector);
                var bb = brep.GetBoundingBox(true);
                list.Add(bb);
                doc.Objects.AddBrep(brep);
            }


#2

You are applying the transformation over the same brep. You should obtain a new ObjRef from the added brep:

obj_ref = new ObjRef( doc.Objects.AddBrep(brep) );


(Karol Wierzbicki) #3

Oh. I guess this is what menno tried to explain me in one of my previous topics, I guess I didn’t get it then. Thanks!