How do i call subroutine in animation / onclick?
-
I have a component which rolls on a track. I have been using a formula for intersection of line-circle and line-line to change the component coords at each increment of the animation in Sketchup Pro 7. Works great.
The formula's are in the enclosing component which holds the sub-components like wheels,track etc.
With onclick I calculate the coords with every increment of the animation. Unfortunately I have separate intersection calculations for each sub-component and it is getting messy.
I would like to implement something like Line_Line_intersect(ParmIN, ParmOUT) & Line_Circle_Intersect(ParmIN,ParmOUT) which I would call in my IF().. statement.
I scanned ruby but it is not clear to me that this is possible. Surprised I couldn't find a clear answer to this anywhere.
skyfish
-
I restructured the code and changed the algorithm. Now I can create rolling elements by
- copying typical component
- make unique
- renaming
- change offset
If you would like to see example, I have attached a file.
skyfish
EDIT:
Oops, now I remember the problem with this algorithm. The
distance between balls is a measure of the curved path. It
doesn't maintain a rigid connection between balls. Going
around the curve, the inter-distance is slightly small.
-
Since I am not getting any replies about subroutines, I did restructure again so that I can copy DC and make a few changes to produce a component that maintains distances.
The example would work for a garage door ( using ASIN & ACOS for angles ).
The calculations were adapted from
http://local.wasp.uwa.edu.au/~pbourke/geometry/sphereline/
http://local.wasp.uwa.edu.au/~pbourke/geometry/2circle/There are some weird bugs in sketchup when using large numbers, in addition to the SQRT problems.
skyfish
Advertisement