Issues with batch mode of XSection after update 1.4 -> 1.7

Previously made as issue in XSection github: https://github.com/klayoutmatthias/xsection/issues/29 Apologies if posted in the wrong category.

When updating XSection plug-in from 1.4 to 1.7, our scripts that call XSection in batch mode have stopped working. I am unsure on whether this is a genuine bug or there is another expectation on how XSection should be called from the command line.

We call some form of the following through the command line or terminal session:

klayout_app.exe <PATH_TO_INPUT_GEOMETRY> -nc -rx -r <PATH_TO_KLAYOUT>/salt/xsection/macros/xsection.lym -rd xs_run=<PATH_TO_PROCESS_FILE> -rd xs_cut=0.0,150.0;0.0,-150.0 -rd xs_out=<PATH_TO_OUTPUT>

In 1.4 this worked fine, starting from 1.7 the error is:

RuntimeError: Unexpected object type (expected argument of class DPoint, got Array) for argument #1 ('dpoint') in Point::from_dpoint
in C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:33
  C:/Users/PavelSmirnov/KLayout/salt/xsection/ruby/xsection_script.rb:263:in `rescue in run_script'
  C:/Users/PavelSmirnov/KLayout/salt/xsection/ruby/xsection_script.rb:180:in `run_script'
  C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:33:in `<module:XS>'
  C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:15:in `<main>'

Is the argument xs_cut defined in a wrong way here? In the changelog it looks like the definition of "cuts" was made more flexible to support multiple cuts within the same call.

Our workaround currently is to modify the XSection code in file KLayout/salt/xsetion/ruby/xsection.rb

        if p1 && p2

          # take the given line
          pts << [[[ p1, p2 ]]]

        else

to

        if p1 && p2

          # take the given line
          pts << [[ p1, p2 ]]

        else

Comments

  • Hi @PavelSmirnov,

    Sorry for missing the issue in the XSection repo. I am not really active there - I personally consider the XSection thing some toy tool. It is hard to believe what people actually use it for.

    But you're right. Batch mode needs the change you proposed. I will take care of that issue in the XSection project.

    Matthias

  • Thank you! On the long term we have plans to implement XSection features natively in our project, so no need to feel obligated to maintain XSection on our account :D

  • Very good :)

    I have released version 1.8 for the benefit of other users. But I have also frozen development except for maintenance. The project feels like having opened Pandora's Box.

    I wish you better luck with your implementation :)

    Matthias

  • Hi Matthias!

    It seems that release 1.8 doesn't have diffs compared to release 1.7 https://github.com/klayoutmatthias/xsection/compare/1.7...1.8

    Latest commit for master branch is still just the release 1.7 commit from 7 months ago.

    I still get an error when using the command mentioned at the beginning of the thread, though the error is a bit different now:

    RuntimeError: No constructor of DPoint available that takes 2000 arguments (implicit call from tuple) for argument #1 ('dpoint') in Point::from_dpoint
    in C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:33
      C:/Users/PavelSmirnov/KLayout/salt/xsection/ruby/xsection_script.rb:263:in `rescue in run_script'
      C:/Users/PavelSmirnov/KLayout/salt/xsection/ruby/xsection_script.rb:180:in `run_script'
      C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:33:in `<module:XS>'
      C:\\Users\\PavelSmirnov\\KLayout\\salt/xsection/macros/xsection.lym:15:in `<main>'
    

    Did some debugging, at setup function for xsection_generator.rb when it does pts.each do |p1,p2| loop, it seems to cast p1 as a tuple of two DPoints, and cast p2 as an empty tuple.

    I suspect that accidentally the commit was left unpushed, so release 1.8 turned out to be identical to 1.7. In which case if the intended fix in the unpushed commit did address the problem identified above, then hopefully 1.8 can be rereleased quite easily.

    Our workaround still works for us, so there is absolutely no hurry with this :)

    Best,
    -Pavel

  • edited April 29

    Hi @PavelSmirnov,

    yes, you're right. Push failed because of an outdated token :(

    I have fixed that. You need to uninstall and re-install the package.

    Best regards and thanks for the notice,

    Matthias

  • Tested now and it works! Thank you for the fix!

  • Thanks for the patch and sorry for the hickup!

    Matthias

Sign In or Register to comment.