• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

New API doc - typos and questions

Scheduled Pinned Locked Moved Developers' Forum
370 Posts 35 Posters 256.4k Views 35 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    thomthom
    last edited by 3 Nov 2009, 13:01

    UI.inputbox
    http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/ui.html#inputbox

    It should be noted that the default value types you pass to the input box controls the return types.
    http://forums.sketchucation.com/viewtopic.php?f=180&t=23288&p=197300#p197298

    Thomas Thomassen β€” SketchUp Monkey & Coding addict
    List of my plugins and link to the CookieWare fund

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 6 Nov 2009, 09:53

      http://code.google.com/intl/nb/apis/sketchup/docs/releases.html
      The release notes says:

      @unknownuser said:

      Cleaner, hash-based syntax for initializing

      But there's nowhere any example of what the hash should look like, keys etc.

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 6 Nov 2009, 12:22

        Thom, you are right it needs to be documented.

        This is from the webtextures_loader.rb. The constants are defined a little earlier in the code, but this gives some idea about the keys:

        
         # Create our dialog.
            keys = {
              ;dialog_title => title,
              ;scrollable => false,
              ;preferences_key => WT_DIALOG_REGISTRY_KEY,
              ;height => WT_DIALOG_HEIGHT,
              ;width => WT_DIALOG_WIDTH,
              ;left => WT_DIALOG_X,
              ;top => WT_DIALOG_Y,
              ;resizable => true,
              ;mac_only_use_nswindow => true}
            @dialog = UI;;WebDialog.new(keys)
           
        

        Hi

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 6 Nov 2009, 12:25

          Thanks Jim. Would probably be able to guess most - but...

          What's unexpected there is :mac_only_use_nswindow - Same as WebDialog.navigation_buttons_enabled?

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 6 Nov 2009, 12:50

            @thomthom said:

            What's unexpected there is :mac_only_use_nswindow - Same as WebDialog.navigation_buttons_enabled?

            Isn't 'nswindow' a base Cocoa (or Carbon) window class?

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 6 Nov 2009, 12:54

              @dan rathbun said:

              @thomthom said:

              What's unexpected there is :mac_only_use_nswindow - Same as WebDialog.navigation_buttons_enabled?

              Isn't 'nswindow' a base Cocoa (or Carbon) window class?

              hm... I Googled 'mac nswindow' seems that you might be onto something.
              http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html

              Does it give any visible difference when it's set to true as oppose to false?

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dan Rathbun
                last edited by 6 Nov 2009, 13:18

                @thomthom said:

                Does it give any visible difference when it's set to true as oppose to false?

                I don't know. I don't have an Apple machine. [..wish I could install OSX of my 686 clone for devlopment. XCode looks like a neat IDE.] There are so many attributes, methods, etc. there it's hard to guess what the SU API is refering to.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 9 Nov 2009, 11:21

                  Edge.reversed_in?
                  http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/edge.html#reversed_in?
                  The reversed_in? method is used to determine if the EdgeUse object is traversed in the corresponding direction as its corresponding edge.

                  Apart from the EdgeUse typo - what does the method really do. I don't understand at all from the description what it does.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by 10 Nov 2009, 10:12

                    @thomthom said:

                    Edge.reversed_in?
                    http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/edge.html#reversed_in?
                    The reversed_in? method is used to determine if the EdgeUse object is traversed in the corresponding direction as its corresponding edge.

                    Apart from the EdgeUse typo - what does the method really do. I don't understand at all from the description what it does.

                    I use it in my 'orient faces' method - although I agree that it all seems pretty arcane and badly explained. If an edge is reversed in a face it is going contrary to that face's logical loop direction. If you test an edge belonging to a selected face and that edge has that face face plus another one that both return as being either reversed or not-reversed then you know that this other face has the same 'orientation' as the selected face: if the other face has the opposite 'reversed-ness' to the selected face then it needs to be flipped over (reversed) so it orients the same way as the selected face...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 10 Nov 2009, 11:01

                      There's a logical orientation of the loops?

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by 10 Nov 2009, 11:33

                        @thomthom said:

                        There's a logical orientation of the loops?

                        If you get a set of vertices for a face's loop it's always listed as an ordered array: it will be rotating 'counter-clockwise' to the face's normal if it's an external loop, or 'clockwise' if it's an internal loop... If an edge's start/end vertices break this 'rule' I think it's said to be 'reversed in the face' ? That is the order of the edge's vertices don't follow the loops 'handed-ness' so are flagged thus...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jarl
                          last edited by 10 Nov 2009, 12:06

                          @unknownuser said:

                          Your help in finding typos/missing details are very welcome!

                          On http://code.google.com/intl/da/apis/sketchup/docs/ourdoc/point3d.html#+ it says that the argument is a Point3d, but it should say a Vector3d.

                          Jarl

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            thomthom
                            last edited by 10 Nov 2009, 12:28

                            Geom;;Point3d.new(10,10,10) + Geom;;Point3d.new(20,20,20)
                            Error; #<ArgumentError; (eval);261;in `+'; Cannot convert argument to Sketchup;;Vector3d>
                            (eval);261
                            

                            Thomas Thomassen β€” SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by 10 Nov 2009, 14:18

                              @jarl said:

                              @unknownuser said:

                              Your help in finding typos/missing details are very welcome!

                              On http://code.google.com/intl/da/apis/sketchup/docs/ourdoc/point3d.html#+ it says that the argument is a Point3d, but it should say a Vector3d.

                              Jarl

                              If you add two pointstogether it returns a vector (or another point if it's taken as an array) ?

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 18 Nov 2009, 10:12

                                Color
                                http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/color.html

                                When creating a Color object you can specify an alpha value. Not mentioned in the examples.

                                Color.new
                                http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/color.html#new
                                The way the arguments are presented now it looks like they are all equal, but it's actually wither RGB(A) values or a String. It also takes Hex, array with Integers or Floats.

                                Oddly enough, you can do: Sketchup::Color.new(128) and get a Red-ish color. But not Sketchup::Color.new(128, 255) - where it will throw an error saying at least 3 values are required. So if you can specify 1, 3 or 4 values for the RGBA combination.

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • TIGT Offline
                                  TIG Moderator
                                  last edited by 18 Nov 2009, 11:08

                                  But the Color's Alpha value is always ignored anyway ?
                                  Whereas Alpha value for the material is used !

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    thomthom
                                    last edited by 18 Nov 2009, 11:22

                                    @tig said:

                                    But the Color's Alpha value is always ignored anyway ?
                                    Whereas Alpha value for the material is used !

                                    Yea, that's what I've noticed as well. Confusing. Should be mentioned in the docs. I had hoped that the alpha channel would be used the the view.draw2d method, but alas - it does not. Wondering if it's by design or if it's a bug.

                                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                    List of my plugins and link to the CookieWare fund

                                    1 Reply Last reply Reply Quote 0
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by 18 Nov 2009, 13:48

                                      I guess it was perhaps an early implementation when perhaps Color and Material were the same thing ?
                                      Also I suppose it allows you to import a RGBA value from elsewhere directly into a Color, but then using the first 3 items in the array is no hardship ???
                                      Seems that the alpha could be removed as it's not needed/useful ?

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        thomthom
                                        last edited by 18 Nov 2009, 13:51

                                        I'd rather see view.drawingcolor= make use of the alpha channel and let us draw transparent objects to the viewport.

                                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                        List of my plugins and link to the CookieWare fund

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          thomthom
                                          last edited by 18 Nov 2009, 17:00

                                          @tig said:

                                          That would be much more use... unfortunately with drawaren't we limited to the built-in color-set, and that has no transparency setting ?

                                          draw is currently bugged an only draws black fill.
                                          draw2d works, and you can specify any Color object (or hex,int,float,array that equal to a colour) but it ignores the alpha.

                                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                          List of my plugins and link to the CookieWare fund

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 8
                                          • 9
                                          • 10
                                          • 11
                                          • 12
                                          • 18
                                          • 19
                                          • 10 / 19
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement