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!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    Webdialogs for SketchUp ......RIP!

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

      Yet another Grasshopper framegrab...

      One thing not discussed here regarding visual-flow-mombo-jumbo-programming is the complexity behind evaluating the chain of hierarchy, and when or what to update as soon as something changes in the gui.

      I'm not sure Python would have any advantages over Ruby solving that computation..

      But I guess that discussion is OT.

      The GUI part is all very possible with webdialogs. In fact it's already happening 😉

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

        @jolran said:

        In fact it's already happening 😉

        🎉

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

        1 條回覆 最後回覆 回覆 引用 0
        • jolranJ 離線
          jolran
          最後由 編輯

          What I've produced after months of work you or some of the others JS-nerds around here(you know who you are!) could probably have duddled together in a weekend or less, Thomthom 💚

          Although the connector framework took some time to get acquainted with..

          1 條回覆 最後回覆 回覆 引用 0
          • Dan RathbunD 離線
            Dan Rathbun
            最後由 編輯

            @tomot said:

            I forgive Dan, he was probably off his meds again, ...

            Or ON them. Sinus cold this past week!

            @tomot said:

            I'm not talking about dumping Ruby.

            It's not feasible to have the app engine making two callbacks into 2 different scripting sub-processes.

            IN truth... I am so weary of waiting for the Ruby API to be fixed, that I no longer care what language it is.

            As long as it is fixed and kept updated.

            If it's not Ruby, it is more likely to be Javascript IMHO.

            I'm not here much anymore.

            1 條回覆 最後回覆 回覆 引用 0
            • A 離線
              Aerilius
              最後由 編輯

              @unknownuser said:

              Javascript IMHO.

              Especially since such a partly implemented API already exists, and even a first plugin.
              Even if JS is not a beauty of a language, it's benefits are the wide-spread and the billions that have been invested into its speed optimization (although Python/Ruby&Co. have also benefited from such developments).

              For the original topic of this thread, neither webdialogs nor SketchUp's choice of scripting language matter. Node-based interfaces (previously mentioned as visual programming) are neither a replacement nor conflicting with webdialogs.

              1 條回覆 最後回覆 回覆 引用 0
              • I 離線
                ilay7k
                最後由 編輯

                Interesting, why does ex-Asgvis use port of Ruby to Python and pyQt dialogs in vray for sketchup?

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

                  They use such a bridge because they make V-Ray for SketchUp and V-Ray for Rhino share the same code-base so they can be developed in parallel.

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

                  1 條回覆 最後回覆 回覆 引用 0
                  • DavidBoulderD 離線
                    DavidBoulder
                    最後由 編輯

                    Interesting discussion. I work on OpenStudio which is a C++ SDK that includes a SketchUp plugin that uses ruby. We use tool called SWIG http://www.swig.org that gives us bindings to Ruby, Python, C# and potentially many other languages. Ruby is our most supported binding, but users are starting to use other bindings as well.

                    David

                    --

                    David Goldwasser
                    OpenStudio Developer
                    National Renewable Energy Laboratory

                    1 條回覆 最後回覆 回覆 引用 0
                    • AdamBA 離線
                      AdamB
                      最後由 編輯

                      Dave,

                      Marshalling parameters and providing some glue to call a C function isn't the problem - though I'm sure SWIG does a great job.

                      The 'heavy lifting' is around exposing underlying C++ entities as first class objects in your chosen host language.

                      Adam

                      Developer of LightUp Click for website

                      1 條回覆 最後回覆 回覆 引用 0
                      • Q 離線
                        qiucx
                        最後由 編輯

                        I do not know SU three month ago and never use ruby for programming. I would like to share my idea of three month usage.

                        1. Webdialog is great idea for ui and HTML5 will extend this advantage. The disadvantage is that the UI provided by SU is not so good.
                        2. The shortage of SU is that the api functions are not powerful, i expect more api to operate the SU and the support for ruby is not up to date. I'd like to easy use of new version ruby api in SU.
                        3. SU should consider to support the usage in ipad and andriod base system.
                        1 條回覆 最後回覆 回覆 引用 0
                        • icehuliI 離線
                          icehuli
                          最後由 編輯

                          I don't think ruby is the one to blame. It is very flexible. With the possibility to write ruby extensions in c/c++, on a Windows PC, one can also write it in C++/cli. Thus one can easily integrate any .net stuff. If one do not like webdialog, any other gui library can be linked through the extension. E.g. one can build c# plugin via p/invoke [DllImport("msvcrt-ruby18", CallingConvention = CallingConvention.Cdecl)]...
                          For stuff like Visual Programming the most challenge thing is parametric model. In sketchup this is not easy, since entities can easy be manipulated. I mean e.g. if you simply delete the area of a face, it becomes 4 lines. The entities are not consistent. They are so flexible. And if this is not a issue, one can make some effort and create a Visual Programming interface for su.

                          1 條回覆 最後回覆 回覆 引用 0
                          • jolranJ 離線
                            jolran
                            最後由 編輯

                            @unknownuser said:

                            if you simply delete the area of a face, it becomes 4 lines. The entities are not consistent. They are so flexible. And if this is not a issue, one can make some effort and create a Visual Programming interface for su.

                            That is why I use Open GL objects through a tool's draw class to visualize entities for "Visual Programming interface". It is to sketchy to try to alter Sketchups entities parametrically. Subdivide a face with a slider and youre toast, as you mention.

                            The biggest problem, as I see it (so far) is that a webdialog freezes during any Ruby operation. Making webdialogs only really usable being used as a form-submit type of thing. One have to write very efficient Ruby code that masks that behavior.

                            I wonder how other type of GUI's, you mention behave during Ruby operations..

                            1 條回覆 最後回覆 回覆 引用 0
                            • icehuliI 離線
                              icehuli
                              最後由 編輯

                              One can use c# wpf or winform for the GUI. One can create another thread for the GUI. And use dispatcher for the calling, something like:
                              in the ruby thread do
                              wpfWindow.Dispatcher.BeginInvoke((Action)(() =>
                              {
                              wpfWindow.Show();
                              wpfWindow.Activate();
                              }), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
                              to open the window and call other functions in the gui.

                              and in gui thread do
                              using VALUE = System.Int32;
                              ruby_extension.BeginInvoke(DispatcherPriority.Input,
                              (Action)(() =>
                              {
                              VALUE state = 0;
                              VALUE rb_mKernel = rb_eval_string_protect("Kernel", ref state);
                              rb_funcall(rb_mKernel, rb_intern("puts"),
                              rb_eval_string_protect(Encoding.UTF8.GetBytes("Hello, World!" + '\0'), ref state));
                              }));
                              to call ruby functions or evaluate ruby scripts.

                              1 條回覆 最後回覆 回覆 引用 0
                              • jolranJ 離線
                                jolran
                                最後由 編輯

                                Oh, I wish I'd taken up on C or C++...

                                Anyway, I gather Windows only ?

                                Both plattforms ought to be provided to keep people happy.

                                1 條回覆 最後回覆 回覆 引用 0
                                • jiminy-billy-bobJ 離線
                                  jiminy-billy-bob
                                  最後由 編輯

                                  Jolran, what do you use for your JS node-based interface ? I was wondering about something similar for a material editor (For vray and friends) like 3dsmax's.

                                  JSmaker ? http://jsmaker.com/jsmaker/

                                  25% off Skatter for SketchUcation Premium Members

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • icehuliI 離線
                                    icehuli
                                    最後由 編輯

                                    @jolran said:

                                    Oh, I wish I'd taken up on C or C++...

                                    Anyway, I gather Windows only ?

                                    Both plattforms ought to be provided to keep people happy.

                                    I think the same method can be applied for c++ gui, e.g. qt, as well. A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated.

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • jolranJ 離線
                                      jolran
                                      最後由 編輯

                                      @unknownuser said:

                                      I think the same method can be applied for c++ gui, e.g. qt, as well. A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated.

                                      Great! It's just the small detail of learning c++ then 😄

                                      Seriously though, I was under the impression these kinds of 2 way Communication was not possible outside webdialog-World.

                                      I would really like to know more.

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • jolranJ 離線
                                        jolran
                                        最後由 編輯

                                        JSmaker is not an option I think.

                                        I use JsPlumb. It's depended of Jquery UI, which is a bit sketchy when dealing with CSS3 transforms. It does not recognize them 😲 So zooming is very fun to deal with 😉
                                        Anyway one have to write nodecreation functions oneself and where endpoints should be added. Jsplumb is only a view technology. Does not do any type of layout (yet).

                                        I've been looking into D3, and it's an awsome framework! But also very low-level so it would take ages to come up with something that's even close to where Jsplumb is now.
                                        But still very interesting...

                                        edit: Removed some off topic ramblings..

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • jolranJ 離線
                                          jolran
                                          最後由 編輯

                                          @unknownuser said:

                                          A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated

                                          So, the dialog does not freeze during Ruby operations ?

                                          How about window modal behavior. I mean how do one activate a dialog through Ruby plugin, must the C# program or whatever being used already be up and running?
                                          I assume you already have tried this in practice.

                                          Sorry bout the noob questions 😳

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • icehuliI 離線
                                            icehuli
                                            最後由 編輯

                                            @jolran said:

                                            @unknownuser said:

                                            A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated

                                            So, the dialog does not freeze during Ruby operations ?

                                            How about window modal behavior. I mean how do one activate a dialog through Ruby plugin, must the C# program or whatever being used already be up and running?
                                            I assume you already have tried this in practice.

                                            Sorry bout the noob questions 😳

                                            Yes, one can activate a dialog through ruby plugin. The c# thread is started within the plugin. I have tried something already. check out https://github.com/icehuli/suWpfExt.
                                            Although it is a alpha version, it should give you a hint how to do the trick. It currently uses swig, which is not necessary. I am working on a version without swig. The plugin is separated in several dlls.

                                            1. myExtMain.dll is the main dll in c++, compiled with /clr, so it can load .net dlls.
                                            2. suWpfUI.dll is the UI dll in c#, witch implements the WPF GUI.
                                            3. suExtMainWrapper.dll is the wapper linked by the GUI to call c++ functions in myExtMain.dll. (This one seems not necessary, the reason to have it is that c# can not be linked to with myExtMain directly. However one can use P/Invoke in c# code
                                              using VALUE = System.Int32; using ID = System.Int32; [DllImport("msvcrt-ruby18", CallingConvention = CallingConvention.Cdecl)] private static extern VALUE rb_funcall_(VALUE recv, ID mid, int argc, __arglist);
                                              to directly call ruby functions, thus the suExtMainWrapper is not necessary.)
                                              Another issue is that suWpfUI and suExtMainWrapper are not explicitly loaded by ruby require so it needs to be placed inside Sketchup.exe directory. I haven't figure out how to avoid this.
                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement