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

    SketchUp RUBY API Wishlist [way of coding wishes, please]

    Scheduled Pinned Locked Moved Developers' Forum
    107 Posts 46 Posters 39.8k Views 46 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.
    • B Offline
      buk2noy
      last edited by

      @daiku said:

      This is music to my ears, Scott. Here's another vote for ruby control of dimension objects. CB.

      nice post!
      ok, how about this my officemate send me a cad file to be SU, problem is when i import them to SU the lines in 2d are not they seem to be.. they are in different axis can SU place it in one axis, ❗

      (is this an existing ruby script?
      if so kindly send to me) 🀣

      seeking for peace of mind

      1 Reply Last reply Reply Quote 0
      • T Offline
        trottolino
        last edited by

        @jadema said:

        How about a method to refresh the SketchUp display when executing long scripts? Today the interface looks like it is frozen when you change focus to another window and then back to SketchUp. The display gets refreshed only when the script completes or a dialog box that requires user input is displayed.

        I'm experiencing the same problem with a routine that generates thousands of faces. The calculation is sometimes very long, but with the screen locked is impossible to understand the percentage of completion and when the calculation will end.
        You have found a solution in the meantime?

        1 Reply Last reply Reply Quote 0
        • M Offline
          mpowell1234567890
          last edited by

          I have a SketchUp RUBY API Wishlist:

          1. A ruby script that coverts multiple lines to 1 whole line.
          2. A ruby script that speeds up shadow rendering.
          3. A ruby script that ables a follow-me tool to cross multiple lines "For example: a cross using any shape"
          4. A ruby script that Measures a volume of a model in Gallons, Liters etc..
          1 Reply Last reply Reply Quote 0
          • R Offline
            remus
            last edited by

            @mpowell1234567890 said:

            I have a SketchUp RUBY API Wishlist:

            1. A ruby script that coverts multiple lines to 1 whole line.

            Have a look at weld.rb http://www.smustard.com/script/Weld

            @unknownuser said:

            1. A ruby script that speeds up shadow rendering.

            That would need to happen in the core SU code i.e. google needs to do that.

            @unknownuser said:

            1. A ruby script that ables a follow-me tool to cross multiple lines "For example: a cross using any shape"

            Hard to know what you mean without more details. Could you post a pic in a new thread?

            @unknownuser said:

            1. A ruby script that Measures a volume of a model in Gallons, Liters etc..

            There are a couple of volume scripts out there at the moment. Id guess it would be a fairly simple task to convert their output to litres/gallons. This would be a good place to start: http://forums.sketchucation.com/viewtopic.php?f=180&t=3188

            p.s. I think this thread is meant more for wishes regarding the ruby API itself, rather than individual scripts.

            http://remusrendering.wordpress.com/

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

              My Volume scripts already let you select the results in gallons [US and UK] and litres as well as most other volume units...

              TIG

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

                Being able to set Layer colour.

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

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

                  • Being able to set Material name.
                  • Being able to delete materials.
                  • Being able to delete ComponentDefinitions

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

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

                    You can delete a definition's instances and then that individual definition from the component-browser thus:

                    model.start_operation("Delete Instances and Definition")
                      definition.instances.each{|instance|instance.erase! if instance.valid?}
                      # this 1st step is optional since all instance become nil anyway when the definition is emptied
                      definition.entities.erase_entities(definition.entities.to_a)
                    model.commit_operation
                    

                    Assumes you have set model and definition... It empties a definition and therefore it disappears off the browser listing. It must be inside an operation to work.

                    PS: You can delete a material BUT it's pretty convoluted. I'll publish a script for it shortly...

                    TIG

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

                      I've not had 100% success with deleting definitions like that. I seemed to run into bugsplats. But I'll do new tests.

                      As for materials, I seen how V-Ray for Sketchup renames and deletes materials:
                      Deleting: iterate the whole model and remove the material - then apply unused materials to dummy groups and purge.

                      Rename: Create new material identical to old with new name - iterate and replace the old material with new. Then run the Delete method.

                      Ugly hacks which I'd rather not use. When model grows in size this just bogs down.

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

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

                        I've also made the equivalent layer.delete method here http://forums.sketchucation.com/viewtopic.php?p=166985#p166985 ...

                        TIG

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

                          http://forums.sketchucation.com/viewtopic.php?p=166978#p166978 has material.delete method - I've streamlined it as much as possible ???

                          TIG

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

                            I've also made a material.name="new_name" method here http://forums.sketchucation.com/viewtopic.php?p=167219#p167219 ...

                            TIG

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

                              material.name="new_name" method now v1.1 - here http://forums.sketchucation.com/viewtopic.php?p=167219#p167219
                              Temp folder fixed for Mac users...

                              TIG

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

                                Be able to track the shadow area on each face. This could make the calculation of shading possible for energy simulation.

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

                                  β€’ to have the 5th (optional) argument for write_image as 'Transparent Background' if the file type is .png

                                  1 Reply Last reply Reply Quote 0
                                  • Dan RathbunD Offline
                                    Dan Rathbun
                                    last edited by

                                    Sketchup::load

                                    The Sketchup::load method does NOT expose the wrap argument, so we can specify wrap=true for rbs scripts.

                                    For some unknown reason, the Google team defeated, or just didn't pass the 2nd argument (wrap) on to the aliased standard load, when they overrode it to handle rbs decrypting.

                                    Please fix this!
                                    _

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      Pout
                                      last edited by

                                      Here is my list:

                                      • Tig, although your solutions on material.name=, layer.delete, material.delete are good, it seems to me it would be much easier to just have them in the API. So i second the proposals of ThomThom

                                      • Also i second the proposal of Morisdov concerning the add_framechange_observer not firing when creating movies or when working in layout. It should fire there to.

                                      • make the entity.id consistent throughout different SU sessions (it changes now from time to time)

                                      • it would be great if you could just select an entity based on a parameter (eg. entity.id) without looping all the entities in the model

                                      • being able to access the font/size and other parameters of a text

                                      • make a difference between the execution of scripts and the interface so it is possible to incorporate a 'stop script' button for example. Now the interface freezes as long as scripts are running. This makes users believe the execution of the script has halted and Sketchup has stopped working.

                                      • ...more to come

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

                                        @pout said:

                                        • Tig, although your solutions on material.name=, layer.delete, material.delete are good, it seems to me it would be much easier to just have them in the API.

                                        And it would be faster.

                                        @pout said:

                                        • make the entity.id consistent throughout different SU sessions (it changes now from time to time)

                                        Ditto!

                                        @pout said:

                                        • it would be great if you could just select an entity based on a parameter (eg. entity.id) without looping all the entities in the model

                                        Ditto. If you have a script that requires observers attached to some objects one want these to be reattached when the model is loaded. Currently one has to iterate the whole model to find the entities, and one has to attach an attribute to be able to find the correct one - which means string comparisons which are really slow.
                                        So a better way to directly reference entities across sessions would be a great addition.

                                        @pout said:

                                        • make a difference between the execution of scripts and the interface so it is possible to incorporate a 'stop script' button for example. Now the interface freezes as long as scripts are running. This makes users believe the execution of the script has halted and Sketchup has stopped working.

                                        while true puts 'Ditto!' end

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

                                        1 Reply Last reply Reply Quote 0
                                        • P Offline
                                          Pout
                                          last edited by

                                          does anyone know if any of the remarks here will be taken into consideration in a new version?

                                          1 Reply Last reply Reply Quote 0
                                          • Dan RathbunD Offline
                                            Dan Rathbun
                                            last edited by

                                            @dan rathbun said:

                                            Sketchup::load

                                            The Sketchup::load method does NOT expose the wrap argument, so we can specify wrap=true for rbs scripts.

                                            For some unknown reason, the Google team defeated, or just didn't pass the 2nd argument (wrap) on to the aliased standard load, when they overrode it to handle rbs decrypting.

                                            Please fix this!_

                                            Taking this a step further.

                                            Since the rbs code blocks are eval'd, and Sketchup.load is an override (redefinition,) just pass the 2nd argument to Sketchup.load (if given,) on as the 2nd argument to the eval method.

                                            That way developers can instantiate a binding() to their custom namespace(s), and have the code evaluated within that scope.

                                            This can also give the GSUT the opportunity to protect some Google namespaces, within the argument validation block of the Sketchup.load method (ie: raise a custom "NotAllowedError" exception.)

                                            I'm not here much anymore.

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

                                            Advertisement