• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Is it follow_me or followme ?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 1.1k Views 4 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
    tomot
    last edited by 12 Dec 2016, 21:27

    I hope inconsistencies in the API are still being corrected!

    I'm following the included example.
    http://ruby.sketchup.com/Sketchup/Face.html#followme-instance_method

    However Followme does not seem to like to turn 90 degree corners see the attached pic and code.
    2016-12-12_12-56-02.png

    group=entities.add_group
    		entities=group.entities
    		#...1 followme profile
                face=entities.add_face @pt
    		#...2 primary section profile used by follow-me
                line = entities.add_line(@ptT, @ptX, @ptY, @ptZ) #line color RED
                face=face.followme(line)
    

    followme draws from @ptT, @ptX them ignores @ptY, @ptZ to finish wrapping around the remaining 2 lines ?


    2016-12-12_12-54-53.png

    [my plugins](http://thingsvirtual.blogspot.ca/)
    tomot

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 12 Dec 2016, 23:19

      The added '_' in follwme is a typo in the API docs.

      If you use .add_line(pt1, pt2) it returns 1 edge defined by those 2 points.
      If you use .add_edges(pt1, pt2, pt3, pt4) it returns an array of 3 edges passing through those 4 points.

      In your example code because .add_line only reads the first 2 points it only makes 1 edge between them.
      But with .add_edges and 4 points it will make the 3 edges expected...

      TIG

      1 Reply Last reply Reply Quote 0
      • T Offline
        tomot
        last edited by 12 Dec 2016, 23:56

        Thanks for your quick response TIG.

        I recall having trouble distinguishing between edges and lines in the past, Its not something one always remembers. May I suggest adding a second example to the API for others looking for clarification
        ....again Thanks!

        [my plugins](http://thingsvirtual.blogspot.ca/)
        tomot

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 13 Dec 2016, 00:05

          It really ought have to been:
          entities.add_edge(pt1, pt2)
          and
          entities.add_edges(pt1, pt2, pt3, pt4, ...)

          BUT it's too late to change it now...

          A Geom 'line' is something else all together -
          defined by an array containing a point and a vector...
          e.g. edge.line

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 13 Dec 2016, 19:23

            @tomot said:

            I hope inconsistencies in the API are still being corrected!

            The place to log mistakes in the API Ruby documents are here:
            https://github.com/SketchUp/ruby-api-docs/issues

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 21 Dec 2016, 12:56

              As TIG said, add_line was a deviance from what the norm. I think it got named like that because in the UI you have the "Line Tool". But in the API this is an unfortunate inconsistency.

              And as Dan mentioned, please report documentation issues in the GitHub repo.

              I queued up some cleanup to the followme method:

              2016-12-21_13h57_14.png

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

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement