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

    How to get info from a face

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 242 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.
    • D Offline
      d0n
      last edited by

      Hi wanted to learn about making plugins and ran into a problem

      How would i get information from a selected face? I want to use the X,Y,Z of a face inside a component.

      somehow I can't get for the life of me get anything to work 😞

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        @d0n said:

        Hi wanted to learn about making plugins and ran into a problem

        How would i get information from a selected face? I want to use the X,Y,Z of a face inside a component.

        somehow I can't get for the life of me get anything to work 😞

        Please provide more info about what you are trying to do. A Face is a planar surface bounded by a collection of Edges. Each Edge has two end Vertex3d locations, which have x,y,z positions, but there is no single x,y,z associated with a Face.

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

          @d0n said:

          Hi wanted to learn about making plugins and ran into a problem ...
          ... somehow I can't get for the life of me get anything to work 😞

          You should read my Ruby Newbie's Guide (link in signature.)
          You need to learn standard Ruby. Then you can apply the SketchUp API extensions (which SketchUp loads automatically after loading the Ruby interpreter.)
          I always recommend reading the good old "Pick-Axe" book (posted in the Ruby Resources sticky topic!) from cover to cover.

          @d0n said:

          How would i get information from a selected face?

          You first get a reference to the selected face from the selection collection:
          face = Sketchup::active_model.selection.grep(Sketchup::Face).first

          @d0n said:

          I want to use the X,Y,Z of a face inside a component.

          Assuming you want the first vertex in the face's vertices collection:
          pos = face.vertices.first.position
          pos should be a Geom::Point3d class object.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • D Offline
            d0n
            last edited by

            Thanks

            which function should i look at if i want to get all the vertices of the face?

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              @d0n said:

              Thanks

              which function should i look at if i want to get all the vertices of the face?

              http://www.sketchup.com/intl/en/developer/docs/ourdoc/face.php#vertices

              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