sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      @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
      • thomthomT Offline
        thomthom
        last edited by

        @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
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @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
          • thomthomT Offline
            thomthom
            last edited by

            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

              @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
              • thomthomT Offline
                thomthom
                last edited by

                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

                  @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

                    @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
                    • thomthomT Offline
                      thomthom
                      last edited by

                      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

                        @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
                        • thomthomT Offline
                          thomthom
                          last edited by

                          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

                            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
                            • thomthomT Offline
                              thomthom
                              last edited by

                              @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

                                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
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  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
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    @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
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      @thomthom said:

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

                                      That would be much more use... unfortunately with draw aren't we limited to the built-in color-set, and that has no transparency setting ?
                                      Transparency ispossible with OpenGL but not as I can seem in it's port to Ruby and SUp ???

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • Dan RathbunD Offline
                                        Dan Rathbun
                                        last edited by

                                        COLOR ...by the way...FYI

                                        Another Color Table with much more info then the one on the SU API Color page, is at
                                        MSDN Samples - Dynamic Color Reference

                                        It's a DHTML sample page... takes awhile to load (and I have broadband.) Once loaded you can sort the table by any column, by clicking it.

                                        I'm not here much anymore.

                                        1 Reply Last reply Reply Quote 0
                                        • thomthomT Offline
                                          thomthom
                                          last edited by

                                          @dan rathbun said:

                                          ANY numeric input is bugged, no matter Fixnum or Hex or Octal.

                                          
                                          > c1 = Sketchup;;Color.new( 255 )
                                          > Color(255,   0,   0, 255)
                                          > # You'd expect (0,0,255,255) ...but
                                          > 
                                          

                                          Why are you expecting a ble value from that? Getting a Red colour is what I'd expect, going left to right in RGB.

                                          @dan rathbun said:

                                          
                                          > c2 = Sketchup;;Color.new( 256 )
                                          > Color(  0,   1,   0, 255)
                                          > # that's just plain weird!
                                          > 
                                          

                                          Ah! They treat a single int as a full colour code. Used to do this stuff in VB apps that used long ints for colours.

                                          
                                          c = 256
                                          r = c & 0xFF
                                          g = (c & 0xFF00) / 0x100
                                          b = (c & 0xFF0000) / 0x10000
                                          
                                          

                                          Results in RGB 0, 1, 0

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

                                          1 Reply Last reply Reply Quote 0
                                          • thomthomT Offline
                                            thomthom
                                            last edited by

                                            @dan rathbun said:

                                            c3 = Sketchup;;Color.new("darkorchid")
                                            > Color(153,  50, 204, 255)
                                            > # all OK so far, lets get the integer output...
                                            > c3.to_i
                                            > 13382297
                                            > # is that right?
                                            > 
                                            
                                            c = 13382297
                                            13382297
                                            r = c % 256
                                            153
                                            g = (c / 256) % 256
                                            50
                                            b = (c & 0xFF0000) / 0x10000
                                            204
                                            

                                            Seems right.

                                            @dan rathbun said:

                                            Let's see what Ruby says...
                                            "0x9932CC".hex
                                            10040012

                                            You get the int by first extracting the rgb components, then: int = b * 65536 + g * 256 + r
                                            So in this case:
                                            0xCC * 65536 + 0x32 * 256 + 0x99 = 13382297

                                            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