TAGGED: scripting-journaling-udf, structure-group
-
-
October 27, 2021 at 3:22 pmmwhitbySubscriber
I'm working on scripting a simulation. Within the structure group edit window there is a tab for Script. I would like to add script to that script tab within my master script for the program where the structure group is defined. I've tried just putting the script I want under the part where I define the structure group and the user properties with no set commands or anything, also I've tried putting set("script", the script that I want); under the part where I define the structure group and the user properties. I have construction group selected in the code too.
October 28, 2021 at 1:05 amGuilin SunAnsys EmployeeUsually you can either directly modify an existing structure group, or write new script in the master file. Seldom people amend the script in the structure every time you run the master file. While it seems easier using scripting, I personally prefer to directly use/modify the structure group, manually check the material fittings and also make sure the structure is what you expect. There are chances that some structure/settings are not complete and it might be difficult to find the issue. When you have hundreds of line, maintaining it can also be challenge.
Please refer some examples:
addstructuregroup - Script command
adduserprop - Script command
Structure Groups - Simulation object
October 28, 2021 at 1:10 pmmwhitbySubscriberMy main goal is to script the whole program in the master file so that I can run it in a loop to update some parameters. I think I may need to put the script in the master file in order for the loops to run and update the structures with the new parameters each time (I have built in some ways to ensure the geometry is valid from the new parameters). If I wanted to do this how would I go about it?
Originally I tried:
addstructuregroup;
set("name","strt_wvg");
deleteall;
then posted all of my script here with no special anything.
However, after I ran the code and checked in the edit box I did not see the script there and I got errors from running the script. Then I tried to put the script into a set command but that didn't work either. Do you have any suggestions on how to get this to work? Thank you!
October 28, 2021 at 3:26 pmGuilin SunAnsys EmployeeUnfortunately 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.
October 29, 2021 at 3:21 pmmwhitbySubscriberThanks for your help!
Viewing 4 reply threads- The topic ‘How to add script to structure group in script’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Difference between answers in version 2024 and 2017 lumerical mode solution
- Errors Running Ring Modulator Example on Cluster
- INTERCONNECT – No results unless rerun simulation until it gives any
- Import material .txt file with script
- Trapezoidal ring
- Help for qINTERCONNECT
- Issues with getting result from interconnent analysis script
- Absorption cross-section of AuNR excited by prism-based TIR
- How to measure transmission coefficients on a given plane .
- Topology Optimization Error
Top Contributors-
1406
-
599
-
591
-
555
-
366
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-