sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] SurfaceGen (0.9.0b) — 28 April 2012

    Scheduled Pinned Locked Moved Plugins
    69 Posts 25 Posters 60.1k Views 25 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      @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&nbsp;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 />&nbsp;&nbsp;</span><span class="syntaxdefault">model&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />&nbsp;&nbsp;</span><span class="syntaxkeyword">if&nbsp;</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&nbsp;</span><span class="syntaxkeyword">>=&nbsp;</span><span class="syntaxdefault">7<br />&nbsp;&nbsp;&nbsp;&nbsp;model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">true</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br />end<br /></span>
      

      The operation will run slower under SU6 - but at least it runs.

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • D Offline
        Diggsey
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          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 😄

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            Diggsey
            last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • D Offline
              d12dozr
              last edited by

              @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!

              3D Printing with SketchUp Book
              http://goo.gl/f7ooYh

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                @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:352

                When 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:in can_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:17

                Erase 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:in can_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:17

                These all relate to 'recurve' reaction to 'surfacegen' entities ?
                I did have a surgacegen error but I can't get it to reproduce now 😕

                TIG

                1 Reply Last reply Reply Quote 0
                • N Offline
                  notareal
                  last edited by

                  Nice! Can't wait some more complex math sculptures... and naturally even more functionality, like with K3DSurf.

                  Little test...


                  Icosahedron_SU.jpg

                  Welcome to try [Thea Render](http://www.thearender.com/), Thea support | [kerkythea.net](http://www.kerkythea.net/) -team member

                  1 Reply Last reply Reply Quote 0
                  • pilouP Offline
                    pilou
                    last edited by

                    In the V6
                    We can draw the "Box" but dialog's window don't opening 😉
                    No error message, nothing in the Ruby console

                    Frenchy Pilou
                    Is beautiful that please without concept!
                    My Little site :)

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Diggsey
                      last edited by

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        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 😉

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          Builder Boy
                          last edited by

                          Sponge-like object:

                          Capture1.PNG

                          All my plugins

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            driven
                            last edited by

                            this is great,

                            some odd behavior on the Mac... when run from plugins (like you should) I get this

                            Error; #<ArgumentError; Cannot convert argument to Sketchup;;Point3d>
                            /Library/Application Support/Google SketchUp 8/SketchUp/Plugins/SURFACEGEN_Dir/surfacegen_tool.rb;266;in `add'
                            /Library/Application Support/Google SketchUp 8/SketchUp/Plugins/SURFACEGEN_Dir/surfacegen_tool.rb;266;in `getExtents'
                            

                            if I put the surfacegen.rb into the folder do a restart and then load from Ruby Code Editor, I get this

                            (eval);428; warning; don't put space before argument parentheses
                            "Run aborted (error has occurred)"
                            (eval);428; warning; don't put space before argument parentheses
                            (eval);10; warning; already initialized constant SURFACEGEN_DIR
                            (eval);11; warning; already initialized constant GRAPH_SIZE
                            (eval);12; warning; already initialized constant WINDOW_HEIGHT
                            (eval);13; warning; already initialized constant ATTR_DICTIONARY
                            "Run aborted (error has occurred)"
                            

                            but if I restart again and use as_pluginloader.rb to load it I get

                            
                            /Library/Application Support/Google SketchUp 8/SketchUp/plugins/SURFACEGEN_Dir/surfacegen.rb;428; warning; don't put space before argument parentheses
                            

                            it works, but has no tool button image...
                            the dialog keeps disappearing behind SU, but that needs show_modal on Macs
                            this is a 'normal' load i.e. image-no dialog

                            learn from the mistakes of others, you may not live long enough to make them all yourself...

                            1 Reply Last reply Reply Quote 0
                            • N Offline
                              notareal
                              last edited by

                              @diggsey said:

                              @notareal
                              That's really nice! What's the equation you used?

                              F(x,y,z) = 2-(cos(x+(1+sqrt(5))/2*y)+cos(x-(1+sqrt(5))/2*y)+cos(y+(1+sqrt(5))/2*z)+cos(y-(1+sqrt(5))/2*z)+cos(z-(1+sqrt(5))/2*x)+cos(z+(1+sqrt(5))/2*x))*16/(x*x+y*y+z*z)
                              [x]; -5, 5
                              [y]; -5, 5
                              [z]; -5, 5
                              

                              There is plenty more at the k3dsurf forum.

                              Welcome to try [Thea Render](http://www.thearender.com/), Thea support | [kerkythea.net](http://www.kerkythea.net/) -team member

                              1 Reply Last reply Reply Quote 0
                              • N Offline
                                notareal
                                last edited by

                                Perhaps you could add some more functionality; like functions min, max and abs. Also allow use of arithmetic operations and pi in axes, like -2*pi.

                                Welcome to try [Thea Render](http://www.thearender.com/), Thea support | [kerkythea.net](http://www.kerkythea.net/) -team member

                                1 Reply Last reply Reply Quote 0
                                • TIGT Offline
                                  TIG Moderator
                                  last edited by

                                  You already have 'pi' [in lowercase] as a function?Capture.PNG

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    @diggsey said:

                                    @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.

                                    The SelectionObserver has always been very buggy: http://www.thomthom.net/software/sketchup/observers/

                                    Thomas Thomassen — SketchUp Monkey & Coding addict
                                    List of my plugins and link to the CookieWare fund

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      Diggsey
                                      last edited by

                                      Just uploaded a fairly major update to the first post!

                                      @driven
                                      This should fix the issues with macs. It now uses cross-platform methods to locate and load resource, and uses show_modal rather than show on macs with the WebDialog.

                                      @notareal
                                      The axes now let you use an expression such as 2*pi

                                      @d12dozr
                                      Helpful error message are now shown when an expression is invalid.

                                      1 Reply Last reply Reply Quote 0
                                      • TIGT Offline
                                        TIG Moderator
                                        last edited by

                                        Thanks 😄

                                        Error; #<ArgumentError; Cannot convert argument to Sketchup;;Point3d>
                                        C;/Program Files/Google/Google SketchUp 8/Plugins/SURFACEGEN_Dir/surfacegen_tool.rb;270;in `add'
                                        C;/Program Files/Google/Google SketchUp 8/Plugins/SURFACEGEN_Dir/surfacegen_tool.rb;270;in `getExtents'
                                        

                                        One minor error in getExtents in surfacegen_tool.rb
                                        Line #270 result.add @p0 if @state >= 0
                                        can raise an error so adjusting it to
                                        return if !@p0 or @p0.class!=Geom::Point3d; result.add @p0 if @state >= 0 might help - you could also add similar validity checks on the other points that are added to the extents ?

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          Diggsey
                                          last edited by

                                          Ah, I knew I'd forgotten something 😄

                                          I've updated the first post. It shouldn't show those errors anymore.

                                          1 Reply Last reply Reply Quote 0
                                          • TIGT Offline
                                            TIG Moderator
                                            last edited by

                                            Cool.
                                            The 'rand' function is also interesting...Capture.PNG

                                            TIG

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 2 / 4
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement