Polygon center coordinates.

edited March 2015 in KLayout Support
Is it possible to determine center coordinates of the polygon? Or maybe its worth to have posibillity to set the polygon coordinates like for the box? In some cases it would be nice feature.

Comments

  • edited March 2015

    Not sure I understand.

    This is not how polygons are defined in GDS/OAS spec. However I believe what you want is to draw a polygon, make it into a cell, then place the cell at some x and y location.

    1. Draw a polygon
    2. Select it
    3. Edit > Selection > Make cell
    4. Select the cell, if it's not already selected. (You must have "Select top level objects" enabled first)
    5. Press 'q'
    6. Now you can place the cell at any x and y location using the x and y boxes in that dialog window.

    This can also be done programmatically, via script.

    However, the default cell origin in the above procedure is at the bottom left of the cell. If you want this truly at the 'center' of the polygon then you have to define what you mean by 'center'. I presume you mean 'centroid', though it is conceivable you can imagine a different definition for center of polygon. Anyway, to do that you have to edit that cell as new top, move it so the origin of that cell is at your centroid, then go back to the parent cell and move it back so now your cell origins are all instanced in the correct location.

    Alternatively, if you want to edit the polygon vertices, select the polygon (not its cell) and press 'q'.

  • edited November -1

    Hi all,

    I understand that you want to position the polygon by entering a numerical position.

    There is "Edit/Move By" which will move the selected relative to the current position. I think I could add "Move To" which does the same in an absolute way.

    But I wonder what will be the "center" of a polygon - will this be the center of the bounding box?

    Matthias

  • edited November -1
    The "center" of ploygon is the center of bounding box. For example if you have so polygon like alligment cross its nice to have feature to place the center of this polygon in the defined possition.
  • edited November -1

    Hi Raveriux,

    Here is a small script which will show a list of bounding box centre coordinates of every selected shape:

    module Discussion592
    
      include RBA
      mw = Application::instance.main_window
      lv =mw.current_view
      info = "The center points of the selection's\nbounding boxes are:\n"
      lv.each_object_selected do |sel|
        if !sel.is_cell_inst?
          shape = sel.shape
          info += "(#{shape.bbox.center})\n"
        end
      end
      RBA::QMessageBox::information(mw, "BBOX Center", info)
    
    end
    
  • edited November -1
    Thank You!
Sign In or Register to comment.