DLL callback to ruby
-
Sweet! But only ruby18-core.chm works out of the 3! Or is it me?
I just posted http://forums.sketchucation.com/viewtopic.php?f=180&t=39119 another challange for you
-
@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. -
Yes indeed, I didn't know the other 2 were loaded into the one. That's a nice ref book! Thanks Dan.
-
@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
-
@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
-
why would you use
Sketchup.send_action(JcB::My_Ext.initalise)
when
JcB::My_Ext.initalise
works for a loaded file?
john
-
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.
-
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
-
@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.
-
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.
-
You will need to do some studying:
- Read and bookmark this post:
[Info] C/C++ Ruby extensions & SketchUp plugins
- You will need to download the Ruby C source, as your DLL code must:
%(#404080)[include "ruby.h"]
- Read the old "Pick-Axe" book's chapter on writing a Ruby extension.
Programming Ruby: Extending Ruby
- Take note of the Ruby C-side functions:
rb_eval_string( *string_to_eval* )
*rb_funcall
... described in section "Evaluating Ruby Expressions in C"
- okay, a dedicated C side Ruby book is also now available:
Advertisement