sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

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

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    107 貼文 46 Posters 43.0k 瀏覽 46 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Al HartA 離線
      Al Hart
      最後由 編輯

      UI.openpanel - bugs and improvement requests

      I would like UI.openpanel to be much more powerful.

      I have at three problems with it.

      1. Patterns for file extensions

      This first code snippet should display all files with either a .zip or .rb extension.
      When I use it in SU 7 Windows, the openfile panel displays only the .zip files, (no .rb files), and showed this '*.zip;_.rb' in the File name box: (with an underscore instead of a *)

      fn = UI.openpanel "Select a zip file.", "",  "*.zip;*.rb"
      
      

      When I pass it just one extension, it works:

      UI.openpanel "Select a zip file.", "",  "*.zip"
      

      But if I pass it a starting folder it fails:

      UI.openpanel "Select a zip file.", "c;/tmp",  "*.zip"
      

      showing '_.zip' in the File Name box

      1. Passing patterns and a starting file separately

      I should be able pass a file name (e.g. the last file the user opened), as well as a set of patterns.

      1. Passing filters.

      The Windows openfile dialog allows you to pass a set of filters which display at the bottom. UI.openfile should have a similar set of patterns.

      #2 and #3 could be implemented with new, optional parameters.

      1. Required file

      Windows Openfile has a setting that required that the user enter a valid, existing file. This would be a nice feature for UI.openpanel.

      Al Hart

      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

      1 條回覆 最後回覆 回覆 引用 0
      • Al HartA 離線
        Al Hart
        最後由 編輯

        Bug/new feature request for Sketchup.load

        Sketchup.load does not set the filename or binding properly. errors during loading are not reported, and executaion errors are not reported properly.

        Here is a test file with an error which only occurs during execution.

        rps_test1.rb

        
        printf "rps_test1.rb\n"
        def test1
                printf xxx
        end
        
        

        When you load it with ruby's load and execute 'test1' you get this error:

        
        Error; #<NameError; c;/tmp/rps_test1.rb;6;in `test1'; undefined local variable or method `xxx' for main;Object>
        c;/devc_2005/rptools/rpt_debug/ruby/rps_test1.rb;6
        
        

        When you load it in Sketchup.load (either the .rb or the compressed .rbs), you get this error message:

        
        
        Error; #<NameError; (eval);11;in `test1'; undefined local variable or method `xxx' for main;Object>
        (eval);11
        
        

        Having the file name and line number for a ruby is very important both when creating a ruby application and when debugging client problems. I have to go to a lot of trouble to work around this bug. 😞

        Assuming that 'eval()' is eventually used by Skethcup.load to load, binding and a file name could be passed to cause errors to be reported properly.

        e.g.: eval(string, TOPLEVEL_BINDING, filename, start_line)

        Al Hart

        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
        IRender nXt from Render Plus

        1 條回覆 最後回覆 回覆 引用 0
        • T 離線
          todd burch
          最後由 編輯

          I haven't read through this post, so some of these might be duplicates. If they are, consider mine a +1.

          • Expose the Surface class.
          • Change the data model for Text so its not a global thing, but an entity thing. That way, each text-related entity can have it own font and other attributes.
          • Expose Dimensions.
          • Fix all the bugs I've reported. Really. 😒
            Thanks, Todd
          1 條回覆 最後回覆 回覆 引用 0
          • N 離線
            NewOne
            最後由 編輯

            Sorry if off-topic.
            But... did you guys heard something about Sketchup 7 ruby documentation? What's really new here? Will it appear? When?

            Thank you. 😄

            1 條回覆 最後回覆 回覆 引用 0
            • scottliningerS 離線
              scottlininger
              最後由 編輯

              We summarized the new SU7 features in a blog post:

              Link Preview Image
              What's New in SketchUp 7

              Posted by Scott Lininger, SketchUp Team SketchUp 7 contains several improvements to the Ruby API. Here's a quick tour of the best changes. I...

              favicon

              (sketchupapi.blogspot.com)

              I can't give an exact date for the detailed documentation. We're working on it.

              Thanks,

              • Scott Lininger
                SketchUp Software Engineer
                Have you visited the Ruby API Docs?
              1 條回覆 最後回覆 回覆 引用 0
              • thomthomT 離線
                thomthom
                最後由 編輯

                My suggestion of way of coding: Being able to hook up a debugger. Sorely needed some times.

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

                1 條回覆 最後回覆 回覆 引用 0
                • N 離線
                  NewOne
                  最後由 編輯

                  To be able to add new menus in SketchUp menu bar.


                  2009-03-10_135226.png

                  1 條回覆 最後回覆 回覆 引用 0
                  • J 離線
                    jadema
                    最後由 編輯

                    Extend the UI class to support the selection of a directory. Currently you can select files, but there doesn't seem to be a way to select a directory or folder.

                    1 條回覆 最後回覆 回覆 引用 0
                    • snicoloS 離線
                      snicolo
                      最後由 編輯

                      The New Ruby API documentation is up and running.

                      Take a look at:
                      http://code.google.com/apis/sketchup/docs/index.html

                      enjoy.
                      Simone.

                      Simone Nicolo
                      QA Manager
                      http://www.sketchup.com

                      1 條回覆 最後回覆 回覆 引用 0
                      • J 離線
                        jadema
                        最後由 編輯

                        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 條回覆 最後回覆 回覆 引用 0
                        • M 離線
                          Matt666
                          最後由 編輯

                          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 條回覆 最後回覆 回覆 引用 0
                          • I 離線
                            iceman
                            最後由 編輯

                            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 條回覆 最後回覆 回覆 引用 0
                            • TIGT 離線
                              TIG Moderator
                              最後由 編輯

                              @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 條回覆 最後回覆 回覆 引用 0
                              • JClementsJ 離線
                                JClements
                                最後由 編輯

                                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 條回覆 最後回覆 回覆 引用 0
                                • B 離線
                                  billbell52
                                  最後由 編輯

                                  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 條回覆 最後回覆 回覆 引用 0
                                  • B 離線
                                    buk2noy
                                    最後由 編輯

                                    @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 條回覆 最後回覆 回覆 引用 0
                                    • T 離線
                                      trottolino
                                      最後由 編輯

                                      @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 條回覆 最後回覆 回覆 引用 0
                                      • M 離線
                                        mpowell1234567890
                                        最後由 編輯

                                        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 條回覆 最後回覆 回覆 引用 0
                                        • R 離線
                                          remus
                                          最後由 編輯

                                          @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 條回覆 最後回覆 回覆 引用 0
                                          • TIGT 離線
                                            TIG Moderator
                                            最後由 編輯

                                            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 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 3 / 6
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement