A point belongs to which side of face

I am new to SketchUp. how can i write function in ruby to find the left edge and it’s start and end point of a rectangular face.

I want fo find left edge’s vertices from any orientation.i can get the vertices of face but if i put the vertices name like a,b,c,d and put the values of coordinate of vertices for different rectangles it’s creation point will be change every time like first time face’s vertex starts from a and next time it’ll be start from b.

Are these faces all lying upon the XY ground plane ?

You originally put this in the SketchUp category, not the Ruby API category.

… but I moved it for him. :wink:

these will be the wall’s face.they will be lying on zx plane

@DanRathbun…thanks for moving.

Actually i want to draw inclined line on face of rectangle from left top to right down diagonally thats why i need these left edge’s coordinates without hardcoding…please provide some solution

yeah i am new in sketchup so it was not known to me…

Okay then you want to filter the array of vertices by that whose position (Geom::Point3d)'s x and z value is the smallest.

The Ruby Array class has the Enumerable module mixed into it, giving it many filter methods like min and sort.

pts = wall_face.vertices.map(&:position)
pts = pts.sort_by {|pt| pt.z }
lower_left_pt = pts.min_by {|pt| pt.x }

You might also do it by the face’s bounds …

left_front_bottom = wall_face.bounds.corner(0)


I’d rather see you learn by finding the solution yourself. We’ll give you little pushes in the right directions.

In this category is a learning list of resources …

1 Like

@DanRathbun… thank you and whatever you said I’ll keep that always in my mind.