[Plugin] SurfaceGen (0.9.0b) — 28 April 2012
-
Diggsey, this is neat! I just started learning this week how to generate implicit surfaces using equations in Meshlab, and I've been importing them into SU - now I can do it all in Sketchup While I don't really understand the math, I just play around with equations and see what pops up.
On that note, do you have any ideas I can use as starters/seed equations for generating neat surfaces? What kind of math would I need to brush up on to understand this stuff better?
For now, I'm just playing, but I have dreams of making some beautiful math sculptures like Bathsheba Grossmanmakes.
Here is a little test I did, using the settings shown in the screenshot.
Did I say thank you, Diggsey?
-
Heh, here's a truncated sphere, settings shown...this is fun!
Some suggestions:
-When switching to "Equation", change the default settings to something that will work just by pressing "Generate"
-Add a random equation/function generator, perhaps using preset equations
-Add an error message when the equation is invalid, pointing out why its invalid if possibleLike Jean says, just ideas...
-
Diggsey, where have You been so far!! We need You! Keep up surprising Us! Thanks!
-
Here's a question for you...is there a way to make the SurfaceGen geometry look like the first Meshlab image? I'm using the same equation, and trying to get results like changing the voxel size in Meshlab, but changing the # of cells in SurfaceGen doesn't seem to have the same effect...am I doing something wrong?
BTW, I like how the settings are saved for each generated surface!!
-
ah very cool!
Topmod and K3dSurf in a same place!
(you can take some formula from K3DSurf@unknownuser said:
For now, I'm just playing, but I have dreams of making some beautiful math sculptures like Bathsheba Grossmanmakes.
Topmod above is perfect for that
by meBy Jotero
-
Great links, Pilou! Thank you Nice work on the sculpture, too.
-
Very nice plugin.
-
In the V6 don't works
@unknownuser said:
Error Loading File surfacegen.rb
cannot convert Hash into StringWorks fine in the V7
-
Thanks everyone who commented!
@d12dozr
I've no idea how to make such complicated structures as those ones you linked to, but you can get some interesting shapes by just mixing up a few of the built in functions:sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh, atan2, hypot, sqrt, cbrt, log, log2, log10, ln, exp
and constants:
e, pi
@unknownuser said:
When switching to "Equation", change the default settings to something that will work just by pressing "Generate"
I'll just make the default equation something that will work for both modes.
@unknownuser said:
Add a random equation/function generator, perhaps using preset equations
That could be interesting. Perhaps the user could choose a level of complexity and it would use that many operations.
@unknownuser said:
Add an error message when the equation is invalid, pointing out why its invalid if possible
Showing an error would be possible, but it might be difficult to point out where. It depends on how much information ruby gives me. For speed, the equation is converted into ruby code, so I can just eval it for each point instead of running my own interpretter.
@unknownuser said:
Here's a question for you...is there a way to make the SurfaceGen geometry look like the first Meshlab image?
I don't know exactly how Meshlab works internally, but it seems like the voxel size is equivalent to the range of values divided by the number of cells. ie:
voxelSize = (max-min)/cellsI'm surprised it should look so different though, just by changing the voxel size.
@Pilou
I've found the problem. It won't let me pass a hash to WebDialog.new. -
@diggsey said:
@Pilou
I've found the problem. It won't let me pass a hash to WebDialog.new.Additionally, SU6 only accepts one argument for
model.start_operation
.I've used this wrapper:
<span class="syntaxdefault"><br />def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">model </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br /> </span><span class="syntaxkeyword">if </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">version</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">split</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'.'</span><span class="syntaxkeyword">)[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">to_i </span><span class="syntaxkeyword">>= </span><span class="syntaxdefault">7<br /> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">true</span><span class="syntaxkeyword">)<br /> else<br /> </span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">end<br />end<br /></span>
The operation will run slower under SU6 - but at least it runs.
-
Thanks thomthom, but I've just used a rescue statement so it will fallback on the older version if the newer one fails. The first post has the updated version which works with v6.
-
There are also a few error-messages appearing in the Ruby Console that needs traps or begin/rescue forms [e.g. after you explode a special group]...
Some of them relate to your 'recurve' too...
But it's a neat tool -
I've tried doing everything possible and can't seem to get any output in the ruby console from either plugin. Can you tell me exactly how to reproduce it?
-
@diggsey said:
I've no idea how to make such complicated structures as those ones you linked to, but you can get some interesting shapes by just mixing up a few of the built in functions:
sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh, atan2, hypot, sqrt, cbrt, log, log2, log10, ln, exp
and constants:
e, pi
Thank you for this, and considering my suggestions too!
-
@diggsey said:
I've tried doing everything possible and can't seem to get any output in the ruby console from either plugin. Can you tell me exactly how to reproduce it?
For example...@unknownuser said:
Error: #<NoMethodError: undefined method
curve' for #<Sketchup::Group:0xa9d06fc>> C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17:in
can_select_curve?'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:32:in `can_select_curve_selection?'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:352When right clicking a tagged 'surfacegen-group'.
Explode the special surgfacegen-group and right-click gives@unknownuser said:
Error: #<NoMethodError: undefined method
curve' for #<Sketchup::ComponentInstance:0xb440344>> C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17:in
can_select_curve?'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:32:incan_select_curve_selection?' C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:352 C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17:in
call'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17Erase that 'bounds' Instance then Select the surface...
@unknownuser said:
Error: #<NoMethodError: undefined method
curve' for #<Sketchup::Face:0xad7783c>> C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17:in
can_select_curve?'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:32:incan_select_curve_selection?' C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:352 C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17:in
call'
C:/Program Files/Google/Google SketchUp 8/Plugins/recurve.rb:17These all relate to 'recurve' reaction to 'surfacegen' entities ?
I did have a surgacegen error but I can't get it to reproduce now -
Nice! Can't wait some more complex math sculptures... and naturally even more functionality, like with K3DSurf.
Little test...
-
In the V6
We can draw the "Box" but dialog's window don't opening
No error message, nothing in the Ruby console -
@notareal
That's really nice! What's the equation you used?@TIG
Make sure you have the latest version of Recurve. I fixed that bug with the last update which is why I couldn't reproduce the error. If you ever get the SurfaceGen error again let me know.@Pilou
Just re-select the group with the select tool. It seems that the SelectionObserver doesn't fire when the selection is changed in code. -
You are right, in that when I get v1.4 of 'recurve' I no longer get these errors with 'surfacegen'. However, I had v1.3 [with SUpv8] and there were no major changes except for making it SUpv6 friendly ?
Anyway... no more error messages... I'll try to break it -
Sponge-like object:
Advertisement