New API doc - typos and questions

Re: New API doc - typos and questions

Postby thomthom » Tue Dec 22, 2009 9:29 am

Edge.reversed_in?
http://code.google.com/intl/nb/apis/ske ... eversed_in?

Why is the example using a begin rescue structure? Does it on occasion cause errors?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

class Sketchup::HLR undocumented

Postby Dan Rathbun » Mon Dec 28, 2009 8:51 pm

The class Sketchup::HLR is undocumented in the API.

It's an Entity subclass.
It inherits all the Entity baseclass methods, and adds 2 of it's own:
  • .calculate
  • .num_faces

If you create a HLR object at the console, and call .parent (when it has no parent) a BUG SPLAT! results. See post: http://forums.sketchucation.com/viewtopic.php?f=11&t=24740#p212101

What is this class HLR used for? (.. as there is no .add_HLR method for the Entities collection object.)
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: New API doc - typos and questions

    Postby thomthom » Wed Dec 30, 2009 6:56 pm

    Tool.getExtents
    http://code.google.com/apis/sketchup/do ... getExtents

    The example given isn't a good one. From my observations, clipping occurs only when you draw outside the model boundary. So returning model.bounds is pointless.
    0
    Thomas Thomassen — SketchUp Monkey & Coding addict
    List of my plugins and link to the CookieWare fund
    User avatar
    thomthom 
    PluginStore Author
    PluginStore Author
     

    Sketchup.send_action to toggle StatusBar

    Postby Dan Rathbun » Thu Dec 31, 2009 6:01 am

    Sketchup.send_action
    http://code.google.com/apis/sketchup/docs/ourdoc/sketchup.html#send_action

    You can toggle the StatusBar on/off in Ruby (PC only?) via:
    Sketchup.send_action(59393)

    The following have no effect on my PC in SU ver 7.1.x:
    Sketchup.send_action(21019) hide Status bar and VCB
    Sketchup.send_action(21020) show Status bar and VCB
    Sketchup.send_action(21022) hide Status bar and VCB?
    ..whereas the above id 59393 does work for just the StatusBar.

    [ NOTE: I've moved my VCB up to the 2nd line of the Top Toolbar Container in 2nd position after the Layers toolbar, so I'd not want the VCB turned off with the StatusBar anyhow. I see them as two different things. ]
    0
      I'm not here much anymore. But a PM will fire email notifications.
      User avatar
      Dan Rathbun 
      PluginStore Author
      PluginStore Author
       

      UI.toolbar_names

      Postby Dan Rathbun » Thu Dec 31, 2009 7:41 am

      UI.toolbar_names
      http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#toolbar_names
      Sketchup Ruby API wrote:The toolbar_names method is used to returns the name of all the available toolbars (this differs between PC and Mac).

      (1) In the above sentence "returns" should be singular.

      (2) I believe punctuation marks are supposed to go at the end of the words, ie: "Mac.)" not "Mac)." ...Language majors, confirm?

      (3) It would nice if we are to do cross-platform scripts, that you list the names for PC and Mac in the API.

      (4) UI.toolbar_names.sort on the PC, ver 7.1 returns:

      ["Camera", "Construction", "DisplayMode", "Drawing", "Edit", "GettingStarted", "Google", "Principle", "Section", "Standard", "StandardViews", "VCB", "Walk"]
      .
      On the [Win32] Sketchup Menu: View > Toolbars (and toolbar captions):
      • Principle is Principal
      • Edit is Modification
      • VCB is Measurements
      • StandardViews is Views
      • Section is Sections
      • DisplayMode is FaceStyle
      • Walk is Walkthrough
      These are on the [Win32] Menu: View > Toolbars but, missing from the UI toolbar methods:
      • LargeToolSet
      • Layers
      • SceneTabs (on View menu )
      • Shadows
      Missing from View Menu and toolbar methods:
      • StatusBar
        (We can toggle it on/off [with send_action on PC], so might as well add it to the toolbar methods so we can test it's visiblilty, and use set_toolbar_visible for cross platform [if it can be toggled on MAC.])
      * If a user has the StatusBar off, a tool might want to instead display a messagebox if it must inform the user of some fact, so it needs to test whether it's on/off.

      (5) This same Toolbar Name Identifier Set is used with the following methods, and have the same problems, missing Identifiers, etc.
      • UI.set_toolbar_visible
      • UI.toolbar_visible?

      So.. we don't mind variation in the toolbar names/symbols, so long as we know what that variation is.

      (An alternative... we might create tb_Name constants under the UI module that would be the same for both platforms.)
      0
      Last edited by Dan Rathbun on Thu Dec 31, 2009 9:41 am, edited 1 time in total.
        I'm not here much anymore. But a PM will fire email notifications.
        User avatar
        Dan Rathbun 
        PluginStore Author
        PluginStore Author
         

        Re: UI.toolbar_names

        Postby Dan Rathbun » Thu Dec 31, 2009 9:40 am

        Dan Rathbun wrote:(An alternative... we might create tb_Name constants under the UI module that would be the same for both platforms.)

        Here's an example, call it 'UI_tb_const.rb'
        Code: Select all
        module UI

        #
        # Example ONLY
        #

        case Sketchup::OS
        when :WIN
           #
          tb_CAM = 'Camera'.freeze
          tb_CONS = 'Construction'.freeze
          tb_DISP = 'DisplayMode'.freeze
          tb_DRAW = 'Drawing'.freeze
          tb_EDIT = 'Edit'.freeze
          tb_GETS = 'GettingStarted'.freeze
          tb_GOOG = 'Google'.freeze
          tb_LTS = 'LargeToolSet'.freeze
          tb_LAYR = 'Layers'.freeze
          tb_STD = 'Standard'.freeze
          tb_TABS = 'SceneTabs'.freeze
          tb_PRIN = 'Principle'.freeze # spelling!
          tb_SBAR = 'StatusBar'.freeze
          tb_SECT = 'Section'.freeze
          tb_SHAD = 'Shadows'.freeze
          tb_VIEW = 'StandardViews'.freeze
          tb_VCB = 'VCB'.freeze
          tb_WALK = 'Walk'.freeze
           #
        when :OSX
           #     what are the Mac Strings?
          tb_CAM = 'Camera'.freeze
          tb_CONS = 'Construction'.freeze
          tb_DISP = 'DisplayMode'.freeze
          tb_DRAW = 'Drawing'.freeze
          tb_EDIT = 'Edit'.freeze
          tb_GETS = 'GettingStarted'.freeze
          tb_GOOG = 'Google'.freeze
          tb_LTS = 'LargeToolSet'.freeze
          tb_LAYR = 'Layers'.freeze
          tb_STD = 'Standard'.freeze
          tb_TABS = 'SceneTabs'.freeze
          tb_PRIN = 'Principle'.freeze # spelling!
          tb_SBAR = 'StatusBar'.freeze
          tb_SECT = 'Section'.freeze
          tb_SHAD = 'Shadows'.freeze
          tb_VIEW = 'StandardViews'.freeze
          tb_VCB = 'VCB'.freeze
          tb_WALK = 'Walk'.freeze
           #
        end # case

        end # module UI extension
        0
          I'm not here much anymore. But a PM will fire email notifications.
          User avatar
          Dan Rathbun 
          PluginStore Author
          PluginStore Author
           

          Re: New API doc - typos and questions

          Postby thomthom » Fri Jan 01, 2010 4:39 pm

          Entities.add_curve
          http://code.google.com/apis/sketchup/do ... #add_curve

          Returns:
          curve a Curve object if successful

          SU7.1M1 PC returns an array of edges. Other versions untested. I'm submitting this as a bug.
          0
          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund
          User avatar
          thomthom 
          PluginStore Author
          PluginStore Author
           

          Re: New API doc - typos and questions

          Postby thomthom » Fri Jan 01, 2010 4:42 pm

          Curve.move_vertices
          http://code.google.com/apis/sketchup/do ... e_vertices

          The vertices method retrieves a collection of all vertices in a curve.


          Seem to have copied the text from Curve.vertices.
          Description needs updating along with an example.
          0
          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund
          User avatar
          thomthom 
          PluginStore Author
          PluginStore Author
           

          Re: New API doc - typos and questions

          Postby TIG » Fri Jan 01, 2010 7:26 pm

          thomthom wrote:Entities.add_curve
          http://code.google.com/apis/sketchup/do ... #add_curve

          Returns:
          curve a Curve object if successful

          SU7.1M1 PC returns an array of edges. Other versions untested. I'm submitting this as a bug.

          It's always returned an array of edges - the curve is then array[0].curve
          0
          TIG
          User avatar
          TIG 
          Global Moderator
           

          Model.save_thumbnail

          Postby Dan Rathbun » Wed Jan 06, 2010 9:46 am

          Model.save_thumbnail

          BUG: SU ver 7.1.6087 win32

          Model.save_thumbnail (which only works for the current model,) but has a bug, in that if the model has never been saved, the method writes a blank thumbnail image to the %UserProfile% folder [actually to the current working directory,] instead of the Model folder specified in Preferences>Files>Model folderpath.

          If the current model has been saved with a thumbnail, then the thumbnail image is properly saved to the Model path as set in Preferences>Files>Model.

          UPDATE - the API should include a Model.refresh_thumbnail method, similar to (or perhaps using the same internal code as,) the ComponentDefinition.refresh_thumbnail method.
          _
          0
          Last edited by Dan Rathbun on Thu Mar 08, 2012 9:55 pm, edited 1 time in total.
            I'm not here much anymore. But a PM will fire email notifications.
            User avatar
            Dan Rathbun 
            PluginStore Author
            PluginStore Author
             

            Model.title / Model.is_saved?

            Postby Dan Rathbun » Wed Jan 06, 2010 1:00 pm

            _
            Model.title
            Sketchup Ruby API wrote:The tile method retrieves the name of the model. If the model is saved on disk, returns the file name without extension. Otherwise returns an empty string.
            http://code.google.com/apis/sketchup/docs/ourdoc/model.html#title
            Change 'tile' to 'title' in method description.

            We could use Model.is_saved? and Model.is_unsaved? methods, as the Model.title method is the only way (that I can find) to determine if the model has yet been saved or not. We cannot rely upon the word 'Untitled' (in the caption bar) because that may actually be a valid filename.

            Workaround:
            Code: Select all
            class Sketchup::Model
            def is_saved?
              return not title.empty?
            end
            def is_unsaved?
              return title.empty?
            end
            end # class
            _
            0
              I'm not here much anymore. But a PM will fire email notifications.
              User avatar
              Dan Rathbun 
              PluginStore Author
              PluginStore Author
               

              Re: New API doc - typos and questions

              Postby thomthom » Wed Jan 06, 2010 3:29 pm

              Camera.set
              http://code.google.com/intl/nb/apis/ske ... a.html#set
              Code: Select all
              The initialize method is deprecated. It essentially does the same thing as Camera.set.


              Seems that's the description for Camera.new http://code.google.com/intl/nb/apis/ske ... a.html#new
              ...and that Camera.new has the description for Camera.set
              0
              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund
              User avatar
              thomthom 
              PluginStore Author
              PluginStore Author
               

              Re: New API doc - typos and questions

              Postby thomthom » Wed Jan 06, 2010 10:35 pm

              View.pickray
              http://code.google.com/apis/sketchup/do ... ml#pickray

              Returns:
              ray
              a ray


              "a ray"? Without testing this I#m guessing either a vector or line.
              0
              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund
              User avatar
              thomthom 
              PluginStore Author
              PluginStore Author
               

              Re: New API doc - typos and questions

              Postby Dan Rathbun » Thu Jan 07, 2010 9:45 am

              thomthom wrote:View.pickray
              http://code.google.com/apis/sketchup/docs/ourdoc/view.html#pickray
              Setchup Ruby API wrote:Returns:
              ray a ray

              "a ray"? Without testing this I#m guessing either a vector or line.

              see this...
              Setchup Ruby API wrote:Model.raytest
              A ray is a two element array containing a point and a vector [Geom::Point3d(), Geom::Vector3d()]. http://code.google.com/apis/sketchup/docs/ourdoc/model.html#raytest
              _
              0
                I'm not here much anymore. But a PM will fire email notifications.
                User avatar
                Dan Rathbun 
                PluginStore Author
                PluginStore Author
                 

                Re: New API doc - typos and questions

                Postby thomthom » Thu Jan 07, 2010 9:51 am

                Yea - I tested it later that day. It's what the Geom module describes as a line.
                0
                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund
                User avatar
                thomthom 
                PluginStore Author
                PluginStore Author
                 

                Re: Line / Ray

                Postby Dan Rathbun » Thu Jan 07, 2010 10:36 am

                thomthom wrote:Yea - I tested it later that day. It's what the Geom module describes as a line.

                Shouldn't the API have a definition for Line and/or Ray as a class (under the Geom module) ?

                something like:
                Code: Select all
                class Geom::Ray < Array
                  def new(*args)
                    Array[Geom::Point3d().new, Geom::Vector3d().new]
                    super()
                  end
                end
                0
                  I'm not here much anymore. But a PM will fire email notifications.
                  User avatar
                  Dan Rathbun 
                  PluginStore Author
                  PluginStore Author
                   

                  Re: New API doc - typos and questions

                  Postby thomthom » Thu Jan 07, 2010 10:40 am

                  Line and Plane? hm... maybe... thought of that myself. but never really felt the need for it to make a request. works fine as it is.

                  Dealing with them as Arrays works ok. They are simple structures.
                  0
                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund
                  User avatar
                  thomthom 
                  PluginStore Author
                  PluginStore Author
                   

                  Model.add_note

                  Postby Dan Rathbun » Mon Jan 11, 2010 2:38 pm

                  Model.add_note

                  The note is not displayed unless there are entities in the model. If you add a note first thing in a new model, it is invisible but .visible? on the note object still returns true.

                  As soon as you draw something, the note appears.
                  0
                    I'm not here much anymore. But a PM will fire email notifications.
                    User avatar
                    Dan Rathbun 
                    PluginStore Author
                    PluginStore Author
                     

                    Set class

                    Postby Dan Rathbun » Tue Jan 12, 2010 8:22 pm

                    Set class
                    http://code.google.com/apis/sketchup/docs/ourdoc/set.html

                    This class is defined in the Objectspace and should be listed under "Core Ruby Classes" (along with Array, Length, Numeric and String.)

                    Instead it's buried under "App Level Classes" and listed with all those classes that are defined inside the Sketchup module.
                    _
                    0
                    Last edited by Dan Rathbun on Sun Jan 17, 2010 5:00 pm, edited 1 time in total.
                      I'm not here much anymore. But a PM will fire email notifications.
                      User avatar
                      Dan Rathbun 
                      PluginStore Author
                      PluginStore Author
                       

                      Model.export

                      Postby Dan Rathbun » Tue Jan 12, 2010 11:12 pm

                      Model.export
                      http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export
                      Sketchup Ruby API wrote:options_hash______ A hash containing the COLLADA (.dae) export options.

                      The options listed in the hash example is missing the option for hidden geometry.
                      The Registry Attribute Name is "ExportHiddenGeometry", but what is the options hash key?
                      • hiddengeometry ?
                      • hidden_geometry ?
                      _
                      0
                      Last edited by Dan Rathbun on Sun Jan 17, 2010 5:00 pm, edited 2 times in total.
                        I'm not here much anymore. But a PM will fire email notifications.
                        User avatar
                        Dan Rathbun 
                        PluginStore Author
                        PluginStore Author
                         

                        Re: New API doc - typos and questions

                        Postby Jim » Tue Jan 12, 2010 11:22 pm

                        Thanks Dan - yet more never-seen-before docs coming to light.
                        0
                        Hi

                        Jim 
                        Global Moderator
                         

                        Re: New API doc - typos and questions

                        Postby thomthom » Tue Jan 12, 2010 11:31 pm

                        I have the mental image of Scott drowning in printouts from this thread... :roll: :lol:
                        0
                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund
                        User avatar
                        thomthom 
                        PluginStore Author
                        PluginStore Author
                         

                        Re: New API doc - typos and questions

                        Postby Jim » Tue Jan 12, 2010 11:36 pm

                        Oh, I think there is a completely undocumented UTM class in there somewhere under Geom.
                        0
                        Hi

                        Jim 
                        Global Moderator
                         

                        Re: New API doc - typos and questions

                        Postby thomthom » Wed Jan 13, 2010 12:03 am

                        Jim wrote:Oh, I think there is a completely undocumented UTM class in there somewhere under Geom.

                        hm.. all I can find out about that one is:
                        Geom::UTM.instance_methods.sort.join("\n")
                        (eval):894: warning: instance_methods: parameter will default to 'true' as of 1.8.1
                        to_a
                        to_latlong
                        to_s
                        x
                        y
                        zone_letter
                        zone_number
                        0
                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund
                        User avatar
                        thomthom 
                        PluginStore Author
                        PluginStore Author
                         

                        Geom::UTM

                        Postby Dan Rathbun » Wed Jan 13, 2010 4:13 am

                        thomthom wrote:
                        Jim wrote:Oh, I think there is a completely undocumented UTM class in there somewhere under Geom.

                        hm.. all I can find out about that one is:
                        Geom::UTM.instance_methods.sort.join("\n")... snip ...

                        from Wikipedia search on "UTM":
                        Universal Transverse Mercator coordinate system, a grid-based method of mapping locations on the surface of the Earth.
                        http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system
                        _
                        0
                        Last edited by Dan Rathbun on Sun Jan 17, 2010 4:45 pm, edited 1 time in total.
                          I'm not here much anymore. But a PM will fire email notifications.
                          User avatar
                          Dan Rathbun 
                          PluginStore Author
                          PluginStore Author
                           

                          Re: New API doc - typos and questions

                          Postby Jim » Fri Jan 15, 2010 3:31 pm

                          View.show_frame

                          Documentation for this method contains some poorly-parsed html tags.
                          0
                          Hi

                          Jim 
                          Global Moderator
                           

                          Model.get_product_family

                          Postby Dan Rathbun » Sun Jan 17, 2010 4:58 pm

                          Model.get_product_family
                          http://code.google.com/apis/sketchup/docs/ourdoc/model.html#get_product_family
                          Skecthup Ruby API wrote:Returns a constant number which indicates the product family of the installed SketchUp application.

                          This is an Application related attribute, why is it part of the Model class?

                          This should be a method of the Sketchup module as in: Sketchup.get_product_family
                          _
                          0
                            I'm not here much anymore. But a PM will fire email notifications.
                            User avatar
                            Dan Rathbun 
                            PluginStore Author
                            PluginStore Author
                             

                            OptionsProviderObserver.onOptionsProviderChanged

                            Postby Dan Rathbun » Sun Jan 17, 2010 6:22 pm

                            OptionsProviderObserver.onOptionsProviderChanged
                            http://code.google.com/apis/sketchup/docs/ourdoc/optionsproviderobserver.html#onOptionsProviderChanged
                            Sketchup Ruby API wrote:The onOptionsProviderChanged method is invoked when an element is added to an Pages object.

                            Should read, "The onOptionsProviderChanged method is invoked when an option is changed for an OptionsProvider object."
                            _
                            0
                              I'm not here much anymore. But a PM will fire email notifications.
                              User avatar
                              Dan Rathbun 
                              PluginStore Author
                              PluginStore Author
                               

                              Re: New API doc - typos and questions

                              Postby thomthom » Fri Jan 22, 2010 12:41 pm

                              Entities.add_curve
                              http://code.google.com/intl/nb/apis/ske ... #add_curve

                              Returns an array of edges - not a Curve object.
                              0
                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund
                              User avatar
                              thomthom 
                              PluginStore Author
                              PluginStore Author
                               

                              Re: New API doc - typos and questions

                              Postby TIG » Fri Jan 22, 2010 1:04 pm

                              thomthom wrote:Entities.add_curve
                              http://code.google.com/intl/nb/apis/ske ... #add_curve

                              Returns an array of edges - not a Curve object.


                              Ita's the same as add_circle which returns an array od edges and to find the just made curves curve you use edges=entities.add_curve(array_of_points)
                              curve=edges[0].curve

                              But strangely not with add_arc which returns an ArcCurve ?

                              It would be unadvisable to change what the API does with these add_ methods - rather it we should keep it as is and fix the API's Guide to reflect it properly - too many scripts already get the curve from the edges array and would fail if it were updated to return the curve not the curve's edges...
                              0
                              TIG
                              User avatar
                              TIG 
                              Global Moderator
                               

                              SketchUcation One-Liner Adverts

                              by Ad Machine » 5 minutes ago



                              Ad Machine 
                              Robot
                               

                              PreviousNext


                               

                              Return to Developers' Forum

                              Who is online

                              Users browsing this forum: crixs and 4 guests

                              Visit our sponsors: