concentric and discontinous lines

edited September 2017 in Ruby Scripting
I need to draw some discontinuous lines onto a circle (360°) from center of circle to diameter ( a little as sun )
lines have a thickness = l and lenght = L
theta is an input , and determines number of lines on 360°

discontinuous lines (= lines with space ) are an random function , not space at same place
may be space would be an % of lenght of line

do you have an idea to do this in ruby ?

or just for beginning , to create some random lines with space

thanks

Comments

  • edited November -1

    Hi,

    try this:

    ly = RBA::CellView::active.layout
    
    li = ly.layer(1, 0)  # or the layer you want to draw on
    
    n = 100     # number of rays
    rad = 1000  # radius database units
    width = 10  # width of rays in database units
    
    n.times do |i|
      a = i.to_f * Math::PI * 2.0 / n
      x1 = 0
      y1 = 0
      x2 = rad * Math.cos(a)
      y2 = rad * Math.sin(a)
      path = RBA::Path::new([ RBA::Point::new(x1, y1), RBA::Point::new(x2, y2) ], width)
      ly.top_cell.shapes(li).insert(path)
    end
    

    Matthias

  • edited November -1
    Hi mathias
    thanks , but the real pb for me is to do same thing with discontinuous lines in place of radius lines.
    or to had , in a second layer some random space ( or blank ) on previous lines to do discontinuous lines after boolean operation.

    and very important , blank ( or space ) on lines will be random from radius line.
    after , in my mind ; i will have choice to select number of blank ( or space or discontinuous area), for example 1 to 5 blank by radius line , and so , a % of lenght of radius line.
  • edited November -1

    Hi Phil,

    this is just a sample. Please adjust it to fit your requirements.

    Matthias

Sign In or Register to comment.