Ansys Learning Forum › Forums › Discuss Simulation › Photonics › How to add script to structure group in script › Reply To: How to add script to structure group in script
October 28, 2021 at 3:26 pm
Guilin Sun
Ansys Employee
Unfortunately it does not work that way. Please refer the links above. For example, the script inside the group should be "myscript" like this
addstructuregroup;
adduserprop("radius",2,0.5e-6);
myscript = "addcircle; \n";
myscript = myscript + "copy(1e-6); \n";
myscript = myscript + "selectall; \n";
myscript = myscript + "set(\"radius\",radius);";
set("name","dimer");
set("script",myscript);
If you only need to change some parameters in the structure group, it might be better to directly access such parameters directly using the master script, for well established groups. For example:
setnamed("mygroup","parameter_name",parameter_value)
In addition, you may need to get more information for the existing groups.
addstructuregroup;
adduserprop("radius",2,0.5e-6);
myscript = "addcircle; \n";
myscript = myscript + "copy(1e-6); \n";
myscript = myscript + "selectall; \n";
myscript = myscript + "set(\"radius\",radius);";
set("name","dimer");
set("script",myscript);
If you only need to change some parameters in the structure group, it might be better to directly access such parameters directly using the master script, for well established groups. For example:
setnamed("mygroup","parameter_name",parameter_value)
In addition, you may need to get more information for the existing groups.