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

DLL callback to ruby

Scheduled Pinned Locked Moved Developers' Forum
41 Posts 4 Posters 10.5k Views 4 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.
  • D Offline
    Dan Rathbun
    last edited by 2 Aug 2011, 01:06

    @alienizer said:

    Sweet! But only ruby18-core.chm works out of the 3! Or is it me?

    ruby18.chm is a wrapper that loads both of the other two, as expandable nodes in the tree control.
    CHM files use a MSIE stub named hh.exe
    They a compiled HTML Help Markup files.
    You can get the HTML Help Workshop app on MS Download.

    I'm not here much anymore.

    1 Reply Last reply Reply Quote 0
    • A Offline
      Alienizer
      last edited by 2 Aug 2011, 01:15

      Yes indeed, I didn't know the other 2 were loaded into the one. That's a nice ref book! Thanks Dan.

      I'm from Mars and moved to Earth to alienize you. Unfortunately, I became humanized.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 2 Aug 2011, 01:20

        @alienizer said:

        Yes indeed, I didn't know the other 2 were loaded into the one. That's a nice ref book! Thanks Dan.

        Well it's supplied with the mingGW compiled Windows Ruby one-click install packages. So I'm not responsible.

        Check your Private Messages

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • A Offline
          Alienizer
          last edited by 2 Aug 2011, 01:23

          @dan rathbun said:

          Well it's supplied with the mingGW compiled Windows Ruby one-click install packages. So I'm not responsible.

          I know, but I should have figured it out myself 😐

          I'm from Mars and moved to Earth to alienize you. Unfortunately, I became humanized.

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by 26 Feb 2016, 16:49

            why would you use

            Sketchup.send_action(JcB::My_Ext.initalise)

            when

            JcB::My_Ext.initalise

            works for a loaded file?

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • M Offline
              Marthmatica
              last edited by 27 Feb 2016, 01:05

              looks like you solved the problem.

              If I want to call an rb function, from a loaded rb in SU, you could just send this function from a dll:

              Sketchup.send_action my_rb_function_def_name_in_an_rb_loaded_file (no string wrap), as you can other SU commands

              which rb SU command, and its function call string is just a string in a class property or in some dll function, thus called in either direction, from dll, or to dll.

              Its a little clunky I notice, a bit unreliable after the stack is toasted a little.

              1 Reply Last reply Reply Quote 0
              • M Offline
                Marthmatica
                last edited by 27 Feb 2016, 01:15

                Because I didn't know. Thanks, that'll be better. Any other tips for reliably sending strings and data from DLL's easily?

                Is there anyway to extend UI webdialog to contain activex controls? I have not tried it yet, I suppose it is doable. The dilemma is sending external commands to SU, in my case, and that work around is running script functions that have to be loaded, for now.

                Also, if you know the browser engine for the UI webdialog, can it be set to a specific browser in SU?

                @unknownuser said:

                WebDialog.newSketchUp 6.0+

                The new method is used to create a new webdialog.

                Note that the browser which is embedded inside the dialog depends on the user's OS. On Mac, Safari is embedded, while on the PC whatever version of Internet Explorer is installed will be embedded.

                I don't have explorer, thank God, but some engine is being used in SU, just wondering where that may be set.

                Just trying to make some easy connectible user dialogs, and experimenting for fun. May be I'll find a hole or two as well, an accidental "in", that's always nice.

                Was also wonderign why "creatObject" from the Sketchup encapsulated object model is impossible, I assume, maybe it is not programmed to be accessible. But the exe. exposes the object model, but not many useful methods, eyt I can instantiate the SU object in ActiveX anyways, but I'll keep chipping away the stone. There is more than one hole, and they'll emerge up in time, but I only have a million years here.

                Thanks

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Marthmatica
                  last edited by 27 Feb 2016, 01:58

                  @driven said:

                  why would you use

                  Sketchup.send_action(JcB::My_Ext.initalise)

                  when

                  JcB::My_Ext.initalise

                  works for a loaded file?

                  john

                  Oh yeah. Forgot. The reason I was doing this, is to send the send_action "string" (or whatever it really is), from a DLL. And it works sometimes, soemtimes not, and so I was trying to get it to be reliable.

                  I don't know how to construct a "this.that" thing from a DLL, if that is required to run a ruby command. I just needed to keep the string as simple as possible. Still experimenting. I just need to call SU commands, from outside of SU data forms, even if initiated in SU, as that is all I can do at present. The reason is as usual, the data aids a real IDE may provide, versus naked scripts having to read text and Excel sheets as the "middleman". Just tryign to minimize the back and forth kind of supposed solutions I Frankenstein together.

                  I really don't know why SU doesn't just expose the whole OM for use by other IDEs. May be it does, but the stupid gene has yet to be naturally selected with myself, and so stupid is what stupid does, take a million years to find a four line solution that works. But, I got a million years, so, might as well do something "extraciricular" while I am here.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Marthmatica
                    last edited by 27 Feb 2016, 02:32

                    Answering my own post. eval("str") makes this 100% reliable, THAT was my problem. I'll be learning for a while. I'll see if it works on whole chunks of ruby code sends from the DLL.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Dan Rathbun
                      last edited by 21 Jul 2017, 19:54


                      You will need to do some studying:


                      1. Read and bookmark this post:

                      [Info] C/C++ Ruby extensions & SketchUp plugins

                      1. You will need to download the Ruby C source, as your DLL code must:

                      %(#404080)[include "ruby.h"]

                      1. Read the old "Pick-Axe" book's chapter on writing a Ruby extension.

                      Programming Ruby: Extending Ruby

                      1. Take note of the Ruby C-side functions:
                      • rb_eval_string( *string_to_eval* )* rb_funcall
                        ... described in section "Evaluating Ruby Expressions in C"
                      1. ❗ okay, a dedicated C side Ruby book is also now available:
                      • http://media.pragprog.com/titles/ruby3/ext_ruby.pdf

                      I'm not here much anymore.

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

                      Advertisement