Constructing Setup/Analysis Script using script commands

structuregroup
analysisgroup
script
model

#1

Editing the Setup Script or Analysis Script in the GUI is easy. It is also possible to construct the Script by using script commands.

For example,
setnamed("structure_group","script","addpoly;addcircle;");
will add a polygon, and a circle to the structure group using the Script tab

Alternatively, users can make use of a text_file.txt (18 Bytes) to contain the script commands. For example,
setnamed("structure_group","script",read("text_file.txt"));
will load the script commands from the text file to the Script tab. Note, please make sure the text file is sitting in the current working directory. Enter ?pwd; in the Script Prompt to print the current working directory.

This process is similar in model, analysis group, and structure group. For example,
setnamed("::model","setup script","addpoly;addcircle;");


How to use script prompt to import scripts into Analysis Groups?
#2

In structure groups and analysis groups, you can also add variables in both setup and analysis scripts. What would be the format of the script command for that? For example, how can I add a variable for an input parameter in an analysis group, define its type, and assign a value to it?


#3

I think this is more towards a GUI feature that users can add parameter, assign value and so on. I am not aware of a script command that can thoroughly replace the GUI operations. Although, the set command can assign a value to an existing variable,
set("analysis_variable",3);
but I dont think it can add parameter, or change type.


How to add some parameters in the analysis by script
#4

I’ve found out that you can actually set up an analysis group (or structure group) using script! As @kchow mentioned above, it is possible to add script to the setup tab of structure group or analysis group and to the analysis tab of analysis groups. It is also possible to add parameters and results to these groups using the following commands.

adduserprop: This command can be used to add parameters to the setup portion of an analysis group or structure group. Follow the hyperlink for details.

addanalysisprop: This command can be used to add parameters to the analysis portion of an analysis group. Follow the hyperlink for details.

addanalysisresult: This command can be used to add parameters to the analysis portion of an analysis group. Follow the hyperlink for details.


#5

Is it possible make?
setnamed("structure_group","script","addpoly;set("name","poly");)


#6

Hi @garciapomar,

You can define the script for a structure group by using the command set/setnamed. The syntax is

setnamed(“structure_group_name”, “script”, script_string);

where ‘script_string’ is the string that you want to put in the script window. Please note that you cannot directly copy and paste the script you want in the window to the string variable, the string variable need to be in a string writing format (e.g., using ‘\n’ or ‘endl’ for a new line and so on). Also please make sure you check the ‘construction group’ box to include ‘deleteall’ at the beginning (or you could include it in the script itself).

I hope this could help. Let me know if you have any difficulties implementing this :slight_smile:


#7

Thank you, that works very well :slight_smile:


#8

A post was split to a new topic: How to build parametrized structure using a script?


#9

Hi, what would be the script command to enable “Construction group” in the Setup–>Script tab of an Analysis Group in FDTD? For a structure group, the command:

set(“construction group”,1);

works fine, but for an analysis group this command brings up an error. Is there a work-around?

Thanks,
Peter


#10

Hi. An easy workaround would be put a “deleteall” command at the beginning of the setup script. That is basically what the property of a construction group is.