The first version was done in March of 2017, nine months earlier than this published file. That made it harder to position everything. Early versions were more complicated didn't use built-in text alignment controls. You may have noticed that this is the sixth clock face version. adjust radius value for actual clock movement shaft size using halign="center" and valign="center is important because the default alignment is going to make numbers be out of place 5 horizontal offset of half the marker width comment out next two lines to remove marker with. it is important to note the start of numbers is at 30 degrees around to 360 so that the numbers go where they should be clock face is sized to fit my simple supportįnt=8 // adjust as needed for different radius sizes #Openscad sin code#version06 - simplified code using align controls for numbers If we did the typical count from 0 to 359 in steps of 30 degrees the top number would be 0 and would go around to 11. The little snip in the text extrusion code text(str(i/30) makes the numbers convert from a value to a text string AND it makes the value go from 1 to 12 instead of 30 to 360! Note, as well, that the starting point of the loop is 30 degrees from the top of the face. The loop count for(i=) is used to print the right number in the right place. The final SCAD code continues beyond just making 12 dots arranged 30 degrees apart around the circle. Experiment with the code snip to understand which mutiplier controls the dots to make either a wide oval or a tall oval. The multiplier of the x and y translation determines the radius distance from the circle's center.Īs a side note, using different multipliers of sine and cosine will make ovals. A step size of 30 gives us 12 dots which are conveniently placed just where the markers for a clock face need to go. If we step a small step size, the circle will look solid. The cosine is commonly shown using the cosine y value, but I've made it controlling the x value because it is the next step which combines cosine and sine control of the x and y positioning which makes a circle.Ī loop step value of ten gives us overlapping dots. This time, as the y value increases step by step, the x value changes to create the cosine wave. The result is a set of dots making the sine wave some will recognize. As the for loop of the code snip above increases from 0 to 359, our code adjusts the position of the dot on the y axis. The sine, is called sin() as an OpenSCAD command. Perhaps you will recognize a typical sine wave from math class. Let's look at the code for a sine wave all by itself. Maybe it would be good to step back a bit. Translate() // position control with radius multiplier #Openscad sin series#Specifically, we need sine and cosine values to arrange a series of objects. Positioning is accomplished by a two-part calculation of points. In some ways it didn't get much further, but I thought the exploration might be interesting to share. #Openscad sin how to#This project started as just an exploration of how to get markers and hour numbers arranged in a circle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |