discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Can someone tell me how to correct this

D
donrecardo
Wed, Nov 11, 2015 10:37 AM

I came across a SCAD program that generates DXF files for my laser cutter

It takes user parameters for length width screw size etc and generates the
DXF files that my laser then cuts

The program works fine except for one small fault

If I tell it my screws are 12mm long it should make a slot for the screw to
sit in that is
just a little longer than the screw ( say 13mm )and should make a cut out to
hold the nut that is maybe 8 mm down the slot so the 12mm screw can reach it
ok

However when I tell it I want to use a 12 mm screw it makes the slot 15mm
long and puts the
cut out for the nut almost 9mm down so the screw cannot reach it  ( well it
does but only by 0.2mm) so the thread doesn't engage

box_generator.scad
http://forum.openscad.org/file/n14365/box_generator.scad

Cheers
Don

--
View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I came across a SCAD program that generates DXF files for my laser cutter It takes user parameters for length width screw size etc and generates the DXF files that my laser then cuts The program works fine except for one small fault If I tell it my screws are 12mm long it should make a slot for the screw to sit in that is just a little longer than the screw ( say 13mm )and should make a cut out to hold the nut that is maybe 8 mm down the slot so the 12mm screw can reach it ok However when I tell it I want to use a 12 mm screw it makes the slot 15mm long and puts the cut out for the nut almost 9mm down so the screw cannot reach it ( well it does but only by 0.2mm) so the thread doesn't engage box_generator.scad <http://forum.openscad.org/file/n14365/box_generator.scad> Cheers Don -- View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Wed, Nov 11, 2015 11:52 AM

near the bottom you might see a line like this:

LengthScrewSlots(length, tablengthperiod, screwLength, screwDiameter,
hexWidth,hexThickness, offsetHex=screwLength*.6666);

That last number is the offset the hex screw is down the shaft.
The author did not consistently define offsetHex everytime the function is
called. Sometimes its missing. Not sure why. Possibly an error.

The value of 0.6666 seems arbitrary and is too big for your example case. A
global with a mm distance would probably be better.

I suggest you play with value and make all calls to LengthScrewSlots include
the same calc.
You should also check WidthScrewSlots which may suffer from the same
problems.

Is this enough to help you ?

--
View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365p14366.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

near the bottom you might see a line like this: LengthScrewSlots(length, tablengthperiod, screwLength, screwDiameter, hexWidth,hexThickness, offsetHex=screwLength*.6666); That last number is the offset the hex screw is down the shaft. The author did not consistently define offsetHex everytime the function is called. Sometimes its missing. Not sure why. Possibly an error. The value of 0.6666 seems arbitrary and is too big for your example case. A global with a mm distance would probably be better. I suggest you play with value and make all calls to LengthScrewSlots include the same calc. You should also check WidthScrewSlots which may suffer from the same problems. Is this enough to help you ? -- View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365p14366.html Sent from the OpenSCAD mailing list archive at Nabble.com.
D
donrecardo
Wed, Nov 11, 2015 1:13 PM

Hi NEON
and thanks for your reply , It has 50% cured the problem

I found out the lines with the 0.6666 value , there were 3 of them
and by making that number smaller it does move the nut closer to where it
should be
however it only moves half of the nuts on each panel
panels with 2 nuts on it only adjusts 1 and panels with 4 nuts on it only
adjusts 2

My problem is I dont really have a clue how SCAD works  so havent any idea
how to move the others
that are still wrong . I have tried altering various things just to see what
they do but
none has sorted it out yet

Don

--
View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365p14367.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hi NEON and thanks for your reply , It has 50% cured the problem I found out the lines with the 0.6666 value , there were 3 of them and by making that number smaller it does move the nut closer to where it should be however it only moves half of the nuts on each panel panels with 2 nuts on it only adjusts 1 and panels with 4 nuts on it only adjusts 2 My problem is I dont really have a clue how SCAD works so havent any idea how to move the others that are still wrong . I have tried altering various things just to see what they do but none has sorted it out yet Don -- View this message in context: http://forum.openscad.org/Can-someone-tell-me-how-to-correct-this-tp14365p14367.html Sent from the OpenSCAD mailing list archive at Nabble.com.