Displaying the Normal of a Polygon
-
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.
-
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
-
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] ) -
Thanks guys thats what I needed.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement