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
[Plugin] Surface Plotter
11 posts
• Page 1 of 1
Re: [Plugin] Surface PlotterHappy new year and thanks too.
MALAISE La Connaissance n'a de valeur que partagée
Re: [Plugin] Surface Plottertruly idon't know how to use equation ,
any example how to make helix stair? thank's Jzer7 just downloaded. Re: [Plugin] Surface PlotterThanks, jzer7...
can you help give a little tut for us idiots? I'm specifically interested in using your tool to create a geometrically/mathematically accurate mirror lens for creating a work SketchUp/Kerkythea telescope. so if you could show how to find an equation, and apply it to creating a lens for instance, that would help me much. thanks.
Re: [Plugin] Surface Plotterjzer7 thanks for this, I almost missed this SU surface grapher.
#1: I was interested in finding out why the Z direction is so much greater that X and Y for example: A Hyperbolic Paraboloid is supposed to look as per the site below http://www.archimy.com/ while the results in SU look like the blue image in this attachment, while the small back image at the btm has the correct proportion. I have not been able to adjust the code, to reflect the proportion. #2: Can you make it possible to enter specific x, y, and z ranges, in order to generate isosurfaces as per the 2nd attachment?
Re: [Plugin] Surface Plottercool plugin, jzer7.
you asked for comments, so here you go (of course I know that you only just started writing plugins, but one should always have dreams ):  as tomot mentioned, it would be cool to define the range of X and Y for the grid. would make the plugin a lot more versatile.  it would be cool to add a drop down list with example equations for noobs like me, who have no idea about maths  at the moment, once you pressed the 'OK' button there is a short period of shocked silence, when nothing happens (SU works frantically to get the surface done. but it doesn't tell us). therefore it would be great to introduce some sort of status report, like progress.rb  and now to get entirely carried away: imagine the following scenario: you have a little window, where to type in the equation (together with some dropdownexamples), as well as the grid dimensions (X and Y values). if you hit the 'Generate' button without typing in any equation, the surface will turn out flat. now you can enter your equation and then hit the 'Update' button, whereupon the surface is being updated  either with showing a status bar to indicate the progress... Or, and that would be absolutely ingenious, you would see the surface being updated in realtime, as it is done with the 'Soap Skin & Bubble' plugin!!! just imagine how cool that would be; changing one figure in you equation and seeing the surface change before your eyes  would make comprehending equations a lot easier (and would therefore be a fantastic tool for school teachers.) Re: [Plugin] Surface Plotter
That is exactly how the Grasshopper plugin for Rhino works. It is fabulous. you can for instance use some algorythm to define the array and form of your windows in a curved building. By changing a parameter in the algorythm, the whole positioning and dimensions will change automatically. Very cool stuff and definitely the future. If the algorythms could be translated to comprehensible forms or definitions, this is a superb design tool. This design method is referred to as 'parametric modeling'. (not to confuse with parametric design a la Revit and Archicad which is not at the same level). Re: [Plugin] Surface PlotterTake a look at the free K3DSurf
11 posts
• Page 1 of 1

Who is online
Users browsing this forum: zul6041 and 21 guests