sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    New API doc - typos and questions

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    370 貼文 35 Posters 270.1k 瀏覽 35 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Dan RathbunD 離線
      Dan Rathbun
      最後由 編輯

      A TEMPORARY fix for dealing with the differing formats of color integers.

      Adds 4 methods to Integer (and subclasses Bignum and Fixnum.)

      Get it in the main Ruby Discussion forum, thread:
      [Ruby Extension] for Sketchup color integers

      I'm not here much anymore.

      1 條回覆 最後回覆 回覆 引用 0
      • thomthomT 離線
        thomthom
        最後由 編輯

        PickHelper.path_at
        PickHelper.depth_at
        PickHelper.path_at
        PickHelper.transformation_at
        All these are described as index 1 being the root element. But that's not in my experience. I was using PickHelper.path_at and PickHelper.transformation_at for one of my scripts where I was drilling down through groups/components. When using PickHelper.transformation_at(1) to get the global positions I would get nil half the time. PickHelper.transformation_at(0) worked instead.

        Error 404 (Not Found)!!1

        favicon

        (code.google.com)

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

        1 條回覆 最後回覆 回覆 引用 0
        • thomthomT 離線
          thomthom
          最後由 編輯

          PolygonMesh.uv_at
          http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/polygonmesh.html#uv_at
          There are two arguments:
          PolygonMesh.uv_at(int_index, bool_front)

          PolygonMesh.uvs
          http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/polygonmesh.html#uvs
          This requires a boolean value as argument.
          true returns front UV data set.
          false returns back data set.

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

          1 條回覆 最後回覆 回覆 引用 0
          • thomthomT 離線
            thomthom
            最後由 編輯

            PolygonMesh.add_polygon
            http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/polygonmesh.html#add_polygon

            I can't seem to add points like the example does.

            Instead, I must first add each point using PolygonMesh.add_point and then provide PolygonMesh.add_polygon with index values that refers to the points.

            In general this PolygonMesh seem to have many errors in the description of the methods, arguments and usage. Recommend a closer revising of this section.

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

            1 條回覆 最後回覆 回覆 引用 0
            • thomthomT 離線
              thomthom
              最後由 編輯

              Entities.fill_from_mesh
              http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#fill_from_mesh

              smooth_flags does not default to 0. Seems to default to 12 (soft and smooth)
              weld_vertices - what does this really do? I can't see any difference in the resulting geometry.

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

              1 條回覆 最後回覆 回覆 引用 0
              • thomthomT 離線
                thomthom
                最後由 編輯

                Entities.add_faces_from_mesh
                http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#add_faces_from_mesh

                @unknownuser said:

                Returns:
                faces
                an array of Face objects if successful

                In my tests it returns 0 - not an array.

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

                1 條回覆 最後回覆 回覆 引用 0
                • C 離線
                  cjthompson
                  最後由 編輯

                  @thomthom said:

                  PolygonMesh.add_polygon
                  http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/polygonmesh.html#add_polygon

                  I can't seem to add points like the example does.

                  Instead, I must first add each point using PolygonMesh.add_point and then provide PolygonMesh.add_polygon with index values that refers to the points.

                  That's weird. It works just fine for me.

                  1 條回覆 最後回覆 回覆 引用 0
                  • thomthomT 離線
                    thomthom
                    最後由 編輯

                    Can you post a quick example?

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

                    1 條回覆 最後回覆 回覆 引用 0
                    • thomthomT 離線
                      thomthom
                      最後由 編輯

                      Ah! That's what I tried. Using a normal Array as substitute of Point3D. How odd that this method suddenly don't let you interchange arrays and Point3Ds... 😕

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

                      1 條回覆 最後回覆 回覆 引用 0
                      • C 離線
                        cjthompson
                        最後由 編輯

                        now I see why it doesn't work with arrays:

                        
                        mesh = Geom;;PolygonMesh.new
                        mesh.add_point([0,0,0])
                        mesh.add_point([1,0,0])
                        mesh.add_point([1,1,0])
                        mesh.add_point([0,1,0])
                        mesh.add_polygon([1,2,3,4])
                        Sketchup.active_model.entities.add_faces_from_mesh(mesh)
                        
                        

                        you can use an array to index the points directly (for some reason, starting at 1)!

                        Can you test whether this is faster than point_at?

                        1 條回覆 最後回覆 回覆 引用 0
                        • thomthomT 離線
                          thomthom
                          最後由 編輯

                          I will see over the weekend. I found some slowness by having to use .add_point and then later use .point_index to build the polygons. building my own hash of Point3Ds and the index I got from add_point was faster.

                          Hopefully adding points in the add_polygon methods directly will be faster.

                          Oh yea - the index start at 1 is annoying as well.

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

                          1 條回覆 最後回覆 回覆 引用 0
                          • C 離線
                            cjthompson
                            最後由 編輯

                            I think I found what your problem is.

                            This works:

                            
                            mesh = Geom;;PolygonMesh.new
                            mesh.add_polygon(Geom;;Point3d.new(0,0,0),Geom;;Point3d.new(1,0,0),Geom;;Point3d.new(1,1,0),Geom;;Point3d.new(0,1,0))
                            Sketchup.active_model.entities.add_faces_from_mesh(mesh)
                            
                            

                            This doesn't:

                            
                            mesh = Geom;;PolygonMesh.new
                            mesh.add_polygon([0,0,0],[1,0,0],[1,1,0],[0,1,0])
                            Sketchup.active_model.entities.add_faces_from_mesh(mesh)
                            
                            

                            EDIT:
                            You can put the arrays inside of another array to get it to work:

                            
                            mesh = Geom;;PolygonMesh.new
                            mesh.add_polygon([[0,0,0],[1,0,0],[1,1,0],[0,1,0]]) #this works
                            Sketchup.active_model.entities.add_faces_from_mesh(mesh)
                            
                            
                            1 條回覆 最後回覆 回覆 引用 0
                            • thomthomT 離線
                              thomthom
                              最後由 編輯

                              Using .add_points first and using index references for .add_polygon seems faster than using Point3d's.

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

                              1 條回覆 最後回覆 回覆 引用 0
                              • RichMorinR 離線
                                RichMorin
                                最後由 編輯

                                General

                                Class and method names could be turned into links
                                to the appropriate API page, for ease of navigation.

                                Sentences should begin with a capital letter and end with
                                a period (etc). Phrases should not.

                                If a modifying phrase is used at the end of a sentence,
                                a comma should be added for clarity:

                                
                                  the name of the attribute dictionary  if successful
                                                            dictionary,
                                
                                

                                Specific

                                http://code.google.com/apis/sketchup/docs/ourdoc/animation.html

                                
                                animation -> animation
                                ruby      -> Ruby
                                
                                ... to pause, only certain ...
                                       pause;
                                
                                

                                http://code.google.com/apis/sketchup/docs/ourdoc/appobserver.html

                                
                                ... a 2nd    model ...
                                      second
                                
                                Useful for if you need ...
                                ---
                                This is useful if you need ...
                                
                                

                                http://code.google.com/apis/sketchup/docs/ourdoc/array.html

                                
                                The SketchUp Array class adds ...
                                ---
                                SketchUp adds ...
                                
                                Specifically, it contains methods ...
                                ---
                                Specifically, it adds methods ...
                                
                                ... arrays of 3     coordinate ...
                                              three
                                
                                ... vector. it returns ...
                                            It
                                
                                

                                http://code.google.com/apis/sketchup/docs/ourdoc/attributedictionaries.html

                                
                                ... all of the attributes dictionaries.
                                               attribute
                                
                                

                                http://code.google.com/apis/sketchup/docs/ourdoc/attributedictionary.html

                                Although the page does not discuss this, setting a
                                custom attribute with a key that contains upper-case
                                letters does not work.

                                The page does not indicate how to set an attribute
                                (eg, '=LenX+20') to be used as an expression.

                                In the entry for AttributeDictionary.each, the "value"
                                argument is being formatted as part of the description
                                for the "key" argument.

                                Ditto for AttributeDictionary.each_pair.

                                1 條回覆 最後回覆 回覆 引用 0
                                • Dan RathbunD 離線
                                  Dan Rathbun
                                  最後由 編輯

                                  On the API docs pages, in the left nav column, whenever you have made a link bold, the cursor changes to a caret instead of the hand cursor. I suspect it's the <b> and </b> tags doing this.
                                  example from the API HTML source:

                                  <li><a href="/apis/..../model.html"><b>Model</b></a></li>
                                  

                                  Perhaps if the bold tags were outside the anchor tags?

                                  <li><b><a href="/apis/..../model.html">Model</a></b></li>
                                  

                                  If the css specifically set a tags such: a {cursor:hand} the nested bold tags should inherit their parent's cursor setting (according to the css reference.)

                                  I'm not here much anymore.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • thomthomT 離線
                                    thomthom
                                    最後由 編輯

                                    The bold tag should not interfere with the cursor regardless if it's inside or outside the link element. It's default cursor property is inherit. It's either some override or other quirk. Could be a browser quirk.
                                    In FF3.5 I don't see this behaviour. What browser do you use?

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

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • Dan RathbunD 離線
                                      Dan Rathbun
                                      最後由 編輯

                                      @thomthom said:

                                      In FF3.5 I don't see this behaviour. What browser do you use?

                                      Currently still using MSIE 7

                                      P.S.: at MSDN it indicates if the cursor is not explicitly set, the browser decides; so it may indeed be a MSIE quirk. (I have MSIE 8 and FF on the computer in another room, I'll check and see how the site looks on that machine later today.)

                                      I'm not here much anymore.

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • thomthomT 離線
                                        thomthom
                                        最後由 編輯

                                        @dan rathbun said:

                                        Currently still using MSIE 7

                                        Tried with IE8 - cursor is normal.

                                        @dan rathbun said:

                                        so it may indeed be a MSIE quirk.

                                        It certainly wouldn't surprise me!

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

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • thomthomT 離線
                                          thomthom
                                          最後由 編輯

                                          @dan rathbun said:

                                          Point3d.<
                                          http://code.google.com/apis/sketchup/docs/ourdoc/point3d.html#%3C

                                          @unknownuser said:

                                          Returns:
                                          true if the point2 is closer to the origin.

                                          Following the example, I get he opposite result.
                                          The Returns: should probably read,
                                          " *true* if the point2 is **farther** from the origin; *false* if the point2 is closer to the origin (than the receiver.)

                                          And the anchor link http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/point3d.html#%3C doesn't work for me under FF3.5. Might be due to the < character.

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

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • Dan RathbunD 離線
                                            Dan Rathbun
                                            最後由 編輯

                                            @thomthom said:

                                            And the anchor link http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/point3d.html#%3C doesn't work for me under FF3.5. Might be due to the < character.

                                            I suggest the Google webmeister change the anchor to "#lessthan" instead of "#%3C".

                                            I would suspect that links to - and + methods may have problems with some browsers as well.

                                            I'm not here much anymore.

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 12
                                            • 13
                                            • 14
                                            • 15
                                            • 16
                                            • 17
                                            • 18
                                            • 19
                                            • 14 / 19
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement