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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      Tool - onMouseMove example has a bad local variable.
      http://code.google.com/apis/sketchup/docs/ourdoc/tool.html#onMouseMove

       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

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

        http://code.google.com/apis/sketchup/docs/ourdoc/face.html#get_UVHelper

        The code example:

        
         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:

        @unknownuser said:

        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

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

          ModelObserver.onPlaceComponent
          http://code.google.com/apis/sketchup/docs/ourdoc/modelobserver.html#onPlaceComponent

          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

          1 Reply Last reply Reply Quote 0
          • scottliningerS Offline
            scottlininger
            last edited by

            @thomthom said:

            ModelObserver.onPlaceComponent
            http://code.google.com/apis/sketchup/docs/ourdoc/modelobserver.html#onPlaceComponent

            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?
            1 Reply Last reply Reply Quote 0
            • R Offline
              remus
              last edited by

              For Point3d.distance_to_line the docs give the same example as point3d.distance.

              http://remusrendering.wordpress.com/

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

                I can't get the DefinitionObserver to trigger at all. http://code.google.com/apis/sketchup/docs/ourdoc/definitionobserver.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

                1 Reply Last reply Reply Quote 0
                • scottliningerS Offline
                  scottlininger
                  last edited by

                  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?
                  1 Reply Last reply Reply Quote 0
                  • scottliningerS Offline
                    scottlininger
                    last edited by

                    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?
                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      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 http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17631 (Completely busted)
                      EntitiesObserver.onContentsModified http://www.sketchucation.com/forums/scf/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

                      1 Reply Last reply Reply Quote 0
                      • scottliningerS Offline
                        scottlininger
                        last edited by

                        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?
                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • R Offline
                            remus
                            last edited by

                            A semi related typo:

                            in this tutorial pt4=[0,9,9] whereas it should be [0,9,0].

                            http://remusrendering.wordpress.com/

                            1 Reply Last reply Reply Quote 0
                            • Chris FullmerC Offline
                              Chris Fullmer
                              last edited by

                              ::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

                              1 Reply Last reply Reply Quote 0
                              • scottliningerS Offline
                                scottlininger
                                last edited by

                                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?
                                1 Reply Last reply Reply Quote 0
                                • R Offline
                                  remus
                                  last edited by

                                  Dont pretend your not in on it as well 😄

                                  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 👍 just as long as you dont want to change your box at all...

                                  http://remusrendering.wordpress.com/

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

                                    Seems that InstanceObserver.onClose is dead as well. http://code.google.com/apis/sketchup/docs/ourdoc/instanceobserver.html#onClose
                                    But onOpen works.

                                    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

                                      Error 404 (Not Found)!!1

                                      favicon

                                      (code.google.com)

                                      @unknownuser said:

                                      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

                                      1 Reply Last reply Reply Quote 0
                                      • scottliningerS Offline
                                        scottlininger
                                        last edited by

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

                                        http://groups.google.com/group/Ruby-API/msg/e30ee3f2b21cb228

                                        • Scott Lininger
                                          SketchUp Software Engineer
                                          Have you visited the Ruby API Docs?
                                        1 Reply Last reply Reply Quote 0
                                        • thomthomT Offline
                                          thomthom
                                          last edited by

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

                                          
                                               # 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

                                          1 Reply Last reply Reply Quote 0
                                          • TIGT Offline
                                            TIG Moderator
                                            last edited by

                                            @unknownuser said:

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

                                            http://groups.google.com/group/Ruby-API/msg/e30ee3f2b21cb228

                                            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 ???
                                            .

                                            TIG

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 18
                                            • 19
                                            • 3 / 19
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement