#include "AllHead.h"
#include "LAMP_ScatterSettingClass.h"


LAMP_ScatterSettingClass::LAMP_ScatterSettingClass(QWidget* parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	this->setWindowTitle(u8"散射仪器仿真设置界面");
	this->settingobj = new LAMP_ScatterSettingXmlClass;
	this->myContext = nullptr;
	QDoubleValidator* doubleValidator = new QDoubleValidator;
	this->ui.lineEdit_A1_incAngle->setValidator(doubleValidator);
	this->ui.lineEdit_A2_incAngle->setValidator(doubleValidator);
	this->ui.checkBox_A1->setChecked(true);
	this->ui.checkBox_A2->setChecked(true);

	this->ui.radioButton_nearfield->setVisible(false);
	this->ui.radioButton_nearfield->setChecked(false);
	this->ui.radioButton_nearfield->setEnabled(false);

	this->ui.radioButton_farfield->setCheckable(true);

	this->ui.radioButton_S1	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S3	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S5	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S8	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S10 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S12 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F1	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F2	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F3	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F4	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F5	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F6	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F7	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F8	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F9	 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F10 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F11 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F12 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
 
}

LAMP_ScatterSettingClass::~LAMP_ScatterSettingClass()
{}

void LAMP_ScatterSettingClass::loadxml(QString xmlpath)
{
	this->ui.lineEdit_xmlpath->setText(xmlpath);
	this->xmlpath = xmlpath;
	this->workpsace = getParantFromPath(xmlpath);
	this->settingobj->loadxml(xmlpath);
	this->renderSettingObj();

}

void LAMP_ScatterSettingClass::savexml()
{
	this->sycnSettingObj();
	if (this->xmlpath.isEmpty()) { 
		QString xmlpath=getSaveFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)");
		if (xmlpath.isEmpty()) {
			return;
		}
		else {
			this->xmlpath = xmlpath;
			this->workpsace = getParantFromPath(xmlpath);
		}
	}
	this->settingobj->savexml(this->xmlpath);
}

void LAMP_ScatterSettingClass::renderSettingObj()
{

	this->ui.checkBox_A1->setChecked(this->settingobj->A1);
	this->ui.checkBox_A2->setChecked(this->settingobj->A2);
	this->ui.lineEdit_A1_incAngle->setText(QString::number(this->settingobj->incidence_A1));
	this->ui.lineEdit_A2_incAngle->setText(QString::number(this->settingobj->incidence_A2));


	this->ui.checkBox_AllScatter->setChecked(this->settingobj->enableScatter);
	this->ui.radioButton_S1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F2->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F4->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F6->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F7->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F9->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F11->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F12->setEnabled(this->ui.checkBox_AllScatter->isChecked());


	this->ui.radioButton_S1->setChecked(this->settingobj->S1);
	this->ui.radioButton_S3->setChecked(this->settingobj->S3);
	this->ui.radioButton_S5->setChecked(this->settingobj->S5);
	this->ui.radioButton_S8->setChecked(this->settingobj->S8);
	this->ui.radioButton_S10->setChecked(this->settingobj->S10);
	this->ui.radioButton_S12->setChecked(this->settingobj->S12);
	this->ui.radioButton_F1->setChecked(this->settingobj->F1);
	this->ui.radioButton_F2->setChecked(this->settingobj->F2);
	this->ui.radioButton_F3->setChecked(this->settingobj->F3);
	this->ui.radioButton_F4->setChecked(this->settingobj->F4);
	this->ui.radioButton_F5->setChecked(this->settingobj->F5);
	this->ui.radioButton_F6->setChecked(this->settingobj->F6);
	this->ui.radioButton_F7->setChecked(this->settingobj->F7);
	this->ui.radioButton_F8->setChecked(this->settingobj->F8);
	this->ui.radioButton_F9->setChecked(this->settingobj->F9);
	this->ui.radioButton_F10->setChecked(this->settingobj->F10);
	this->ui.radioButton_F11->setChecked(this->settingobj->F11);
	this->ui.radioButton_F12->setChecked(this->settingobj->F12);

	this->ui.lineEdit_startFreq->setText(QString::number(this->settingobj->startfre));
	this->ui.lineEdit_endfreq->setText(QString::number(this->settingobj->endfre));
	this->ui.lineEdit_freqPoints->setText(QString::number(this->settingobj->freponts));
	this->ui.radioButton_farfield->setChecked(this->settingobj->farfield);
	this->ui.radioButton_nearfield->setChecked(this->settingobj->nearfield);
	this->ui.lineEdit_TaskName->setText(this->settingobj->taskName);
	this->ui.lineEdit_xmlpath->setText(this->xmlpath);


}

void LAMP_ScatterSettingClass::sycnSettingObj()
{
	//renderSettingObj 函数的关系，使用界面控件值，更新 settingobj 的值
	this->settingobj->A1 = this->ui.checkBox_A1->isChecked();
	this->settingobj->A2 = this->ui.checkBox_A2->isChecked();
	this->settingobj->incidence_A1 = this->ui.lineEdit_A1_incAngle->text().toDouble();
	this->settingobj->incidence_A2 = this->ui.lineEdit_A2_incAngle->text().toDouble();

	this->settingobj->enableScatter = this->ui.checkBox_AllScatter->isChecked();
	this->settingobj->S1 = this->ui.radioButton_S1->isChecked();
	this->settingobj->S3 = this->ui.radioButton_S3->isChecked();
	this->settingobj->S5 = this->ui.radioButton_S5->isChecked();
	this->settingobj->S8 = this->ui.radioButton_S8->isChecked();
	this->settingobj->S10 = this->ui.radioButton_S10->isChecked();
	this->settingobj->S12 = this->ui.radioButton_S12->isChecked();
	this->settingobj->F1 = this->ui.radioButton_F1->isChecked();
	this->settingobj->F2 = this->ui.radioButton_F2->isChecked();
	this->settingobj->F3 = this->ui.radioButton_F3->isChecked();
	this->settingobj->F4 = this->ui.radioButton_F4->isChecked();
	this->settingobj->F5 = this->ui.radioButton_F5->isChecked();
	this->settingobj->F6 = this->ui.radioButton_F6->isChecked();
	this->settingobj->F7 = this->ui.radioButton_F7->isChecked();
	this->settingobj->F8 = this->ui.radioButton_F8->isChecked();
	this->settingobj->F9 = this->ui.radioButton_F9->isChecked();
	this->settingobj->F10 = this->ui.radioButton_F10->isChecked();
	this->settingobj->F11 = this->ui.radioButton_F11->isChecked();
	this->settingobj->F12 = this->ui.radioButton_F12->isChecked();

	this->settingobj->startfre = this->ui.lineEdit_startFreq->text().toDouble();
	this->settingobj->endfre = this->ui.lineEdit_endfreq->text().toDouble();
	this->settingobj->freponts = this->ui.lineEdit_freqPoints->text().toDouble();
	this->settingobj->farfield = this->ui.radioButton_farfield->isChecked();
	this->settingobj->nearfield = this->ui.radioButton_nearfield->isChecked();
 
	this->settingobj->taskName = this->ui.lineEdit_TaskName->text();




}

void LAMP_ScatterSettingClass::createAntModel()
{
	// 分块计算
	for (map<std::string, SphericalCoordinates>::iterator iter = AntSettingdict.begin(); iter != AntSettingdict.end(); ++iter) {
		std::string k = iter->first;
		SphericalCoordinates sp = iter->second;
		sp.phi = sp.phi * M_PI / 180;
		sp.theta = sp.theta * M_PI / 180;
		CartesianCoordinates cp = sphericalToCartesian(sp);
		TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
		TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
		Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);

		DataAISMap[k] = shape_ais;
	}
}

void LAMP_ScatterSettingClass::initAntModelSettingParams()
{
	QString fileName = QCoreApplication::applicationDirPath() + "/ScattingAntParams/ScatteringAntSetting.ini"; // 散射模型设置
	QSettings* setting = new QSettings(fileName, QSettings::IniFormat);
	setting->setIniCodec(QTextCodec::codecForName("UTF-8"));

	if (QFile::exists(fileName))
	{

	}
	else {
		setting->setValue("CoordinateSystemName", u8"Spheric(R,theta,phi)");
		setting->setValue("description", u8"R：半径，theta 入射角，phi 方位角");
		// 天线坐标
		// A1 ,A2    S1 S3 S5 S8 S10 S12 F1  F2 F3 F4 F5 F6 F7 F8 F9 F10  F11 F12
		setting->setValue("A1", u8"9.3,90,0");
		setting->setValue("A2", u8"9.3,90,180");
		setting->setValue("S1", u8"9.3,45,14");
		setting->setValue("S3", u8"9.3,45,45");
		setting->setValue("S5", u8"9.3,45,60");
		setting->setValue("S8", u8"9.3,45,120");
		setting->setValue("S10", u8"9.3,45,135");
		setting->setValue("S12", u8"9.3,45,166");
		setting->setValue("F1", u8"9.3,75,15");
		setting->setValue("F2", u8"9.3,75,30");
		setting->setValue("F3", u8"9.3,75,45");
		setting->setValue("F4", u8"9.3,75,60");
		setting->setValue("F5", u8"9.3,75,75");
		setting->setValue("F6", u8"9.3,75,86");
		setting->setValue("F7", u8"9.3,75,94");
		setting->setValue("F8", u8"9.3,75,105");
		setting->setValue("F9", u8"9.3,75,120");
		setting->setValue("F10", u8"9.3,75,135");
		setting->setValue("F11", u8"9.3,75,151");
		setting->setValue("F12", u8"9.3,75,165");

		//  A1,A2, 为 S1 S3 S5 S8 S10 S12 F1  F2 F3 F4 F5 F6 F7 F8 F9 F10  F11 F12  的雷达辐射方向图仿真模型
		setting->setValue("ant_A1", u8"A1_ant.ffe");
		setting->setValue("ant_A2", u8"A2_ant.ffe");
		setting->setValue("ant_S1", u8"S1_ant.ffe");
		setting->setValue("ant_S3", u8"S3_ant.ffe");
		setting->setValue("ant_S5", u8"S5_ant.ffe");
		setting->setValue("ant_S8", u8"S8_ant.ffe");
		setting->setValue("ant_S10", u8"S10_ant.ffe");
		setting->setValue("ant_S12", u8"S12_ant.ffe");
		setting->setValue("ant_F1", u8"F1_ant.ffe");
		setting->setValue("ant_F2", u8"F2_ant.ffe");
		setting->setValue("ant_F3", u8"F3_ant.ffe");
		setting->setValue("ant_F4", u8"F4_ant.ffe");
		setting->setValue("ant_F5", u8"F5_ant.ffe");
		setting->setValue("ant_F6", u8"F6_ant.ffe");
		setting->setValue("ant_F7", u8"F7_ant.ffe");
		setting->setValue("ant_F8", u8"F8_ant.ffe");
		setting->setValue("ant_F9", u8"F9_ant.ffe");
		setting->setValue("ant_F10", u8"F10_ant.ffe");
		setting->setValue("ant_F11", u8"F11_ant.ffe");
		setting->setValue("ant_F12", u8"F12_ant.ffe");
		setting->sync();
	}
	 
	// 重新加载配置向
	AntSettingdict["A1"] = antsettingstring2Spherical(setting->value("A1").toString());
	AntSettingdict["A2"] = antsettingstring2Spherical(setting->value("A2").toString());
	AntSettingdict["S1"] = antsettingstring2Spherical(setting->value("S1").toString());
	AntSettingdict["S3"] = antsettingstring2Spherical(setting->value("S3").toString());
	AntSettingdict["S5"] = antsettingstring2Spherical(setting->value("S5").toString());
	AntSettingdict["S8"] = antsettingstring2Spherical(setting->value("S8").toString());
	AntSettingdict["S10"] = antsettingstring2Spherical(setting->value("S10").toString());
	AntSettingdict["S12"] = antsettingstring2Spherical(setting->value("S12").toString());
	AntSettingdict["F1"] = antsettingstring2Spherical(setting->value("F1").toString());
	AntSettingdict["F2"] = antsettingstring2Spherical(setting->value("F2").toString());
	AntSettingdict["F3"] = antsettingstring2Spherical(setting->value("F3").toString());
	AntSettingdict["F4"] = antsettingstring2Spherical(setting->value("F4").toString());
	AntSettingdict["F5"] = antsettingstring2Spherical(setting->value("F5").toString());
	AntSettingdict["F6"] = antsettingstring2Spherical(setting->value("F6").toString());
	AntSettingdict["F7"] = antsettingstring2Spherical(setting->value("F7").toString());
	AntSettingdict["F8"] = antsettingstring2Spherical(setting->value("F8").toString());
	AntSettingdict["F9"] = antsettingstring2Spherical(setting->value("F9").toString());
	AntSettingdict["F10"] = antsettingstring2Spherical(setting->value("F10").toString());
	AntSettingdict["F11"] = antsettingstring2Spherical(setting->value("F11").toString());
	AntSettingdict["F12"] = antsettingstring2Spherical(setting->value("F12").toString());

	// 获取雷达的辐射仿真方向图，并加载到 AntffePathDict,
	AntffePathDict["A1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A1").toString();
	AntffePathDict["A2"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A2").toString();
	AntffePathDict["S1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S1").toString();
	AntffePathDict["S3"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S3").toString();
	AntffePathDict["S5"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S5").toString();
	AntffePathDict["S8"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S8").toString();
	AntffePathDict["S10"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S10").toString();
	AntffePathDict["S12"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S12").toString();
	AntffePathDict["F1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F1").toString();
	AntffePathDict["F2"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F2").toString();
	AntffePathDict["F3"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F3").toString();
	AntffePathDict["F4"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F4").toString();
	AntffePathDict["F5"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F5").toString();
	AntffePathDict["F6"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F6").toString();
	AntffePathDict["F7"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F7").toString();
	AntffePathDict["F8"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F8").toString();
	AntffePathDict["F9"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F9").toString();
	AntffePathDict["F10"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F10").toString();
	AntffePathDict["F11"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F11").toString();
	AntffePathDict["F12"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_F12").toString(); 
}

void LAMP_ScatterSettingClass::closeWindows()
{


	for (map<std::string, Handle(AIS_InteractiveObject)>::iterator iter = DataAISMap.begin(); iter != DataAISMap.end(); ++iter) {
		this->myContext->Erase(iter->second, Standard_True);
		this->myContext->Remove(iter->second, Standard_True);
	}
	this->close();
}

void LAMP_ScatterSettingClass::setDocument3d(Handle(AIS_InteractiveContext) myContext)
{
	this->myContext = myContext;
	this->initAntModelSettingParams();
	this->createAntModel();
	this->myContext->Display(DataAISMap["A1"],Standard_True);
	this->myContext->Display(DataAISMap["A2"], Standard_True);
 
}

void LAMP_ScatterSettingClass::createFEKOLua()
{
	// 展示计算
	QProgressDialog progressDialog(u8"创建脚本..", u8"终止", 0, AntSettingdict.size() * 2);
	progressDialog.setWindowTitle(u8"成像中");
	progressDialog.setWindowModality(Qt::WindowModal);
	progressDialog.setAutoClose(true);
	progressDialog.setValue(0);
	progressDialog.setMinimum(0);
	progressDialog.show();


	this->sycnSettingObj();
	std::map<QString, QString> antfarfiledatastr;
	if (isExists(this->workpsace)) {
		// 复制天线方向图
		for (map<std::string, QString>::iterator iter = AntffePathDict.begin(); iter != AntffePathDict.end(); ++iter) {
			QString sourcepath = iter->second;
			QString desPath= this->workpsace + u8"/" + getFileNameFromPath(sourcepath);
			copyFile(sourcepath, desPath); 
			progressDialog.setWindowTitle(u8"解析仿真天线方向图.....");
			FEKOBase::FEKOFarFieldFileClass temp;
			temp.parseFarFieldFile(desPath);
			if (temp.dataBlockList.count() == 0) {
				QMessageBox::warning(nullptr, u8"警告", u8"ffe文件解析失败，请检查文件格式是否正确！");
			}
			size_t thetapoints = temp.dataBlockList[0].thetaSamples;
			size_t phipoints = temp.dataBlockList[0].phiSamples;
			antfarfiledatastr[QString::fromStdString(iter->first)] = QString(u8"%1_farfieldData = project.FieldDataList:AddFarFieldData(\"%1\",%2,%3)")
				.arg(getFileNameFromPath(sourcepath))
				.arg(QString::number(thetapoints))
				.arg(QString::number(phipoints));
			progressDialog.setValue(progressDialog.value() + 1);
		}
	}
	else {
		this->savexml();
		if (isExists(this->workpsace)) {}
		else { return; }
	}
	


	// 创建脚本
	QString luascript = QString(u8"--- create feko task :%1\n--- mode:Scatter\n\n").arg(this->settingobj->taskName);
	luascript = luascript + QString(u8"-- create strip pulse \n");
	luascript = luascript + QString(u8"-- LAMP \n\n");
	luascript = luascript + QString(u8"-- warning:the configure's number of a feko project should be less than 600. if greater than 600,the program will very slow\n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"app=cf.GetApplication()\n");
	luascript = luascript + QString(u8"project=app.Project  --- get current project\n");
	
	if (this->settingobj->nearfield) { // 构建天线方向图
		for (map<QString, QString>::iterator iter = antfarfiledatastr.begin(); iter != antfarfiledatastr.end(); ++iter) {
			luascript = luascript + iter->second;
			luascript = luascript + QString(u8"\n");
		}
	}
	else {}
 	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"--const values\n");
	luascript = luascript + QString(u8"local pi=3.141592653589793238462643383279\n");
	luascript = luascript + QString(u8"local r2d=180.0/pi;\n");
	luascript = luascript + QString(u8"local d2r=pi/180.0;\n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"--  varables \n");
	luascript = luascript + QString(u8"\n");
	luascript = luascript + QString(u8"\n");
	// 设置频率
	luascript = luascript + QString(u8"local f1=%1  -- start freq\n").arg(QString::number(this->settingobj->startfre * 1e9));
	luascript = luascript + QString(u8"local f2=%2 -- end freq\n").arg(QString::number(this->settingobj->endfre * 1e9));
	luascript = luascript + QString(u8"local freq_num=%3 -- freq point \n").arg(QString::number(this->settingobj->freponts));
	luascript = luascript + QString(u8"\n");
	// 创建configuration
	luascript = luascript + QString(u8"temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n");
	luascript = luascript + QString(u8"temp_standardConfiguration.Label=\"ScatterFEKOSetting\" -- set standardConfiguration label  PRF Count\n");
	luascript = luascript + QString(u8"--- set frequency\n"); // 设置频率
	luascript = luascript + QString(u8"frequencyRange=temp_standardConfiguration.Frequency\n");
	luascript = luascript + QString(u8"properties = frequencyRange:GetProperties()\n");
	luascript = luascript + QString(u8"properties.RangeType = cf.Enums.FrequencyRangeTypeEnum.LinearSpacedDiscrete\n");
	luascript = luascript + QString(u8"properties.Start = f1 -- start\n");
	luascript = luascript + QString(u8"properties.End=f2 --end \n");
	luascript = luascript + QString(u8"properties.NumberOfDiscreteValues=freq_num -- freq_num\n");
	luascript = luascript + QString(u8"frequencyRange:SetProperties(properties)\n");
	if (this->settingobj->nearfield) { //近场
		if (this->settingobj->A1) {
			SphericalCoordinates p = AntSettingdict["A1"];
			CartesianCoordinates cp = sphericalToCartesian(p);
			luascript = luascript + QString(u8"-- set Source\n");
			luascript = luascript + QString(u8"A1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A1_farfieldData)\n"); // 设置发射源
			luascript = luascript + QString(u8"A1_farFieldSource.Label=\"A1\"\n");
			luascript = luascript + QString(u8"A1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
			luascript = luascript + QString(u8"A1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
			luascript = luascript + QString(u8"A1_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
			luascript = luascript + QString(u8"A1_farFieldSource.Theta=%1\n").arg(QString::number(180-p.theta));
			luascript = luascript + QString(u8"A1_farFieldSource.Phi=%1\n").arg(QString::number(180+p.phi));
			luascript = luascript + QString(u8"A1_farFieldSource_workplane=A1_farFieldSource.LocalWorkplane\n");
			luascript = luascript + QString(u8"A1_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
			luascript = luascript + QString(u8"A1_farFieldSource_workplane.Origin.Y=0\n");
			luascript = luascript + QString(u8"A1_farFieldSource_workplane.Origin.Z=0    \n");
			luascript = luascript + QString(u8"\n");
			luascript = luascript + QString(u8"-- set nearfield\n");
			luascript = luascript + QString(u8"A1_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
																																								.arg(QString::number(p.theta))
																																								.arg(QString::number(p.phi))
																																								.arg(QString::number(0))
																																								.arg(QString::number(p.theta))
																																								.arg(QString::number(p.phi)); // 设置接收点
			luascript = luascript + QString(u8"A1_nearFieldRequest.Label=\"A1\"\n");
			luascript = luascript + QString(u8"A1_nearFieldRequest_workplane=A1_nearFieldRequest.LocalWorkplane\n");
			luascript = luascript + QString(u8"A1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
			luascript = luascript + QString(u8"A1_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
			luascript = luascript + QString(u8"A1_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
			luascript = luascript + QString(u8"A1_nearfieldAdvance=A1_nearFieldRequest.Advanced\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.CalculateElectricFields=true\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.CalculateMagneticFields=true\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
			luascript = luascript + QString(u8"A1_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
			luascript = luascript + QString(u8"\n");
		
		
		}
		else {}
		if (this->settingobj->A2) {
			SphericalCoordinates p = AntSettingdict["A2"];
			CartesianCoordinates cp = sphericalToCartesian(p);
			luascript = luascript + QString(u8"-- set Source\n");
			luascript = luascript + QString(u8"A2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A2_farfieldData)\n"); // 设置发射源
			luascript = luascript + QString(u8"A2_farFieldSource.Label=\"A2\"\n");
			luascript = luascript + QString(u8"A2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
			luascript = luascript + QString(u8"A2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
			luascript = luascript + QString(u8"A2_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
			luascript = luascript + QString(u8"A2_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
			luascript = luascript + QString(u8"A2_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
			luascript = luascript + QString(u8"A2_farFieldSource_workplane=A2_farFieldSource.LocalWorkplane\n");
			luascript = luascript + QString(u8"A2_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
			luascript = luascript + QString(u8"A2_farFieldSource_workplane.Origin.Y=0\n");
			luascript = luascript + QString(u8"A2_farFieldSource_workplane.Origin.Z=0    \n");
			luascript = luascript + QString(u8"\n");
			luascript = luascript + QString(u8"-- set nearfield\n");
			luascript = luascript + QString(u8"A2_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
				.arg(QString::number(p.theta))
				.arg(QString::number(p.phi))
				.arg(QString::number(0))
				.arg(QString::number(p.theta))
				.arg(QString::number(p.phi)); // 设置接收点
			luascript = luascript + QString(u8"A2_nearFieldRequest.Label=\"A2\"\n");
			luascript = luascript + QString(u8"A2_nearFieldRequest_workplane=A2_nearFieldRequest.LocalWorkplane\n");
			luascript = luascript + QString(u8"A2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
			luascript = luascript + QString(u8"A2_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
			luascript = luascript + QString(u8"A2_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
			luascript = luascript + QString(u8"A2_nearfieldAdvance=A2_nearFieldRequest.Advanced\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.CalculateElectricFields=true\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.CalculateMagneticFields=true\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
			luascript = luascript + QString(u8"A2_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
			luascript = luascript + QString(u8"\n");


		}
		else {}
		if (this->settingobj->enableScatter) {
			if (this->settingobj->S1) {
				SphericalCoordinates p = AntSettingdict["S1"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S1_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S1_farFieldSource.Label=\"S1\"\n");
				luascript = luascript + QString(u8"S1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S1_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S1_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S1_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S1_farFieldSource_workplane=S1_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S1_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S1_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S1_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S1_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S1_nearFieldRequest.Label=\"S1\"\n");
				luascript = luascript + QString(u8"S1_nearFieldRequest_workplane=S1_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S1_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S1_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S1_nearfieldAdvance=S1_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S1_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			
			}
			else {}
			if (this->settingobj->S3) {
				SphericalCoordinates p = AntSettingdict["S3"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S3_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S3_farFieldSource.Label=\"S3\"\n");
				luascript = luascript + QString(u8"S3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S3_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S3_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S3_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S3_farFieldSource_workplane=S3_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S3_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S3_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S3_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S3_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S3_nearFieldRequest.Label=\"S3\"\n");
				luascript = luascript + QString(u8"S3_nearFieldRequest_workplane=S3_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S3_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S3_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S3_nearfieldAdvance=S3_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S3_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->S5) {
				SphericalCoordinates p = AntSettingdict["S5"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S5_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S5_farFieldSource.Label=\"S5\"\n");
				luascript = luascript + QString(u8"S5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S5_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S5_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S5_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S5_farFieldSource_workplane=S5_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S5_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S5_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S5_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S5_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S5_nearFieldRequest.Label=\"S5\"\n");
				luascript = luascript + QString(u8"S5_nearFieldRequest_workplane=S5_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S5_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S5_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S5_nearfieldAdvance=S5_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S5_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->S8) {
				SphericalCoordinates p = AntSettingdict["S8"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S8_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S8_farFieldSource.Label=\"S8\"\n");
				luascript = luascript + QString(u8"S8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S8_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S8_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S8_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S8_farFieldSource_workplane=S8_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S8_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S8_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S8_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S8_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S8_nearFieldRequest.Label=\"S8\"\n");
				luascript = luascript + QString(u8"S8_nearFieldRequest_workplane=S8_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S8_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S8_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S8_nearfieldAdvance=S8_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S8_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->S10) {
				SphericalCoordinates p = AntSettingdict["S10"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S10_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S10_farFieldSource.Label=\"S10\"\n");
				luascript = luascript + QString(u8"S10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S10_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S10_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S10_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S10_farFieldSource_workplane=S10_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S10_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S10_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S10_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S10_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S10_nearFieldRequest.Label=\"S10\"\n");
				luascript = luascript + QString(u8"S10_nearFieldRequest_workplane=S10_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S10_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S10_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S10_nearfieldAdvance=S10_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S10_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			
			}
			else {}
			if (this->settingobj->S12) {
				SphericalCoordinates p = AntSettingdict["S12"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"S12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S12_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"S12_farFieldSource.Label=\"S12\"\n");
				luascript = luascript + QString(u8"S12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S12_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S12_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"S12_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"S12_farFieldSource_workplane=S12_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"S12_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"S12_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"S12_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"S12_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"S12_nearFieldRequest.Label=\"S12\"\n");
				luascript = luascript + QString(u8"S12_nearFieldRequest_workplane=S12_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"S12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"S12_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"S12_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"S12_nearfieldAdvance=S12_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"S12_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F1) {
				SphericalCoordinates p = AntSettingdict["F1"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F1_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F1_farFieldSource.Label=\"F1\"\n");
				luascript = luascript + QString(u8"F1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F1_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F1_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F1_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F1_farFieldSource_workplane=F1_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F1_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F1_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F1_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F1_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F1_nearFieldRequest.Label=\"F1\"\n");
				luascript = luascript + QString(u8"F1_nearFieldRequest_workplane=F1_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F1_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F1_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F1_nearfieldAdvance=F1_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F1_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F2) {
				SphericalCoordinates p = AntSettingdict["F2"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F2_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F2_farFieldSource.Label=\"F2\"\n");
				luascript = luascript + QString(u8"F2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F2_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F2_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F2_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F2_farFieldSource_workplane=F2_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F2_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F2_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F2_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F2_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F2_nearFieldRequest.Label=\"F2\"\n");
				luascript = luascript + QString(u8"F2_nearFieldRequest_workplane=F2_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F2_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F2_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F2_nearfieldAdvance=F2_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F2_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F3) {
				SphericalCoordinates p = AntSettingdict["F3"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F3_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F3_farFieldSource.Label=\"F3\"\n");
				luascript = luascript + QString(u8"F3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F3_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F3_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F3_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F3_farFieldSource_workplane=F3_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F3_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F3_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F3_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F3_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F3_nearFieldRequest.Label=\"F3\"\n");
				luascript = luascript + QString(u8"F3_nearFieldRequest_workplane=F3_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F3_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F3_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F3_nearfieldAdvance=F3_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F3_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F4) {
				SphericalCoordinates p = AntSettingdict["F4"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F4_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F4_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F4_farFieldSource.Label=\"F4\"\n");
				luascript = luascript + QString(u8"F4_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F4_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F4_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F4_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F4_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F4_farFieldSource_workplane=F4_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F4_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F4_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F4_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F4_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F4_nearFieldRequest.Label=\"F4\"\n");
				luascript = luascript + QString(u8"F4_nearFieldRequest_workplane=F4_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F4_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F4_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F4_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F4_nearfieldAdvance=F4_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F4_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F5) {
				SphericalCoordinates p = AntSettingdict["F5"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F5_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F5_farFieldSource.Label=\"F5\"\n");
				luascript = luascript + QString(u8"F5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F5_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F5_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F5_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F5_farFieldSource_workplane=F5_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F5_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F5_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F5_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F5_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F5_nearFieldRequest.Label=\"F5\"\n");
				luascript = luascript + QString(u8"F5_nearFieldRequest_workplane=F5_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F5_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F5_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F5_nearfieldAdvance=F5_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F5_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F6) {
				SphericalCoordinates p = AntSettingdict["F6"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F6_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F6_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F6_farFieldSource.Label=\"F6\"\n");
				luascript = luascript + QString(u8"F6_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F6_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F6_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F6_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F6_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F6_farFieldSource_workplane=F6_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F6_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F6_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F6_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F6_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F6_nearFieldRequest.Label=\"F6\"\n");
				luascript = luascript + QString(u8"F6_nearFieldRequest_workplane=F6_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F6_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F6_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F6_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F6_nearfieldAdvance=F6_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F6_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F7) {
				SphericalCoordinates p = AntSettingdict["F7"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F7_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F7_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F7_farFieldSource.Label=\"F7\"\n");
				luascript = luascript + QString(u8"F7_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F7_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F7_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F7_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F7_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F7_farFieldSource_workplane=F7_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F7_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F7_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F7_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F7_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F7_nearFieldRequest.Label=\"F7\"\n");
				luascript = luascript + QString(u8"F7_nearFieldRequest_workplane=F7_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F7_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F7_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F7_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F7_nearfieldAdvance=F7_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F7_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F8) {
				SphericalCoordinates p = AntSettingdict["F8"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F8_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F8_farFieldSource.Label=\"F8\"\n");
				luascript = luascript + QString(u8"F8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F8_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F8_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F8_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F8_farFieldSource_workplane=F8_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F8_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F8_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F8_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F8_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F8_nearFieldRequest.Label=\"F8\"\n");
				luascript = luascript + QString(u8"F8_nearFieldRequest_workplane=F8_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F8_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F8_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F8_nearfieldAdvance=F8_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F8_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F9) {
				SphericalCoordinates p = AntSettingdict["F9"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F9_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F9_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F9_farFieldSource.Label=\"F9\"\n");
				luascript = luascript + QString(u8"F9_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F9_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F9_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F9_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F9_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F9_farFieldSource_workplane=F9_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F9_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F9_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F9_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F9_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F9_nearFieldRequest.Label=\"F9\"\n");
				luascript = luascript + QString(u8"F9_nearFieldRequest_workplane=F9_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F9_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F9_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F9_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F9_nearfieldAdvance=F9_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F9_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F10) {
				SphericalCoordinates p = AntSettingdict["F10"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F10_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F10_farFieldSource.Label=\"F10\"\n");
				luascript = luascript + QString(u8"F10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F10_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F10_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F10_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F10_farFieldSource_workplane=F10_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F10_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F10_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F10_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F10_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F10_nearFieldRequest.Label=\"F10\"\n");
				luascript = luascript + QString(u8"F10_nearFieldRequest_workplane=F10_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F10_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F10_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F10_nearfieldAdvance=F10_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F10_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F11) {
				SphericalCoordinates p = AntSettingdict["F11"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F11_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F11_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F11_farFieldSource.Label=\"F11\"\n");
				luascript = luascript + QString(u8"F11_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F11_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F11_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F11_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F11_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F11_farFieldSource_workplane=F11_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F11_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F11_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F11_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F11_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F11_nearFieldRequest.Label=\"F11\"\n");
				luascript = luascript + QString(u8"F11_nearFieldRequest_workplane=F11_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F11_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F11_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F11_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F11_nearfieldAdvance=F11_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F11_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F12) {
				SphericalCoordinates p = AntSettingdict["F12"];
				CartesianCoordinates cp = sphericalToCartesian(p);
				luascript = luascript + QString(u8"-- set Source\n");
				luascript = luascript + QString(u8"F12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F12_farfieldData)\n"); // 设置发射源
				luascript = luascript + QString(u8"F12_farFieldSource.Label=\"F12\"\n");
				luascript = luascript + QString(u8"F12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F12_farFieldSource.Position.N=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F12_farFieldSource.Theta=%1\n").arg(QString::number(180 - p.theta));
				luascript = luascript + QString(u8"F12_farFieldSource.Phi=%1\n").arg(QString::number(180 + p.phi));
				luascript = luascript + QString(u8"F12_farFieldSource_workplane=F12_farFieldSource.LocalWorkplane\n");
				luascript = luascript + QString(u8"F12_farFieldSource_workplane.Origin.X=0 -- move reference Point\n");
				luascript = luascript + QString(u8"F12_farFieldSource_workplane.Origin.Y=0\n");
				luascript = luascript + QString(u8"F12_farFieldSource_workplane.Origin.Z=0    \n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"-- set nearfield\n");
				luascript = luascript + QString(u8"F12_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi))
					.arg(QString::number(0))
					.arg(QString::number(p.theta))
					.arg(QString::number(p.phi)); // 设置接收点
				luascript = luascript + QString(u8"F12_nearFieldRequest.Label=\"F12\"\n");
				luascript = luascript + QString(u8"F12_nearFieldRequest_workplane=F12_nearFieldRequest.LocalWorkplane\n");
				luascript = luascript + QString(u8"F12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
				luascript = luascript + QString(u8"F12_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(cp.y));
				luascript = luascript + QString(u8"F12_nearFieldRequest_workplane.Origin.Z=%1\n").arg(QString::number(cp.z));
				luascript = luascript + QString(u8"F12_nearfieldAdvance=F12_nearFieldRequest.Advanced\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.CalculationType=cf.Enums.NearFieldCalculationTypeEnum.Fields\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.CalculateElectricFields=true\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.CalculateMagneticFields=true\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.ExportSettings.ASCIIEnabled=true\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.ExportSettings.OutFileEnabled=true\n");
				luascript = luascript + QString(u8"F12_nearfieldAdvance.OnlyScatteredPartCalculationEnabled=true    \n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
		}
		else {}

	}
	else {}
	if (this->settingobj->farfield) { // 远场

		if (this->settingobj->A1) {
			SphericalCoordinates p = AntSettingdict["A1"];
			luascript = luascript + QString(u8"A1_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p.theta)).arg(QString::number(p.phi));
			luascript = luascript + QString(u8"A1_temp_source.Label = \"%1\"\n").arg("A1");
			luascript = luascript + QString(u8"A1_temp_source.PolarisationAngle = 0\n");
			luascript = luascript + QString(u8"A1_temp_source_workplane = A1_temp_source.LocalWorkplane\n");
			luascript = luascript + QString(u8"A1_temp_source_workplane.Origin.X = 0\n");
			luascript = luascript + QString(u8"A1_temp_source_workplane.Origin.Y = 0\n");
			luascript = luascript + QString(u8"A1_temp_source_workplane.Origin.Z = 0\n");
			luascript = luascript + QString(u8"\n");

			luascript = luascript + QString(u8"A1_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
			luascript = luascript + QString(u8"A1_farFieldRequest.Label =\"%1\"\n").arg("A1");
			luascript = luascript + QString(u8"A1_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n");
			luascript = luascript + QString(u8"\n");
		}
		else {}
		if (this->settingobj->A2) {
			SphericalCoordinates p = AntSettingdict["A2"];
			luascript = luascript + QString(u8"A2_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p.theta)).arg(QString::number(p.phi));
			luascript = luascript + QString(u8"A2_temp_source.Label = \"%1\"\n").arg("A2");
			luascript = luascript + QString(u8"A2_temp_source.PolarisationAngle = 0\n");
			luascript = luascript + QString(u8"A2_temp_source_workplane = A2_temp_source.LocalWorkplane\n");
			luascript = luascript + QString(u8"A2_temp_source_workplane.Origin.X = 0\n");
			luascript = luascript + QString(u8"A2_temp_source_workplane.Origin.Y = 0\n");
			luascript = luascript + QString(u8"A2_temp_source_workplane.Origin.Z = 0\n");
			luascript = luascript + QString(u8"\n");

			luascript = luascript + QString(u8"A2_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
			luascript = luascript + QString(u8"A2_farFieldRequest.Label =\"%1\"\n").arg("A2");
			luascript = luascript + QString(u8"A2_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n");
			luascript = luascript + QString(u8"\n");
		}
		else {}
		if (this->settingobj->enableScatter) {
			if (this->settingobj->S1) {
				SphericalCoordinates p = AntSettingdict["S1"];
				luascript = luascript + QString(u8"S1_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p.theta)).arg(QString::number(p.phi));
				luascript = luascript + QString(u8"S1_temp_source.Label = \"%1\"\n").arg("S1");
				luascript = luascript + QString(u8"S1_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S1_temp_source_workplane = S1_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S1_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S1_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S1_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"S1_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S1_farFieldRequest.Label =\"%1\"\n").arg("S1");
				luascript = luascript + QString(u8"S1_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->S3) { // 仿照S1 ,构建 S3 的创建
				SphericalCoordinates p_S3 = AntSettingdict["S3"];
				luascript = luascript + QString(u8"S3_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S3.theta)).arg(QString::number(p_S3.phi));
				luascript = luascript + QString(u8"S3_temp_source.Label = \"%1\"\n").arg("S3");
				luascript = luascript + QString(u8"S3_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S3_temp_source_workplane = S3_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S3_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S3_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S3_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"S3_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S3_farFieldRequest.Label =\"%1\"\n").arg("S3");
				luascript = luascript + QString(u8"S3_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->S5) {
				SphericalCoordinates p_S5 = AntSettingdict["S5"];
				luascript = luascript + QString(u8"S5_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S5.theta)).arg(QString::number(p_S5.phi));
				luascript = luascript + QString(u8"S5_temp_source.Label = \"%1\"\n").arg("S5");
				luascript = luascript + QString(u8"S5_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S5_temp_source_workplane = S5_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S5_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S5_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S5_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"S5_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S5_farFieldRequest.Label =\"%1\"\n").arg("S5");
				luascript = luascript + QString(u8"S5_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->S8) {
				SphericalCoordinates p_S8 = AntSettingdict["S8"];
				luascript = luascript + QString(u8"S8_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S8.theta)).arg(QString::number(p_S8.phi));
				luascript = luascript + QString(u8"S8_temp_source.Label = \"%1\"\n").arg("S8");
				luascript = luascript + QString(u8"S8_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S8_temp_source_workplane = S8_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S8_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S8_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S8_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"S8_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S8_farFieldRequest.Label =\"%1\"\n").arg("S8");
				luascript = luascript + QString(u8"S8_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->S10) {
				SphericalCoordinates p_S10 = AntSettingdict["S10"];
				luascript = luascript + QString(u8"S10_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S10.theta)).arg(QString::number(p_S10.phi));
				luascript = luascript + QString(u8"S10_temp_source.Label = \"%1\"\n").arg("S10");
				luascript = luascript + QString(u8"S10_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S10_temp_source_workplane = S10_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S10_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S10_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S10_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"S10_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S10_farFieldRequest.Label =\"%1\"\n").arg("S10");
				luascript = luascript + QString(u8"S10_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->S12) {
				SphericalCoordinates p_S12 = AntSettingdict["S12"];
				luascript = luascript + QString(u8"S12_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S12.theta)).arg(QString::number(p_S12.phi));
				luascript = luascript + QString(u8"S12_temp_source.Label = \"%1\"\n").arg("S12");
				luascript = luascript + QString(u8"S12_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"S12_temp_source_workplane = S12_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"S12_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"S12_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"S12_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"S12_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"S12_farFieldRequest.Label =\"%1\"\n").arg("S12");
				luascript = luascript + QString(u8"S12_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->F1) {
				SphericalCoordinates p_F1 = AntSettingdict["F1"];
				luascript = luascript + QString(u8"F1_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F1.theta)).arg(QString::number(p_F1.phi));
				luascript = luascript + QString(u8"F1_temp_source.Label = \"%1\"\n").arg("F1");
				luascript = luascript + QString(u8"F1_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F1_temp_source_workplane = F1_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F1_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F1_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F1_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"F1_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F1_farFieldRequest.Label =\"%1\"\n").arg("F1");
				luascript = luascript + QString(u8"F1_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");
				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->F2) {
				SphericalCoordinates p_F2 = AntSettingdict["F2"];
				luascript = luascript + QString(u8"F2_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F2.theta)).arg(QString::number(p_F2.phi));
				luascript = luascript + QString(u8"F2_temp_source.Label = \"%1\"\n").arg("F2");
				luascript = luascript + QString(u8"F2_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F2_temp_source_workplane = F2_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F2_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F2_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F2_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"F2_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F2_farFieldRequest.Label =\"%1\"\n").arg("F2");
				luascript = luascript + QString(u8"F2_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->F3) {
				SphericalCoordinates p_F3 = AntSettingdict["F3"];
				luascript = luascript + QString(u8"F3_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F3.theta)).arg(QString::number(p_F3.phi));
				luascript = luascript + QString(u8"F3_temp_source.Label = \"%1\"\n").arg("F3");
				luascript = luascript + QString(u8"F3_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F3_temp_source_workplane = F3_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F3_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F3_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F3_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"F3_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F3_farFieldRequest.Label =\"%1\"\n").arg("F3");
				luascript = luascript + QString(u8"F3_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->F4) {
				SphericalCoordinates p_F4 = AntSettingdict["F4"];
				luascript = luascript + QString(u8"F4_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F4.theta)).arg(QString::number(p_F4.phi));
				luascript = luascript + QString(u8"F4_temp_source.Label = \"%1\"\n").arg("F4");
				luascript = luascript + QString(u8"F4_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F4_temp_source_workplane = F4_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F4_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F4_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F4_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"F4_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F4_farFieldRequest.Label =\"%1\"\n").arg("F4");
				luascript = luascript + QString(u8"F4_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");



				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F5) {
				SphericalCoordinates p_F5 = AntSettingdict["F5"];
				luascript = luascript + QString(u8"F5_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F5.theta)).arg(QString::number(p_F5.phi));
				luascript = luascript + QString(u8"F5_temp_source.Label = \"%1\"\n").arg("F5");
				luascript = luascript + QString(u8"F5_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F5_temp_source_workplane = F5_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F5_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F5_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F5_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F5_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F5_farFieldRequest.Label =\"%1\"\n").arg("F5");
				luascript = luascript + QString(u8"F5_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");

			}
			else {}
			if (this->settingobj->F6) {
				SphericalCoordinates p_F6 = AntSettingdict["F6"];
				luascript = luascript + QString(u8"F6_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F6.theta)).arg(QString::number(p_F6.phi));
				luascript = luascript + QString(u8"F6_temp_source.Label = \"%1\"\n").arg("F6");
				luascript = luascript + QString(u8"F6_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F6_temp_source_workplane = F6_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F6_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F6_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F6_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F6_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F6_farFieldRequest.Label =\"%1\"\n").arg("F6");
				luascript = luascript + QString(u8"F6_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F7) {
				SphericalCoordinates p_F7 = AntSettingdict["F7"];
				luascript = luascript + QString(u8"F7_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F7.theta)).arg(QString::number(p_F7.phi));
				luascript = luascript + QString(u8"F7_temp_source.Label = \"%1\"\n").arg("F7");
				luascript = luascript + QString(u8"F7_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F7_temp_source_workplane = F7_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F7_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F7_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F7_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F7_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F7_farFieldRequest.Label =\"%1\"\n").arg("F7");
				luascript = luascript + QString(u8"F7_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F8) {
				SphericalCoordinates p_F8 = AntSettingdict["F8"];
				luascript = luascript + QString(u8"F8_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F8.theta)).arg(QString::number(p_F8.phi));
				luascript = luascript + QString(u8"F8_temp_source.Label = \"%1\"\n").arg("F8");
				luascript = luascript + QString(u8"F8_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F8_temp_source_workplane = F8_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F8_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F8_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F8_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F8_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F8_farFieldRequest.Label =\"%1\"\n").arg("F8");
				luascript = luascript + QString(u8"F8_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F9) {
				SphericalCoordinates p_F9 = AntSettingdict["F9"];
				luascript = luascript + QString(u8"F9_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F9.theta)).arg(QString::number(p_F9.phi));
				luascript = luascript + QString(u8"F9_temp_source.Label = \"%1\"\n").arg("F9");
				luascript = luascript + QString(u8"F9_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F9_temp_source_workplane = F9_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F9_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F9_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F9_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F9_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F9_farFieldRequest.Label =\"%1\"\n").arg("F9");
				luascript = luascript + QString(u8"F9_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");
			}

			else {}
			if (this->settingobj->F10) {
				SphericalCoordinates p_F10 = AntSettingdict["F10"];
				luascript = luascript + QString(u8"F10_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F10.theta)).arg(QString::number(p_F10.phi));
				luascript = luascript + QString(u8"F10_temp_source.Label = \"%1\"\n").arg("F10");
				luascript = luascript + QString(u8"F10_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F10_temp_source_workplane = F10_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F10_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F10_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F10_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");

				luascript = luascript + QString(u8"F10_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F10_farFieldRequest.Label =\"%1\"\n").arg("F10");
				luascript = luascript + QString(u8"F10_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");


				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F11) {
				SphericalCoordinates p_F11 = AntSettingdict["F11"];
				luascript = luascript + QString(u8"F11_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F11.theta)).arg(QString::number(p_F11.phi));
				luascript = luascript + QString(u8"F11_temp_source.Label = \"%1\"\n").arg("F11");
				luascript = luascript + QString(u8"F11_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F11_temp_source_workplane = F11_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F11_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F11_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F11_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n");
				luascript = luascript + QString(u8"F11_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F11_farFieldRequest.Label =\"%1\"\n").arg("F11");
				luascript = luascript + QString(u8"F11_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");



				luascript = luascript + QString(u8"\n");
			}
			else {}
			if (this->settingobj->F12) {
				SphericalCoordinates p_F12 = AntSettingdict["F12"];
				luascript = luascript + QString(u8"F12_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_F12.theta)).arg(QString::number(p_F12.phi));
				luascript = luascript + QString(u8"F12_temp_source.Label = \"%1\"\n").arg("F12");
				luascript = luascript + QString(u8"F12_temp_source.PolarisationAngle = 0\n");
				luascript = luascript + QString(u8"F12_temp_source_workplane = F12_temp_source.LocalWorkplane\n");
				luascript = luascript + QString(u8"F12_temp_source_workplane.Origin.X = 0\n");
				luascript = luascript + QString(u8"F12_temp_source_workplane.Origin.Y = 0\n");
				luascript = luascript + QString(u8"F12_temp_source_workplane.Origin.Z = 0\n");
				luascript = luascript + QString(u8"\n"); 

				luascript = luascript + QString(u8"F12_farFieldRequest = temp_standardConfiguration.FarFields:Add(0,0,0,0,1,1)\n");
				luascript = luascript + QString(u8"F12_farFieldRequest.Label =\"%1\"\n").arg("F12");
				luascript = luascript + QString(u8"F12_farFieldRequest.CalculationDirection=cf.Enums.FarFieldCalculationDirectionEnum.FromPlaneWave\n\n");

				luascript = luascript + QString(u8"\n");
			}
			else {}
		}
		else {}

	}
	else {}

 
	
	
	QString filePath = this->workpsace + QDir::separator() + this->settingobj->taskName+ QString(u8"_Scattering.lua");
	QFile file(filePath); 	// 创建文件对象
	if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
		QTextStream stream(&file); 		// 创建文本流，并设置编码为UTF-8
		stream.setCodec("UTF-8"); 
		stream << luascript;
		file.close();
		QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入成功!\n%1").arg(filePath)); 		// 提示文件写入成功
		qDebug() << "File written successfully.";
	}
	else {
		qDebug() << "Could not open file for writing.";
		QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入失败"));
	}
	progressDialog.setValue(progressDialog.maximum());
	progressDialog.close();
	return  ;
}

void LAMP_ScatterSettingClass::setTaskName(QString name)
{
	this->ui.lineEdit_TaskName->setText(name);
	this->settingobj->taskName = name;
}

void LAMP_ScatterSettingClass::setWorkSpacePath(QString path)
{
	this->workpsace = getParantFromPath(path);
	this->xmlpath = path;
	this->ui.lineEdit_xmlpath->setText(this->xmlpath);
}

void LAMP_ScatterSettingClass::on_radioButton_S1_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }

	this->switchAntShowAndHide("S1", flag);
 
}
void LAMP_ScatterSettingClass::on_radioButton_S3_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("S3", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_S5_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("S5", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_S8_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("S8", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_S10_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("S10", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_S12_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("S12", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F1_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F1", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F2_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F2", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F3_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F3", flag); this->switchAntShowAndHide("F1", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F4_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F4", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F5_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F5", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F6_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F6", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F7_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F7", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F8_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F8", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F9_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F9", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F10_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F10", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F11_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F11", flag);

}
void LAMP_ScatterSettingClass::on_radioButton_F12_toggled(bool flag)
{
	if (this->myContext.IsNull()) {}
	else { return; }
	this->switchAntShowAndHide("F12", flag);

}
void LAMP_ScatterSettingClass::on_checkBox_A1_toggled(bool flag)
{
	this->ui.lineEdit_A1_incAngle->setEnabled(this->ui.checkBox_A1->isChecked());
	this->switchAntShowAndHide("A1", this->ui.checkBox_A1->isChecked());
	if (this->myContext.IsNull()) {}
	else { return; }
 
}
void LAMP_ScatterSettingClass::on_checkBox_A2_toggled(bool flag)
{
	this->ui.lineEdit_A2_incAngle->setEnabled(this->ui.checkBox_A2->isChecked());
	this->switchAntShowAndHide("A2", this->ui.checkBox_A2->isChecked());
	if (this->myContext.IsNull()) {}
	else { return; }
 
}

void LAMP_ScatterSettingClass::on_checkBox_AllScatter_toggled(bool flag)
{
	this->ui.radioButton_S1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_S12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F2->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F4->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F6->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F7->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F9->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F11->setEnabled(this->ui.checkBox_AllScatter->isChecked());
	this->ui.radioButton_F12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
}

void LAMP_ScatterSettingClass::on_lineEdit_A1_incAngle_editingFinished()
{
	// 根据坐标计算
	this->myContext->Erase(DataAISMap["A1"], Standard_True);
	AntSettingdict["A1"].theta = this->ui.lineEdit_A1_incAngle->text().toDouble();
	SphericalCoordinates sp = AntSettingdict["A1"];
	sp.phi = sp.phi * M_PI / 180;
	sp.theta = sp.theta * M_PI / 180;
	CartesianCoordinates cp = sphericalToCartesian(sp);
	TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
	TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
	Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
	DataAISMap["A1"] = shape_ais;
	this->myContext->Display(DataAISMap["A1"],Standard_True);
}
void LAMP_ScatterSettingClass::on_lineEdit_A2_incAngle_editingFinished()
{
	// 根据坐标计算
	this->myContext->Erase(DataAISMap["A2"], Standard_True);
	AntSettingdict["A2"].theta =  this->ui.lineEdit_A2_incAngle->text().toDouble();
	SphericalCoordinates sp = AntSettingdict["A2"];
	sp.phi = sp.phi * M_PI / 180;
	sp.theta = sp.theta * M_PI / 180;
	CartesianCoordinates cp = sphericalToCartesian(sp);
	TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
	TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
	Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
	DataAISMap["A2"] = shape_ais;
	this->myContext->Display(DataAISMap["A2"], Standard_True);
}
void LAMP_ScatterSettingClass::on_pushButton_load_clicked()
{
	QString  xmlpath = getOpenFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)");
	if (isExists(xmlpath)) {
		this->loadxml(xmlpath);
	}
	else {

	}
 
}
void LAMP_ScatterSettingClass::on_pushButton_apply_clicked()
{
	this->savexml();
	this->createFEKOLua();
}

void LAMP_ScatterSettingClass::on_okButton_clicked()
{
	this->savexml();
	this->createFEKOLua();

	// 确定按钮判断是否需要接口
	QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否关闭窗口", QMessageBox::Yes | QMessageBox::No);
	if (reply == QMessageBox::Yes) {
		this->closeWindows();
	}
	else {
		return;
	}
}
void LAMP_ScatterSettingClass::on_cancelButton_clicked()
{
	this->closeWindows();
}

void LAMP_ScatterSettingClass::switchAntShowAndHide(std::string antName, bool flag) {
	if (flag) {
		this->myContext->Display(DataAISMap[antName], Standard_True);
	}
	else {
		this->myContext->Erase(DataAISMap[antName], Standard_True);
	}
}

SphericalCoordinates LAMP_ScatterSettingClass::antsettingstring2Spherical(QString sphericalStr)
{
	QList<QString> ps = sphericalStr.split(",");
	SphericalCoordinates p{
		ps[0].toDouble(),
		ps[1].toDouble(),
		ps[2].toDouble()
	};
	return p;
}

LAMP_ScatterSettingXmlClass::LAMP_ScatterSettingXmlClass()
{
	// 对成员变量进行初始化
	this->taskName = u8"TESTScatterimage";
	this->A1 = true;
	this->A2 = true;
	this->incidence_A1 = 90;
	this->incidence_A2 = 90;
	this->startfre = 0;
	this->endfre = 0;
	this->freponts = 0;
	this->farfield=false;
	this->nearfield=true;
	this->enableScatter=true;
	this->S1=true;
	this->S3=false;
	this->S5=false;
	this->S8=false;
	this->S10=false;
	this->S12=false;
	this->F1=false;
	this->F2=false;
	this->F3=false;
	this->F4=false;
	this->F5=false;
	this->F6=false;
	this->F7=false;
	this->F8=false;
	this->F9=false;
	this->F10=false;
	this->F11=false;
	this->F12 = false;
}

LAMP_ScatterSettingXmlClass::~LAMP_ScatterSettingXmlClass()
{
}

void LAMP_ScatterSettingXmlClass::loadxml(QString fileName)
{
	QFile file(fileName);
	if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
		QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件");
		return;
	}

	QXmlStreamReader xmlReader(&file);

	while (!xmlReader.atEnd() && !xmlReader.hasError()) {
		QXmlStreamReader::TokenType token = xmlReader.readNext();

		if (token == QXmlStreamReader::StartElement) {
			QString name= xmlReader.name().toString();
			qDebug() << name<<u8" : "<< xmlReader.text().toString();

			if (xmlReader.name().toString() == "TaskName") {

				taskName = xmlReader.text().toString();
			}
			else if (xmlReader.name().toString() == "Startfre") {
				startfre = xmlReader.text().toString().toDouble();
			}
			else if (xmlReader.name().toString() == "Endfre") {
				endfre = xmlReader.text().toString().toDouble();
			}
			else if (xmlReader.name().toString() == "Freponts") {
				freponts = xmlReader.text().toString().toDouble();
			}
			else if (xmlReader.name().toString() == "Farfield") {
				farfield = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "Nearfield") {
				nearfield = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "A1") {
				A1 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "Incidence_A1") {
				incidence_A1 = xmlReader.text().toString().toDouble();
			}
			else if (xmlReader.name().toString() == "A2") {
				A2 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "Incidence_A2") {
				incidence_A2 = xmlReader.text().toString().toDouble();
			}
			else if (xmlReader.name().toString() == "EnableScatter") {
				enableScatter = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S1") {
				S1 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S3") {
				S3 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S5") {
				S5 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S8") {
				S8 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S10") {
				S10 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "S12") {
				S12 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F1") {
				F1 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F2") {
				F2 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F3") {
				F3 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F4") {
				F4 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F5") {
				F5 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F6") {
				F6 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F7") {
				F7 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F8") {
				F8 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F9") {
				F9 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F10") {
				F10 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F11") {
				F11 = (xmlReader.text().toString().toLower() == "true");
			}
			else if (xmlReader.name().toString() == "F12") {
				F12 = (xmlReader.text().toString().toLower() == "true");
			} 
		}
	}
	if (xmlReader.hasError()) {
		QMessageBox::warning(nullptr, u8"警告", u8"XML文件解析错误");
	}
	file.close();
}

void LAMP_ScatterSettingXmlClass::savexml(QString fileName)
{
	QFile file(fileName);
	if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
		QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件");
		return;
	}

	QXmlStreamWriter xmlWriter(&file);
	xmlWriter.setAutoFormatting(true);
	xmlWriter.writeStartDocument();
	xmlWriter.writeStartElement("FEKOSimulationDataparams");
	xmlWriter.writeTextElement("TaskName", taskName);
	xmlWriter.writeTextElement("Startfre", QString::number(startfre));
	xmlWriter.writeTextElement("Endfre", QString::number(endfre));
	xmlWriter.writeTextElement("Freponts", QString::number(freponts)); 
	xmlWriter.writeTextElement("Farfield", farfield ? "true" : "false");
	xmlWriter.writeTextElement("Nearfield", nearfield ? "true" : "false");
	xmlWriter.writeTextElement("A1", A1 ? "true" : "false");
	xmlWriter.writeTextElement("Incidence_A1", QString::number(incidence_A1));
	xmlWriter.writeTextElement("A2", A2 ? "true" : "false");
	xmlWriter.writeTextElement("Incidence_A2", QString::number(incidence_A2));
	xmlWriter.writeTextElement("EnableScatter", enableScatter ? "true" : "false");
	xmlWriter.writeTextElement("S1", S1 ? "true" : "false");
	xmlWriter.writeTextElement("S3", S3 ? "true" : "false");
	xmlWriter.writeTextElement("S5", S5 ? "true" : "false");
	xmlWriter.writeTextElement("S8", S8 ? "true" : "false");
	xmlWriter.writeTextElement("S10", S10 ? "true" : "false");
	xmlWriter.writeTextElement("S12", S12 ? "true" : "false");
	xmlWriter.writeTextElement("F1", F1 ? "true" : "false");
	xmlWriter.writeTextElement("F2", F2 ? "true" : "false");
	xmlWriter.writeTextElement("F3", F3 ? "true" : "false");
	xmlWriter.writeTextElement("F4", F4 ? "true" : "false");
	xmlWriter.writeTextElement("F5", F5 ? "true" : "false");
	xmlWriter.writeTextElement("F6", F6 ? "true" : "false");
	xmlWriter.writeTextElement("F7", F7 ? "true" : "false");
	xmlWriter.writeTextElement("F8", F8 ? "true" : "false");
	xmlWriter.writeTextElement("F9", F9 ? "true" : "false");
	xmlWriter.writeTextElement("F10", F10 ? "true" : "false");
	xmlWriter.writeTextElement("F11", F11 ? "true" : "false");
	xmlWriter.writeTextElement("F12", F12 ? "true" : "false");
	xmlWriter.writeEndElement(); // 关闭FEKOSimulationDataparams元素
	xmlWriter.writeEndDocument();
	file.close();
}
