[Feature request] Additional object properties

edited December 2012 in KLayout Development

It would be nice to be able to see additional object properties for the following cases:

  • Rectangles: The coordinates of the origin (currently only centre is shown)
  • Instances: The bounding box (currently only the origin is shown)
  • Polygons, rectangles, wires, (instances): The covered area, as seen in Glade.

Since I just started Ruby scripting, I am not sure if I could potentially extend the Object Properties window?

Comments

  • edited December 2012

    Hi friendx,

    The properties dialog is intended to edit the object's properties, so derived properties are not shown. The rectangle origin is available however - if you use the "Corners" tab, you can edit the corner coordinates instead of the center and dimensions.

    You cannot (easily) modify the object properties dialog with Ruby, but you can code an alternative one.

    Create a macro with the code to compute some derived properties and bind this macro to your favourite key. A starting point for the computation may is this (the code is taken from calc_area.rbm in the "Useful Ruby modules" page):

      app = RBA::Application.instance
      mw = app.main_window
    
      lv = mw.current_view
      if lv == nil
        raise "No view selected"
      end
    
      total_area = 0.0
    
      lv.each_object_selected do |obj|
    
        shape = obj.shape
        layout = lv.cellview(obj.cv_index).layout
    
        if shape.is_polygon? || shape.is_box? || shape.is_path?
          polygon = shape.polygon
          a = polygon.area
          m = obj.trans.mag * layout.dbu
          total_area += a * m * m
        end
    
      end
    
      RBA::MessageBox.info("Total area", "Total area of selected objects is #{total_area} square micron", RBA::MessageBox.b_ok)
    

    Best regards,

    Matthias

Sign In or Register to comment.