[ resent to the whole group ]
On 11/12/2024 5:04 AM, Raymond West wrote:
Here is a random design for a simple control panel cutout.
How, in text, would you define that the two fixing holes, and make
them horizontal? (once users are given an inch (or 25.4mm) they will
want to take a mile, at least.)
(I went down the rabbit hole of asking ChatGPT (I never defined it was
openscad) I just gave it the dxf file. It wrote me a python script,
which I'm not going to check, since it ends in a day of arguing.)
I asked - 'I want to rotate the large circle with the two small
circles 90 degrees so that the two circles are horizontal. can you
rewrite the dxf file'
So the three circles on the right are a cutout (for a knob, perhaps) and
two mounting holes for screws?
I would think of something along the general lines of
module cutout(cutoutD, mountD, mountSep) {
circle(d=cutoutD);
for (x = [mountSep/2, -mountSep/2])
translate([x, 0]) circle(d=mountD);
}
cutout(cutoutD=25, mountD=5, mountSep=37);
which gives you cutout and mounting holes that you can position and
rotate as desired. Set the arguments as appropriate for your particular
components, of course. There are multiple ways to measure such a layout
- diameters, radii, et cetera - but I picked what I thought was the most
obvious: diameters of the holes, and center-to-center distance for the
mounting holes.
Thus, e.g.:
difference() {
square([80,100]);
translate([30,20]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([30,50]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([30,80]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([60,35]) rotate(90) cutout(cutoutD=15, mountD=3, mountSep=22);
translate([60,65]) rotate(90) cutout(cutoutD=15, mountD=3, mountSep=22);
}
yields
Of course, if you have one particular mounting pattern that you use a
lot you'd want to wrap it in a module itself, something like:
module bigKnob() {
cutout(cutoutD=25, mountD=5, mountSep=37);
}
module smallKnob() {
cutout(cutoutD=15, mountD=3, mountSep=22);
}
difference() {
square([80,100]);
translate([30,20]) bigKnob();
translate([30,50]) bigKnob();
translate([30,80]) bigKnob();
translate([60,35]) rotate(90) smallKnob();
translate([60,65]) rotate(90) smallKnob();
}
[ resent to the whole group ]
On 11/12/2024 5:04 AM, Raymond West wrote:
>
> Here is a random design for a simple control panel cutout.
>
> How, in text, would you define that the two fixing holes, and make
> them horizontal? (once users are given an inch (or 25.4mm) they will
> want to take a mile, at least.)
>
> (I went down the rabbit hole of asking ChatGPT (I never defined it was
> openscad) I just gave it the dxf file. It wrote me a python script,
> which I'm not going to check, since it ends in a day of arguing.)
>
> I asked - 'I want to rotate the large circle with the two small
> circles 90 degrees so that the two circles are horizontal. can you
> rewrite the dxf file'
>
So the three circles on the right are a cutout (for a knob, perhaps) and
two mounting holes for screws?
I would think of something along the general lines of
module cutout(cutoutD, mountD, mountSep) {
circle(d=cutoutD);
for (x = [mountSep/2, -mountSep/2])
translate([x, 0]) circle(d=mountD);
}
cutout(cutoutD=25, mountD=5, mountSep=37);
which gives you cutout and mounting holes that you can position and
rotate as desired. Set the arguments as appropriate for your particular
components, of course. There are multiple ways to measure such a layout
- diameters, radii, et cetera - but I picked what I thought was the most
obvious: diameters of the holes, and center-to-center distance for the
mounting holes.
Thus, e.g.:
difference() {
square([80,100]);
translate([30,20]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([30,50]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([30,80]) cutout(cutoutD=25, mountD=5, mountSep=37);
translate([60,35]) rotate(90) cutout(cutoutD=15, mountD=3, mountSep=22);
translate([60,65]) rotate(90) cutout(cutoutD=15, mountD=3, mountSep=22);
}
yields
Of course, if you have one particular mounting pattern that you use a
lot you'd want to wrap it in a module itself, something like:
module bigKnob() {
cutout(cutoutD=25, mountD=5, mountSep=37);
}
module smallKnob() {
cutout(cutoutD=15, mountD=3, mountSep=22);
}
difference() {
square([80,100]);
translate([30,20]) bigKnob();
translate([30,50]) bigKnob();
translate([30,80]) bigKnob();
translate([60,35]) rotate(90) smallKnob();
translate([60,65]) rotate(90) smallKnob();
}