SketchUcation Premium Membership

 

 

New API doc - typos and questions

Re: New API doc - typos and questions

Postby Chris Fullmer » Wed Mar 04, 2009 8:12 am

http://code.google.com/apis/sketchup/do ... 3d.html#z=

It says:

Code: Select all
Point3d.z=

    The y= method is used to set the z value of a 3D point.


That second line should say "The z= method..."
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6687
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Thu Mar 05, 2009 1:10 pm

http://code.google.com/intl/nb/apis/ske ... .html#area

Face.area actually takes an optional argument. I'm not sure what the argument is. It accepts pure numbers which then seems to be a scale factor. But it also accepts Transformation objects.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Thu Mar 05, 2009 1:16 pm

Same applies to Edge.length
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Sun Mar 15, 2009 1:11 pm

Point3d.project_to_plane
The example uses project_to_line

Code: Select all
 plane = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
 point = Geom::Point3d.new 10,10,10
 projected_point = point.project_to_line line
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby Chris Fullmer » Tue Mar 17, 2009 3:04 am

Tool - onMouseMove example has a bad local variable.
http://code.google.com/apis/sketchup/do ... nMouseMove
Code: Select all
 def onMouseMove(flags, x, y, view)
   puts "onMouseMove: flags = " + key.to_s
   puts "                 x = " + x.to_s
   puts "                 y = " + y.to_s
   puts "              view = " + view.to_s
 end


The variable "key" should be replaced with "flag" I think. That makes the example work.

Chris
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6687
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Tue Mar 17, 2009 9:25 pm

http://code.google.com/apis/sketchup/do ... t_UVHelper

The code example:
Code: Select all
 model = Sketchup.active_model
 entities = model.active_entities
 pts = []
 pts[0] = [0, 0, 0]
 pts[1] = [9, 0, 0]
 pts[2] = [9, 9, 0]
 pts[3] = [0, 9, 0]

 # Add the face to the entities in the model
 face = entities.add_face pts
 tw = Sketchup::TextureWriter.new
 uvHelp = face.get_UVHelper true, true, tw


This will return the error:
Error: #<TypeError: (eval):95:in `get_UVHelper': wrong argument type (expected Sketchup::TextureWriter)>
(eval):95


Instead of tw = Sketchup::TextureWriter.new, the method tw = Sketchup.create_texture_writer will work.
Which leads to another questions: why can't tw = Sketchup::TextureWriter.new be used as in the example?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Tue Mar 17, 2009 11:19 pm

ModelObserver.onPlaceComponent
http://code.google.com/apis/sketchup/do ... eComponent

The manual claims that a Model is passed on as the argument, but instead it's the ComponentInstance. I have not tested the rest of the ModelObserver events to see if they also match.

onPlaceComponent FIXED
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby ScottLininger » Wed Mar 18, 2009 7:17 am

thomthom wrote:ModelObserver.onPlaceComponent
http://code.google.com/apis/sketchup/do ... eComponent

The manual claims that a Model is passed on as the argument, but instead it's the ComponentInstance. I have not tested the rest of the ModelObserver events to see if they also match.


Thomas, you rock.

I'll double check all of the modelobserver arguments. Thanks!
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby remus » Wed Mar 18, 2009 9:31 pm

For Point3d.distance_to_line the docs give the same example as point3d.distance.
remus
 
Posts: 8055
Joined: Fri Nov 30, 2007 8:48 am
Location: UK
Name: remus

Re: New API doc - typos and questions

Postby thomthom » Wed Mar 18, 2009 9:39 pm

I can't get the DefinitionObserver to trigger at all. http://code.google.com/apis/sketchup/do ... erver.html Neither the onComponentInstanceAdded or onComponentInstanceRemoved events. Are these the correct event names?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby ScottLininger » Tue Mar 24, 2009 9:16 pm

I just had a big one reported to me... posting it here so folks are aware until the next fix.

The face.material method is entirely missing from the new docs.
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby ScottLininger » Tue Mar 31, 2009 6:38 pm

There's a new update live that fixes (most of) the problems reported above. There were one or two that will require me to pound on it a bit more. Keep 'em coming!

I also posted a new tutorial on reading attributes.
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby thomthom » Tue Mar 31, 2009 6:45 pm

Nice one Scott.

I seem to have come across three observer events that doesn't work. It would probably be useful to mark these in the docs with a warning so that people won't waste a whole lot of time trying to get them work work. ..like I have...

DefinitionObserver viewtopic.php?f=180&t=17631 (Completely busted)
EntitiesObserver.onContentsModified viewtopic.php?f=180&t=17970 (Add and Remove event works though. Haven't tried the Erase event.)
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby ScottLininger » Tue Mar 31, 2009 6:58 pm

I also just got this one from a coworker:

Sketchup.get_resource_path example fails. Looks like there's a required parameter that's not properly documented.

-Scott
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby thomthom » Tue Mar 31, 2009 7:06 pm

These failing observers is quite severe. I don't suppose there's a chance the dev team can push out an update outside the servicepack schedule? (I don't know what your schedule is, but seeing that we just got an servicepack I'm a bit pessimistic to when this might be addressed...)
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby remus » Tue Mar 31, 2009 7:56 pm

A semi related typo:

in this tutorial pt4=[0,9,9] whereas it should be [0,9,0].
remus
 
Posts: 8055
Joined: Fri Nov 30, 2007 8:48 am
Location: UK
Name: remus

Re: New API doc - typos and questions

Postby Chris Fullmer » Tue Mar 31, 2009 8:03 pm

::OFF TOPIC::
All right Remus, come clean. Your always in the Ruby forum, you spotted a typo in tutorial, you answer questions once in a while....how much ruby do you know? Are you making plugins and selling them overseas for big money or something?

Chris
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6687
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby ScottLininger » Tue Mar 31, 2009 8:06 pm

Just saw another one: the Sketchup.break_edges= example is the Sketchup.break_edges? example.

Thom, step 1 with the observers is to confirm if it's the implementation that is broken or the documentation. Simone has filed A-list bugs against the observer problems you've found, and he and I have been chatting about it. Any fixes will have to wait until the next maintenance release.

Feel free to PM me if you want to brainstorm workarounds for what you're trying to accomplish. I know a few tricks. ;)
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby remus » Tue Mar 31, 2009 8:09 pm

Dont pretend your not in on it as well :D

on a more serious note, it seems a shame to miss out on the ever so powerful ruby based capabilities of sketchup, so i thought i'd try my hand at it and see if i got anywhere.

I reckon i could just about right a box making script at the moment :thumb: just as long as you dont want to change your box at all...
remus
 
Posts: 8055
Joined: Fri Nov 30, 2007 8:48 am
Location: UK
Name: remus

Re: New API doc - typos and questions

Postby thomthom » Tue Mar 31, 2009 8:44 pm

Seems that InstanceObserver.onClose is dead as well. http://code.google.com/apis/sketchup/do ... ml#onClose
But onOpen works.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Wed Apr 01, 2009 1:42 pm

http://code.google.com/intl/nb/apis/ske ... ctive_path

For example, if a user has double-clicked into a component to edit its geometry, and then double clicked into a sub-group to edit that, the active_path might contain:

And there it stops. Doesn't actually display an example.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby ScottLininger » Wed Apr 01, 2009 4:00 pm

Self note: We should add these codes to the send_action docs:

http://groups.google.com/group/Ruby-API ... f2b21cb228
- Scott Lininger
SketchUp Software Engineer
Have you visited the Ruby API Docs?
User avatar
ScottLininger
SketchUp Team
 
Posts: 169
Joined: Tue Oct 21, 2008 11:17 pm
Location: Boulder, CO

Re: New API doc - typos and questions

Postby TIG » Wed Apr 01, 2009 5:01 pm

ScottLininger wrote:Self note: We should add these codes to the send_action docs:

http://groups.google.com/group/Ruby-API ... f2b21cb228


Does this list work 'across-platforms' - my understanding was that PCs and Macs differ ?

If there are such codes it makes like a lot easier...

Some "wrong": Sketchup.send_action 21513 >>> opens the Outliner ???
.
Last edited by TIG on Thu Apr 02, 2009 9:23 am, edited 1 time in total.
TIG
User avatar
TIG
Global Moderator
 
Posts: 13975
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Wed Apr 01, 2009 6:37 pm

http://code.google.com/apis/sketchup/do ... erver.html

Code: Select all
     # This is an example of an observer that watches tool interactions.
     class MyToolsObserver < Sketchup::ShadowInfoObserver
       def onActiveToolChanged(tools, tool_name, tool_id)
         UI.messagebox("onActiveToolChanged: " + tool_name.to_s)
       end
     end

     # Attach the observer.
     Sketchup.active_model.tools.add_observer(MyToolsObserver.new)

Note that it refers to Sketchup::ShadowInfoObserver instead of Sketchup::ToolsObserver.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Fri Apr 03, 2009 10:19 am

http://code.google.com/intl/nb/apis/ske ... l#dynamic=

The manual says the argument should be either true or false, but the example sets it to 3.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby Chris Fullmer » Fri Apr 03, 2009 7:50 pm

The FAQ page lists some sites that carry/catalog ruby scripts. the Sketchucation extensions index (thanks to Jim!) would also be a great resource to add to that list now

extensions url:

http://www.sketchucation.com/extensions-index/

Chris
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6687
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby thomthom » Sat Apr 04, 2009 7:15 pm

http://code.google.com/apis/sketchup/do ... erver.html
It'd be nice if the ToolsObserver listed the full list of tools IDs.

I've begun a list here which associates constants to the IDs for convenient use in scripts: viewtopic.php?f=180&t=18124
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby Jim » Sat Apr 04, 2009 7:55 pm

thomthom wrote:http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html
It'd be nice if the ToolsObserver listed the full list of tools IDs.

I've begun a list here which associates constants to the IDs for convenient use in scripts: viewtopic.php?f=180&t=18124


In the back of my mind I have the idea the the tool id's were not reliable and shouldn't be used; but I can't remember why.
Jim
Global Moderator
 
Posts: 4126
Joined: Mon Nov 12, 2007 10:13 pm
Location: NEOH
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: other
Level of SketchUp: Intermediate

Re: New API doc - typos and questions

Postby thomthom » Sat Apr 04, 2009 8:36 pm

Jim wrote:
thomthom wrote:http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html
It'd be nice if the ToolsObserver listed the full list of tools IDs.

I've begun a list here which associates constants to the IDs for convenient use in scripts: viewtopic.php?f=180&t=18124


In the back of my mind I have the idea the the tool id's were not reliable and shouldn't be used; but I can't remember why.

I thought is was the tool names as on Mac the first four characters where truncated? No?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: New API doc - typos and questions

Postby Chris Fullmer » Fri Apr 10, 2009 1:16 am

http://code.google.com/apis/sketchup/do ... definition

The ComponentInstance.definition example does not include the method in the example anywhere, so by definition it is not really an example.

This is the given example:

Code: Select all
 point = Geom::Point3d.new 10,20,30
 transform = Geom::Transformation.new point
 model = Sketchup.active_model
 entities = model.active_entities
 path=Sketchup.find_support_file "Bed.skp",
   "Components/Components Sampler/"
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6687
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Need SketchUp Books, Models, Styles or Textures? Check out our One Stop Shop for SketchUp.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012

PreviousNext

Return to Developers' Forum

Who is online

Users browsing this forum: a3rosmith, AchilleIT, opsketchsa, TheNewHobbyist and 8 guests