CascadeStudio icon indicating copy to clipboard operation
CascadeStudio copied to clipboard

Bound box error for shapes formed from intersection with loft.

Open gulamf opened this issue 8 months ago • 0 comments

Hello See code below.

The bound box for the first example seems to be fine. That is the intersection of a cylinder and a box.

However the second example, the bound box is wrong. It seems to refer back to the original loft and not the new intersected shape.

Output from at the console is

Cylinder zmax 5 Box0 zmax 2.5 Intersection0 zmax 2.5 <--------Correct Loft zmax 20.00000000000149 Box1 zmax 2.5 Intersection1 zmax 20.00000000000149 <--------Incorrect

Any ideas?


function bbzmax(shape) {
    var box = new oc.Bnd_Box();
    oc.BRepBndLib.prototype.Add(shape, box);
    return box.GetZmax();
}


//---------NO ERROR--------------
let c = Cylinder(2.5,5);
let b0 = Box(10,10,5,true);
let i0 = Intersection([c,b0]);

console.log("Cylinder zmax " + bbzmax(c));
console.log("Box0 zmax " + bbzmax(b0));
console.log("Intersection0 zmax " + bbzmax(i0));


//----------------ERROR-------------
// Sketch: An interface for drawing 2D shapes and curves
let face = new Sketch([-10,-8]).Fillet(2).
               LineTo([ 10,-8]).Fillet(2).
               LineTo([  0, 8]).Fillet(2).
               End(true).Face();

// Loft: Interpolates along an array of Wires into a continuous solid shape
let l =   Loft([GetWire(face), Translate([0,0,20], Circle(8, true))]);
let b1 =  Box(10,10,5,true);
let i1 = Intersection([l,b1]);

console.log("Loft zmax " + bbzmax(l));
console.log("Box1 zmax " + bbzmax(b1));
console.log("Intersection1 zmax " + bbzmax(i1));

gulamf avatar Mar 15 '25 23:03 gulamf