• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

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.
  • J Offline
    jadema
    last edited by 22 Mar 2009, 23:44

    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.

    1 Reply Last reply Reply Quote 0
    • M Offline
      Matt666
      last edited by 1 Apr 2009, 05:40

      Hi all!
      To have possiblity to call a tool by its ID, with function Sketchup.send_action.
      For example :

      Sketchup.send_action 21022
      

      It works great on PC. On Mac, it returns this bug below in the console :
      @unknownuser said:

      Error: #<TypeError: can't convert Fixnum into String>

      Frenglish at its best !
      My scripts

      1 Reply Last reply Reply Quote 0
      • I Offline
        iceman
        last edited by 9 Apr 2009, 21:34

        Let me add my two cents. I've only been using the API for a couple of days now, and I can see that dimensions aren't accessible from it. This would be very important to me. I can see it's been requested a couple of times already...

        Thanks for such a great tool.

        Just thought of another one. Last night I tried to create a script to let me control the camera like you would in a video game: WASD and mouselook. Turns out that key press events are consumed by shortcuts before they can get to a script. Also, you can't copy the shortcut keys, change them temporarily while your tool is running, and then restore them when it's deactivated. A way around this would be nice. I know the walk tool lets you use the arrow keys, but it would be nice to a) be able to change those keys and b) use mouse look at the same time

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 13 Apr 2009, 22:40

          @iceman said:

          I've only been using the API for a couple of days now, and I can see that dimensions aren't accessible from it.

          You can work-around this dimensions_not_being_API_accessible issue...
          Make a component-dimension one_unit long and save it
          In the script insert it at the first picked point, then transfoem it...
          Rotate it to the angle given by the second picked point and scale it in its X to match the distance_between_the_two_points : one_unit
          The dimension numbers should change to match, which the ticks and leaders remain fixed.
          You could have a third picked point to locate the text and scale it in the Y to suit ?
          You could then explode that instance if appropriate...

          TIG

          1 Reply Last reply Reply Quote 0
          • J Offline
            JClements
            last edited by 13 Apr 2009, 22:57

            If its not going to be part of the core program, then a way to export as a Flash Animations.

            A means to use object tweening within a scene or between scenes [ie., apply a name to a group ie., Object1<TweenBegin> in Scene1, and on Scene2 place a copy of that object with a name of Object1<TweenEnd> ]. Any transformations to Ojbect1<TweenEnd> such a scale, position, and rotation would be tweened between Scene1 and Scene2 at whatever frame rate the user designate to the properties of objectname<TeenEnd>.

            John | Illustrator | Beaverton, Oregon

            1 Reply Last reply Reply Quote 0
            • B Offline
              billbell52
              last edited by 1 May 2009, 14:12

              Maybe I am thinking about this wrong but I think a good idea is to develop a rubygem that exposes the SketchUp Ruby API to a standard ruby install. You can continue to develop the embedded Ruby capability but a lot of existing Ruby capability/code/gems can be put to immediate use. The relieves the pressure to urgently add capability that exists someplace else. For example I may want to couple SketchUp to a RubyOnRails environment. I don't expect you to embed ROR into SketchUp. I would have the capability of doing it on my own if I could access the Ruby API from a standard Ruby install.

              Also, as I understand the Sketchup Ruby API is based on 1.8.0. Exposing the Ruby API to an external Ruby environment would allow users to use a more current release.

              Does this make any sense?

              1 Reply Last reply Reply Quote 0
              • B Offline
                buk2noy
                last edited by 5 May 2009, 05:59

                @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 28 May 2009, 16:24

                  @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 2 Jun 2009, 18:38

                    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 2 Jun 2009, 18:47

                      @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
                      • T Offline
                        TIG Moderator
                        last edited by 3 Jun 2009, 10:26

                        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 17 Jun 2009, 08:43

                          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 23 Jun 2009, 08:48

                            • 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
                            • T Offline
                              TIG Moderator
                              last edited by 23 Jun 2009, 09:20

                              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 23 Jun 2009, 09:30

                                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
                                • T Offline
                                  TIG Moderator
                                  last edited by 23 Jun 2009, 10:51

                                  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
                                  • T Offline
                                    TIG Moderator
                                    last edited by 23 Jun 2009, 10:51

                                    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
                                    • T Offline
                                      TIG Moderator
                                      last edited by 24 Jun 2009, 13:38

                                      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
                                      • T Offline
                                        TIG Moderator
                                        last edited by 26 Jun 2009, 09:12

                                        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 14 Jul 2009, 02:57

                                          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
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 6
                                          • 3 / 6
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement