Drawing path or polygon

Hi Matthias,

When drawing a path or polygon manually by clicking the left mouse button to add vertices, is there a way to go back one or more vertices in case you made a wrong click somewhere, for instance by pressing the "Backspace" button one or more times? For now, I draw the full polygon or path and edit the wrong vertices afterwards using "Partial" but that can be quite cumbersome...

Cheers,

Tomas

Comments

  • No, there is no "backspace" yet, but that is a nice suggestion. That should be pretty intuitive.

    I created a ticket: https://github.com/KLayout/klayout/issues/1058

  • Or ^Z, though that might "undo" the whole command?

  • @Matthias
    May I know how to draw a path by Ruby code?
    I knew how to create a box in ruby , such as "top.shapes(l1).insert(RBA::Box::new(-10000, 1, 10000, -1))"
    but , what code for the path ?
    I tried
    top.shapes(l1).insert(RBA::Path::new(-10000, 1, 10000, -1))
    top.shapes(l1).insert(RBA::Line::new(-10000, 1, 10000, -1))
    But it is non workable.... :'(

  • Hi jiunnweiyeh,

    A path should have (at least) an array of points and a path width as parameters:

    RBA::Path::new([point1, point2, point3, ...], pathwidth)

    See also: https://www.klayout.de/doc-qt5/code/class_Path.html

    Cheers,

    Tomas

  • hi @tomas2004
    Thanks your reply , I can't make path use following code.. I just make a 1 um path from 0,0 to 15,15.

        currentname = RBA::Application::instance.main_window.current_view.active_cellview.cell_name
        layout = RBA::CellView.active.layout
        top = layout.cell(currentname)
        l1 = layout.layer(123, 0)
        top.shapes(l1).insert(RBA::Path::new(points=0,0,15,15),1)
        top.shapes(l1).insert(RBA::Path::new([0,0,15,15],1)
    

    I guess that , I have to package the coordinate (0,0 15,15) to "spine" format.
    But I have no idea how to process that...could you please help it?
    Thanks.

  • Hi jiunnweiyeh,

    The points need to be instances of the Point (DBU units) or DPoint (um) class:

      include RBA
    
      layout_view = Application.instance.main_window.current_view
      cell_view = layout_view.active_cellview
      layout = cell_view.layout
      viewed_cell = cell_view.cell
    
      layer = layout.layer(123, 0)
    
      point1 = DPoint.new(0.0, 0.0)
    
      point2 = DPoint.new(15.0, 15.0)
    
      viewed_cell.shapes(layer).insert(DPath.new([point1, point2],1.0))  
    

    Cheers,

    Tomas

  • @tomas2004
    I Got it, Thanks very much for your help.

Sign In or Register to comment.