SketchUp Ruby API Extension LibraryModerator: Jim
69 posts
• Page 1 of 3 • 1, 2, 3
SketchUp Ruby API Extension LibraryI have started a code repository to organize all of the code and snippets around the forums, and on my hard disk.
My hope is that it can be organized and packaged into a versioned library - making it easy to install and upgrade; not to mention creating a well-documented 'standard' library of extension methods for SketchUp developers. My other hope is that the many folks in this community will want to "share the blame." Seriously, a library which provides some basic (and not so basic) methods could go a long way in advancing SketchUp even further. So to facilitate these goals, I have created a mercurial repository on Google Code: skx - A Community-Maintained Ruby Language Extension Library for Google SketchUp If you have an interest in being a project member, please reply or shoot me a message.
Re: SketchUp Ruby API Extension LibraryHi Jim, I'm very interested in this project. Of course you do realize that now this means I a going to have to re-configure my /plugins/ Hg repo too accomodate multiple projects
I think this kind of project sounds great, and I've got a few snippets of code that I'd like to contribute to it. I am finally done with school as of about 3 hours ago, so I'll see if I can get some of my code together and cleaned up and ready to post. Thanks for organizing it. Chris
Re: SketchUp Ruby API Extension LibraryJim, I was wondering if it is possible to have a library like this check the internet to see if an update is available everytime it turns on (if there's an internet connection). Just to keep it updated. Maybe even the server can push the new version onto the user's machine.
Chris
Re: SketchUp Ruby API Extension LibraryThis is something different from the plugins business, right?
Chris
Re: SketchUp Ruby API Extension Library
Excellent, thanks Chris! Now I an going to explain how to set it up so you do not have to re-configure (much.) Create (if there is not already) a file named .hgignore in your Plugins repository. In it, add the following simple lines:
hg will now ignore everything in the skx directory as long as you don't tell hg to add it. Since skx is designed to be in Plugins/skx, you can clone it into the Plugins folder. So you have a repository in your repository, but so what. Just don't add skx to citygen.
Re: SketchUp Ruby API Extension Library
Chris, I'm not sure what you mean by the plugins business, but I think you mean CityGen because we talk more about the source code management software and where to locate its repository than we talk about CityGen. This project is the start of a general-purpose library of Ruby methods for extending SketchUp's Ruby API. I'd like to have you on-board, if possible. Specifically, I'd like to see some WebDialog/Ruby/Javascript interface libraries so the average person can create decent dialogs without needing memorize 4 or 5 O'Reilly books.
Re: SketchUp Ruby API Extension Library
I was thinking of the SCF extensions index really.
Not really, but later, namesets might become useful not only for linking and crosslinking the code but also the models (both are object-oriented).
Yes I would be happy to help where I can, but I get a bit lost with the codespeak - I am sure you remember I'm only an old builder. Tip me the wink if something specific comes up though. Chris
Re: SketchUp Ruby API Extension Library
Ok, great! I've added you to the project page.
I think so. I don't know about push, but a "check for updates" is an option. The built-in socket calls are very limited in Sketchup, so I am not sure if it is the best to use. But I also don't know if anyone has written networking code that could go fetch the files and that works in Sketchup. I added you to the project also.
Re: SketchUp Ruby API Extension Library
This is possible if we use a webdialog to fetch the updates with an AJAX call. There could be an XML file with plugin name, info, date time, and download location (etc etc). The Javascript would then make an HTTP request for that XML file check it with the local installation. If there's an update it request the updates. (Not sure if you can svae files to disk via JS - but maybe it can forward the file content to the ruby end and have ruby store it. ..hmm... just came to think of something - I think webdialogs transfer data via the webdialog's url... that might cause problems with transferring files. might have to make ruby download the files after all. This is something I'd been hoping to look into - as I'd love to have a plugin updater. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension Library
This is something I have to do as well. what I'm curious about is: "hg" is a name Chris made for the CG repository? (I thought it was come odd naming convention by the repository software.) Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryI think hg is used for all mercurial folders (trivia: hg is the atomic symbol for mercury, thus mercurial.)
Re: SketchUp Ruby API Extension Libraryhg is the mercurial command-line executable - I tried TurtleHG, but found it slow so I installed the command-line version.
Also, this .hgignore file will tell hg to ignore everything by default unless explicitly added.
Re: SketchUp Ruby API Extension Library
How would I clone the skx repository?
I'm confused by this. Doesn't skx use hg? Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension Library
ignoring files by pattern does not mean you can not still add individual files to the repository. It only means they will not be acted on by default. So I can have 1,000 files in the working directory, but unless I explicitly add them to the repository (hg add filename), they are ignored by hg. This is good because if I type 'hg add' with no filenames, EVEYTHING in my Plugins folder would get added to the repo on next commit. I can of course revert that before pushing, but why worry about it when I can ignore them? So yes, skx does use hg. It is a hg repository. It is located in my Plugins folder, which happens to also be a hg repository. But Plugins is set to ignore (not act on) everything unless explicitly added. So unless I accidentally type 'hg add skx' while working in Plugins, I don't need to worry about adding anything unwanted to the Plugins repo. My Plugins repository is not a clone of citygen, by the way.
Re: SketchUp Ruby API Extension LibraryEarlier today I saw lots of files when I used the Coogle Code browser of the repository. From the Updates page I only see a readme file being added since then, but I can now only see the readme file. All other files are gone. What happened? Did you remove the files?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryIts possible to reset a repository on googlecode so it removes all files and repo history. But you can still the big history here:
http://code.google.com/p/skx/updates/list
Re: SketchUp Ruby API Extension Library
Yeah, I reset it. Sorry.
Re: SketchUp Ruby API Extension LibraryOk.
Are you interested in having some code snippets uploaded? Or should we wait? What would the procedure be? Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryFire away!
I have 2 organization schemes in mind, but it's hard to tell which way to go without seeing what is available. First would be a file-based organization where loosely related methods are stored in a single file.
The other is a folder-based:
The file-based solution has fewer overall files. The folder solution has the advantage of users being able to require exactly the methods they want, and none they don't. As for the scripts, the file-based scheme would look like:
Where the folder-scheme would be slightly more typing to get what you want..
If I need to decide today, I would go with folders. Each method (or very closely related methods) go in a small file in a folder. Then, you can still create a file that can require the entire folder if you so desire. I just pushed up a small file with 4 basic Sketchup::Selection methods.
Re: SketchUp Ruby API Extension LibraryI reset the repo because I wanted to make a good-faith attempt at getting permission before adding other peoples work to the code base.
Re: SketchUp Ruby API Extension LibraryI added a couple of snippets that was ready to upload. I'll upload more once I dig through my random collection.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryJim I was wondering how broad in scope is this library supposed to be? I have a method for creating bezier splines. It either actually draws it or just returns an array of its points.
So is that something worth putting into this library? And if so, does it need its own new folder/file? Chris
Re: SketchUp Ruby API Extension LibraryI could have sworn I replied to this already...
I think a broad scope is fine as long as things are documented well. Documentation si going to be a big job. As more methods get added, relationships and patterns will emerge that will lead to an organization scheme. For now, I am fine with a catch-all 'misc' folder for files that don't have an obvious place.
This sounds like it should be split into a backend bezier math library, and a separate drawing method. Each sound useful on their own, so maybe they could each be made into something more general.
Re: SketchUp Ruby API Extension Library
Is the intention to extend existing Sketchup classes with methods? Or add other classes/modules? I've never really extended the SU classes as I've never been sure if they'd interfere with other. Instead I made separate modules - even though it'd be more convenient to extend existing. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryI'm wondering if maybe some methods that simplifies common Transformation actions would be useful?
Personally Transformations is something that I've had to twist my head a bit to understand. Some helper methods might make it easier for people new to this. As well as working as examples of how they work - provided they are nicely commented. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension Library
I actually added a Group.moveto(Point3d) method this morning. It's a common thing to want to do with a Group. But does it work with other transformations? I'm not sure. Group.rotate(angle, X_AXIS) - not bad, but if you want to use the Group's axes, then you still need to write Group.rotate(angle, Group.transformation.xaxis) which I guess is a little better than tr = group.transformation Group.transform!(Geom::Transformation.rotation(tr.origin, tr.xaxis, angle) But is the first examples so much better that is needs to extend the Group class. I'm not so sure.
Yes it is. For the most part, people have (rightly) avoided extending SketchUp's classes. But this library is the right place to do it.
Re: SketchUp Ruby API Extension Library
Ok. I suppose that the methods are reviewed for potential conflicts? I added a Group.real_parent that work around an SU bug where Group.entities.parent doesn't return the definition. I didn't name it .definition as I've seen some code out there that works with SU4+. Maybe my method should be merged with that method? Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension LibraryAnyone talked to any SU devs about this?
Maybe they have a reserved list of methods. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: SketchUp Ruby API Extension Library
I sent a message to Scott asking him to review and comment, if possible.
Re: SketchUp Ruby API Extension LibraryDo I understand correctly that Model.start_operation calls can not be nested? If calls do become nested, is there a performance penalty, or stability issues?
I'm am thinking about adding in some protection to start_operation to prevent nesting - raise an exception or something. What do you think?
SketchUcation One-Liner AdvertsVertex Tools for SketchUp. Take control over each vertex with this vertex editor for SketchUp.
Premium Members get 20% discount!
69 posts
• Page 1 of 3 • 1, 2, 3
|