Rounding Shapes

Discussion in 'ShapeJS' started by pendarestan, Apr 20, 2017.

Tags:
  1. pendarestan
    pendarestan Well-Known Member
    How can I round a shape in ShapeJS? For example, if I union two boxes I want fillets on the concave edges. If I try this using setRounding on the primitives, there are no fillets.

    var box1 = new Box(10*MM, 10*MM, 10*MM);
    box1.setRounding(2*MM);
    var box2 = new Box(10*MM, 10*MM, 10*MM);
    box2.setTransform(new Translation(5*MM, 5*MM, 5*MM));
    box2.setRounding(2*MM);
    var union = new Union(box1, box2);​
     
  2. Oliver_Krangle
    Oliver_Krangle Well-Known Member
    I was needing to figure this out myself. The only thing you are missing is the blending command after doing the union of the rounded cubes.

    var uiParams = [
    {
    name: "blend",
    label: "blend",
    desc: "blend",
    type: "double",
    rangeMin: 0.1,
    rangeMax: 20,
    step: 0.1,
    defaultVal: 2,
    unit: "MM",
    group: "Size"
    },
    {
    name: "round",
    label: "round",
    desc: "round",
    type: "double",
    rangeMin: 0.1,
    rangeMax: 20,
    step: 0.1,
    defaultVal: 2,
    unit: "MM",
    group: "Size"
    }
    ];

    function main(args) {
    var box1 = new Box(10*MM, 10*MM, 10*MM);
    box1.setRounding(args.round);
    var box2 = new Box(10*MM, 10*MM, 10*MM);
    box2.setTransform(new Translation(5*MM, 5*MM, 5*MM));
    box2.setRounding(args.round);
    var union1 = new Union(box1, box2);
    union1.setBlend(args.blend);

    var s = 20 * MM;
    return new Scene(union1, new Bounds(-s,s,-s,s,-s,s));
    }

    union_blend.jpg
     
  3. pendarestan
    pendarestan Well-Known Member