HELP setting up a SU code editor
-
Well, the bridge that Matt is using is a Windows-only thing - you'd need to ask TBD about the possibility of porting.
-
I am already looking into porting SketchUp Bridge to Mac, but it will take some time as I need to learn the internals of OSX.
-
I could have sworn SketchUp had a socket interface somewhere. If we could send commands reliably over a socket, then the Java interface becomes trivial. And you can use the IDE to access SketchUp on a remote computer.
-
Hi all,
as your online Matt (and any one else) I'm just trying to combine two rubies to print out a full xml list of my local SU ruby api.
I've taken the exporter from tomatoes_export.rb and I'm trying capture the puts from su_api.rb as it loops thru all the rubies on my local SU
I haven't got any of it working yet, I only just thought of it ...
will it work
I guess step 1 is get su_api.rb to loop the list it gathers to ruby console and copy paste the results into excel....
I want to add the list to resources template.
or is there an easy way to have an introspective, local, platform aware list....
-
@Matt is this what you mean?" title="@Matt is this what you mean?" class=" img-fluid img-markdown" />I have no idea what it means, but you probably do...
# begin code def socket_listener(v) puts "r;#{v.inspect}" if v == "Connection closed" p SKSocket.disconnect end end puts "Connecting..." p SKSocket.connect "google.com", 80 puts "Done." puts "adding listener..." p SKSocket.add_socket_listener { |e| socket_listener(e) } puts "Done." puts "Writing..." p SKSocket.write("HEAD / HTTP/1.1\n\n") # end code
thank you goes to Dr. YSG (ygut...@gmail.com)
-
@driven said:
or is there an easy way to have an introspective, local, platform aware list....
Of all the .rb/.rbs files in the Tools/Plugins file heirarchy ?
.. or the objects they create, ie: Classes / Modules / Methods, etc. ??
-
this is what my mac can find [in open SU], I went through manually, there's a few I don't recognise, and aren't on API Doc
what does #arity mean??
john
-
arity is the number of arguments a method accepts
def my_method(a, b) has arity of 2.
Introspection is possible. I built these charts using the same idea:
http://sketchuptips.blogspot.com/2008/08/sketchup-ruby-api-class-diagrams.htmlBut the introspection sometimes gives you bad information - look at the MaterialsObserver methods from your own list, and compare them to the names in the API docs. Maybe it's just exposing a buggy API. At any rate, the MatsObs is the only one I know for sure is returning bogus method names.
I believe that socket code snippet is mine. I used it to get Lego inventories from sites like peeron.com, and build a Component inventory. It is not officially supported and so there's no guarantee it will be around in the next version. But it's fun to play with.
-
@driven said:
what does #arity mean??
disappointingly - the number of arguments - but I don't know what the -1's mean on your list.
-
hi Jim,
thanks for the clear answer
the SLSocket doesn't show up at all on XP [on the same Mac] and I haven't gone through the methods on it yet,I really need to mod the script to generate the full list automatically, so I can compare with 3 other Macs with different versions of Ruby etc and with and without scripts,
I thought I recognised at least one of TIG's, but there's other at last ones that aren't on the API as well.
I take a look at your list in the morning...
john
-
An old post on SkSocket at over at GG.
http://groups.google.com/group/sketchupruby/browse_frm/thread/0b81977cc5d795ba# -
cheers Dan,
I found that earlier and followed the links to the test script I ran.
I posted the results because I don't how to interrupt the output, although it did show me a potentially 'protected' name, that's used in a script that just won't run on OSX on my Mac, but will on XP [same mac]
SKSocket doesn't show up under XP....
john
@ Jim, had a look at the charts, very nice
-
@driven said:
@ Jim, had a look at the charts, very nice
@ JIM .. dittos from me. I'd like some that we're left right hierachry, tho.
-
@chrisglasier said:
@driven said:
what does #arity mean??
disappointingly - the number of arguments - but I don't know what the -1's mean on your list.
"For methods written in C, returns -1 if the call takes a variable number of arguments."
http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_method.html#Method.arity -
@driven said:
SKSocket doesn't show up under XP....
Nor does:
class Sketchup::GeodesicI have module Precision, but not the 3 methods your list shows.
I cant find (mix-in) module Smoothable (is this a plugin?)
None of the DC classes or modules are on your list.
The following classes, don't have prototypes defined (BUT SHOULD!):
UI::InputPoint [*no-proto]
UI::Menu [*no-proto]
UI::PickHelper [*no-proto]
UI::Tool [*no-proto]Sketchup::FrameChangeObserver [*no-proto]
And then the standard extensions:
LanguageHandler ( should be moved to -> UI::LanguageHandler )
SketchupExtension (should be moved to -> Sketchup::Extension)P.S. - I accidently opened your list in ol' plain Notepad and it of course could not handle the EOLs.
But when I opened it in Notepad++ no problem, and the app automatically switched to UNIX EOLs for that 1 file tab. -
I write my plugins in ASCII - since Ruby 1.8 only deals with ASCII. Despite the data from SU comes in as UTF-8.
I tried with UTF-8 at one point and got errors... -
@dan rathbun said:
@driven said:
SKSocket doesn't show up under XP....
Nor does:
class Sketchup::Geodesic
only if you don't have Geodesic.rb instaled BEFORE loading suapi.rbI have module Precision, but not the 3 methods your list shows.
that one may be a Mac thing, I need to automate my process, you'll see why...I cant find (mix-in) module Smoothable (is this a plugin?)
[balso, only if you don't have Geodesic.rb instaled BEFORE loading suapi.rb[/b]]None of the DC classes or modules are on your list.
I don't have Pro installedThe following classes, don't have prototypes defined (BUT SHOULD!): why???
UI::InputPoint [*no-proto]
UI::Menu [*no-proto]
UI::PickHelper [*no-proto]
UI::Tool [*no-proto]
Not sure what you mean here, but it may come to me if they suddenly turn upSketchup::FrameChangeObserver [*no-proto]
Is this a Pro thing?And then the standard extensions:
LanguageHandler ( should be moved to -> UI::LanguageHandler )
SketchupExtension (should be moved to -> Sketchup::Extension)
possibly Mac thing, but are you see the pattern emerging?P.S. - I accidently opened your list in ol' plain Notepad and it of course could not handle the EOLs.
But when I opened it in Notepad++ no problem, and the app automatically switched to UNIX EOLs for that 1 file tab.
all the at last and google rubies are (UTF8),but sometimes other plugins arn'tBasically, it seems suapi.rb could be the basis for a de-bugger,
if it's loaded without any plugins you will get a snapshot of YOUR setup's usable content,
if you than add the atLast/Google 'advanced' rubies
if you than add 'PRO' you will get an 'advanced' 'PRO' snapshot of YOUR 'advanced PRO' setup.Then, if we all collate our reports, we would have a three stage baseline of what actually is installed on Mac's,PC,Linux,Chrome.....
and this could be used as the library in the editor for targeting ruby's to 'levels of set-up' or at least a 'Basic SetUp' requirement comment on a script...
I know there other factors, but we can test against installed version of Ruby as well as other
this would certainly help de-bugging, wouldn't it?
I've got a folder with a basic set of rubies I found make a difference, and a manual process to go with it, anyone want meto post it?
Not for the faint hearted, but shouldn't do any damage?
john
-
@dan rathbun said:
@driven said:
@ Jim, had a look at the charts, very nice
@ JIM .. dittos from me. I'd like some that we're left right hierachry, tho.
Thanks, I used Graphviz to make the image. It's easy enough to output a asci .dot file for Graphviz.
I think I have something similar in Freeplane.
-
@dan rathbun said:
Wht re-invent? Ruby has a debugger.Not, a all, I 'm meaning some sort of version control/monitor/indicator, so if I write what I think is a really simple beginners type ruby, with only SU6 on a Mac available for testing, my editor can highlight the fact I've used a Win32 only method that also needs MeshAdditions.rb + Geodesic.rb or wharever... before it will run on my machine
It's part of the stabdard library. It makes more since to get it working woth SU embedded Ruby.
%(#004000)[**I totally agree on that, problem is some Standard things appear not to work on All machines, Before we even get into properly evaluating things like GPU and CPU it would be good to know if something is Never going to work
It could also mean, that if I want to distribute a RadRails Ruby9 experimental plugin that I've concocted on my bespoke setup, I can forewarn others who might want to use it, or supply the extra bits as an instal package**]
-
@driven said:
@dan rathbun said:
Why re-invent? Ruby has a debugger.
Not, a all, I 'm meaning some sort of version control / monitor / indicator, so if I write what I think is a really simple beginners type ruby, with only SU6 on a Mac available for testing, my editor can highlight the fact I've used a Win32 only method that also needs MeshAdditions.rb + Geodesic.rb or wharever... before it will run on my machine.Oh OK, well then debugger is the wrong term for what you want. And we've discussed something similar before in other threads, Rick Wilson had an experimental approach that was implemented as embedded documentation, that would need to be parsed. I think they were 'leaning' toward a RDoc-like syntax.
Myself, and I think Jim Foltz prefer something that is 'live-Ruby.' Where a ruby script, (or a module distro'd with Sketchup,) tasked with Extension management, can actually ask the plugin / extension about itself.
Right now, if you have ever used the SketchupExtension class, you should realize that it creates a Ruby object (before an extension / script is actually loaded and only loads it if the user has 'checked the box' in the Extensions page of the Preferences dialog. The SketchupExtension class object contains (at present,) only a handful of attributes, but if you compare them to those within a GEM spec ... you should find the the GEM spec has an attribute for almost all those in the SketchupExtension object; plus quite a few more.
I would prefer either adopting the GEM spec format, or as close to it as possible; and revise the SketchupExtension class (rev 2?, which should really be Sketchup::Extension class,) to add extra attributes, stealing those from GEM spec that apply, and adding some specific Sketchup attributes (such as a platform attribute: 'PC','Mac' or 'Both') It should be possible to add attributes to the class, and still be backward compatible, ie, the current SU Extensions dialog will just ignore all the extra attributes.
Looking forward.. a future SU version could 'grey-out' the checkbox if the extension does not support the user's platform, or if the user's installation does not have modules or classes that are listed in the 'dependancies' attribute(s). This could work for 'conflicts', where the checkbox does not become active until conflicting extensions have been unchecked.
So, then.. an editor / IDE could also access this information. If Sketchup is loaded, the IDE could iterate and query the Extensions collection to determine what it needs to know. If SU is not loaded, the IDE could start it's own Ruby instance, and run a script that can build it's own SU Extensions collection.
Advertisement