Page 1 of 1

Address Calculator Examples

PostPosted: Sun Sep 12, 2010 12:25 am
by scottmartinez
Here a few examples for those wanting to try out the new Address Calculator tool. You can copy and paste these into the calculator or save them as text (.txt) files and load them into the calculator that way. The easiest way to see the effect of these samples is to first create some simple text using the Text to G-Code tool and then apply these translations.

*** Project onto sphere. This example will adjust Z values in a spherical pattern around the center point.

#100=0(X CENTER OF SPHERE)
#101=0(Y CENTER OF SPHERE)
#102=-5(Z CENTER OF SPHERE)
#103=7(RADIUS OF SPHERE)
#104=0(Z CUTOFF PLANE)

#60=@X-#100(X DIST)
#61=@Y-#101(Y DIST)
#62=SQR[[#60*#60]+[#61*#61]]
IF[#62GT#103]THEN #62=#103
#63=#102+SQR[#103*#103-#62*#62]
IF[#63LT#104]THEN #63=#104

!Z=@Z+#63


*** Radiating Sine Wave. This example will adjust Z values in a "ripple" pattern radiating from the center.

#100=0(X CENTER)
#101=0(Y CENTER)
#102=3(DISTANCE PER CYCLE)
#103=.5(AMPLITUDE)

#60=@X-#100(X DIST)
#61=@Y-#101(Y DIST)
#62=SQR[[#60*#60]+[#61*#61]](DISTANCE FROM CENTER)

#63=SIN[#62*[360/#102]]*#103

!Z=@Z+#63


*** Twist. This example will rotate X and Z values using the Y position as the rotation amount.

#100=0(X CENTER OF TWIST AXIS)
#101=0(Z CENTER OF TWIST AXIS)
#102=20(Y POS FOR FULL TURN)

#50=[@Y/#102]*360 (ROTATION AMOUNT)
#51=@X-#100
#52=@Z-#101
#53=SQR[[#51*#51]+[#52*#52]]

#54=#50+ATAN[#52]/[#51]

!X=#100+COS[#54]*#53
!Z=#101+SIN[#54]*#53


Enjoy! I will try to post more examples as they occur to me. Feel free to post your own examples.

Scott