I'm wondering if the syntax for the user could be 'improved'. afaik, if I want to create an object with a number of alterations to it, say to represent a plate with a pattern of holes in it, I have to either make multiple objects, either adding them up as I proceed, or at the end, in a return statement, say. The alternative is to create an array, and add the holes there, which seems artificial, to me. Is there not a simpler construction that could be implemented, as in my commented code below, sort of incrementing an object in the similar way we handle other values?
// AngelCAD code.
shape@ main_shape()
{
// create cube and 3 small cubes
double d = 100;
solid@ mycub = cube(d);
solid@ hole = cube(2);
solid@ holecube1 = mycub - translate(5,10,d-2)*hole;
solid@ holecube2 = holecube1 -translate(90,5,d-2)*hole;
solid@ holecube = holecube2 -translate(50,50,d-2)*hole;
return holecube;
}
/*
shape@ main_shape()
{
// create cube & 3 small cubes - the way I'd like it
double d = 100;
solid@ mycub = cube(d);
solid@ hole = cube(2);
solid@ holecube = mycub - translate(5,10,d-2)*hole;
holecube =- translate(90,5,d-2)*hole;
holecube =- holecube2 -translate(50,50,d-2)*hole;
return holecube;
}
*/
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);
}