To draw triangles with specific angles.

edited June 2013 in General
Is there any tool by which,one can draw an triangle with specific angles?say i want one angle of triangle to be 5 degrees and others would be obviously 90degrees and 85degrees in case of right angled triangle.But the basic problem is how can you draw or set the one angle of triangle to be 5 degrees?
If there is not any tool available,is there any alternative solution to this problem?My basic aim is to draw triangles with different angles starting 5degrees onwards!

Comments

  • edited June 2013

    Hallo,

    there is no explicit tool for that but, that is a nice application for a PCell.

    You could start with the circle sample PCell and modify it to represent a triangle with the required parameters.

    Another approach is to use Ruby code to generate the layout. Here is some sample code to generate a triangle:

    mw = RBA::Application::instance.main_window
    view = mw.current_view || raise("No view open")
    cell = view.active_cellview.cell
    layer = view.current_layer.current.layer_index
    
    # the three points of the triangle in database units
    pts = [ RBA::Point::new(0, 0), RBA::Point::new(1000, 2000), RBA::Point::new(2000, 1000) ]
    
    # create the triangle
    cell.shapes(layer).insert(RBA::Polygon::new(pts))
    

    This code will generate a triangle with the given three points in the current cell on the layer currently selected.
    You can compute the points using any formula you wish. You can also put the triangle generation into a loop and thus generate a whole array of shapes with a variation of parameters.

    In every case, some insight into the Ruby scripting API is helpful to understand what the script does. See http://klayout.de/doc/programming/index.html for some documentation.

    Matthias

Sign In or Register to comment.