Can anyone point me to examples, other than the API, for using the view.draw method to draw an outline of the geometry that will be created. It is simple enough to do a line from one point to another, but i’m looking to get it to work with a shape, from InputPoint1 to iInputPoint2.
so if i am going to draw an extruded triangle or square and my 2 Input Points determine the length and direction, i’m trying to learn how to dynamically show the outline of the shape as i am moving the mouse around to determine the 2nd InputPoint.
i’ve searched and searched through the documentation and forums and sketchucation, even tried studying source code of other extensions that sort of do this, but they all relate to drawing one line from A to B.
i imagine it might be pretty complex to do this, since the points would need to be constantly doing transformations on the plane perpendicular to the vector of InputPoint1 and InputPoint2 and relative to those points
def draw(view) if( @ip1.valid? ) if( @ip1.display? ) @ip1.draw(view) @drawn = true end
if( @ip2.valid? ) points = [@ip1, @ip2] @ip2.draw(view) if( @ip2.display? ) view.set_color_from_line(@ip1, @ip2)
view.line_width = 5 view.draw(GL_LINES, points)
@drawn = true end end end
This is what i have so far with just creating the simple line, and the geometry is created after the 2nd click. so does anyone know of some more complex examples of the view.draw_lines method that i can study for doing shape outlines? any suggestions or direction would be very helpful, thanks