-
-
August 11, 2021 at 6:41 pm
xuzhihe
SubscriberHello everyone,
I tried to sweep the parameters. I stored these parameters in my txt file. Is it possible to import these three parameters from my local txt file? Or I have to build my own API to import local parameters? Could anyone give me a hand? I really appreciate help and patience.?
August 12, 2021 at 7:16 pmKyle
Ansys Employee
You can import data from a text file into the Script Workspace as a matrix using the readdata command:
Once the data is in the Script Workspace it can be set as the parameters of the sweep using script commands. For information on creating script commands to create parameter sweeps please see:
I modified the script on that page to use values instead of ranges:
addsweep;
setsweep("sweep", "name", "thickness_sweep_script");
setsweep("thickness_sweep_script", "type", "Values");
setsweep("thickness_sweep_script", "number of points", 3);
thickness_matrix = linspace(0, 1e-6, 3);
para = struct;
para.Name = "thickness";
para.Parameter = "::model::AR structure::thickness";
para.Type = "Length";
para.Value_1 = thickness_matrix(1);
para.Value_2 = thickness_matrix(2);
para.Value_3 = thickness_matrix(3);
para.Units = "microns";
# add the parameter thickness to the sweep
addsweepparameter("thickness_sweep_script", para);
November 11, 2022 at 3:38 pmchatte29
SubscriberThis is not very clear. Where are we supposed to plug these values in?
Viewing 2 reply threads- The topic ‘Can I import parameters from txt file?’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
4838
-
1587
-
1386
-
1242
-
1021
Top Rated Tags© 2026 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.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.
