"Trans::new" "no implicit conversion"

Trying to run .rb script:

trans = Trans::new(Trans::R270, false, 0, 0)

returns error "no implicit conversion for RBA::Trans into Integer (Class TyperError)"

Klayout version = 0.25.5
Ruby interpreter 2.4.0-p0 (x64-mingw32)

Has anyone come across this error before?

Comments

  • The rotation is expressed in units of 90 degrees (see doc), so in Python this works:

    trans = klayout.db.Trans(270, False, 0, 0)
    

    which means that in Ruby this should work:

    trans = Trans::new(270, false, 0, 0)
    

    Cheers, Erwin

  • edited October 2018

    Hi Erwin,

    thanks for answering, and I'm a bit sorry I have to correct you ...

    By "in units of 90 degree" I meant that 0 = 0, 1 = 90, 2 = 180 and 3 = 270. Maybe the description is kind of misleading.

    So 270 degree are actually:

    pya.Trans(3, False, 0, 0)
    

    It gets a bit more confusing when you switch to complex transformations with an arbitrary angle. For those it's really degree, so the equivalent of 270 degree as integer-to-integer complex transformations is:

    pya.ICplxTrans(1.0, 270, False, 0, 0)
    

    The error above actually happens only because Trans.R270 already is a Trans object representing a 270 degree rotation. So the answer simply is:

    trans = pya.Trans.R270
    

    or in Ruby:

    trans = RBA::Trans::R270
    

    Kind regards,

    Matthias

  • Hi Matthias, thanks for the correction. Best regards, Erwin

Sign In or Register to comment.