Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorjmk1729
    • CommentTimeJan 2nd 2017 edited
     

    Hi all,

    I'm new to drawing tools like KLayout as well as the scripting language Ruby. So far I've managed to figure out enough from the forums and online documentation (along with some Ruby tutorials) to produce the tiling of hexagons I want, but I would like to figure out a few more things. The first is if I can save a floating point height associated with each layer such that when I save a tiling as a dxf file, I can see it as a 3D drawing in a program like Solidworks. Is this doable?

    The second is treating each mask (hexagonal tiling) as a single entity (cell?) so that I can load multiple masks into the same layout and move them around with respect to one another. Is this as simple as creating a different cell for each mask? Here's the script I've cobbled together to make the initial hexagonal tilings:

    module MyMacro
    
    include RBA
    
    # Change to working directory
    Dir.chdir("My working directory")
    
    # Layout for hexagonal tiling
    layout = RBA::Layout::new
    
    # create a new view (mode 1) with an empty layout
    main_window = RBA::Application::instance.main_window
    layout = main_window.create_layout(1).layout
    layout_view = main_window.current_view
    
    # database unit 1nm:
    layout.dbu = 0.001
    
    # Create sixteen levels (layers) to etch to
    layer = []
    x = 1
    
    16.times {
    layer_index = layout.insert_layer( RBA::LayerInfo.new(x,0) )
    layer.push(layer_index)
    x += 1
    }
    
    # add a cell (in this case "TOP")
    top_id = layout.add_cell("TOP")
    top = layout.cell(top_id)
    
    pt = []
    # filename = "test_poly.txt"
    filename = "hexagonaltiling.txt"
    
    f = File.foreach(filename) do |line|
    # puts line
    pt = line.split(" ").map(&:to_i)
    if pt[0] != 0
    hex = [RBA::Point::new(pt[1], pt[2]), RBA::Point::new(pt[3], pt[4]), RBA::Point::new(pt[5], pt[6]),RBA::Point::new(pt[7], pt[8]), RBA::Point::new(pt[9], pt[10]), RBA::Point::new(pt[11],        pt[12])]
    top.shapes(layer[pt[0]]).insert(RBA::SimplePolygon::new(hex))
    end
    end
    
    
    # select the top cell in the view, set up the view's layer list and
    # fit the viewport to the extensions of our layout
    layout_view.select_cell(top.cell_index, 0)
    layout_view.add_missing_layers
    layout_view.remove_unused_layers
    layout_view.zoom_fit
    
    layout.write("final.dxf")
    
    end
    

    Thanks for any help!

    • CommentAuthorMatthias
    • CommentTimeJan 4th 2017
     

    Hi,

    the script doesn't look bad, but the third dimension simply isn't accessible in KLayout. By tweaking the DXF writer you basically could make it emit z coordinates, but right now that's not more than a hack. Maybe there are reasonable applications if you combine that with an extrusion vector. In that case, the DXF file could be made to look like a simple model of the material stack. Is that what you want to achieve?

    The second question sounds a bit strange and I'm somewhat confused. "Masks" are basically layers, but since you use layers for the z direction I guess you want to use cells for "masks", right? Cells are basically stacks of layers, but they share the same layers.

    Matthias

    • CommentAuthorjmk1729
    • CommentTimeJan 4th 2017
     

    Hi Matthias,

    Yes I suppose a simple model of the material stack is what I am after. I think this may be more of a job for a program like Solidworks from your answer. In either case, these are meant to be photomasks, so height doesn't matter for their original intent.

    Right, the way I encode the layers I'm treating them as different heights. I could merge each individual mask I create into one layer, then load the separate layers (now masks) and shift them around like that. Alternatively I could just build the text files to only contain the coordinates for hexagons I care about and not split the masks into layers in the first place; I was using layers conceptually to understand the etches I want to make using each mask.

    To elaborate on what you're asking, I was thinking of calling each mask a cell yes, but I think unless I add in each mask as a distinct set of layers, that's not an efficient way to approach the problem of loading in all the masks into one layout and moving them around.

    Thanks,

    jmk1729

    • CommentAuthorMatthias
    • CommentTimeJan 7th 2017
     

    Hi,

    If I understand you correctly, you are looking for a way to represent the 3d topography with layers (creating z bins). That's a valid approach and of course you can use cells to cluster the layers. By convention, you will then have just those layers which belong to you mask inside one cell even if the concept of cells/layers will allow more.

    I'd suggest to use layers/datatypes for name the mask (layer) and z bin (datatype). Conceptually there is no difference, but that makes organizing the layers somewhat easier.

    Coming back to the original question: is there any specific topic you need help with scripting?

    Matthias

    • CommentAuthorjmk1729
    • CommentTimeJan 9th 2017
     

    Hi Matthias,

    What is the definition of a datatype? How would you modify the code to create layers and datatypes as you suggest?

    • CommentAuthorMatthias
    • CommentTimeJan 9th 2017
     

    Hi,

    the datatype number is the second parameter to RBA::LayerInfo::new. It's basically some kind of sub-layer, although they don't really form a hierarchy in that sense. Using datatypes just simplifies the management of layers somewhat.

    Matthias

    • CommentAuthorjmk1729
    • CommentTimeJan 12th 2017
     

    Hi Matthias,

    Another related question if you don't mind: I made the tiling all into one layer, but had problems porting it into Solidworks because of the individual hexagon borders. I used the merge feature in KLayout to merge all the regions together, but it left horizontal lines running left to right everywhere there was the start of a new open area, i.e. lack of a layer. Do you know what I'm talking about? What are those lines, and can I get rid of them somehow?

    • CommentAuthorMatthias
    • CommentTimeJan 15th 2017 edited
     

    Hi,

    These lines a lines connection holes with the outside hull of polygons.

    In other formats such as GDS2, there are no polygons with holes. Hence, KLayout will create these connection lines to turn polygons with holes into ones without holes.

    It does so even for DXF for no specific reason, but DXF also isn't the primary target format. It's basically possible to output polygons without these construction lines, but there is no option to enable this behaviour yet.

    Matthias