K
ken@volksswitch.org
Fri, Nov 27, 2020 10:54 PM
I've been using OpenSCAD for about two years and I just realized that I
don't know how to something simple like increment a variable or pass a value
from one part of my code to another.
Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]]
I'd like to count the number of times that the first element of each sub
vector exceeds 2.
I think I can iterate through x with a for loop and ask whether x[i][0] > 1,
but I don't know what to do with the result of that comparison. k=0 then
k=k+1 isn't supported in the language. And even if it was, k is undefined
outside of the loop.
A function may be helpful, but it looks like a function is just a line of
code that has been set aside for modularity. Search can iterate across a
vector but any comparison has to be equality, nothing as fancy as "greater
than".
Ken
I've been using OpenSCAD for about two years and I just realized that I
don't know how to something simple like increment a variable or pass a value
from one part of my code to another.
Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]]
I'd like to count the number of times that the first element of each sub
vector exceeds 2.
I think I can iterate through x with a for loop and ask whether x[i][0] > 1,
but I don't know what to do with the result of that comparison. k=0 then
k=k+1 isn't supported in the language. And even if it was, k is undefined
outside of the loop.
A function may be helpful, but it looks like a function is just a line of
code that has been set aside for modularity. Search can iterate across a
vector but any comparison has to be equality, nothing as fancy as "greater
than".
Ken
NH
nop head
Fri, Nov 27, 2020 11:04 PM
A recursive function can do what you want.
function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count
: count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
x = [[3,5],[1,6],[6,1],[8,4]];
echo(count_more_than(x));
On Fri, 27 Nov 2020 at 22:54, ken@volksswitch.org wrote:
I’ve been using OpenSCAD for about two years and I just realized that I
don’t know how to something simple like increment a variable or pass a
value from one part of my code to another.
Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]]
I’d like to count the number of times that the first element of each sub
vector exceeds 2.
I think I can iterate through x with a for loop and ask whether x[i][0] >
1, but I don’t know what to do with the result of that comparison. k=0 then
k=k+1 isn’t supported in the language. And even if it was, k is undefined
outside of the loop.
A function may be helpful, but it looks like a function is just a line of
code that has been set aside for modularity. Search can iterate across a
vector but any comparison has to be equality, nothing as fancy as “greater
than”.
Ken
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A recursive function can do what you want.
function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count
: count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
x = [[3,5],[1,6],[6,1],[8,4]];
echo(count_more_than(x));
On Fri, 27 Nov 2020 at 22:54, <ken@volksswitch.org> wrote:
> I’ve been using OpenSCAD for about two years and I just realized that I
> don’t know how to something simple like increment a variable or pass a
> value from one part of my code to another.
>
>
>
> Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]]
> I’d like to count the number of times that the first element of each sub
> vector exceeds 2.
>
>
>
> I think I can iterate through x with a for loop and ask whether x[i][0] >
> 1, but I don’t know what to do with the result of that comparison. k=0 then
> k=k+1 isn’t supported in the language. And even if it was, k is undefined
> outside of the loop.
>
>
>
> A function may be helpful, but it looks like a function is just a line of
> code that has been set aside for modularity. Search can iterate across a
> vector but any comparison has to be equality, nothing as fancy as “greater
> than”.
>
>
>
> Ken
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
RD
Revar Desmera
Fri, Nov 27, 2020 11:39 PM
Don’t even need to go recursive for this.
len([for (x=v) if(x[0]>n) 1])
On Nov 27, 2020, at 3:05 PM, nop head nop.head@gmail.com wrote:
A recursive function can do what you want.
function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
x = [[3,5],[1,6],[6,1],[8,4]];
echo(count_more_than(x));
On Fri, 27 Nov 2020 at 22:54, ken@volksswitch.org wrote:
I’ve been using OpenSCAD for about two years and I just realized that I don’t know how to something simple like increment a variable or pass a value from one part of my code to another.
Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times that the first element of each sub vector exceeds 2.
I think I can iterate through x with a for loop and ask whether x[i][0] > 1, but I don’t know what to do with the result of that comparison. k=0 then k=k+1 isn’t supported in the language. And even if it was, k is undefined outside of the loop.
A function may be helpful, but it looks like a function is just a line of code that has been set aside for modularity. Search can iterate across a vector but any comparison has to be equality, nothing as fancy as “greater than”.
Ken
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Don’t even need to go recursive for this.
len([for (x=v) if(x[0]>n) 1])
> On Nov 27, 2020, at 3:05 PM, nop head <nop.head@gmail.com> wrote:
>
>
> A recursive function can do what you want.
>
> function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
>
> x = [[3,5],[1,6],[6,1],[8,4]];
>
> echo(count_more_than(x));
>
>
>
> On Fri, 27 Nov 2020 at 22:54, <ken@volksswitch.org> wrote:
>> I’ve been using OpenSCAD for about two years and I just realized that I don’t know how to something simple like increment a variable or pass a value from one part of my code to another.
>>
>>
>>
>> Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times that the first element of each sub vector exceeds 2.
>>
>>
>>
>> I think I can iterate through x with a for loop and ask whether x[i][0] > 1, but I don’t know what to do with the result of that comparison. k=0 then k=k+1 isn’t supported in the language. And even if it was, k is undefined outside of the loop.
>>
>>
>>
>> A function may be helpful, but it looks like a function is just a line of code that has been set aside for modularity. Search can iterate across a vector but any comparison has to be equality, nothing as fancy as “greater than”.
>>
>>
>>
>> Ken
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
D
David
Sat, Nov 28, 2020 1:00 AM
Revar, you must be a C programmer!
On 11/27/20 5:39 PM, Revar Desmera wrote:
Don’t even need to go recursive for this.
len([for (x=v) if(x[0]>n) 1])
On Nov 27, 2020, at 3:05 PM, nop head nop.head@gmail.com wrote:
A recursive function can do what you want.
function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ?
count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1
: count);
x = [[3,5],[1,6],[6,1],[8,4]];
echo(count_more_than(x));
On Fri, 27 Nov 2020 at 22:54, <ken@volksswitch.org
mailto:ken@volksswitch.org> wrote:
I’ve been using OpenSCAD for about two years and I just realized
that I don’t know how to something simple like increment a
variable or pass a value from one part of my code to another.
Case in point. I have a vector of vectors: x =
[[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times
that the first element of each sub vector exceeds 2.
I think I can iterate through x with a for loop and ask whether
x[i][0] > 1, but I don’t know what to do with the result of that
comparison. k=0 then k=k+1 isn’t supported in the language. And
even if it was, k is undefined outside of the loop.
A function may be helpful, but it looks like a function is just a
line of code that has been set aside for modularity. Search can
iterate across a vector but any comparison has to be equality,
nothing as fancy as “greater than”.
Ken
_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
<http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org>
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Revar, you must be a C programmer!
On 11/27/20 5:39 PM, Revar Desmera wrote:
> Don’t even need to go recursive for this.
> len([for (x=v) if(x[0]>n) 1])
>
>> On Nov 27, 2020, at 3:05 PM, nop head <nop.head@gmail.com> wrote:
>>
>>
>> A recursive function can do what you want.
>>
>> function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ?
>> count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1
>> : count);
>>
>> x = [[3,5],[1,6],[6,1],[8,4]];
>>
>> echo(count_more_than(x));
>>
>>
>>
>> On Fri, 27 Nov 2020 at 22:54, <ken@volksswitch.org
>> <mailto:ken@volksswitch.org>> wrote:
>>
>> I’ve been using OpenSCAD for about two years and I just realized
>> that I don’t know how to something simple like increment a
>> variable or pass a value from one part of my code to another.
>>
>> Case in point. I have a vector of vectors: x =
>> [[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times
>> that the first element of each sub vector exceeds 2.
>>
>> I think I can iterate through x with a for loop and ask whether
>> x[i][0] > 1, but I don’t know what to do with the result of that
>> comparison. k=0 then k=k+1 isn’t supported in the language. And
>> even if it was, k is undefined outside of the loop.
>>
>> A function may be helpful, but it looks like a function is just a
>> line of code that has been set aside for modularity. Search can
>> iterate across a vector but any comparison has to be equality,
>> nothing as fancy as “greater than”.
>>
>> Ken
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>> <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
RD
Revar Desmera
Sat, Nov 28, 2020 1:31 AM
Yes, C and twenty or thirty other languages. Plus a few domain specific languages I wrote.
-Revar
On Nov 27, 2020, at 5:01 PM, David ainut@hiwaay.net wrote:
Revar, you must be a C programmer!
On 11/27/20 5:39 PM, Revar Desmera wrote:
Don’t even need to go recursive for this.
len([for (x=v) if(x[0]>n) 1])
On Nov 27, 2020, at 3:05 PM, nop head nop.head@gmail.com wrote:
A recursive function can do what you want.
function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
x = [[3,5],[1,6],[6,1],[8,4]];
echo(count_more_than(x));
On Fri, 27 Nov 2020 at 22:54, ken@volksswitch.org wrote:
I’ve been using OpenSCAD for about two years and I just realized that I don’t know how to something simple like increment a variable or pass a value from one part of my code to another.
Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times that the first element of each sub vector exceeds 2.
I think I can iterate through x with a for loop and ask whether x[i][0] > 1, but I don’t know what to do with the result of that comparison. k=0 then k=k+1 isn’t supported in the language. And even if it was, k is undefined outside of the loop.
A function may be helpful, but it looks like a function is just a line of code that has been set aside for modularity. Search can iterate across a vector but any comparison has to be equality, nothing as fancy as “greater than”.
Ken
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Yes, C and twenty or thirty other languages. Plus a few domain specific languages I wrote.
-Revar
> On Nov 27, 2020, at 5:01 PM, David <ainut@hiwaay.net> wrote:
>
>
> Revar, you must be a C programmer!
>
>
>
> On 11/27/20 5:39 PM, Revar Desmera wrote:
>> Don’t even need to go recursive for this.
>> len([for (x=v) if(x[0]>n) 1])
>>
>>> On Nov 27, 2020, at 3:05 PM, nop head <nop.head@gmail.com> wrote:
>>>
>>>
>>> A recursive function can do what you want.
>>>
>>> function count_more_than(v, n = 2, i = 0, count = 0) = i >= len(v) ? count : count_more_than(v, n, i + 1, count = v[i][0] > n ? count + 1 : count);
>>>
>>> x = [[3,5],[1,6],[6,1],[8,4]];
>>>
>>> echo(count_more_than(x));
>>>
>>>
>>>
>>> On Fri, 27 Nov 2020 at 22:54, <ken@volksswitch.org> wrote:
>>>> I’ve been using OpenSCAD for about two years and I just realized that I don’t know how to something simple like increment a variable or pass a value from one part of my code to another.
>>>>
>>>>
>>>>
>>>> Case in point. I have a vector of vectors: x = [[3,5],[1,6],[6,1],[8,4]] I’d like to count the number of times that the first element of each sub vector exceeds 2.
>>>>
>>>>
>>>>
>>>> I think I can iterate through x with a for loop and ask whether x[i][0] > 1, but I don’t know what to do with the result of that comparison. k=0 then k=k+1 isn’t supported in the language. And even if it was, k is undefined outside of the loop.
>>>>
>>>>
>>>>
>>>> A function may be helpful, but it looks like a function is just a line of code that has been set aside for modularity. Search can iterate across a vector but any comparison has to be equality, nothing as fancy as “greater than”.
>>>>
>>>>
>>>>
>>>> Ken
>>>>
>>>> _______________________________________________
>>>> OpenSCAD mailing list
>>>> Discuss@lists.openscad.org
>>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>> _______________________________________________
>>> OpenSCAD mailing list
>>> Discuss@lists.openscad.org
>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
D
David
Sat, Dec 5, 2020 5:52 AM
Trying to make a mount for a 3D printer sensor. Constructing all the
basic stuff from large basic blocks.
What's wrong with there I am? The subtraction is one doing what I would
like it to do. Something having to do with the faces is my guess but
actually, I'm clueless. :(
The last construction I thought would be a cutaway, leaving the vertical
arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
could include the STL if the non-parameterized version of need be
if/when I can find one, probably on thingiverse.
This is from scratch with nothing streamlined and no efficiency attempts
in the code yet. Just straight hunt-and-peck so far.
Thanks,
David
Trying to make a mount for a 3D printer sensor. Constructing all the
basic stuff from large basic blocks.
What's wrong with there I am? The subtraction is one doing what I would
like it to do. Something having to do with the faces is my guess but
actually, I'm clueless. :(
The last construction I thought would be a cutaway, leaving the vertical
arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
could include the STL if the non-parameterized version of need be
if/when I can find one, probably on thingiverse.
This is from scratch with nothing streamlined and no efficiency attempts
in the code yet. Just straight hunt-and-peck so far.
Thanks,
David
D
David
Sat, Dec 5, 2020 6:02 AM
Found something very similar to what I'm trying to do. File attached
this time. :)
David
On 12/4/20 11:52 PM, David wrote:
Trying to make a mount for a 3D printer sensor. Constructing all the
basic stuff from large basic blocks.
What's wrong with there I am? The subtraction is one doing what I
would like it to do. Something having to do with the faces is my
guess but actually, I'm clueless. :(
The last construction I thought would be a cutaway, leaving the
vertical arm (I think) of the BL Touch mount for a Creality CR-10 S5
printer. I could include the STL if the non-parameterized version of
need be if/when I can find one, probably on thingiverse.
This is from scratch with nothing streamlined and no efficiency
attempts in the code yet. Just straight hunt-and-peck so far.
Thanks,
David
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Found something very similar to what I'm trying to do. File attached
this time. :)
David
On 12/4/20 11:52 PM, David wrote:
> Trying to make a mount for a 3D printer sensor. Constructing all the
> basic stuff from large basic blocks.
>
> What's wrong with there I am? The subtraction is one doing what I
> would like it to do. Something having to do with the faces is my
> guess but actually, I'm clueless. :(
>
> The last construction I thought would be a cutaway, leaving the
> vertical arm (I think) of the BL Touch mount for a Creality CR-10 S5
> printer. I could include the STL if the non-parameterized version of
> need be if/when I can find one, probably on thingiverse.
>
> This is from scratch with nothing streamlined and no efficiency
> attempts in the code yet. Just straight hunt-and-peck so far.
>
> Thanks,
>
> David
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
L
lar3ry@sasktel.net
Sat, Dec 5, 2020 6:10 AM
Hard to help without seeing your code.
On 4 Dec 2020 at 23:52, David wrote:
Trying to make a mount for a 3D printer sensor. Constructing all the
basic stuff from large basic blocks.
What's wrong with there I am? The subtraction is one doing what I would
like it to do. Something having to do with the faces is my guess but
actually, I'm clueless. :(
The last construction I thought would be a cutaway, leaving the vertical
arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
could include the STL if the non-parameterized version of need be
if/when I can find one, probably on thingiverse.
This is from scratch with nothing streamlined and no efficiency attempts
in the code yet. Just straight hunt-and-peck so far.
Hard to help without seeing your code.
On 4 Dec 2020 at 23:52, David wrote:
> Trying to make a mount for a 3D printer sensor. Constructing all the
> basic stuff from large basic blocks.
>
> What's wrong with there I am? The subtraction is one doing what I would
> like it to do. Something having to do with the faces is my guess but
> actually, I'm clueless. :(
>
> The last construction I thought would be a cutaway, leaving the vertical
> arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
> could include the STL if the non-parameterized version of need be
> if/when I can find one, probably on thingiverse.
>
> This is from scratch with nothing streamlined and no efficiency attempts
> in the code yet. Just straight hunt-and-peck so far.
D
David
Sat, Dec 5, 2020 6:19 AM
Thought I had. Sorry. Source is a tad overdone. <sigh> F6 shows it
sorta correctly now. Still some slots and mount hole for the sensor to
"punch out." That vertical part did not display correctly until just
today.
// Attempt at a BL Touch (BLT) mounting bracket that fits my CR-10 S5.
// Hope to do it all in variables. :)
mbd = 4; // mounting bolt diameters
bltbd = 3; // mounting blt diameters
mbt = 4; // mounting base thickness
armt = 6; // arm thickness
arml = 30; // total arm length
armoffseth = 21.76; // from bottom of bracket. too low!
mountfw = 34.67; // mount full width
armoffsetl = 18; // arm offset left
mountfh = 37; // mount full height
mounttbhc = 4.19; // mount top bolt hole center, from right
mounttbhbr = 4.4; // mount top bolt hole center, from bottom
mountbbhcr = 22; // mount bottom bolt hole center, from right
mountbbbcb = 32; // mount bottom bolt hole center, from bottom
armbhacr = 23.38; // arm bolt holes (all) center, from right
// all arm bolt holes measured from base, and numbered from base
armbh1offset = 8.54; // arm bolt hole 1 center, from base
armbh2offset = 19; // arm bolt hole 2 center, from base
armbh3offset = 27.66; // arm bolt hole 3 center, from base
armtop = 9; // distanct from top of mount to top of arm
// full size base, arm, and total volume
difference () {
cube ([mountfh, mountfw, arml]); //full volume
cube ([28, armoffsetl, arml]); // subtract lower right block
translate([31.4, mounttbhc, 0]) // set location for bolt hole 1
cylinder(h=mountfh, d=bltbd); // subtract bolt hole 1
translate([13, 21.85, 0]) // set location for
bolt hole 2
cylinder(h=mountfh, d=bltbd); // subtract bolt hole 2
translate([0, armoffsetl, mbd]) // set location to remove
bottom left chunk
cube([22, 16.7, arml]); // subtract that chunk
translate([mountfh - armtop, 0, mbd]) // set location to remove
top chunk
// cube([mountfh - armtop, mountfw, mountfh]); // remove top
chunk
cube([mountfh - armtop, mountfw, mountfh]);
}
// translate([28.25, mountfw, mbd]); // set location
to remove top chunk
// cube([9, mountfw, mountfh]);
//translate ([40, 40, 0])
// cylinder(h=40, d=15);
On 12/5/20 12:10 AM, lar3ry@sasktel.net wrote:
Hard to help without seeing your code.
On 4 Dec 2020 at 23:52, David wrote:
Trying to make a mount for a 3D printer sensor. Constructing all the
basic stuff from large basic blocks.
What's wrong with there I am? The subtraction is one doing what I would
like it to do. Something having to do with the faces is my guess but
actually, I'm clueless. :(
The last construction I thought would be a cutaway, leaving the vertical
arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
could include the STL if the non-parameterized version of need be
if/when I can find one, probably on thingiverse.
This is from scratch with nothing streamlined and no efficiency attempts
in the code yet. Just straight hunt-and-peck so far.
Thought I had. Sorry. Source is a tad overdone. <sigh> F6 shows it
sorta correctly now. Still some slots and mount hole for the sensor to
"punch out." That vertical part did not display correctly until just
today.
// Attempt at a BL Touch (BLT) mounting bracket that fits my CR-10 S5.
// Hope to do it all in variables. :)
mbd = 4; // mounting bolt diameters
bltbd = 3; // mounting blt diameters
mbt = 4; // mounting base thickness
armt = 6; // arm thickness
arml = 30; // total arm length
armoffseth = 21.76; // from bottom of bracket. too low!
mountfw = 34.67; // mount full width
armoffsetl = 18; // arm offset left
mountfh = 37; // mount full height
mounttbhc = 4.19; // mount top bolt hole center, from right
mounttbhbr = 4.4; // mount top bolt hole center, from bottom
mountbbhcr = 22; // mount bottom bolt hole center, from right
mountbbbcb = 32; // mount bottom bolt hole center, from bottom
armbhacr = 23.38; // arm bolt holes (all) center, from right
// all arm bolt holes measured from base, and numbered from base
armbh1offset = 8.54; // arm bolt hole 1 center, from base
armbh2offset = 19; // arm bolt hole 2 center, from base
armbh3offset = 27.66; // arm bolt hole 3 center, from base
armtop = 9; // distanct from top of mount to top of arm
// full size base, arm, and total volume
difference () {
cube ([mountfh, mountfw, arml]); //full volume
cube ([28, armoffsetl, arml]); // subtract lower right block
translate([31.4, mounttbhc, 0]) // set location for bolt hole 1
cylinder(h=mountfh, d=bltbd); // subtract bolt hole 1
translate([13, 21.85, 0]) // set location for
bolt hole 2
cylinder(h=mountfh, d=bltbd); // subtract bolt hole 2
translate([0, armoffsetl, mbd]) // set location to remove
bottom left chunk
cube([22, 16.7, arml]); // subtract that chunk
translate([mountfh - armtop, 0, mbd]) // set location to remove
top chunk
// cube([mountfh - armtop, mountfw, mountfh]); // remove top
chunk
cube([mountfh - armtop, mountfw, mountfh]);
}
// translate([28.25, mountfw, mbd]); // set location
to remove top chunk
// cube([9, mountfw, mountfh]);
//translate ([40, 40, 0])
// cylinder(h=40, d=15);
On 12/5/20 12:10 AM, lar3ry@sasktel.net wrote:
> Hard to help without seeing your code.
>
> On 4 Dec 2020 at 23:52, David wrote:
>
>> Trying to make a mount for a 3D printer sensor. Constructing all the
>> basic stuff from large basic blocks.
>>
>> What's wrong with there I am? The subtraction is one doing what I would
>> like it to do. Something having to do with the faces is my guess but
>> actually, I'm clueless. :(
>>
>> The last construction I thought would be a cutaway, leaving the vertical
>> arm (I think) of the BL Touch mount for a Creality CR-10 S5 printer. I
>> could include the STL if the non-parameterized version of need be
>> if/when I can find one, probably on thingiverse.
>>
>> This is from scratch with nothing streamlined and no efficiency attempts
>> in the code yet. Just straight hunt-and-peck so far.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
L
lar3ry
Sat, Dec 5, 2020 6:54 AM
Well, it's definitely not the way I would go about it, so here's what I would
do.
You'll have to play with the values, and you are certainly welcome to put
them into variables.
Note the pound sign (#). It will help you see where the line puts the
object.
difference() {
union() {
translate([0,18,0])
cube([37,16.67,4]);
translate([22,18,0])
cube([6,16.67,30]);
translate([28,0,0])
cube([9,19,4]);
}
translate([13,22,-.001])
cylinder(h=6,d=3);
translate([31,4,-.001])
cylinder(h=6,d=3);
}
--
Sent from: http://forum.openscad.org/
Well, it's definitely not the way I would go about it, so here's what I would
do.
You'll have to play with the values, and you are certainly welcome to put
them into variables.
Note the pound sign (#). It will help you see where the line puts the
object.
difference() {
union() {
translate([0,18,0])
cube([37,16.67,4]);
translate([22,18,0])
cube([6,16.67,30]);
translate([28,0,0])
cube([9,19,4]);
}
translate([13,22,-.001])
# cylinder(h=6,d=3);
translate([31,4,-.001])
# cylinder(h=6,d=3);
}
--
Sent from: http://forum.openscad.org/