xsection icon indicating copy to clipboard operation
xsection copied to clipboard

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

Open qpavsmi opened this issue 1 year ago • 0 comments

I recently updated XSection from 1.4 to 1.7, and noticed that my scripts relying on calling xsection using batch mode stopped working :(

Boiling the issue down, basically I have this command I execute in terminal:

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>

This used to work before XSection update but now it halts with following error:

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>'

I'm not sure if this is a bug or there was a syntax change with how xs_cut should be stated. Reading up on changelog it seems that a feature was introduced to specify more than one two-point cut.

This is not blocking for me since I can get XSection working by editing editing the line 200 from 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

qpavsmi avatar Nov 02 '23 08:11 qpavsmi