Making a Box and Rotating It

edited July 2015 in Ruby Scripting
Hey Everyone,

Can somebody tell me how to rotate a box that I make by a certain angle? I have been looking through the documentation and I can't find anything. Thanks.

Comments

  • edited July 2015

    Shameless plug: Download The Red Toolbox, unzip it into your C:\Users\username\KLayout\macros folder (or equivalent on Linux), restart KLayout, select box, run The Red Toolbox menu > Selection > Rotate by angle (individually). Note that the result is a polygon (rotated boxes are not supported in GDS/OAS spec).

    Look at lines 61-82 of that code

    David

  • edited July 2015

    Hi Maximus (nice name, BTW),

    do you mean by script or manually?

    By script:

    RBA::Polygon::new(RBA::Box::new(left, bottom, right, top))
       .transformed(RBA::ICplxTrans::new(1.0, rotation_angle_in_degree, false, 0, 0))
    

    Manually: draw a box and rotate using "Edit/Selection/Rotate By Angle" or use David's toolbox as suggested

    Matthias

Sign In or Register to comment.