A few days ago, another poster asked a question of how to model an organic material. It seemed to follow a mathematical equation.
I modified a plugin from Jim Foltz (eq_grapher.rb) to plot curves in 3 dimensions, and later expanded it to create surfaces with the right normals. This is an example generated by the new script:
I prepared this as an exercise to become familiar with Ruby and Sketchup's API (and for fun), so I haven't thought much about what others might want to see here. So comments are welcomed.
To try it:
1. Install script
2. Menu is: Plugins -> Plot surface
3. Enter an equation (say "x.abs + 3*x") in Ruby's format.
4. The script will then iterate for values of x between -10 and 10 and y between -10 and 10 and compute a value for z.
5. If the value for z is greater than 100 or less than 100 it will be ignored
6. A surface composed by triangles between those points will be generated around (0,0,0)
7. All entities (lines and faces) will be inside a group (called "surface")
Also, this is my first attempt at writing a plugin, so let me know if I broke any common practice regarding posting of scripts in this forum.
Enjoy,
---
Juan



