Some trigonometry complications for a simple model

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Some trigonometry complications for a simple model

fred_dot_u
This post was updated on .
line_mount_3nuts.scad


I've run into a peculiar aspect of my code and I don't know if it's my ignorance of the software or an undocumented (or documented) feature.

Code comments relative to this problem are located at
// bolt thread opening @ 255 degrees (also 15 degrees)
and
// nut recess cut-out @ 255 degrees (also 15 degrees)

This model is a simple ring with three holes spaced around the circumference. One hole is at 45 degrees absolute and the other two are 120 degrees spaced relative. The problem arose when using the appropriate absolute values in the code. The placement of the 3.5 mm holes appeared to be no trouble. The second and third figures should be 15 (135 - 120) and 255 (135 + 120), based on the 135 figure for the recess placed at 45 degrees.

The inner diameter of the ring gets three $fn = 6 cylinders to provide for nut recesses. The holes, nuts and bolts will provide centering capability of the ring when mounted to the intended cylinder. The 45 degree nut recess placement was simple (in my opinion) by using the pythagorean theorem. If that's incorrect, please advise.

The second and third recesses provide the trouble. Using trigonometry, I was able to place the solids used in the difference function in what appeared to be the correct locations under the surface of the inner diameter. Closer examination and use of the # feature showed the placement to be incorrect.

By increasing the "abitmore" figure for the nut recess depth/thickness in the ring, I was able to observe the cut at the outer diameter of the ring begin to chop away asymmetrically from the cylinder place radially at the same location. The increase of the "abitmore" figure created small triangles on either side of the circle, increasing in size as the number was adjusted. By so doing, I discovered that I had to change the rotation angle of the solid that creates the nut recess by one degree from the figures noted above. This is not a serious problem, generally speaking, as one degree from 120 isn't going to affect the practical use of the device, but I'd like to understand and/or avoid this problem should I build a similar model in the future.

Top image - before +/- 1 change, bottom image - after change.






The synopsis is that my bolt cut-outs are one degree different rotation from desired. They match the nut solid cut-out rotation angle, also one degree incorrect, while the trigonometry figures to place the nut solid cut-outs match the desired figures.

I could have perhaps adjusted the trig figures and left the nut solid rotations and bolt cut-out rotations with the desired figures, but I expect that would still place one segment of figures disparate from the others.

What have I done wrong, or what is wrong with OpenSCAD that this works only when there is a difference of one in the figures?

Please note that I'm not a coding wizard by any means. It's quite a challenge to keep my models at least moderately parametric, but then again, I like some challenge in my life! My fillets aren't as parametric as they could be, I suppose, but that's trivial code in general and not worth the neurons at this point.

Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

fred_dot_u
After forgetting to add the file to my post, I edited it and added the file. A message appeared to inform me that the changes are not going to be sent to the mailing list and to reply to the message to correct that. I'm now adding the same file to this message to ensure it makes it to the list.line_mount_3nuts.scad
Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

fred_dot_u
Please also note that the increases to the "abitmore" figure were done in each individual location in the code for trouble shooting purposes only. I don't want the nut-recesses to extend to the outer diameter. The un-modified code is correct for depth placement.
Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

L Boyd
Without digging thru your code, may I suggest an approach like this

$fn = 30;
module ring(){
  difference(){
  cylinder(5,d=30);
  translate([0,0,-.1])cylinder(6,d=25);}}

module bolt_hole(deg){
  rotate([0,0,deg])
  translate([0,-12,2.5])rotate([90,0,0]){cylinder(5,d=1.5);
  cylinder(1,d=2.5,$fn=6);}}

difference(){
  ring();
  bolt_hole(45);
  bolt_hole(45+120);
  bolt_hole(45-120);}
Larry
Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

fred_dot_u
Your suggestion is a good bit simpler than my implementation. I'm likely to swap out my adjusted code for yours with appropriate values to fit my model.

Perhaps someone with a penchant for self-torture can figure out why I have to have one degree value change for my code in order to accomplish what I did.
Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

ednisley
On 08/31/2016 03:22 PM, fred_dot_u wrote:
> one degree value change for my code

The (automatically set) number of facets around the ring ID isn't a
multiple of three, so the 120° spacing for the nut traps doesn't align
with the facets: one or both sides of each trap will "dig into" a facet.

Setting $fn=8*3 tidies things up a bit.

Then you'll see the difference between a true cylinder and OpenSCAD's
inscribed polygon representation: the ID facets are closer to the center
than the true cylinder's ID, so the points of the nuts don't quite break
through the facets. Turns out the precisely calculated trig position
isn't quite what you want; you must either embiggen the ring ID or move
the nut traps closer to the center to make the answer come out right.

Because you only care about radial position of the nut trap bases
(toward the OD), make the "nuts" twice as tall (toward the ID) as they
are now, so they punch through whatever stands in their way. That takes
care of facet misalignment, inscribed polygon ID, and all that.

When making cutouts, nothing exceeds like excess, at least when there's
nothing you care about standing in the way.

Works for me, anyhow...

--
Ed
softsolder.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 --
Ed
softsolder.com
Reply | Threaded
Open this post in threaded view
|

Re: Some trigonometry complications for a simple model

L Boyd
Feel free to adapt my code. That's what it's for.

Since I centered the holes in height (Z axis), if you change both cylinders in the ring by adding center=true, it will drop the ring so you can see how the bolt holes interact with the ring.

For more information on inscribed vs circumscribed cylinders see
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/undersized_circular_objects

When I print objects with holes, I need to fudge them a bit larger than just making them circumscribed if I actually want a bolt to pass thru.
Larry