Photonics

Photonics

Write multi line string

    • Hatef
      Subscriber

      Hi

      I'm writing a script to add a structure group and also configure the structure group using the scripting. Similar to the post here:

      https://support.lumerical.com/hc/en-us/articles/360034924093-addstructuregroup-Script-command

      In the above link there is a code (posted in following) where the script is created and passed to the structure group.

      myscript =      "addcircle; 
      ";
      myscript = myscript + "copy(1e-6); 
      ";
      myscript = myscript + "selectall; 
      ";
      myscript = myscript + "set("radius",radius);";
      set("script",myscript); 
      

      However, I'm wondering if there is a better way to set this script instead of writing "myscript = myscript + " ABC" "

      To be more clear I'm looking for something like following:

      myscript = begin{

      ABC;

      DEF;

      GHI;

      }end


      in both Matlab and Python such coding is possible. I believe there was another example on lumerical website where we write code to Model object using the way that I want; However, I cannot find it anymore.


      Would it be possible to help me?

      Thank you very much

    • Guilin Sun
      Ansys Employee
      I am not aware of the direct way you mentioned.
      The way to cascade "my script" is to have one script file, with "\" to separate lines.
      We have similar method to execute Matlab code in Lumerical script: https://support.lumerical.com/hc/en-us/articles/360034407974-matlab
      but not for groups. All online examples use the same method:
      adduserprop - Script command
      addstructuregroup - Script command
      runsetup - Script command

Viewing 1 reply thread
  • You must be logged in to reply to this topic.