SketchUp RUBY API Wishlist [way of coding wishes, please]

SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby ScottLininger » Wed Oct 22, 2008 7:53 pm

Hey guys,

My goal is to check these forums every day to see if I can be of help. I'm one of the "new guys" on the SketchUp team, having been with Google for about a year, now. In my day to day job I mostly work in the Ruby API, so I'm in the same boat as you in regards to its capabilities, and I'm an internal advocate for improvements.

Maybe a moderator could split this into a new topic? I'd love to hear everyone's wish list.

In any case, I will do some research into these posted bugs and confirm that they are in our internal tracking system.

Cheers,
0
Last edited by Jim on Sat Oct 25, 2008 10:45 am, edited 1 time in total.
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger 
 

Re: SketchUp RUBY Wishlist

Postby MarcioAB » Thu Oct 23, 2008 1:12 pm

Great! A "Ruby API Wish List Followed by SketchUp Team". This could be a sticker, right ?

The most up-to-date "Wish List" in the very first page and good discussions in the sub-sequent pages.

Regards
Marcio
0

MarcioAB 
 

Re: SketchUp RUBY Wishlist

Postby tomasz » Thu Oct 23, 2008 7:59 pm

Scott,
I 've got one, almost a Christmas wish : - can Ruby tell me if I should use UVHelper instead of uv_at when I want to get proper UVs for a face, PLEASE!

I other words - can Ruby tell me if the face's texture is photo-matched or not?
Please check this thread. Could it be an additional .materialType result .. say 3?

Tomasz
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY Wishlist

Postby Jim » Thu Oct 23, 2008 11:51 pm

Thanks for starting this topic, Scott!

Ok, I split this topic off from the earlier posts and made it sticky. Let the wishing continue...
0
Hi

Jim 
Global Moderator
 

Re: SketchUp RUBY Wishlist

Postby MarcioAB » Fri Oct 24, 2008 2:43 am

Fix onMButtonDown() api.
0

MarcioAB 
 

Re: SketchUp RUBY Wishlist

Postby CPhillips » Fri Oct 24, 2008 3:32 am

Here is one (of 1000):

The text and dimension tool are not accessible from Ruby. You can't read or set the text for example.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchUp RUBY Wishlist

Postby tomasz » Fri Oct 24, 2008 7:43 am

The Sections are hardly accessible from Ruby, only through Selection! You can't read or set it active.
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY Wishlist

Postby daiku » Fri Oct 24, 2008 6:13 pm

This is music to my ears, Scott. Here's another vote for ruby control of dimension objects. CB.
0
User avatar
daiku 
PluginStore Author
PluginStore Author
 

Re: SketchUp RUBY API Wishlist [way of coding wishes,please]

Postby toxicvoxel » Sat Oct 25, 2008 10:44 pm

Two requests:
Simple methods for retrieving points,angles and distances without using a tool class.(Something as simple as 'getpoint' and getangle in AutoCAD's api. Maybe something like pt=Sketchup.utility.getpoint(prompt) for example)
'Getangle' should offer the use of the protractor tool for input.

Then a request for the Sketchup COM api: Include a 'runRubyScript' method that can be called from the api and returns the return value from the script.
0

toxicvoxel 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Jackson » Sun Oct 26, 2008 5:00 pm

Welcome to SCF Scott, it's great to see your involvement here!
0
Last edited by Jackson on Tue Oct 28, 2008 7:31 am, edited 1 time in total.
Jackson

Jackson 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Matt666 » Sun Oct 26, 2008 5:37 pm

Hi all !
One great improvment would be to have some control on inferences via ruby... Isolate, stop, start, etc....
0
Frenglish at its best !
My scripts

Matt666 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby NewOne » Sun Oct 26, 2008 5:49 pm

Move (and rotate) axes from ruby !!! :sketchstatic: Actually, to be able to access any tool from ruby.

regards!
0

NewOne 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Matt666 » Sun Oct 26, 2008 7:19 pm

Hi all !
One ruby improvment :
- A command autolisp like function !! To have access to all native tools (like said NewOne), and to have possibility to control this tool !
Command autolisp function work like that :
To make a line :
Code: Select all
(command "_LINE" "0,0,0" "10,0,0" "")
(command " 'International Name of the tool' " " 'first point' " " 'any point you want' " "")

"" stops the command.
One very intersting thing is you can insert pause that let user doing what he wants !
Code: Select all
(command "_LINE" "0,0,0" PAUSE" "")

PAUSE stops process and let user giving a point, in this example.
Another cool thing is an Autocad variable that show if a command (or tool) is active. And you can use it in the code !
Code: Select all
(command "_LINE")(while (not (eq (getvar "cmdactive") 0)))(command PAUSE))

(getvar "cmdactive") returns 0 (no active tool) or 1 (one active tool)
0
Frenglish at its best !
My scripts

Matt666 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby tomasz » Mon Oct 27, 2008 4:32 pm

Selection display bug to be fixed, please.
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Jim » Tue Oct 28, 2008 12:01 am

Something I have been wanting to do is write a suite of general-purpose Observers based on the built-in ones. Most of the Observers are designed to be attached to a specific entity in a model (or to THE model) - the SelectionObserver, for example is attached to a model's selection collection. It just seems inefficient and error-prone for each plugin author who needs one to implement their own SelectionObserver when a single instance can handle all requests.

So, I guess I'm really proposing a simplified API for using Observers.

The way I see this API working is that a plugin would 'require' the observer file, which would create a single Observer instance. Then the plugin would 'register' methods in the form of blocks (or procs?). In my experiments, I used the Ruby Singleton class to ensure there is ever only one instance created.

Here is how I see the API being used (without getting into the details of the implementation):

Code: Select all
# My Plugin
require 'app_observer' # Global AppObserver instance created
def hello(args)
  puts "Hello #{args}"
end
# Register hello() to be called for an onNewModel event
id = AppObserver.instance.register("onNewModel") {|args| hello(args) }
# AppObserver attaches itself when its registry goes from 0 to >0 elements
...
AppObserver.instance.unregister(id) # stop calling hello for onNewModel event
# AppObserver detaches itself when its registry falls to 0 elements.


It really simplifies using Observers, which in turn could allow authors to create better plugins, with more advanced features, in a shorter time. It may also save on resources by having one and only one instance of most of the Observers (confirm?)


(related post)
0
Hi

Jim 
Global Moderator
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby david. » Tue Oct 28, 2008 12:23 am

Jim,

Nice idea. Also, I'm curious if you mixed in the Singleton module to implement your singletons? I've found that I can't require a library module like Singleton unless I point directly to my Ruby installation directories. I realize that this isn't required to implement singletons, but it seems the most simple and consistent.
0

david. 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby ScottLininger » Tue Oct 28, 2008 4:41 pm

Jim wrote:Something I have been wanting to do is write a suite of general-purpose Observers based on the built-in ones.


This is a fantastic idea. Attaching observers reliably to every component instance, for example, is challenging. So a helper script is one approach... another would be to create some uber-observers at the Sketchup level. Obviously, there are potential performance concerns with any of these.
0
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby JClements » Wed Oct 29, 2008 11:48 am

A standard for displaying script documentation, besides their description, in the menus:

The ruby filename, creator, version level; basically an "about" display for each script. Optional info could be copyright info, contact (email) link, website link, and display of a help file on a local drive.

=============================================

An easier way to organize scripts in a user defined menu (there are scripts that do this now, but I wouldn't call them user friendly)
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby tomasz » Wed Oct 29, 2008 6:30 pm

New method for a texture, very useful for exporters.
texture.alpha_channel? -> (true or false)
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Whaat » Wed Oct 29, 2008 7:19 pm

Tomasz wrote:New method for a texture, very useful for exporters.
texture.alpha_channel? -> (true or false)

Ooohhh..that reminds me:

How about a method that samples the texture color on a face?

face.color_at(u,v)->returns a SketchUp::Color object.

Could be used for displacement mapping inside SketchUp for example.
0

Whaat 
PluginStore Author
PluginStore Author
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Jim » Wed Oct 29, 2008 9:19 pm

david. wrote:Jim,

Nice idea. Also, I'm curious if you mixed in the Singleton module to implement your singletons? I've found that I can't require a library module like Singleton unless I point directly to my Ruby installation directories. I realize that this isn't required to implement singletons, but it seems the most simple and consistent.


Hi David,

Yes, I used the singleton class from Ruby. I copied singleton.rb from the Ruby language installation to a 'ruby' folder in my Sketchup/Plugins folder. The Ruby singleton is very easy to use, and was simply the best and fastest solution. I think there are a few other files from the installed Ruby files that I needed also.
0
Hi

Jim 
Global Moderator
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby morisdov » Thu Oct 30, 2008 4:44 pm

Hello

Inside SketchUp it works fine but when creating an AVI file with Export -> Animation
the - Sketchup::Pages.add_frame_change_observer - is not firing between frames.

Is there anything i should change or another observer i can use between frames in Export Animation ?

viewtopic.php?f=180&t=10926

Thanks
0

morisdov 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Jim » Sun Nov 02, 2008 2:19 pm

One of the more important things that could be done using the Ruby API, and which would benefit nearly all users is a unified API for menus and toolbars. I don't mean being able to lock toolbars; I mean the possibility to provide menu and toolbar customization using a "Menu & Toolbar Editor" within SketchUp.

The need is apparent in CadFather's Toolbar plugins; where he creates a collection of scripts and adds toolbar buttons for them. Although these are nice toolbars, they are going to prove difficult to maintain as scripts are updated and obsoleted.

Really, there would need to be some registry that would:

* "install" a plugin so that is is not located in the Plugins folder, and so not automatically loaded.
* allow un-modified plugins to continue to function.
* allow new/modified plugins to create new, or be added to, existing menus, submenus, and toolbars.
* handle the creation of menus and toolbars at startup.

The possibilities are fantastic, if you let your mind run wild:

* allow menu/toolbars "sets" to be created.
* allow plugins to be downloaded as-needed, or used online. (zero install: net_require "progrsssbar.rb")
* check new versions of plugins online, and upgrade.

Of course, I do not mean to remove the ability for developers to create their own menu or toolbars. But even if it's just for the numerous scripts that are single-menu, or single-button plugins, this would be an improvement.

(related post)
0
Hi

Jim 
Global Moderator
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby Matt666 » Mon Nov 03, 2008 3:38 pm

Hi guys !
I wish one day, we would have access to print parameters via ruby... One day... :D
0
Frenglish at its best !
My scripts

Matt666 
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby tomasz » Wed Nov 12, 2008 11:15 pm

An important wish for ALL exporters, I believe:
- a method to read a cropped region in 2point perspective view.
As far as I am aware, currently there is no way to read it!

Please!
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby tomasz » Thu Nov 13, 2008 9:07 pm

A Ruby method that will give us a real UVW coordinates of a projected texture, so exporters could use a single, original texture, instead of say 200 small textures of a photo mapped terrain.
0

tomasz 
SU2TH & SU2KT Developer
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby chrisglasier » Sun Nov 23, 2008 4:30 am

A switch (if it does not exist) to activate a ruby on selection of an entity or entities to allow interaction with a webdialog.

See:
viewtopic.php?f=180&t=14299

Thanks

Chris
0
With JSON machines we can analyse what is to be achieved so that IT can help with automation to achieve it.
User avatar
chrisglasier 
PluginStore Author
PluginStore Author
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby TIG » Sun Nov 23, 2008 9:00 pm

chrisglasier wrote:A switch (if it does not exist) to activate a ruby on selection of an entity or entities to allow interaction with a webdialog.

See:
viewtopic.php?f=180&t=14299

Thanks

Chris

Search v7..............
0
TIG
User avatar
TIG 
Global Moderator
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby notareal » Wed Nov 26, 2008 1:55 pm

Tomasz wrote:A Ruby method that will give us a real UVW coordinates of a projected texture, so exporters could use a single, original texture, instead of say 200 small textures of a photo mapped terrain.


:thumb: Agree!
0
Welcome to try Thea Render, Thea support | kerkythea.net -team member

notareal 
Thea Render Support
Thea Render Support
 

Re: SketchUp RUBY API Wishlist [way of coding wishes, please]

Postby confitex architure » Mon Dec 01, 2008 2:34 pm

Hi ScottLininger.
Not realy a ruby way of coding, but almost...
I mentionned it in an another post: It would be so nice to retrieve a variable from a model into a dynamic component's attribute instead of the opposit (right now, if I understand well, it is only possible to "export" and to make a code to fill the DC's attribute).

By the way, I would be very glad if we could learn from your famous animated "sprite" code :-)

Thanks!!!
0

confitex architure 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Developers' Forum

Who is online

Users browsing this forum: P53ud0 and 5 guests

Visit our sponsors: