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

    Displaying the Normal of a Polygon

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 153 Views 3 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.
    • J Offline
      jach9009
      last edited by

      I was wondering if there is a way to display the normal of a selected polygon? I have researched it a little bit and it seems like I may need to calculate the normal based on the vertex's of the polygons. Has anyone done this or have any ideas on the easiest way to accomplish this task.

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

        If the polygon is a simple singple plane (which it should be if its a polygon), then you just take the face and get its normal. Let's say you have the single face selected, you can run this line of code in the ruby console:

        Sketchup.active_model.selection[0].normal

        And that will return the vector that represents the polygon's normal. Is that what you're looking for?

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          If by polygon you mean a face, then it's easy. If the polygon is just geometry without entities, then it needs to be calculated. But you can use creative solutions, like
          normal = Geom::Vector3d.new( [Geom.fit_plane_to_points](http://sketchup.com/intl/en/developer/docs/ourdoc/geom.php#fit_plane_to_points)(points)[0...3] )

          1 Reply Last reply Reply Quote 0
          • J Offline
            jach9009
            last edited by

            Thanks guys thats what I needed.

            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