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
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • J 離線
      Jim
      最後由 編輯

      @david. said:

      Jim,

      Nice idea. Also, I'm curious if you mixed in the Singleton module to implement your singletons? I've found that I can't require a library module like Singleton unless I point directly to my Ruby installation directories. I realize that this isn't required to implement singletons, but it seems the most simple and consistent.

      Hi David,

      Yes, I used the singleton class from Ruby. I copied singleton.rb from the Ruby language installation to a 'ruby' folder in my Sketchup/Plugins folder. The Ruby singleton is very easy to use, and was simply the best and fastest solution. I think there are a few other files from the installed Ruby files that I needed also.

      Hi

      1 條回覆 最後回覆 回覆 引用 0
      • M 離線
        morisdov
        最後由 編輯

        Hello

        Inside SketchUp it works fine but when creating an AVI file with Export -> Animation
        the - Sketchup::Pages.add_frame_change_observer - is not firing between frames.

        Is there anything i should change or another observer i can use between frames in Export Animation ?

        301 Moved Permanently

        favicon

        (www.sketchucation.com)

        Thanks

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

          One of the more important things that could be done using the Ruby API, and which would benefit nearly all users is a unified API for menus and toolbars. I don't mean being able to lock toolbars; I mean the possibility to provide menu and toolbar customization using a "Menu & Toolbar Editor" within SketchUp.

          The need is apparent in CadFather's Toolbar plugins; where he creates a collection of scripts and adds toolbar buttons for them. Although these are nice toolbars, they are going to prove difficult to maintain as scripts are updated and obsoleted.

          Really, there would need to be some registry that would:

          • "install" a plugin so that is is not located in the Plugins folder, and so not automatically loaded.
          • allow un-modified plugins to continue to function.
          • allow new/modified plugins to create new, or be added to, existing menus, submenus, and toolbars.
          • handle the creation of menus and toolbars at startup.

          The possibilities are fantastic, if you let your mind run wild:

          • allow menu/toolbars "sets" to be created.
          • allow plugins to be downloaded as-needed, or used online. (zero install: net_require "progrsssbar.rb")
          • check new versions of plugins online, and upgrade.

          Of course, I do not mean to remove the ability for developers to create their own menu or toolbars. But even if it's just for the numerous scripts that are single-menu, or single-button plugins, this would be an improvement.

          (related post)

          Hi

          1 條回覆 最後回覆 回覆 引用 0
          • M 離線
            Matt666
            最後由 編輯

            Hi guys !
            I wish one day, we would have access to print parameters via ruby... One day... 😄

            Frenglish at its best !
            My scripts

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

              An important wish for ALL exporters, I believe:

              • a method to read a cropped region in 2point perspective view.
                As far as I am aware, currently there is no way to read it!

              Please!

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                A Ruby method that will give us a real UVW coordinates of a projected texture, so exporters could use a single, original texture, instead of say 200 small textures of a photo mapped terrain.

                Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                1 條回覆 最後回覆 回覆 引用 0
                • chrisglasierC 離線
                  chrisglasier
                  最後由 編輯

                  A switch (if it does not exist) to activate a ruby on selection of an entity or entities to allow interaction with a webdialog.

                  See:
                  http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=14299

                  Thanks

                  Chris

                  With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                  1 條回覆 最後回覆 回覆 引用 0
                  • TIGT 離線
                    TIG Moderator
                    最後由 編輯

                    @chrisglasier said:

                    A switch (if it does not exist) to activate a ruby on selection of an entity or entities to allow interaction with a webdialog.

                    See:
                    http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=14299

                    Thanks

                    Chris

                    Search v7..............

                    TIG

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

                      @unknownuser said:

                      A Ruby method that will give us a real UVW coordinates of a projected texture, so exporters could use a single, original texture, instead of say 200 small textures of a photo mapped terrain.

                      👍 Agree!

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

                      1 條回覆 最後回覆 回覆 引用 0
                      • C 離線
                        confitex architure
                        最後由 編輯

                        Hi ScottLininger.
                        Not realy a ruby way of coding, but almost...
                        I mentionned it in an another post: It would be so nice to retrieve a variable from a model into a dynamic component's attribute instead of the opposit (right now, if I understand well, it is only possible to "export" and to make a code to fill the DC's attribute).

                        By the way, I would be very glad if we could learn from your famous animated "sprite" code 😄

                        Thanks!!!

                        1 條回覆 最後回覆 回覆 引用 0
                        • M 離線
                          MarcioAB
                          最後由 編輯

                          Access to Model.open ( open method of Model class ) as presented in this topic1 and this topic2.

                          Thank you

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

                            hello Scott,
                            Thanks for your interest in helping out. That game you made was pretty cool.

                            I would like to see some convience methods like in the Blender API. This may not be appealing to Gurus but might be quite helpful to the new rubyist. Something like...

                            
                            obj.LocX --> (0,0,0)
                            obj.LocX += 20
                            obj.LocX --> (20,0,0)
                            obj.loc = 0,0,0 #set loc
                            obj.getMatrix()
                            
                            

                            i am also wondering why there is no way to do simple and dirty animations, like...

                            
                            Loop
                                obj.LocX += 10
                                sleep(.02)
                                SU.Redraw()
                            
                            

                            I really like most of the SU API's layout compared to Blender, except the Transformation module, it seems a little clumsy. But i might be missing something important. I am not an engineer, just a real brave lad, thats all.

                            So if you want to enlighten me, feel free 😄

                            Always sleep with a loaded gun under your pillow!

                            1 條回覆 最後回覆 回覆 引用 0
                            • daikuD 離線
                              daiku
                              最後由 編輯

                              I'd like to be able to specify the font size for text objects.

                              Clark Bremer
                              http://www.northernlightstimberframing.com

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

                                I would like to see a GUI added to the Ruby API. This has been sadly lacking from when the Ruby API was first added to be the scripting language for SU. Please add this to your SU8 wish list. Failing that, perhaps an easier task maybe to add a Python API with GUI to SU. I see no reason why SU can't function with 2 scripting languages.

                                [my plugins](http://thingsvirtual.blogspot.ca/)
                                tomot

                                1 條回覆 最後回覆 回覆 引用 0
                                • thomthomT 離線
                                  thomthom
                                  最後由 編輯

                                  A GUI to the API what do you mean? As oppose to Webdialogs?

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

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

                                    I think what tomot wants is a GUI toolkit built-in for SU scripting. Web dialogs are quite lacking. Scriptwriters need widgets!

                                    Text, Listbox, Entry, Button, Frame, Toplevel, Spinbox, Label, Scrollbar, Dialogs, RadioButton, CheckButton, Menu, Scale, LabelFrame, Canvas, OptionMenu, PanedWindow, Image Support

                                    Python has all this built-in to the language as Tkinter(Tk widgets) An easy to use GUI builder with every thing a script writer/SUupper needs, amoung others.

                                    I will also volunteer to do most of the dirty work to grow a Python API(and i could get others to help also -- SU DEV would not have to do much).

                                    One of the best things about Python as compared to Ruby is the tons and tons of great documentation. This would be very appealing to those who wish to script but cannot find good docs for Ruby. And the built-in GUI is just icing on the cake!

                                    Always sleep with a loaded gun under your pillow!

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

                                      @jessejames said:

                                      I think what tomot wants is a GUI toolkit built-in for SU scripting. Web dialogs are quite lacking. Scriptwriters need widgets!

                                      Text, Listbox, Entry, Button, Frame, Toplevel, Spinbox, Label, Scrollbar, Dialogs, RadioButton, CheckButton, Menu, Scale, LabelFrame, Canvas, OptionMenu, PanedWindow, Image Support

                                      Yes that's exactly what I meant. Here is a Google definition of Webdialogs:

                                      By using powerful cross-browser Javascript and CSS, WebDialog renders dialogs, windows and even modal dialogs inside the browser window. It avoids the problems caused by restrictive popup blockers and gives you greater flexibility when designing your web application's user interface.

                                      That's not going to help my scripting endeavors without now also having to learn Javascript and CSS.

                                      JJ you put a generous offer of the table, I would like to contribute where ever possible. Lets hope we can get ScottLininger on board? Because without some support from Google I can't see this going very far.

                                      [my plugins](http://thingsvirtual.blogspot.ca/)
                                      tomot

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • thomthomT 離線
                                        thomthom
                                        最後由 編輯

                                        Coming from a webdesign background I forgot that HTML, CSS and JS is also a thing to be learnt. I see your point. I was just confused because you allready have most of the controls JJ mentioned. But as you say, it a new set of languages to learn.

                                        As for the lacking set of widgets, there are many frameworks that can easily be added on to extend the widget collection.

                                        But I'm puzzled by another thing, tomot; you would be willing to learn Python to make a GUI, but not CSS+JS?

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

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

                                          @thomthom said:

                                          But I'm puzzled by another thing, tomot; you would be willing to learn Python to make a GUI, but not CSS+JS?

                                          It may surprise you Thomas; I'm not a Ruby programmer or a LISP programmer nor GDL http://en.wikipedia.org/wiki/Geometric_Description_Language programmer.
                                          I could not sit down with a text editor and bang out a new Ruby without at the same time having open on my Desktop at least 2 or 3 existing Ruby's whose content may help form the basis of a new ruby idea I'm trying to bring into being. Then through lots of cutting and pasting of code and many trials and errors of loading and reloading the same script into the console, over and over again, I eventually arrive at the solution. The programming related lines I can't solve I usually bring forth to this forum for help from those that have real programming knowledge, and I'm always grateful for their support. The following piece of code was provided by Jim Foltz.

                                          normal = useanamehere.normal
                                          normal.length = -$xxx
                                          tr = Geom;;Transformation.translation(normal)
                                          group.transform! tr
                                          

                                          This small piece of code has been invaluable, its used repeatedly to offset distances that make 2d lines into 3d, planes, without it Window and Door Tools could not exist.

                                          Its also one of the reasons I'm grateful that not each Ruby contributor decides to use obfuscation on their code. Obviously if everyone did this, this community would not have benefited from my Window and Door Tools scripts.

                                          If this Python API works out, I will approach scripting with it the same way I do with Ruby. Firstly I would ask for some simple existing Ruby's to be converted to Python. I would use that as a springboard to start scripting in Python.

                                          [my plugins](http://thingsvirtual.blogspot.ca/)
                                          tomot

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

                                            @tomot said:

                                            ...I could not sit down with a text editor and bang out a new Ruby without at the same time having open on my Desktop at least 2 or 3 existing Ruby's whose content may help form the basis of a new ruby idea I'm trying to bring into being. Then through lots of cutting and pasting of code and many trials and errors of loading and reloading the same script into the console, over and over again, I eventually arrive at the solution.

                                            I agree tomot,
                                            The work flow for writing scripts in SU is frustrating. This must be improved. Nobody(pro or not) has the ability to write bug free scripts in one go.

                                            1.) A built-in text editor(very simple) with syntax highlight so a new scripter can get started easily
                                            2.) a multi-line Console(for testing snippets with proper indentation) to replace the single line Ruby Console
                                            3.) a real GUI toolkit(Python has TK built-in to the language)
                                            4.) a good SU specific scripting tutorial.( most important )

                                            These are the key to happy SU scripting.

                                            The current work flow is painful and a real determent to all who wish to learn, or write scripts for SU. Something must be done. Scripting must be made available to all, not just a few professionals at the top.

                                            SU design is flawless everywhere but this area. Once we can fix this, the full power of SU will be available to all.

                                            Always sleep with a loaded gun under your pillow!

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

                                            Advertisement