Thursday, November 13, 2008

What's New in SketchUp 7



SketchUp 7 contains several improvements to the Ruby API. Here's a quick tour of the best changes.
  • Improve your script's performance!
    Ability to perform faster inside start_operation transactions.
    go_faster = true
    model.start_operation operation_name, go_faster

    Results from some real world tests, once the go_faster boolean was added:

    Intersect overlaps with 500 overlapping squares
    28.4 seconds vs. 26.3 (~92% as long)

    Make faces with 500 faceless cubes
    21.7 seconds vs. 14.5 (~66% as long)

    Windowizer 3.0
    with Four 20'x20' windows, 12x12
    16.1 seconds vs. 7.0 seconds (~43% as as long)

    Windowizer 4.0 with Ten 5'x5' windows, 6x6
    22.6 seconds vs 8.7 seconds (~38% as long)

  • Leverage improved Web Dialogs
    Addition of min/max widths.
    WebDialog.min_width=100
    WebDialog.max_width=300

    WebDialog.min_height=500
    WebDialog.max_height=600


    Fixed Mac support for WebDialogs execute_script
    WebDialog.execute_script('alert("Bug is Fixed!")');

    New full_security mode for webdialogs (disables plugins and remote links)
    WebDialog.set_full_security

    Ability to hide home/next/back navigation icons on the Mac
    WebDialog.navigation_buttons_enabled=true

    Cleaner, hash-based syntax for initializing
    my_dialog = WebDialog.new(my_settings_hash)

  • Control Scale Tool handles on your components
    Your script can now control which scale tool handles appear
    # Disable the green and red-axes handles
    # by setting bits 1 and 2 to 1.
    behavior = my_component_definition.behavior
    behavior.no_scale_mask = (1
    << 1) + (1 << 2)

  • Load Definitions from the Web, or save to disk
    Ability to download a definition from URL
    model.definitions.load_from_url(url, download_handler
    )

    Ability to Save components to disk from the API
    my_definition.save_as(path)

  • Know more about what your users are doing
    New methods for detecting "Component Edit" mode
    users_current_edit = model.active_path
    edit_mode_transform = model.edit_transform

    Easily determine if they're running in licensed Pro
    is_licensed_pro = Sketchup.is_pro?

    New "model level" callbacks in ModelObserver
    def onActivePathChanged(model) { # Detect edit mode }
    def onPlaceComponent(instance) { # Detect placements }
    def onExplode(model) { # Detect group/component explode }
    def onBeforeComponentSaveAs(instance) { # Add data on save as }
    def onAfterComponentSaveAs(instance) { # Then clean up }

    Detect if they've turned off your extension via the AppObserver
    def onUnloadExtension(extension_name)

  • Delete your scenes via the API
    my_page.erase

  • Keep SketchUp in Synch
    UI.refresh_inspectors # force complete UI update
    my_definition.refresh_thumbnail # force thumb update
    my_definition.invalidate_bounds # force bb update

  • Measure your groups regardless of their transform
    untransformed_bb = my_group.local_bounds

  • Use middle mouse button in your custom tools
    def onMButtonDown(flags, x, y, view) { # now works! }
    def onMButtonUp(flags, x, y, view) { # now works! }

  • Send ruby console output to the standard out
    If you start up SketchUp from the command line, you can pipe to standard error and see ruby puts statements appear for you.
    Sketchup.exe > myRubyLog.txt

  • and your users will benefit from numerous stability fixes!

    Detailed documentation is coming soon... stay tuned!

10 comments:

David said...

Does version 7 add any capability to call web services without having to resort to using external scripts? The WebDialog goes half way, but without the ability to programmatically read and act on the response from a server the ability to have a meaningful, two-way web service conversation is all but impossible.

Anonymous said...

will be it be possible to add attribute data to a dynamic component through the ruby api?

And if so will it be possible to do this without Sketchup pro?

Anonymous said...

I was wondering how you were going to stop the DC add-ons being distributed around the web. That license call explains it!

Scott Lininger said...

Hey David,

SU7 does not inherently ship with the ability to call web services. As you say, one could use the WebDialog to do so via AJAX. Alternatively, one could ship a plugin with the extra Ruby modules to make requests directly, but these don't come with SketchUp.

Scott Lininger said...

thrrd,

It is possible to attach DC attributes using the API. You can learn a bit more from a recent groups thread: http://groups.google.com/group/sketchupruby/browse_frm/thread/eb7d2e7ab9038492/af73a7ee457b82df

Anonymous said...

"Detailed documentation is coming soon... stay tuned!"

Soon, when?

Thanks :)

Unknown said...

Yes, please: I can't find any sign of the new API methods in the API docs (which still states "SU 6"). Is there any documentation for the SU 7 API? eg. behavior.no_scale_mask

Mike

Scott Lininger said...

Hey Mike,

The updated docs are coming. We're almost done with them and are in the process of editing and review. Stay tuned.

Anonymous said...

Well... it takes a long time for that documentation to be reviewed and edited... Let's hope it worth :)
And let's hope Sketchup 8 will not appear sooner than sketchup 7 documentation :))
A good day to everyone!

August said...

Iulius said...

"Well... it takes a long time for that documentation to be reviewed and edited..."

I agree. And that's my specialty, doing API documentation.

However, I've been in touch with the Google API folks and it seems that Google did not assign/hire any writers so it's up to the engineers, who of course could not start the doc until the product was released, they could not do two jobs at once.

Hey, if it keeps these hardworking engineers busy between releases, that's a good thing.

I'm sure that they are doing their best and I, for one, would rather they not have to issue a correction update right away.

However, it did not have to be this way. (It does now, it's too close to done for any methodology change to make a difference at this point.)

In my expert opinion (and in all modesty, I am) Google is still doing their API doc with 20th Century methods. The proof is that it's this late.

If their doc process was as 21st Century as SketchUp itself is, the doc could have been done in parallel and reviewed along with the code and it could have been released at nearly the same time as the API itself, without impacting the engineering schedule (except perhaps to improve it) and without adding staff. (Maybe I can convince them to modernize before v8.)

Just my opinion,
August