允许LAMPCAE 调用 FEKO 相关程序

pull/1/head
剑古敛锋 2024-07-23 11:40:54 +08:00
parent 3d7795b494
commit 93607b8c4e
44 changed files with 2084 additions and 267 deletions

View File

@ -18,22 +18,12 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"hidden": true,
"name": "Qt-Default",
"inherits": "5.15.2_msvc2019_64",
"vendor": {
"qt-project.org/Default": {
"checksum": "hFHqn7KAkQOhAQUh9kbJbv7R0NY="
}
}
},
{
"hidden": true,
"name": "5.15.2_msvc2019_64",
"inherits": "Qt",
"environment": {
"QTDIR": "C:/QT/5.15.2/MSVC2019_64"
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
@ -42,14 +32,60 @@
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "ptcEk6DrMo+x2qNR/kb8KvrnFFM="
"checksum": "YNIStcUN4HHJp37D1czaJOv62js="
}
}
},
{
"hidden": true,
"name": "Qt-Default",
"inherits": "qt5_applications_Qt",
"vendor": {
"qt-project.org/Default": {
"checksum": "vWQZGf1EL41MrzRk0/XOL4RtG+o="
}
}
},
{
"hidden": true,
"name": "qt5_applications_Qt",
"inherits": "Qt",
"environment": {
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "T2tyAvOKmucIMsIcfejT0g5G9Ak="
}
}
},
{
"hidden": true,
"name": "tools_qt5",
"inherits": "Qt",
"environment": {
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "NXPzuLDKd0Ogh1d8A052mZcXNgE="
}
}
}
],
"vendor": {
"qt-project.org/Presets": {
"checksum": "phjq3Wa78xncEM1Mjqgn2bZOHPo="
"checksum": "qqdzywvCP+sXDFmqOD/r0r4I9nM="
}
}
}

View File

@ -1,6 +1,6 @@
#include "MeshConfig.h"
#include <QDebug>
#include "Common/DebugLogger.h"
#define MESHON true;
#define MESHOFF false;
#define MESHIMPORT "cgns;msh;neu;stl;dat;vtk;inp"
@ -64,6 +64,7 @@ namespace ConfigOption
void MeshConfig::setImportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/)
{
// Common::function_to_trace();
switch(type) {
case MeshDataType::None :{
break;
@ -102,6 +103,7 @@ namespace ConfigOption
void MeshConfig::setExportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/)
{
switch(type) {
case MeshDataType::None :{
break ;

View File

@ -30,7 +30,7 @@ target_compile_definitions(GeometryDataExchange PRIVATE "GEOMETRYDATAEXCHANGE_AP
list(APPEND _depend_library Common PythonModule DataProperty Geometry ModuleBase)
list(APPEND _runtimes_libraries
OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKIGES OpenCASCADE::TKMath OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKXSBase OpenCASCADE::TKernel VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOGeometry VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib
OpenCASCADE::TKSTL OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKIGES OpenCASCADE::TKMath OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKXSBase OpenCASCADE::TKernel VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOGeometry VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib
)
#-----------------------------------------------------------------------------

View File

@ -31,6 +31,12 @@ add_library(MainWidgets
${_interface}
${_header}
${_source}
fekocadTaskinit.cpp
fekocadTaskinit.h
fekocadTaskinit.ui
createfekocadmodel.cpp
createfekocadmodel.h
createfekocadmodel.ui
)

View File

@ -47,6 +47,8 @@ namespace MainWidget
repaintTitleBar();
_ui->propTabWidget->tabBar()->hide(); // 属性接口
MainWidgetPy::init(mainwindow, this, _geometryWidget, _meshWidget, _physicsWidget);
connect(_meshWidget,SIGNAL(ToOCCTItemSIGNAL(MeshData::MeshKernal *)),this,SIGNAL(MeshToGeometrySig(MeshData::MeshKernal *)));
}
ControlPanel::~ControlPanel()

View File

@ -9,6 +9,7 @@ libaojun
#include "mainWidgetsAPI.h"
#include "ModuleBase/dockWidgetBase.h"
#include "MeshData/meshKernal.h"
class PipelineObjTreeDockWidget;
class PipelineObjPropDockWidget;
@ -60,6 +61,7 @@ namespace MainWidget
signals:
void updateActionStates();
void MeshToGeometrySig(MeshData::MeshKernal *);
// void updataPropertyTab(DataProperty::DataBase* popList);
public:

View File

@ -174,6 +174,7 @@ namespace MainWidget
void MeshWidget::contextMenuEvent(QContextMenuEvent *event)
{
qDebug()<<"MeshWidget::contextMenuEvent(QContextMenuEvent *)";
Q_UNUSED(event)
_currentItem = currentItem();
if (_currentItem == nullptr)
@ -188,10 +189,15 @@ namespace MainWidget
edit->setVisible(isMeshEditable());
action = pop_menu.addAction(QIcon(), tr("Rename"));
connect(action, SIGNAL(triggered()), this, SLOT(rename()));
if (_currentItem->type() == MeshChild)
{
action = pop_menu.addAction(QIcon(), tr("Remove"));
connect(action, SIGNAL(triggered()), this, SLOT(removeMeshData()));
//
// action=pop_menu.addAction(QIcon(),tr("ToOCCT"));
// connect(action, SIGNAL(triggered()), this, SLOT(ToOCCTItemSLOT()));
}
else if (_currentItem->type() == MeshSetChild)
{
@ -472,4 +478,23 @@ namespace MainWidget
// emit clearHighLight();
}
void MeshWidget::ToOCCTItemSLOT() {
_currentItem = currentItem();
if (_currentItem == nullptr)
return;
int index = _meshRoot->indexOfChild(_currentItem);
if (index >= 0)
{
MeshData::MeshKernal *k = _data->getKernalAt(index);
if (k == nullptr)
return;
emit this->ToOCCTItemSIGNAL(k);
return;
}
}
}

View File

@ -63,6 +63,8 @@ namespace MainWidget
void removeCaseComponentSig(int componentID);
//重命名算例中的项(组件item和边界item)
void renameCaseComponentSig(int componentID);
// 模型转换
void ToOCCTItemSIGNAL(MeshData::MeshKernal* curItem);
// void showDialog(QDialog*);
@ -105,6 +107,7 @@ namespace MainWidget
*/
void removeVisibleMesh();
void ToOCCTItemSLOT();
private:
void contextMenuEvent(QContextMenuEvent *event) override;
bool isMeshEditable();

View File

@ -0,0 +1,222 @@
/**
* @file createfekocadmodel.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_CreateFEKOCADModel.h"
// resolved
#include "createfekocadmodel.h"
#include "ui_CreateFEKOCADModel.h"
#include "Settings/BusAPI.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QTextStream>
#include <QDebug>
#include <QProcess>
namespace MainWidget {
CreateFEKOCADModel::CreateFEKOCADModel(QWidget* parent)
: QDialog(parent)
, ui(new Ui::CreateFEKOCADModel)
{
ui->setupUi(this);
connect(ui->pushButton_OpenAntParams, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_OpenAntParams()));
connect(ui->pushButton_OpenLoadModel, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_OpenLoadModel()));
connect(ui->pushButton_SettingName, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_SettingName()));
connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_add()));
connect(ui->pushButton_Delete, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_Delete()));
}
CreateFEKOCADModel::~CreateFEKOCADModel()
{
delete ui;
}
void CreateFEKOCADModel::setSTLFilePathList(const QStringList& stlfilePathList) {
for(QString filepath:stlfilePathList){
ui->listWidget->addItem(filepath);
}
}
void CreateFEKOCADModel::onclicked_pushButton_SettingName() {
QString cfxNamePath=QFileDialog::getSaveFileName(
this, // Parent widget
tr(u8"选择cfx工程作为模版"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("CFX Files (*.cfx)") // File filter
);
ui->lineEdit->setText(cfxNamePath);
}
void CreateFEKOCADModel::onclicked_pushButton_add() {
QStringList fileNames= QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择模型"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("STL(*.stl);;IGES Files (*.iges);;IGES Files (*.igs)") // File filter
);
// Add the selected file paths to the list widget
for (const QString &fileName : fileNames) {
ui->listWidget->addItem(fileName);
}
// Update the working directory
}
void CreateFEKOCADModel::onclicked_pushButton_Delete() {
if(ui->listWidget->count()==0){
return;
}else{
qDebug()<<"CreateFEKOCADModel::on_pushButton_Delete";
// int row = ui->listWidget->currentIndex().row();
ui->listWidget->takeItem(ui->listWidget->currentIndex().row());
}
}
void CreateFEKOCADModel::accept()
{
if(this->MergerScriptFilePath()) // 创建模型文件
{
if(QFile(_saveMergeFilepath).exists()){ // 确定文件一定存在
QStringList parames;
parames.append(this->ui->lineEdit->text());
parames.append("--run-script");
parames.append(_saveMergeFilepath);
QProcess* process=new QProcess(this);
process->start(Setting::BusAPI::instance()->getFekocadPath(),parames);
process->waitForFinished(-1);
qDebug()<<"CreateFEKOCADModel::accept";
}else{
QMessageBox::warning(this, QObject::tr("Error"), QObject::tr(u8"文件不存在: ")+_saveMergeFilepath);
return;
}
}else{}
QDialog::accept();
}
void CreateFEKOCADModel::onclicked_pushButton_OpenAntParams() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"仿真天线参数初始化文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_ant_init_script (*.lua)") // File filter
);
ui->lineEdit_loadAnt->setText(filePath);
}
void CreateFEKOCADModel::onclicked_pushButton_OpenLoadModel() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"加载模型导入文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_model_init_script (*.lua)") // File filter
);
ui->lineEdit_loadModel->setText(filePath);
}
void CreateFEKOCADModel::setAntParamsFilePath(const QString& filePath) {
ui->lineEdit_loadAnt->setText(filePath);
}
void CreateFEKOCADModel::setModelParamsFilePath(const QString& filePath)
{
ui->lineEdit_loadModel->setText(filePath);
// 文件解析
QFile modelfile(filePath);
QTextStream modelinStream(&modelfile);
while(!modelinStream.atEnd()) {
QString line = modelinStream.readLine();
QString geoline = line;
// 提取模型文件
QString geoFilter = "project.Importer.Geometry:Import";
if(geoline.contains(geoFilter)) {
geoline = geoline.remove("project.Importer.Geometry:Import");
geoline = geoline.remove(")");
geoline = geoline.remove("(");
ui->listWidget->addItem(geoline);
} else {
}
QString stlFilter = "project.Importer.Mesh:Import";
QString stlline = line;
if(line.contains(stlFilter)) {
stlline = stlline.remove("project.Importer.Mesh:Import");
stlline = stlline.remove(")");
stlline = stlline.remove("(");
ui->listWidget->addItem(stlline);
} else {
}
}
}
bool CreateFEKOCADModel::MergerScriptFilePath() {
// 合并文件
_saveMergeFilepath= QFileDialog::getSaveFileName(
this, // Parent widget
tr(u8"创建加载模型初始化文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_cfx_init_script (*.lua)") // File filter
);
// 合并文件
QFile saveFile(_saveMergeFilepath);
if (!saveFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(this, QObject::tr("Error"), QObject::tr(u8"不能创建文件"));
return false;
}else{}
QTextStream outStream(&saveFile);
outStream << "------------- load model list----------------------------------------------------------------------------------"<<"\n";
// model
// 创建lua脚本内存
QString scripttext = "";
scripttext =scripttext +"app=cf.GetApplication()"+"\n";
scripttext =scripttext +"project=app.Project --- get current project"+"\n";
scripttext =scripttext +"solutionConfigurations = project.SolutionConfigurations "+"\n";
scripttext =scripttext +"solutionConfigurations:SetSourcesPerConfiguration()"+"\n";
for(size_t i=0;i<ui->listWidget->count();i++){
QListWidgetItem *item = ui->listWidget->item(i);
QString filepath = item->text();
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
if(fileinfo.exists()){
if(fileinfo.suffix()=="stl") {
scripttext =scripttext +QString("project.Importer.Mesh:Import(\"%1\")").arg(filepath);
scripttext=scripttext+"\n";
}else if(fileinfo.suffix()=="iges"||fileinfo.suffix()=="igs") {
scripttext = scripttext
+ QString("project.Importer.Geometry:Import(\"%1\")")
.arg(filepath);
scripttext = scripttext + "\n";
}else{}
}
else{
QMessageBox::warning(this, QObject::tr("Error"),u8"文件不存在: "+ filepath);
continue;
}
}
outStream << scripttext << "\n";
outStream << "------------- load ant params----------------------------------------------------------------------------------"<<"\n";
// ant
QFile antfile(this->ui->lineEdit_loadAnt->text());
if (!antfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::warning(this, QObject::tr("Error"),u8"不能打开加载天线参数文件: "+ this->ui->lineEdit_loadAnt->text());
return false; // Skip this file if it cannot be opened
}else {}
QTextStream antinStream(&antfile);
while (!antinStream.atEnd()) {
outStream << antinStream.readLine() << "\n";
}
outStream <<"--------------------- \" PRF configuration \"-----------------------------"<<"\n";
outStream <<""<<"\n";
outStream <<"-- Enable the parallel Solver"<<"\n";
outStream <<"project.Launcher.Settings.FEKO.Parallel.Enabled = true"<<"\n";
outStream <<""<<"\n";
outStream <<"-- Save the *.cfx file"<<"\n";
outStream <<"results = project.Launcher:RunPREFEKO()"<<"\n";
outStream <<QString("app:SaveAs([[%1]])").arg(this->ui->lineEdit->text())<<"\n";
outStream <<"results = project.Launcher:RunPREFEKO()"<<"\n";
antfile.close(); // Close the current file before moving to the next
// 设置求解参数
saveFile.close(); // Close the merged file
return true;
}
}

View File

@ -0,0 +1,49 @@
/**
* @file createfekocadmodel.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_CREATEFEKOCADMODEL_H
#define LAMPCAE_CREATEFEKOCADMODEL_H
#include "mainWidgetsAPI.h"
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class CreateFEKOCADModel;
}
QT_END_NAMESPACE
namespace MainWidget {
class MAINWIDGETSAPI CreateFEKOCADModel : public QDialog {
Q_OBJECT
public:
explicit CreateFEKOCADModel(QWidget* parent = nullptr);
~CreateFEKOCADModel() override;
public:
void setSTLFilePathList(const QStringList& stlfilePathList);
void setAntParamsFilePath(const QString& antParamsfilePath);
void setModelParamsFilePath(const QString& ModelParamsfilePath);
bool MergerScriptFilePath();
public slots:
void accept() override;
void onclicked_pushButton_OpenAntParams();
void onclicked_pushButton_OpenLoadModel();
void onclicked_pushButton_SettingName();
void onclicked_pushButton_add();
void onclicked_pushButton_Delete();
private:
Ui::CreateFEKOCADModel* ui;
QStringList stlfilePathList;
QString xmlParamsfilePath;
QString _saveMergeFilepath;
};
} // namespace MainWidget
#endif // LAMPCAE_CREATEFEKOCADMODEL_H

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateFEKOCADModel</class>
<widget class="QDialog" name="CreateFEKOCADModel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>557</height>
</rect>
</property>
<property name="windowTitle">
<string>CreateFEKOCADModel</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>天线构建脚本</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButton_Delete">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item row="3" column="0" rowspan="3" colspan="2">
<widget class="QListWidget" name="listWidget">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKO cfx文件</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_SettingName">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButton_add">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton_OpenAntParams">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择天线构建脚本</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_loadAnt">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>模型加载脚本</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_loadModel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_OpenLoadModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择模型导入脚本</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CreateFEKOCADModel</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>417</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>417</x>
<y>278</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CreateFEKOCADModel</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>417</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>417</x>
<y>278</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,124 @@
/**
* @file fekocadTaskinit.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-21
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_fekocadTaskinit.h" resolved
#include <QFileDialog>
#include <QMessageBox>
#include <QProgressDialog>
#include <QProcess>
#include "fekocadTaskinit.h"
#include "ui_fekocadTaskinit.h"
#include "Settings/BusAPI.h"
#include <QDebug>
namespace MainWidget {
fekocadTaskinit::fekocadTaskinit(QWidget* parent)
: QDialog(parent)
, ui(new Ui::fekocadTaskinit)
{
ui->setupUi(this);
connect(ui->pushButton_Delete, SIGNAL(clicked()), this, SLOT(pushButton_Delete_clicked()));
connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(pushButton_add_clicked()));
connect(ui->pushButton_Select, SIGNAL(clicked()), this, SLOT(pushButton_Select_clicked()));
}
fekocadTaskinit::~fekocadTaskinit()
{
delete ui;
}
void fekocadTaskinit::pushButton_Delete_clicked() {
if(ui->listWidget->count()==0){
return;
}else{
ui->listWidget->removeItemWidget(ui->listWidget->takeItem(ui->listWidget->currentIndex().row()));
}
}
void fekocadTaskinit::pushButton_add_clicked() {
QStringList fileNames= QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择生成的模型构建脚本"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("Lua Files (*.lua)") // File filter
);
// Add the selected file paths to the list widget
for (const QString &fileName : fileNames) {
ui->listWidget->addItem(fileName);
}
// Update the working directory
}
void fekocadTaskinit::pushButton_Select_clicked() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"选择cfx工程作为模版"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("cad feko model (*.cfx)") // File filter
);
if(QFile(filePath).exists()){
ui->lineEdit->setText(filePath);
_workcfxfilepath=filePath;
}else{
return;
}
}
void fekocadTaskinit::accept()
{
if(QFile(_workcfxfilepath).exists())
{
qDebug()<<"accept:"+_workcfxfilepath;
// 指令程序,
// cadfeko 目标与场景模型.cfx --non-interactive --run-script StripImage_STRIP_POLAR_VT_PRF_0_T_99.lua
QString workspaceDir = QDir(_workcfxfilepath).dirName();
QString cadfekoPath = Setting::BusAPI::instance()->getFekocadPath();
QStringList luaFiles;
for (int i = 0; i < ui->listWidget->count(); i++) {
luaFiles.append(ui->listWidget->item(i)->text());
}
QProgressDialog progressDialog(u8"模型工程生成", u8"终止", 0, luaFiles.count());
progressDialog.setWindowTitle(u8"生成中");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMaximum(luaFiles.count());
progressDialog.setMinimum(0);
progressDialog.show();
// 逐个执行lua文件
for (int i = 0; i < luaFiles.count(); i++) {
QString luaFile = luaFiles.at(i);
QStringList parames;
parames.append(_workcfxfilepath);
parames.append("--non-interactive");
parames.append("--run-script");
parames.append(luaFile);
QProcess* process=new QProcess(this);
process->start(Setting::BusAPI::instance()->getFekocadPath(),parames);
process->waitForFinished(-1);
progressDialog.setValue(i);
qDebug()<<"excute lua file:"+luaFile;
QCoreApplication::processEvents(); // 允许事件处理,以便取消按钮响应
// 检查是否点击了取消按钮
if (progressDialog.wasCanceled()) {
qDebug() << "User canceled operation.";
break; // 退出任务循环
}
}
}
else{
QMessageBox::warning(this, tr("Warning"), tr("Please select a valid CAD FEKO model file."));
return;
}
QDialog::accept();
}
} // namespace MainWidget

View File

@ -0,0 +1,39 @@
/**
* @file fekocadinit.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-21
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_FEKOCADTASKINIT_H
#define LAMPCAE_FEKOCADTASKINIT_H
#include "mainWidgetsAPI.h"
#include <QDialog>
namespace Ui {
class fekocadTaskinit;
}
namespace MainWidget {
class MAINWIDGETSAPI fekocadTaskinit : public QDialog {
Q_OBJECT
public:
explicit fekocadTaskinit(QWidget* parent = nullptr);
~fekocadTaskinit() override;
public slots:
void accept() override;
void pushButton_Delete_clicked();
void pushButton_add_clicked();
void pushButton_Select_clicked();
private:
Ui::fekocadTaskinit* ui;
QString _workcfxfilepath;
};
} // namespace MainWidget
#endif // LAMPCAE_FEKOCADTASKINIT_H

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>fekocadTaskinit</class>
<widget class="QDialog" name="fekocadTaskinit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>367</height>
</rect>
</property>
<property name="windowTitle">
<string>计算任务初始化</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKO cfx文件</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_add">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton_Delete">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>PRFList</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QListWidget" name="listWidget">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>fekocadTaskinit</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>318</x>
<y>341</y>
</hint>
<hint type="destinationlabel">
<x>318</x>
<y>183</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>fekocadTaskinit</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>318</x>
<y>341</y>
</hint>
<hint type="destinationlabel">
<x>318</x>
<y>183</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -41,7 +41,7 @@ add_library(MainWindow
#-----------------------------------------------------------------------------
target_compile_definitions(MainWindow PRIVATE "MAINWINDOW_API")
list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
list(APPEND _depend_library PointCloudOperator Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
if(_WIN_)
list(APPEND _depend_library XGenerateReport)
endif()

View File

@ -45,6 +45,9 @@
#include "MainWidgets/preWindow.h"
#include "MainWidgets/ProcessWindow.h"
#include "MainWidgets/projectSolveDialog.h"
#include "MainWidgets/meshViewProvider.h"
#include "MainWidgets/meshKernalViewObject.h"
#include "MainWindowPy.h"
#include "MeshData/meshKernal.h"
#include "MeshData/meshSet.h"
@ -62,8 +65,7 @@
#include "SignalHandler.h"
#include "SolverControl/DialogSolverManager.h"
#include "PointCloudOperator/MeshOpearatorCommon.h"
#include "MainWidgets/createfekocadmodel.h"
#include "SubWindowManager.h"
#include "Translator.h"
@ -102,6 +104,8 @@
// logger
#include "Common/DebugLogger.h"
#include "PluginWBFZExchangePlugin/OCCTBase.h"
#include "PointCloudOperator/MeshOpearatorCommon.h"
#include "MainWidgets/fekocadTaskinit.h"
namespace GUI {
MainWindow::MainWindow(bool useRibbon)
@ -242,9 +246,6 @@ namespace GUI {
connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this,
SLOT(printMessage(Common::Message, QString)));
// 文件
connect(_ui->actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew()));
connect(_ui->actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen()));
@ -253,6 +254,7 @@ namespace GUI {
connect(_ui->actionWorkingDir, SIGNAL(triggered()), this, SLOT(setWorkingDir()));
connect(_ui->actionImportMesh, SIGNAL(triggered()), this, SLOT(on_importMesh()));
connect(_ui->actionExportMesh, SIGNAL(triggered()), this, SLOT(on_exportMesh()));
connect(_ui->actionScaneExport, SIGNAL(triggered()), this, SLOT(on_exportMesh()));
connect(_ui->actionLoadPointCloud, SIGNAL(triggered()), this, SLOT(on_importPcl())); // 点云
connect(_ui->actionSavePointCloud, SIGNAL(triggered()), this, SLOT(on_exportPcl()));
@ -294,7 +296,17 @@ namespace GUI {
connect(_ui->actionFEKOImage, SIGNAL(triggered()), this, SLOT(on_actionFEKOImage()));
connect(_ui->actionantScatteringFEKOSetting, SIGNAL(triggered()), this,
SLOT(on_actionantScatteringFEKOSetting()));
connect(_ui->actionFEKOScatterSetting, SIGNAL(triggered()), this,
SLOT(on_actionantScatteringFEKOSetting()));
connect(_ui->actionLoadFEKOScatterResult, SIGNAL(triggered()), this,
SLOT(on_actionFEKO2csv()));
connect(_ui->actionExportRCS, SIGNAL(triggered()), this, SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImageSetting, SIGNAL(triggered()), this,
SLOT(on_actionImageSetting()));
connect(_ui->actionLoadFEKOImageResult, SIGNAL(triggered()), this, SLOT(on_actionFEKO2csv()));
connect(_ui->actionExportFEKOResultToEcho, SIGNAL(triggered()), this, SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImageCreate, SIGNAL(triggered()), this, SLOT(on_actionFEKOImage()));
// 属性表
connect(_ui->actionAttriutionDBShow, SIGNAL(triggered()), this,
SLOT(on_AttriutionDBShow()));
@ -315,7 +327,8 @@ namespace GUI {
_viewSignalMapper->setMapping(_ui->actionViewYMinus, QString("YMinus"));
_viewSignalMapper->setMapping(_ui->actionViewZPlus, QString("ZPlus"));
_viewSignalMapper->setMapping(_ui->actionViewZMinus, QString("ZMinus"));
connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager,SLOT(setView(QString)));
connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager,
SLOT(setView(QString)));
// 设置mesh选择模式
_selectSignalMapper = new QSignalMapper(this);
connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
@ -323,11 +336,13 @@ namespace GUI {
connect(_ui->actionSelectMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 单点
connect(_ui->actionSelectMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,SLOT(map())); // 多选
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshSurfaceNode, SIGNAL(triggered()), _selectSignalMapper,SLOT(map())); // 多选
connect(_ui->actionBoxMeshSurfaceCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshSurfaceNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshSurfaceCell, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map()));
_selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody,
@ -382,9 +397,6 @@ namespace GUI {
_selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody,
(int)ModuleBase::SelectModel::GeometryWinBody);
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
SLOT(selectGeometryModelChanged(int)));
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
@ -426,34 +438,59 @@ namespace GUI {
SLOT(on_actionImageShowTool()));
connect(_ui->actionRCShowTool, SIGNAL(triggered()), this, SLOT(on_actionRCShowTool()));
// 加载预制模型
connect(_ui->actionLoadPreForestMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreForestMeshFile_triggereds()));
connect(_ui->actionLoadPreCropMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreCropMeshFile_triggereds()));
connect(_ui->actionLoadPreGrasslandMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreGrasslandMeshFile_triggereds()));
connect(_ui->actionLoadPreWaterBodyMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreSoilMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreSoilMeshFile_triggereds()));
connect(_ui->actionLoadPreDynamicWaterBodyMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreDynamicWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreRoadMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreRoadMeshFile_triggereds()));
connect(_ui->actionLoadPreArtificialMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreArtificialMeshFile_triggereds()));
connect(_ui->actionLoadForestPointCloudFile,SIGNAL(triggered()),this, SLOT(on_actionLoadForestPointCloudFile_triggereds()));
connect(_ui->actionLoadRhounessPointCloudFile,SIGNAL(triggered()),this, SLOT(on_actionLoadRhounessPointCloudFile_triggereds()));
connect(_ui->actionLoadGeometricCorrectionFile,SIGNAL(triggered()),this, SLOT(on_actionLoadGeometricCorrectionFile_triggereds()));
connect(_ui->actionLoadRadioModelFile,SIGNAL(triggered()),this, SLOT(on_actionLoadRadioModelFile_triggereds()));
connect(_ui->actionLoadPreForestMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreForestMeshFile_triggereds()));
connect(_ui->actionLoadPreCropMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreCropMeshFile_triggereds()));
connect(_ui->actionLoadPreGrasslandMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreGrasslandMeshFile_triggereds()));
connect(_ui->actionLoadPreWaterBodyMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreSoilMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreSoilMeshFile_triggereds()));
connect(_ui->actionLoadPreDynamicWaterBodyMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreDynamicWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreRoadMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreRoadMeshFile_triggereds()));
connect(_ui->actionLoadPreArtificialMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreArtificialMeshFile_triggereds()));
connect(_ui->actionLoadForestPointCloudFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadForestPointCloudFile_triggereds()));
connect(_ui->actionLoadRhounessPointCloudFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadRhounessPointCloudFile_triggereds()));
connect(_ui->actionLoadGeometricCorrectionFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadGeometricCorrectionFile_triggereds()));
connect(_ui->actionLoadRadioModelFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadRadioModelFile_triggereds()));
// 网格操作
connect(_ui->actionMeshDelete, SIGNAL(triggered()),this,SLOT(on_deleteMesh()));
connect(_ui->actionMeshCopy, SIGNAL(triggered()),this,SLOT(on_copyMesh()));
connect(_ui->actionMeshClip, SIGNAL(triggered()),this,SLOT(on_clipMesh()));
connect(_ui->actionMeshDelete, SIGNAL(triggered()), this, SLOT(on_deleteMesh()));
connect(_ui->actionMeshCopy, SIGNAL(triggered()), this, SLOT(on_copyMesh()));
connect(_ui->actionMeshClip, SIGNAL(triggered()), this, SLOT(on_clipMesh()));
connect(_ui->actionMeshSave, SIGNAL(triggered()), this, SLOT(on_saveMeshEdit()));
// 网格三角网
connect(_ui->actionMeshTriangleSurface,SIGNAL(triggered()),this,SLOT(on_actionMeshTriangleSurface()));
connect(_ui->actionMeshTriangleSurface, SIGNAL(triggered()), this,
SLOT(on_actionMeshTriangleSurface()));
// 网格转换为几何
connect(_controlPanel,SIGNAL(MeshToGeometrySig(MeshData::MeshKernal *)),this,SLOT(on_MeshToGeo(MeshData::MeshKernal *)));
connect(_controlPanel, SIGNAL(MeshToGeometrySig(MeshData::MeshKernal*)), this,
SLOT(on_MeshToGeo(MeshData::MeshKernal*)));
// 网格
connect(_ui->action_generatorWaterPlane,SIGNAL(triggered()),this, SLOT(on_action_generatorWaterPlane()));
// connect(_ui->actionMeshToOCCT,SIGNAL(triggered()),this,SLOT(on_actionMeshToOCCT()));
connect(_ui->action_generatorWaterPlane, SIGNAL(triggered()), this,
SLOT(on_action_generatorWaterPlane()));
// connect(_ui->actionMeshToOCCT,SIGNAL(triggered()),this,SLOT(on_actionMeshToOCCT()));
connect(_ui->actionBatchStartFEKOCADModel, SIGNAL(triggered()), this,
SLOT(on_actionBatchStartFEKOCADModel()));
connect(_ui->actionCreateLoadModelScript, SIGNAL(triggered()), this,
SLOT(on_actionCreateLoadModelScript()));
connect(_ui->actionCreateCADModel, SIGNAL(triggered()), this,
SLOT(on_actionCreateCADModel()));
}
void MainWindow::registerMoudel()
@ -471,6 +508,9 @@ namespace GUI {
_processWindow = new MainWidget::ProcessWindow(this);
_processWindow->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea);
addDockWidget(Qt::BottomDockWidgetArea, _processWindow);
}
Ui::MainWindowRibbon* MainWindow::getUi()
@ -731,20 +771,23 @@ namespace GUI {
return;
}
QStringList meshsuffix =
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split(
";");
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getImportSuffix(ConfigOption::MeshDataType::vtkMesh)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
if(suffix.contains(s)) {
list.append(suffix);
}
}
}
std::sort(list.begin(), list.end());
// DebugInfo("import mesh data file format : %s \n ",
// list.join(";;").toUtf8().constData());
QString suffixes = list.join(";;");
QString senderName = sender()->objectName();
int modelID = -1;
@ -752,7 +795,7 @@ namespace GUI {
suffixes = list.at(0);
modelID = senderName.right(1).toInt();
}
// DebugInfo("import mesh data file format : %s \n ", suffixes.toUtf8().constData());
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Import Mesh"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptOpen);
@ -851,6 +894,16 @@ namespace GUI {
void MainWindow::on_exportMesh()
{
// 根据用户的选择做出响应
if(QMessageBox::question(nullptr, "info", u8"是否保存网格模型修改?",
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
this->on_saveMeshEdit();
// 执行相关操作
} else {
// this->on_saveMeshEdit();
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
@ -894,6 +947,7 @@ namespace GUI {
QString aFileName = dlg.selectedFiles().join(",");
if(aFileName.isEmpty())
return;
QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)")
.arg(aFileName)
.arg(aSuffix)
@ -1707,101 +1761,324 @@ namespace GUI {
// emit this->actionLoadPointCloudText(this);
}
//"forest", "crop", "grass", "uav", "water", "dwater", "road", "geo", "radi", "soil", "land", "vegetation", "water_scene"
void MainWindow::on_actionLoadPreForestMeshFile_triggereds() {
//"forest", "crop", "grass", "uav", "water", "dwater", "road", "geo", "radi", "soil", "land",
//"vegetation", "water_scene"
void MainWindow::on_actionLoadPreForestMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreForestMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "forest");
}
void MainWindow::on_actionLoadPreCropMeshFile_triggereds() {
void MainWindow::on_actionLoadPreCropMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreCropMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "crop");
}
void MainWindow::on_actionLoadPreGrasslandMeshFile_triggereds() {
void MainWindow::on_actionLoadPreGrasslandMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreGrasslandMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "grass");
}
void MainWindow::on_actionLoadPreWaterBodyMeshFile_triggereds() {
void MainWindow::on_actionLoadPreWaterBodyMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "water");
}
void MainWindow::on_actionLoadPreSoilMeshFile_triggereds() {
void MainWindow::on_actionLoadPreSoilMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreSoilMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Soil");
emit this->on_loadPreMeshFile(this, "soil");
}
void MainWindow::on_actionLoadPreDynamicWaterBodyMeshFile_triggereds() {
void MainWindow::on_actionLoadPreDynamicWaterBodyMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreDynamicWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "dwater");
}
void MainWindow::on_actionLoadPreRoadMeshFile_triggereds() {
void MainWindow::on_actionLoadPreRoadMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreRoadMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "road");
}
void MainWindow::on_actionLoadPreArtificialMeshFile_triggereds() {
void MainWindow::on_actionLoadPreArtificialMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreArtificialMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "uav");
}
void MainWindow::on_actionLoadForestPointCloudFile_triggereds() {
void MainWindow::on_actionLoadForestPointCloudFile_triggereds()
{
DebugInfo("on_actionLoadForestPointCloudFile_triggered\n"); // 加载点云
on_importPcl();
}
void MainWindow::on_actionLoadRhounessPointCloudFile_triggereds() { // 加载粗糙度点云
void MainWindow::on_actionLoadRhounessPointCloudFile_triggereds()
{ // 加载粗糙度点云
DebugInfo("on_actionLoadRhounessPointCloudFile_triggered\n");
on_importPcl();
}
void MainWindow::on_actionLoadGeometricCorrectionFile_triggereds() {
void MainWindow::on_actionLoadGeometricCorrectionFile_triggereds()
{
DebugInfo("on_actionLoadGeometricCorrectionFile_triggered\n");
emit this->on_loadPreMeshFile(this, "geo");
}
void MainWindow::on_actionLoadRadioModelFile_triggereds() {
void MainWindow::on_actionLoadRadioModelFile_triggereds()
{
DebugInfo("on_actionLoadRadioModelFile_triggered\n");
emit this->on_loadPreMeshFile(this, "radi");
}
void MainWindow::on_deleteMesh() {
void MainWindow::on_deleteMesh()
{
DebugInfo("MainWindow::on_deleteMesh\n");
emit this->on_deleteMeshSIGNAL(this);
}
void MainWindow::on_copyMesh() {
void MainWindow::on_copyMesh()
{
DebugInfo("MainWindow::on_copyMesh\n");
emit this->on_copyMeshSIGNAL(this);
}
void MainWindow::on_clipMesh() {
void MainWindow::on_clipMesh()
{
DebugInfo("MainWindow::on_clipMesh\n");
emit this->on_clipMeshSIGNAL(this);
}
void MainWindow::on_saveMeshEdit() {
void MainWindow::on_saveMeshEdit()
{
DebugInfo("MainWindow::on_saveMeshEdit\n");
emit this->on_saveMeshSIGNAL(this);
MeshData::MeshData* _meshData = MeshData::MeshData::getInstance();
MainWidget::MeshViewProvider* _meshProvider =
this->getSubWindowManager()->getPreWindow()->getMeshViewProvider();
// 更新保存模型
int nKernal = _meshData->getKernalCount();
if(nKernal == 0)
return;
for(int i = 0; i < nKernal; ++i) {
auto k = _meshData->getKernalAt(i); // 获取对应的kernal
auto vObjs = _meshProvider->getViewObjects(k); // 获取对应的view对象
if(!(k->isVisible()) || nullptr == vObjs)
continue;
// 根据显示更新实体
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->AddInputData(vObjs->getDisplayData());
geometryFilter->Update();
k->setMeshData(geometryFilter->GetOutput());
qDebug() << QString("%1 Point Number %2,Cel Number %3")
.arg(k->getName())
.arg(k->getMeshData()->GetNumberOfPoints())
.arg(k->getMeshData()->GetNumberOfCells());
// k->getMeshData()->DeepCopy(vObjs->getDisplayData());
}
// emit this->on_saveMeshSIGNAL(this);
}
void MainWindow::on_actionMeshTriangleSurface() {
void MainWindow::on_actionMeshTriangleSurface()
{
DebugInfo("MainWindow::on_actionMeshTriangleSurface\n");
emit this->on_actionMeshTriangleSurfaceSIGNAL(this);
}
void MainWindow::on_MeshToGeo(MeshData::MeshKernal* k) {
void MainWindow::on_MeshToGeo(MeshData::MeshKernal* k)
{
DebugInfo("MainWindow::on_MeshToGeo\n");
vtkDataSet* meshdata= k->getMeshData();
vtkPolyData* polydata=vtkPolyData::SafeDownCast(meshdata);
TopoDS_Shape* polyshp=MeshOpearator::MeshOpearatorCommon::vtkPolygonToOCC(polydata);
if(nullptr==polyshp){
vtkDataSet* meshdata = k->getMeshData();
TopoDS_Shape* polyshp = MeshOpearator::MeshOpearatorCommon::vtkdataSetToOCC(meshdata);
if(nullptr == polyshp) {
return;
}
Geometry::GeometrySet* geoSet = new Geometry::GeometrySet(Geometry::GeometryType::STL,true);
qDebug()<<"Model geoSet";
TopoDS_Shape* polyshptemp=new TopoDS_Shape();
geoSet->setShape(polyshptemp);
geoSet->setName(k->getName()+"_mesh2OCCT");
Geometry::GeometrySet* geoSet =
new Geometry::GeometrySet(Geometry::GeometryType::STL, true);
qDebug() << "Model geoSet";
geoSet->setShape(polyshp);
geoSet->setName(k->getName() + "_mesh2OCCT");
Geometry::GeometryData::getInstance()->appendGeometrySet(geoSet);
qDebug()<<"Model geoSet";
qDebug() << "Model geoSet";
emit this->updateActionStatesSig();
emit this->_subWindowManager->getPreWindow()->showGeoSet(geoSet,true);
emit this->_subWindowManager->getPreWindow()->showGeoSet(geoSet, true);
emit this->updateGeometryTreeSig();
qDebug()<<"Model over";
qDebug() << "Model over";
}
void MainWindow::on_action_generatorWaterPlane() {
void MainWindow::on_action_generatorWaterPlane()
{
DebugInfo("MainWindow::on_action_generatorWaterPlane\n");
emit this->on_action_generatorWaterPlaneSIGNAL(this);
}
void MainWindow::on_actionBatchStartFEKOCADModel() {
MainWidget::fekocadTaskinit* dlg=new MainWidget::fekocadTaskinit(this);
dlg->exec();
}
void MainWindow::on_actionCreateCADModel() {
DebugInfo("MainWindow::on_actionCreateCADModel\n");
QStringList stlList;
{
// 弹出对话框,询问是否导入场景中模型
if(MeshData::MeshData::getInstance()->getKernalCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的网格模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
stlList = this->on_saveMesh2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择stl文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"STL(*.stl)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
stlList.append(fileName);
}
}
}
QStringList geoList;
{
if(Geometry::GeometryData::getInstance()->getGeometrySetCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的几何模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
geoList = this->on_saveGeometryModel2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择iges文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"IGES(*.igs)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
geoList.append(fileName);
}
}
}
for(QString igsname:geoList){
stlList.append(igsname);
}
MainWidget::CreateFEKOCADModel* DialogcreateFekoCAD=new MainWidget::CreateFEKOCADModel(this);
DialogcreateFekoCAD->setSTLFilePathList(stlList);
DialogcreateFekoCAD->exec();
}
QStringList MainWindow::on_saveGeometryModel2StlFile_InScane()
{
QStringList geofileList;
QString geoPath=QFileDialog::getSaveFileName(this, "Save Geometry in FEKOCAD WorkSpace", "", "IGES(*.igs)");
if(geoPath.isEmpty())
{
return QStringList();
}
QString pycode = QString("MainWindow.exportGeometry(\"%1\")").arg(geoPath);
Py::PythonAgent::getInstance()->submit(pycode);
geofileList.append(geoPath);
return geofileList;
}
QStringList MainWindow::on_saveMesh2StlFile_InScane()
{
int KernalCount=MeshData::MeshData::getInstance()->getKernalCount();
QStringList stlfileList;
for(int ki=0;ki<KernalCount;ki++){
MeshData::MeshKernal* k=MeshData::MeshData::getInstance()->getKernalAt(ki);
if(k->isVisible()) {
MainWidget::MeshKernalViewObj* viewObj = this->getSubWindowManager()
->getPreWindow()
->getMeshViewProvider()
->getViewObjects(k);
if(viewObj->getDisplayData()->GetNumberOfCells()!=k->getMeshData()->GetNumberOfCells()||viewObj->getDisplayData()->GetNumberOfPoints()!=k->getMeshData()->GetNumberOfPoints()) {
if(QMessageBox::information(this, tr("Warning"), tr(u8"模型已经修改是否保存模型并导入到FEKOCAD中?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// 根据显示更新实体
k->getMeshData()->Initialize();
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->AddInputData(viewObj->getDisplayData());
geometryFilter->Update();
k->setMeshData(geometryFilter->GetOutput());
}
}else{}
QString stlPath=QFileDialog::getSaveFileName(this, "Save File in FEKOCAD WorkSpace", Setting::BusAPI::instance()->getWorkingDir()+"/"+k->getName(), "STL(*.stl)");
if(stlPath.isEmpty())
{
continue;
}
else{
// 保存模型
if(MeshOpearator::MeshOpearatorCommon::saveMeshDataToSTL( stlPath,k->getMeshData())){
this->printMessageToMessageWindow(ModuleBase::Message(Common::Message::Normal,QString(tr("Save %1 success!")).arg(stlPath)));
stlfileList.append(stlPath);
}else{
this->printMessageToMessageWindow(ModuleBase::Message(Common::Message::Error,QString(tr("Save %1 failed!")).arg(stlPath)));
}
}
}
else{}
}
return stlfileList;
}
void MainWindow::on_actionCreateLoadModelScript()
{
QStringList stlList;
{
// 弹出对话框,询问是否导入场景中模型
if(MeshData::MeshData::getInstance()->getKernalCount()!=0 && QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的网格模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
stlList = this->on_saveMesh2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择stl文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"STL(*.stl)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
stlList.append(fileName);
}
}
}
QStringList geoList;
{
if(Geometry::GeometryData::getInstance()->getGeometrySetCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的几何模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
geoList = this->on_saveGeometryModel2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择IGES文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
u8"IGES(*.igs)" // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
geoList.append(fileName);
}
}
}
if(stlList.count()!=0||geoList.count()!=0) {
// 生成FEKO模型加载参数
QString scriptPath = QFileDialog::getSaveFileName(
this, u8"保存为CAD模型创建文件", Setting::BusAPI::instance()->getWorkingDir(),
"_model_init_script(*.lua)");
if(scriptPath.isEmpty()) {
return;
} else {
}
Setting::TaskDesc* newTaskDesc = Setting::BusAPI::instance()->getNewTask();
newTaskDesc->setTaskClass(Setting::TaskClassDesc::WriteTask);
newTaskDesc->setState(Setting::TaskDescState::Running);
newTaskDesc->setTaskName(scriptPath);
emit actionGenerateImportModelScript(newTaskDesc->getTaskId(), this, stlList, geoList,
scriptPath);
}else{}
}
} // namespace GUI

View File

@ -35,6 +35,7 @@
// ribbon customize
#include "SARibbonBar/SARibbonActionsManager.h"
#include "SARibbonBar/SARibbonCustomizeWidget.h"
#include "MainWidgets/meshKernalViewObject.h"
class XToolManger;
class QTreeWidgetItem;
@ -85,6 +86,7 @@ namespace Post {
namespace XReport {
class ReportWindow;
}
namespace GUI {
class SubWindowManager;
class SignalHandler;
@ -304,7 +306,6 @@ namespace GUI {
// 打开二维曲线绘制信号
void openPlot();
// 点云处理信号
void on_actionLoadPointCloudText(GUI::MainWindow* m);
// 统计滤波
@ -350,7 +351,14 @@ namespace GUI {
void on_action_generatorWaterPlaneSIGNAL(GUI::MainWindow* m);
void exportMeshKernel2FEKOCAD(int taskID,QString FilePath,GUI::MainWindow* m,MeshData::MeshKernal* k,MainWidget::MeshKernalViewObj* viewObj);
void actionGenerateImportModelScript(int TaskID,GUI::MainWindow* m,QStringList stlPath,QStringList geoList,QString scriptPath);
public slots:
void on_actionCreateLoadModelScript();
/*状态栏显示信息 */
void setStatusBarInfo(QString);
/// 切换语言
@ -432,7 +440,9 @@ namespace GUI {
void on_saveMeshEdit();
void on_actionMeshTriangleSurface();
QStringList on_saveMesh2StlFile_InScane();
//void on_actionMeshToOCCT();
QStringList on_saveGeometryModel2StlFile_InScane();
private slots:
/*关闭主窗口 */
@ -450,8 +460,8 @@ namespace GUI {
/// 导入点云
void on_importPcl();
void on_actionBatchStartFEKOCADModel();
void on_actionCreateCADModel();
// 导入网格
void importMeshDataset(vtkDataSet* dataset);
// 导出网格

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1185</width>
<height>921</height>
<width>1156</width>
<height>900</height>
</rect>
</property>
<property name="windowTitle">
@ -41,7 +41,6 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionImportMesh"/>
@ -273,15 +272,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>1185</width>
<height>23</height>
<width>1156</width>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionClose"/>
<addaction name="separator"/>
@ -316,14 +314,6 @@
<addaction name="actionViewZMinus"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionUser_Guidance"/>
<addaction name="actionUser_Manual"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuSolve">
<property name="enabled">
<bool>true</bool>
@ -390,10 +380,6 @@
<property name="title">
<string>MeshEdit</string>
</property>
<addaction name="actionMeshDelete"/>
<addaction name="actionMeshCopy"/>
<addaction name="actionMeshClip"/>
<addaction name="actionMeshTriangleSurface"/>
</widget>
<addaction name="actionSurfaceMesh"/>
<addaction name="actionSolidMesh"/>
@ -565,6 +551,9 @@
<addaction name="separator"/>
<addaction name="actionantScatteringFEKOSetting"/>
<addaction name="separator"/>
<addaction name="actionCreateLoadModelScript"/>
<addaction name="actionCreateCADModel"/>
<addaction name="actionBatchStartFEKOCADModel"/>
</widget>
<widget class="QMenu" name="menuTarget">
<property name="title">
@ -584,7 +573,7 @@
<addaction name="actionMeshProcess"/>
<addaction name="actionPointCloudProcess"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_ForestTarget">
<property name="title">
@ -603,6 +592,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -622,7 +612,7 @@
</property>
<addaction name="actionLoadPreCropMeshFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_CropTarget">
<property name="title">
@ -641,6 +631,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -660,7 +651,7 @@
</property>
<addaction name="actionLoadPreGrasslandMeshFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_GrasslandTarget">
<property name="title">
@ -679,6 +670,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -698,7 +690,7 @@
</property>
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_WaterBodyTarget">
<property name="title">
@ -717,6 +709,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -737,7 +730,7 @@
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_SoilTarget">
<property name="title">
@ -756,6 +749,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -776,7 +770,7 @@
<addaction name="actionLoadPreDynamicWaterBodyMeshFile"/>
<addaction name="action_generatorWaterPlane"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_DynamicWaterBodyTarget">
<property name="title">
@ -795,6 +789,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -816,7 +811,7 @@
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_RoadTarget">
<property name="title">
@ -835,6 +830,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -853,8 +849,9 @@
<string>制备</string>
</property>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL">
<property name="title">
@ -873,6 +870,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -892,7 +890,7 @@
</property>
<addaction name="actionLoadGeometricCorrectionFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_GeometricCorrectionScene">
<property name="title">
@ -911,6 +909,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -930,7 +929,7 @@
</property>
<addaction name="actionLoadRadioModelFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL">
<property name="title">
@ -949,6 +948,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -976,7 +976,7 @@
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_LandSurfaceScene">
<property name="title">
@ -995,6 +995,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -1015,7 +1016,7 @@
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_WaterBodyScene">
<property name="title">
@ -1034,6 +1035,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -1061,7 +1063,7 @@
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionScaneExport"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_VegetationScene">
<property name="title">
@ -1080,6 +1082,7 @@
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
@ -1116,7 +1119,6 @@
<addaction name="menuWindows"/>
<addaction name="menuSettings"/>
<addaction name="menuPlugins"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="GeometryEditToolBar">
<property name="windowTitle">
@ -1283,6 +1285,11 @@
<string>加载FEKO图像回波仿真结果</string>
</property>
</action>
<action name="actionExportFEKOResultToEcho">
<property name="text">
<string>切分回波结果</string>
</property>
</action>
<action name="actionFEKOImageCreate">
<property name="text">
<string>FEKO成像结果</string>
@ -1597,7 +1604,7 @@
<normaloff>:/QUI/icon/graphOption.png</normaloff>:/QUI/icon/graphOption.png</iconset>
</property>
<property name="text">
<string>Graph Options</string>
<string>参数设置</string>
</property>
</action>
<action name="actionSurfaceMesh">
@ -2676,7 +2683,7 @@
</action>
<action name="actionPCLPoissonMesh">
<property name="text">
<string>PoissonMesh</string>
<string>泊松重建</string>
</property>
</action>
<action name="actionGeo1">
@ -2766,6 +2773,31 @@
<string>生成动态水面</string>
</property>
</action>
<action name="actionMeshSave">
<property name="text">
<string>MeshSave</string>
</property>
</action>
<action name="actionMeshUndo">
<property name="text">
<string>MeshReLoading</string>
</property>
</action>
<action name="actionBatchStartFEKOCADModel">
<property name="text">
<string>批量生成计算任务</string>
</property>
</action>
<action name="actionCreateCADModel">
<property name="text">
<string>创建FEKOCAD模型</string>
</property>
</action>
<action name="actionCreateLoadModelScript">
<property name="text">
<string>生成加载模型参数文件</string>
</property>
</action>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>

View File

@ -1673,8 +1673,10 @@ namespace GUI {
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
if(!meshSet)
if(!meshSet){
qDebug()<<"nullptr==meshSet";
continue;
}
meshSet->generateDisplayDataSet();
vtkSmartPointer<vtkDataSet> tempDisplayDataSet=meshSet->getDisplayDataSet();
if(nullptr==tempDisplayDataSet){

View File

@ -82,6 +82,7 @@ add_library(ModuleBase
${_interface}
${_header}
${_source}
)
#-----------------------------------------------------------------------------

View File

@ -428,10 +428,11 @@ namespace LAMPCAEDesigner
//_meshConfig->enableExportMesh(meshConfig->isExportMeshEnabled());
_exportMeshSuffix = meshConfig->getExportSuffix();
_meshConfig->setExportSuffix(meshConfig->getExportSuffix());
_importPclSuffix=meshConfig->getImportSuffix(ConfigOption::MeshDataType::PointCloud);
_meshConfig->setImportSuffix(_importPclSuffix);
_importPclSuffix=meshConfig->getImportSuffix(ConfigOption::MeshDataType::PointCloud); // 点云
_meshConfig->setImportSuffix(_importPclSuffix,ConfigOption::MeshDataType::PointCloud);
_exportPclSuffix=meshConfig->getExportSuffix(ConfigOption::MeshDataType::PointCloud);
_meshConfig->setExportSuffix(_exportPclSuffix);
_meshConfig->setExportSuffix(_exportPclSuffix,ConfigOption::MeshDataType::PointCloud);
// _meshConfig->enableMeshGeneration(meshConfig->isMeshGenerationEnabled());
_isSurfaceMesh = meshConfig->isSurfaceMeshEnabled();

View File

@ -94,9 +94,12 @@ add_library(PluginMeshDataExchange
${_interface}
${_header}
${_source}
ExportSTLDataSigleKernelExchange.cpp
ExportSTLDataSigleKernelExchange.h
)
message(${_header})
message(${_source})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,85 @@
/**
* @file STLDataSigleKernelExchange.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include <vtkGeometryFilter.h>
#include <vtkSTLWriter.h>
#include <QFile>
#include "ExportSTLDataSigleKernelExchange.h"
#include "Settings/BusAPI.h"
#include "Common/Types.h"
#include "MainWindow/MainWindow.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
namespace MeshData {
ExportSTLDataSigleKernelExchange::ExportSTLDataSigleKernelExchange(const QString& fileName,
int taskID, int KernelID,
GUI::MainWindow* mw)
: ModuleBase::ThreadTask(mw)
, _KID(KernelID)
, _TaskID(taskID)
, _fileName(fileName)
{
}
ExportSTLDataSigleKernelExchange::~ExportSTLDataSigleKernelExchange() {}
void ExportSTLDataSigleKernelExchange::defaultMeshFinished()
{
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
QString information{};
ModuleBase::Message msg;
if(_success) {
information = QString("Successful Export Mesh to \"%1\"").arg(_fileName);
msg.type = Common::Message::Normal;
msg.message = information;
Setting::BusAPI::instance()->findTask(_TaskID)->setState(
Setting::TaskDescState::Finished);
emit _mainwindow->printMessage(Common::Message::Normal,
"Export STL File Success" + _fileName);
} else {
information = QString("Failed Export Mesh to \"%1\"").arg(_fileName);
msg.type = Common::Message::Error;
msg.message = information;
Setting::BusAPI::instance()->findTask(_TaskID)->setState(
Setting::TaskDescState::Failed);
emit _mainwindow->printMessage(Common::Message::Error,
"Export STL File Failed" + _fileName);
}
emit showInformation(information);
emit _mainwindow->printMessageToMessageWindow(msg);
}
void ExportSTLDataSigleKernelExchange::run()
{
ModuleBase::ThreadTask::run();
QString stlPath = _fileName;
Setting::BusAPI::instance()->findTask(_TaskID)->setState(Setting::TaskDescState::Running);
MeshKernal* k = MeshData::getInstance()->getKernalByID(_KID);
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->SetInputData(k->getMeshData());
geometryFilter->Update();
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
writer->SetInputConnection(geometryFilter->GetOutputPort());
writer->SetFileTypeToBinary();
writer->SetFileName(stlPath.toLocal8Bit().constData());
writer->Write();
if(QFile(stlPath).exists()) {
_success = true;
} else {
_success = false;
}
defaultMeshFinished();
}
} // namespace MeshData

View File

@ -0,0 +1,40 @@
/**
* @file STLDataSigleKernelExchange.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_EXPORTSTLDATASIGLEKERNELEXCHANGE_H
#define LAMPCAE_EXPORTSTLDATASIGLEKERNELEXCHANGE_H
#include "ModuleBase/ThreadTask.h"
#include "meshDataExchangePluginAPI.h"
#include "meshDataExchangePlugin.h"
#include "MainWindow/MainWindow.h"
namespace MeshData {
class MESHDATAEXCHANGEPLUGINAPI ExportSTLDataSigleKernelExchange
: public ModuleBase::ThreadTask
{
public:
ExportSTLDataSigleKernelExchange(const QString &fileName,int taskID,int KernelID,GUI::MainWindow *mw);
virtual ~ExportSTLDataSigleKernelExchange();
virtual void run();
void defaultMeshFinished();
private:
bool _success{false};
QString _fileName;
int _KID;
int _TaskID;
};
} // namespace MeshData
#endif // LAMPCAE_EXPORTSTLDATASIGLEKERNELEXCHANGE_H

View File

@ -6,6 +6,7 @@
#include "MeshData/meshKernal.h"
#include "Common/Types.h"
#include "Common/DebugLogger.h"
#include <QDebug>
namespace MeshData
{
@ -21,7 +22,9 @@ namespace MeshData
void MeshThreadBase::defaultMeshFinished()
{
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
qDebug()<<"MeshThreadBase::defaultMeshFinished";
if (_threadRuning)
{
QString information{};
@ -36,6 +39,7 @@ namespace MeshData
// emit _mainwindow->updateActionsStatesSig();
emit _mainwindow->getSubWindowManager()->openPreWindowSig();
emit _mainwindow->updatePreMeshActorSig();
qDebug()<<"MeshThreadBase::defaultMeshFinished";
information = QString("Successful Import Mesh From \"%1\"").arg(_fileName);
msg.type = Common::Message::Normal;
msg.message = information;
@ -75,8 +79,7 @@ namespace MeshData
}
// emit showInformation(information);
// emit _mainwindow->printMessageToMessageWindow(msg);
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
}
void MeshThreadBase::setReadResult(bool result)

View File

@ -36,6 +36,8 @@ namespace WBFZ {
this->initVTKView(); // 初始化VTK视图
this->setWindowTitle(u8"预制模型导入");
this->ui->progressBar->setValue(0);
// 连接 comboBox 的 setCurrentText 信号与更新 listWidget 的槽函数
connect(ui->FiltercomboBox, QOverload<const QString &>::of(&QComboBox::setCurrentText), this, &DialogImportModelDataset::updateModellistWidget);
@ -43,16 +45,12 @@ namespace WBFZ {
// 连接 comboBox 的 currentIndexChanged 信号与更新 listWidget 的槽函数
connect(ui->FiltercomboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, &DialogImportModelDataset::updateModellistWidget);
// 连接 listWidget 的 currentItemChanged 信号与更新 VTK 的槽函数
connect(ui->ModellistWidget, QOverload<QListWidgetItem *, QListWidgetItem *>::of(&QListWidget::currentItemChanged),
this, &DialogImportModelDataset::handleItemClicked);
// 连接 pushButton 的 clicked 信号与更新 listWidget 的槽函数
connect(ui->Addmodel_pushButton, SIGNAL(clicked()), this, SLOT(on_push_add_models_slot()));
connect(ui->ModellistWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(modelItem_doubleClicked(QListWidgetItem *)));
connect(this, SIGNAL(updateFilterModel(const QString )), this, SLOT(filterModel(const QString)));
connect(this, SIGNAL(updateFilterModel(const QString )), this, SLOT(FilterModelByEnglish(const QString)));
// connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(on_TestLoadModelImport()));
}
@ -68,10 +66,8 @@ namespace WBFZ {
//清除FiltercomboBox内容
ui->FiltercomboBox->clear();
// 初始化其它设置
_librarySettingPath = QString("%1\\model\\library.ini").arg(Setting::BusAPI::instance()->getApplicationExePath()); // 替换为实际的配置文件路径
// 读取INI文件中的Names分组
QSettings settings(_librarySettingPath, QSettings::IniFormat);
settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
@ -80,6 +76,7 @@ namespace WBFZ {
QStringList keys = settings.childKeys();
for (const QString &key : keys) {
_categories[settings.value(key).toString()] = key; // 将中文名称作为键,英文名称作为值存储
_categoriesEnglish[key] = settings.value(key).toString();
}
settings.endGroup();
@ -101,13 +98,13 @@ namespace WBFZ {
// 模型筛选
void DialogImportModelDataset::filterModel(QString filterStr) {
qDebug()<<filterStr;
QSettings settings(_librarySettingPath, QSettings::IniFormat);
settings.beginGroup("Models");
QString key = getEnglishCategory(filterStr);
QStringList models = settings.value(key).toStringList();
settings.endGroup();
ui->ModellistWidget->clear();
if (!models.isEmpty()) {
ui->ModellistWidget->addItems(models);
@ -392,19 +389,22 @@ namespace WBFZ {
// 根据获取的路径导入预览模型
this->importPreViewModel(modelPath);
this->curViewPath=modelPath;
// this->importMeshModelToMainWindows(modelPath);
}
settings.endGroup();
//
//
// qDebug()<<"modelItem_doubleClicked : "+selectPath;
// this->importPreViewModel(selectPath);
}
void DialogImportModelDataset::accept()
{
this->importMeshModelToMainWindows(this->curViewPath);
QDialog::accept();
}
void DialogImportModelDataset::FilterModelByEnglish(const QString& filterStr) {
QString comboxfilterStr = _categoriesEnglish[filterStr];
this->ui->FiltercomboBox->setCurrentText(comboxfilterStr);
//filterModel(comboxfilterStr);
}
} // namespace WBFZ

View File

@ -37,7 +37,7 @@ namespace WBFZ {
~DialogImportModelDataset() override;
public:
public slots:
void initLibrary();
void filterModel(QString filterStr);// 根据条件筛选
QString getEnglishCategory(const QString &chineseCategory); // 新增中英文转换函数声明
@ -49,6 +49,7 @@ namespace WBFZ {
public slots:
virtual void accept();
void FilterModelByEnglish(const QString& filterStr); // 新增根据英文筛选函数声明
void updateModellistWidget(const QString &filterStr); // 声明 updateModellistWidget 函数
void handleItemClicked(QListWidgetItem *current, QListWidgetItem *previous);
void on_push_add_models_slot();
@ -59,7 +60,7 @@ namespace WBFZ {
Ui::DialogImportModelDataset* ui;
QString _librarySettingPath; // ini 配置环境地址
QMap<QString, QString> _categories; // 用于存储Names分组的数据
QMap<QString,QString> _categoriesEnglish; // 用于存储英文分组的数据
// 三维模型操作
public: // 陈增辉
void importMeshModelToMainWindows(QString stdPath); // 最终导入模型

View File

@ -0,0 +1,28 @@
/**
* @file dialogpointcloudscane.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-18
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPointCloudScane.h"
// resolved
#include "dialogpointcloudscane.h"
#include "ui_DialogPointCloudScane.h"
namespace WBFZEquipment {
DialogPointCloudScane::DialogPointCloudScane(QWidget* parent)
: QDialog(parent)
, ui(new Ui::DialogPointCloudScane)
{
ui->setupUi(this);
}
DialogPointCloudScane::~DialogPointCloudScane()
{
delete ui;
}
} // namespace WBFZEquipment

View File

@ -0,0 +1,34 @@
/**
* @file dialogpointcloudscane.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-18
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPOINTCLOUDSCANE_H
#define LAMPCAE_DIALOGPOINTCLOUDSCANE_H
#include <QDialog>
namespace WBFZEquipment {
QT_BEGIN_NAMESPACE
namespace Ui {
class DialogPointCloudScane;
}
QT_END_NAMESPACE
class DialogPointCloudScane : public QDialog {
Q_OBJECT
public:
explicit DialogPointCloudScane(QWidget* parent = nullptr);
~DialogPointCloudScane() override;
private:
Ui::DialogPointCloudScane* ui;
};
} // namespace WBFZEquipment
#endif // LAMPCAE_DIALOGPOINTCLOUDSCANE_H

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WBFZEquipment::DialogPointCloudScane</class>
<widget class="QDialog" name="WBFZEquipment::DialogPointCloudScane">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>700</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="btnDown">
<property name="text">
<string>垂直向下运动</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="btnForward">
<property name="text">
<string>平台前进</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnUp">
<property name="text">
<string>垂直向上运动</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="btnBackward">
<property name="text">
<string>平台后退</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="btnStartScan">
<property name="text">
<string>开始扫描</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -23,8 +23,12 @@
#include <QFileInfo>
#include "MeshOperator.h"
#include "wavemodel.h"
#include "MeshOperatorMenu.h"
#include "Settings/BusAPI.h"
#include "ExportSTLDataSigleKernelExchange.h"
#include <QDebug>
#include <vtkSTLWriter.h>
#include <QFileDialog>
GUI::MainWindow* MeshData::MeshDataExchangePlugin::_mainwindow = nullptr;
namespace MeshData {
@ -38,22 +42,16 @@ namespace MeshData {
connect(_mainwindow, SIGNAL(on_loadPreMeshFile(GUI::MainWindow*, QString)), this,
SLOT(on_LoadPreMeshFileDialog(GUI::MainWindow*, QString)));
_toolboxMenu = new QMenu("ImportTestBar");
QAction* action_ModelFilterImport = _toolboxMenu->addAction("ModelFilterImport");
connect(action_ModelFilterImport, SIGNAL(triggered()), this,
SLOT(on_TestLoadModelImport()));
m->menuBar()->addMenu(_toolboxMenu);
// _toolboxMenu = new QMenu("ImportTestBar");
// QAction* action_ModelFilterImport = _toolboxMenu->addAction("ModelFilterImport");
// connect(action_ModelFilterImport, SIGNAL(triggered()), this,
// SLOT(on_TestLoadModelImport()));
// m->menuBar()->addMenu(_toolboxMenu);
connect(_mainwindow, SIGNAL(on_deleteMeshSIGNAL(GUI::MainWindow*)), this,
SLOT(on_deleteMesh(GUI::MainWindow*)));
connect(_mainwindow, SIGNAL(on_copyMeshSIGNAL(GUI::MainWindow*)), this,
SLOT(on_copyMesh(GUI::MainWindow*)));
connect(_mainwindow, SIGNAL(on_clipMeshSIGNAL(GUI::MainWindow*)), this,
SLOT(on_clipMesh(GUI::MainWindow*)));
connect(_mainwindow, SIGNAL(on_saveMeshSIGNAL(GUI::MainWindow*)), this,
SLOT(on_saveMesh(GUI::MainWindow*)));
connect(_mainwindow, SIGNAL(on_action_generatorWaterPlaneSIGNAL(GUI::MainWindow*)), this,
SLOT(on_action_generatorWaterPlane(GUI::MainWindow*)));
connect(_mainwindow, SIGNAL(exportMeshKernel2FEKOCAD(QString ,GUI::MainWindow* ,MeshData::MeshKernal* ,MainWidget::MeshKernalViewObj* )), this,
SLOT(on_exportMeshKernel2FEKOCAD(QString ,GUI::MainWindow* ,MeshKernal* ,MainWidget::MeshKernalViewObj* )));
}
bool MeshDataExchangePlugin::install()
@ -71,6 +69,7 @@ namespace MeshData {
IO::IOConfigure::RegisterMeshImporter("LS-DYNA(*.k)", KEYimportMesh);
IO::IOConfigure::RegisterMeshImporter("PDB(*.pdb)", PDBimportMesh);
IO::IOConfigure::RegisterMeshImporter("Patran(*.bdf)", BDFimportMesh);
IO::IOConfigure::RegisterPclImporter("VegetationPointCloud(*.xyz)", XYZimportPCL); // 点云
IO::IOConfigure::RegisterPclImporter("Point Cloud Data(*.pcd)", PCDimportPCL);
IO::IOConfigure::RegisterPclImporter("Polygon File Format(*.ply)", PLYimportPCL);
@ -87,9 +86,13 @@ namespace MeshData {
IO::IOConfigure::RegisterMeshExporter("SU2(*.su2)", SU2exportMesh);
IO::IOConfigure::RegisterMeshExporter("LS-DYNA(*.key)", KEYexportMesh);
IO::IOConfigure::RegisterMeshExporter("PDB(*.pdb)", PDBexportMesh);
IO::IOConfigure::RegisterPclExporter("Point Cloud Data(*.pcd)", PCDexportPCL);
IO::IOConfigure::RegisterPclExporter("vtk polygon Data(*.ply)", PLYexportPCL);
MeshOperatorMenu* meshOperatorMenu=new MeshOperatorMenu(_mainwindow);
return true;
}
@ -148,31 +151,14 @@ namespace MeshData {
}
void MeshDataExchangePlugin::on_LoadPreMeshFileDialog(GUI::MainWindow* _m, QString _fileType)
{
qDebug()<<_fileType;
// emit this->on_loadPreMeshFile(this, "radi");
WBFZ::DialogImportModelDataset* dialog = new WBFZ::DialogImportModelDataset(_mainwindow);
dialog->show();
emit dialog->updateFilterModel(_fileType);
dialog->show();
}
void MeshDataExchangePlugin::on_deleteMesh(GUI::MainWindow* m)
{
MeshOperator* _meshOperator = new MeshOperator(m);
_meshOperator->on_deleteMesh();
}
void MeshDataExchangePlugin::on_copyMesh(GUI::MainWindow* m)
{
MeshOperator* _meshOperator = new MeshOperator(m);
_meshOperator->on_copyMesh();
}
void MeshDataExchangePlugin::on_clipMesh(GUI::MainWindow* m)
{
MeshOperator* _meshOperator = new MeshOperator(m);
_meshOperator->on_clipMesh();
}
void MeshDataExchangePlugin::on_saveMesh(GUI::MainWindow* m)
{
MeshOperator* _meshOperator = new MeshOperator(m);
_meshOperator->on_saveMesh();
}
void MeshDataExchangePlugin::on_action_generatorWaterPlane(GUI::MainWindow* m)
{
// 生成水平面
@ -181,6 +167,16 @@ namespace MeshData {
w->show();
}
void MeshDataExchangePlugin::on_exportMeshKernel2FEKOCAD(int taskID,QString stlPath,GUI::MainWindow* m, MeshKernal* k,
MainWidget::MeshKernalViewObj* viewObj)
{
ExportSTLDataSigleKernelExchange* exportSTLDataSigleKernelExchange =
new ExportSTLDataSigleKernelExchange(stlPath, taskID, k->getID(), m);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(exportSTLDataSigleKernelExchange);
emit tc->threadStart();
}
} // namespace MeshData
void Register(GUI::MainWindow* m, QList<Plugins::PluginBase*>* ps)
@ -200,9 +196,9 @@ bool CGNSimportMesh(QString AbFileName, int modelId)
bool CGNSexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto CGNSwriter = new MeshData::CGNSdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -222,9 +218,9 @@ bool MSHimportMesh(QString AbFileName, int modelId)
bool MSHexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto MSHwriter = new MeshData::MSHdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -244,9 +240,9 @@ bool NEUimportMesh(QString AbFileName, int modelId)
bool NEUexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto NEUwriter = new MeshData::NEUdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -266,9 +262,9 @@ bool VTK_DAT_STL_importMesh(QString AbFileName, int modelId)
bool VTK_DAT_STL_exportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto VTK_DAT_STL_writer = new MeshData::VTKdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -288,9 +284,9 @@ bool INPimportMesh(QString AbFileName, int modelId)
bool INPexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto INPwriter = new MeshData::INPdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -310,9 +306,9 @@ bool CNTMimportMesh(QString AbFileName, int modelId)
bool CNTMexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto CNTMwriter = new MeshData::CNTMdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -342,9 +338,9 @@ bool SU2importMesh(QString AbFileName, int modelId)
bool SU2exportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto SU2writer = new MeshData::CNTMdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -365,9 +361,9 @@ bool AnotherSU2importMesh(QString AbFileName)
bool AnotherSU2exportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto SU2writer = new MeshData::CNTMdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -389,9 +385,9 @@ bool KEYimportMesh(QString AbFileName, int modelId)
bool KEYexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto KEYwirter = new MeshData::KEYdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -423,9 +419,9 @@ bool MESHDATAEXCHANGEPLUGINAPI BDFimportMesh(QString AbFileName, int modelId)
bool MESHDATAEXCHANGEPLUGINAPI PDBexportMesh(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto PDBWriter = new MeshData::PDBdataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -446,9 +442,9 @@ bool MESHDATAEXCHANGEPLUGINAPI FOAMimportMesh(QString AbFileName, int modelId)
bool MESHDATAEXCHANGEPLUGINAPI FOAMexportMesh(QString AbFileName, int id)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto FoamWriter = new MeshData::FoamDataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), id);
@ -493,9 +489,9 @@ bool MESHDATAEXCHANGEPLUGINAPI PLYimportPCL(QString AbFileName, int id)
bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto pcdWriter = new MeshData::PointClouddataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);
@ -506,9 +502,9 @@ bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName, int modelId)
bool MESHDATAEXCHANGEPLUGINAPI PLYexportPCL(QString AbFileName, int modelId)
{
MeshData::MeshOperator* _meshOperator =
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
_meshOperator->on_saveMesh();
// MeshData::MeshOperator* _meshOperator =
// new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
// _meshOperator->on_saveMesh();
auto pcdWriter = new MeshData::PointClouddataExchange(
AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId);

View File

@ -3,13 +3,13 @@
#include "meshDataExchangePluginAPI.h"
#include "PluginManager/pluginBase.h"
#include "MeshData/meshKernal.h"
#include <QMenuBar>
#include <QMenu>
#include "MainWidgets/meshKernalViewObject.h"
namespace MeshData {
class MeshOperator;
// class MeshOperator;
enum MeshOperation { MESH_NONE, MESH_READ, MESH_WRITE };
@ -34,14 +34,25 @@ namespace MeshData {
public slots:
void on_TestLoadModelImport();
void on_LoadPreMeshFileDialog(GUI::MainWindow* _m, QString _fileType);
void on_deleteMesh(GUI::MainWindow* m);
void on_copyMesh(GUI::MainWindow* m);
void on_clipMesh(GUI::MainWindow* m);
void on_saveMesh(GUI::MainWindow* m);
void on_action_generatorWaterPlane(GUI::MainWindow* m);
void on_exportMeshKernel2FEKOCAD(int taskID,QString FilePath,GUI::MainWindow* m,MeshKernal* k,MainWidget::MeshKernalViewObj* viewObj);
};
}
extern "C"
{
void MESHDATAEXCHANGEPLUGINAPI Register(GUI::MainWindow* m, QList<Plugins::PluginBase*>* plugs);

View File

@ -63,7 +63,7 @@ int CMDExcuteApp::excuteCmd(QString exePath, QString params)
int CMDExcuteApp::waitExcutedFinish()
{
while (!this->cmd->waitForFinished()) {
if(this->cmd->waitForFinished(-1)) {
//qDebug() << u8"运行状态:" << this->cmd->state();
QCoreApplication::processEvents();
}

View File

@ -291,7 +291,7 @@ void FEKOBase::FEKOSimulationSARClass::saveFEKOImageSettingXML() {
qDebug() << "finish save fekoSimulation xml file.";
}
QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfidx, size_t endprfidx,QString cfxName,FEKOBase::TRANSLATIONPOLARTYPE polartype) {
QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfidx, size_t endprfidx,QString cfxName,FEKOBase::TRANSLATIONPOLARTYPE polartype,QString ConfigurationPreSuffix) {
if (this->simulationparams->startfreq > 1e6) {
this->simulationparams->startfreq = this->simulationparams->startfreq / 1e9;
} // ==> GHz
@ -348,7 +348,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8"--- local ant_phi_start=-1.5 -- 当前工程的起始点 天线指向扫描角\n");
luascript = luascript + QString(u8"--- local ant_phi_delta= 3/2800 -- 这里调整步进增量为\n");
luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8"--- PRF POint Setting --- \n");
luascript = luascript + QString(u8"--- PRF Point Setting --- \n");
{
@ -356,11 +356,11 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
for (size_t i = startprfidx; i < this->FEKOAntPoselist.size() && i < endprfidx; i++) {
FEKOBase::FEKOSatelliteParams temp = this->FEKOAntPoselist[i];
QString prf_id = QString::number(QString::number(temp.PRFidx).toInt());
luascript = luascript + QString(u8" ---------------------\"%1_PRF_%2\" start polarangle do not rotation -------------------------------------------------\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" ---------------------\"%1_%2_%3\" start polarangle do not rotation -------------------------------------------------\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8" PRF_phi=%1 --- 天线照射方向\n").arg(QString::number(temp.antpos.phi));
luascript = luascript + QString(u8" PRF_theta=%1 --- 入射角\n").arg(QString::number(temp.antpos.theta));
luascript = luascript + QString(u8" temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n");
luascript = luascript + QString(u8" temp_standardConfiguration.Label=\"%1_PRF_%2\" -- set standardConfiguration label PRF Count\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" temp_standardConfiguration.Label=\"%1_%2_%3\" -- set standardConfiguration label PRF Count\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8" --- set frequency\n"); // 设置频率
luascript = luascript + QString(u8" frequencyRange=temp_standardConfiguration.Frequency\n");
luascript = luascript + QString(u8" properties = frequencyRange:GetProperties()\n");
@ -371,7 +371,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8" frequencyRange:SetProperties(properties)\n");
luascript = luascript + QString(u8" -- set Source\n");
luascript = luascript + QString(u8" farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(farFieldData)\n"); // 设置发射源
luascript = luascript + QString(u8" farFieldSource.Label=\"FarSource_%1_PRF_%2\"\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" farFieldSource.Label=\"FarSource_%1_%2_%3\"\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8" farFieldSource.Position.U=%1\n").arg(QString::number(temp.antpos.x));
luascript = luascript + QString(u8" farFieldSource.Position.V=%1\n").arg(QString::number(temp.antpos.y));
luascript = luascript + QString(u8" farFieldSource.Position.N=%1\n").arg(QString::number(temp.antpos.z));
@ -384,7 +384,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8" -- set nearfield\n");
luascript = luascript + QString(u8" temp_nearFieldRequest=temp_standardConfiguration.NearFields:AddSpherical(%1,%2,%3,%4,%5,%6,1,1,1) -- nearfield \n").arg(QString::number(0)).arg(QString::number(temp.antpos.theta)).arg(QString::number(temp.antpos.phi)).arg(QString::number(0)).arg(QString::number(temp.antpos.theta)).arg(QString::number(temp.antpos.phi)); // 设置接收点
luascript = luascript + QString(u8" temp_nearFieldRequest.Label=\"NearField_%1_PRF_%2\"\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" temp_nearFieldRequest.Label=\"NearField_%1_%2_%3\"\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8" temp_nearFieldRequest_workplane=temp_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8" temp_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(temp.antpos.x));
luascript = luascript + QString(u8" temp_nearFieldRequest_workplane.Origin.Y=%1\n").arg(QString::number(temp.antpos.y));
@ -401,15 +401,15 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8" \n");
luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8" -- \n");
luascript = luascript + QString(u8" print(\"%1_PRF_%2\")\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" ---------------------\"%1_PRF_%2\" end -------------------------------------------------\n").arg(polarTranslationflag).arg(prf_id);
luascript = luascript + QString(u8" print(\"%1_%2_%3\")\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8" ---------------------\"%1_%2_%3\" end -------------------------------------------------\n").arg(polarTranslationflag).arg(ConfigurationPreSuffix).arg(prf_id);
luascript = luascript + QString(u8"\n");
}
}
luascript = luascript + QString(u8"-- prf point setting over -------\n");
luascript = luascript + QString(u8" \n");
luascript = luascript + QString(u8"--------------------- \"remove not PRF configuration \"-----------------------------\n");
luascript = luascript + QString(u8"--------------------- \"remove not %1 configuration \"-----------------------------\n").arg(ConfigurationPreSuffix);
luascript = luascript + QString(u8"local configid = #(project.SolutionConfigurations)\n");
luascript = luascript + QString(u8"print(configid)\n");
luascript = luascript + QString(u8"local config_idx = 0;\n");
@ -417,7 +417,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8" config_idx = configid - idx + 1\n");
luascript = luascript + QString(u8" temp_standardConfig = project.SolutionConfigurations:Item(config_idx)\n");
luascript = luascript + QString(u8" configlabel = temp_standardConfig.Label\n");
luascript = luascript + QString(u8" if string.find(configlabel, \"PRF\") then\n");
luascript = luascript + QString(u8" if string.find(configlabel, \"%1\") then\n").arg(ConfigurationPreSuffix);
luascript = luascript + QString(u8" print(configlabel)\n");
luascript = luascript + QString(u8" else\n");
luascript = luascript + QString(u8" temp_standardConfig:Delete()\n");

View File

@ -235,7 +235,7 @@ namespace FEKOBase {
public: // 初始化模型
void loadFEKOImageSettingXML(QString xmlpath);
void saveFEKOImageSettingXML();
QString createLuaSciptString(size_t startprfidx, size_t endprfidx,QString cfxName,FEKOBase::TRANSLATIONPOLARTYPE polartype=FEKOBase::TRANSLATIONPOLARTYPE::POLAR_VT);
QString createLuaSciptString(size_t startprfidx, size_t endprfidx,QString cfxName,FEKOBase::TRANSLATIONPOLARTYPE polartype=FEKOBase::TRANSLATIONPOLARTYPE::POLAR_VT,QString ConfigurationPreSuffix="PRF");
};
//==========================================================

View File

@ -428,10 +428,6 @@ void QtSARAntModelSettingClass::on_pushButton_OK_clicked()
this->refreshFEKOSimulationParams(); // 最后更新下参数
this->saveFEKOImageSettingXML();
if(this->ui->checkBox_VT->isChecked()) {
this->CreateInitCfxScript(FEKOBase::POLAR_VT);
@ -493,8 +489,6 @@ void QtSARAntModelSettingClass::on_pushButton_OK_clicked()
qDebug() << "User canceled operation.";
break; // 退出任务循环
}
}
progressDialog.setWindowTitle(u8"馈源脚本生产成功");
progressDialog.setValue(this->FEKOAntPoselist.size());
@ -783,19 +777,19 @@ void QtSARAntModelSettingClass::CreateInitCfxScript(FEKOBase::TRANSLATIONPOLARTY
QString cfxName ="";
QString luatext="";
if(polartype==FEKOBase::TRANSLATIONPOLARTYPE::POLAR_VT) {
cfxName = QString("%1_%2_POLAR_VT_PRF_ant_init_script")
cfxName = QString("%1_%2_POLAR_VT_PRF_ant_init_template_script")
.arg(this->simulationparams->taskName)
.arg(FEKOBase::FEKOImageModeenumToString(this->simulationparams->imagemode))
.arg(QString::number(start_prf_idx))
.arg(QString::number(end_prf_idx - 1));
luatext =this->createLuaSciptString(start_prf_idx, end_prf_idx, cfxName, FEKOBase::POLAR_VT);
luatext =this->createLuaSciptString(start_prf_idx, end_prf_idx, cfxName, FEKOBase::POLAR_VT,"template");
}else if(polartype==FEKOBase::TRANSLATIONPOLARTYPE::POLAR_HT){
cfxName = QString("%1_%2_POLAR_HT_PRF_ant_init_script")
cfxName = QString("%1_%2_POLAR_HT_PRF_ant_init_template_script")
.arg(this->simulationparams->taskName)
.arg(FEKOBase::FEKOImageModeenumToString(this->simulationparams->imagemode))
.arg(QString::number(start_prf_idx))
.arg(QString::number(end_prf_idx - 1));
luatext=this->createLuaSciptString(start_prf_idx, end_prf_idx, cfxName, FEKOBase::POLAR_HT);
luatext=this->createLuaSciptString(start_prf_idx, end_prf_idx, cfxName, FEKOBase::POLAR_HT,"template");
}else{
return;
}

View File

@ -11,7 +11,7 @@
#include "DialogPCLBilateralFilter.h"
#include "DialogPCLGPMesh.h"
#include "DialogPCLPoissonMesh.h"
#include "Settings/BusAPI.h"
#include <QFileInfo>
#include "Common/DebugLogger.h"
#include "AllHead.h"
@ -60,6 +60,9 @@ namespace WBFZ {
connect(_mainwindow,SIGNAL(on_actionImageShowToolTriggleSIGNAL(GUI::MainWindow* )),this,SLOT(actionImageShowToolShow(GUI::MainWindow*)));
connect(_mainwindow,SIGNAL(on_actionRCShowToolSIGNAL(GUI::MainWindow* )),this,SLOT(actionactionRCShowTool(GUI::MainWindow*)));
connect(_mainwindow,SIGNAL(actionGenerateImportModelScript(int ,GUI::MainWindow* ,QStringList,QStringList ,QString )),this,SLOT(actionGenerateImportModelScript(int ,GUI::MainWindow* ,QStringList,QStringList ,QString )));
DebugInfo("WBFZExchangePlugin::WBFZExchangePlugin has init \n");
}
@ -166,6 +169,51 @@ namespace WBFZ {
MainWidget::DialogPCLPoissonMesh dlg(m);
dlg.exec();
}
void WBFZExchangePlugin::actionGenerateImportModelScript(int TaskID, GUI::MainWindow* m,
QStringList stlPath,QStringList geoList,
QString scriptPath)
{
scriptPath = scriptPath.replace(".lua", "_model_init_script.lua");
// 写入导入模型脚本
Setting::BusAPI::instance()->findTask(TaskID)->setState(Setting::TaskDescState::Running);
// 创建lua脚本内存
QString scripttext = "";
scripttext =scripttext +"app=cf.GetApplication()"+"\n";
scripttext =scripttext +"project=app.Project --- get current project"+"\n";
for(QString filepath:stlPath){
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
scripttext =scripttext +QString("project.Importer.Mesh:Import(\"%1\")").arg(filepath);
scripttext=scripttext+"\n";
}
for(QString filepath:geoList){
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
scripttext =scripttext +QString("project.Importer.Geometry:Import(\"%1\")").arg(filepath);
scripttext=scripttext+"\n";
}
// 创建文件对象
QFile file(scriptPath);
// 打开文件以供写入,如果文件不存在将创建新文件
if(file.open(QIODevice::WriteOnly | QIODevice::Text)) {
// 创建文本流并设置编码为UTF-8
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream << scripttext;
// 关闭文件
file.close();
QMessageBox::information(m, u8"提示",u8"文件写入成功:\t"+scriptPath);
Setting::BusAPI::instance()->findTask(TaskID)->setState(Setting::TaskDescState::Finished);
} else {
qDebug() << "Could not open file for writing.";
QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"),
QString::fromUtf8(u8"文件写入失败"));
Setting::BusAPI::instance()->findTask(TaskID)->setState(Setting::TaskDescState::Failed);
}
}
} // namespace WBFZ

View File

@ -54,10 +54,8 @@ namespace WBFZ
void actionImageShowToolShow(GUI::MainWindow* m);
// RCS展示工具
void actionactionRCShowTool(GUI::MainWindow* m);
// 生成导入模型的 脚本代码
void actionGenerateImportModelScript(int TaskID,GUI::MainWindow* m,QStringList stlPath,QStringList geoList,QString scriptPath);
};
}

View File

@ -8,6 +8,30 @@
*/
#include "MeshOpearatorCommon.h"
#include <TopoDS_Shape.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkSmartPointer.h>
#include <QDialog>
#include <QProgressBar>
#include <QLabel>
#include <QProgressDialog>
#include <QFileDialog>
#include <QDebug>
#include <StlAPI_Writer.hxx>
#include <vtkSTLWriter.h>
namespace MeshOpearator {
@ -16,5 +40,92 @@ namespace MeshOpearator {
}
TopoDS_Shape* MeshOpearatorCommon::vtkPolygonToOCC(vtkPolyData* polyData)
{
QString filepath=QFileDialog::getSaveFileName(nullptr, u8"保存文件", "", u8"STL文件(*.stl)");
if(filepath.isEmpty()) {
return nullptr;
}
QProgressDialog progressDialog(u8"格式转换", u8"终止", 0, 100);
progressDialog.setWindowTitle(u8"转换中");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMinimum(0);
progressDialog.show();
// 创建 OpenCASCADE 的顶层形状
TopoDS_Shape* shape=new TopoDS_Shape();
BRep_Builder builder;
builder.MakeCompound(TopoDS::Compound(*shape));
// 提取点和面数据
vtkPoints* points = polyData->GetPoints();
vtkCellArray* polygons = polyData->GetPolys();
progressDialog.setMaximum(points->GetNumberOfPoints()+polygons->GetNumberOfCells());
// 创建 OpenCASCADE 中的顶点
std::vector<TopoDS_Vertex> vertices;
for(vtkIdType i = 0; i < points->GetNumberOfPoints(); ++i) {
double coords[3];
points->GetPoint(i, coords);
gp_Pnt pt(coords[0], coords[1], coords[2]);
TopoDS_Vertex vertex;
builder.MakeVertex(vertex, pt, 1.0e-6); // 创建顶点并添加到形状中
builder.Add(*shape, vertex);
vertices.push_back(vertex);
progressDialog.setValue(i);
}
// 创建 OpenCASCADE 中的多边形(面)
polygons->InitTraversal();
for(vtkIdType i = 0; i < polygons->GetNumberOfCells(); ++i) {
vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();
polygons->GetNextCell(ids);
BRepBuilderAPI_MakePolygon polygonBuilder;
for(vtkIdType j = 0; j < ids->GetNumberOfIds(); ++j) {
int id = ids->GetId(j);
polygonBuilder.Add(vertices[id]);
}
polygonBuilder.Close(); // 封闭多边形
// 创建面,并添加到形状中
TopoDS_Shape face = polygonBuilder.Shape();
builder.Add(*shape, face);
progressDialog.setValue(i+points->GetNumberOfPoints());
}
progressDialog.close();
return shape;
}
TopoDS_Shape* MeshOpearatorCommon::vtkdataSetToOCC(vtkDataSet* dataset)
{
vtkSmartPointer<vtkGeometryFilter> geofilter=vtkSmartPointer<vtkGeometryFilter>::New();
geofilter->SetInputData(dataset);
geofilter->Update();
vtkPolyData* polydata=geofilter->GetOutput();
if(nullptr==polydata){
qDebug()<<QString("nullptr==polydata: %1").arg(nullptr==polydata);
return nullptr;
}else{}
return vtkPolygonToOCC(polydata);
return nullptr;
}
bool MeshOpearatorCommon::saveMeshDataToSTL(QString stlPath, vtkDataSet* data)
{
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->SetInputData(data);
geometryFilter->Update();
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
writer->SetInputConnection(geometryFilter->GetOutputPort());
writer->SetFileTypeToBinary();
writer->SetFileName(stlPath.toLocal8Bit().constData());
writer->Write();
return QFile(stlPath).exists();
}
} // namespace MeshOpearator

View File

@ -111,8 +111,10 @@
#include "MeshData/meshSet.h"
#include "Meshdata/meshKernal.h"
#include <TopoDS_Shape.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS.hxx>
namespace MeshOpearator {
@ -123,8 +125,10 @@ namespace MeshOpearator {
public:
MeshOpearatorCommon(QObject* parent=nullptr);
~MeshOpearatorCommon()=default;
static TopoDS_Shape* vtkPolygonToOCC(vtkPolyData* polygon) ;
static TopoDS_Shape* vtkdataSetToOCC(vtkDataSet* dataset) ;
static bool saveMeshDataToSTL(QString savePath,vtkDataSet* data );
public:
};

View File

@ -23,6 +23,8 @@ add_library(Settings
${_interface}
${_header}
${_source}
TaskListClass.cpp
TaskListClass.h
)
#-----------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GraphOptionDialog</class>
<widget class="QDialog" name="GraphOptionDialog">
@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<width>845</width>
<height>507</height>
</rect>
</property>
<property name="windowTitle">
<string>Graph Option</string>
<string>参数设置</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
@ -55,7 +55,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="colorTab">
<attribute name="title">
@ -322,6 +322,143 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>FEKO环境设置</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_CADFeko">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_RunFeko">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditFEKOPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_18">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>RunFeko路径</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_17">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKOCAD路径</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKO Bin文件地址</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonSelectFekoInstallPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择地址</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditPreFEKO">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_19">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>PreFEKO路径</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -36,6 +36,10 @@ namespace Setting
setting->setValue("/Plugins/Name", _plugins);
setting->setValue("/User/GUidance", _showUserGuidance);
setting->setValue("/Style/Ribbon", _useRibbon);
setting->setValue("/Feko/InstallPath", _FEKOInstallPath);
setting->setValue("/Feko/FekocadPath", _FEKOCADPath);
setting->setValue("/Feko/RunFekoPath", _RunFEKOPath);
setting->setValue("/Feko/preFekoPath", _preFEKOPath);
}
void MainSetting::readINI(QSettings *setting)
{
@ -46,6 +50,11 @@ namespace Setting
_plugins = setting->value("/Plugins/Name").toStringList();
_showUserGuidance = setting->value("/User/GUidance").toBool();
_useRibbon = setting->value("/Style/Ribbon").toBool();
_FEKOInstallPath=setting->value("/Feko/InstallPath" ).toString();
_FEKOCADPath=setting->value("/Feko/FekocadPath" ).toString();
_RunFEKOPath=setting->value("/Feko/RunFekoPath" ).toString();
_preFEKOPath=setting->value("/Feko/preFekoPath" ).toString();
QDir dir(_workingDir);
@ -148,5 +157,37 @@ namespace Setting
{
return _plugins;
}
const QString& MainSetting::getFekoInstallPath() const
{
return _FEKOInstallPath;
}
void MainSetting::setFekoInstallPath(const QString& fekoInstallPath)
{
_FEKOInstallPath = fekoInstallPath;
}
const QString& MainSetting::getFekocadPath() const
{
return _FEKOCADPath;
}
void MainSetting::setFekocadPath(const QString& fekocadPath)
{
_FEKOCADPath = fekocadPath;
}
const QString& MainSetting::getRunFekoPath() const
{
return _RunFEKOPath;
}
void MainSetting::setRunFekoPath(const QString& runFekoPath)
{
_RunFEKOPath = runFekoPath;
}
const QString& MainSetting::getPreFekoPath() const
{
return _preFEKOPath;
}
void MainSetting::setPreFekoPath(const QString& preFekoPath)
{
_preFEKOPath = preFekoPath;
}
}

View File

@ -69,6 +69,26 @@ namespace Setting
QStringList _recentFiles{};
QString _licensePath;
QStringList _plugins{};
QString _FEKOInstallPath;
public:
const QString& getFekoInstallPath() const;
void setFekoInstallPath(const QString& fekoInstallPath);
const QString& getFekocadPath() const;
void setFekocadPath(const QString& fekocadPath);
const QString& getRunFekoPath() const;
void setRunFekoPath(const QString& runFekoPath);
private:
QString _FEKOCADPath;
QString _RunFEKOPath;
public:
const QString& getPreFekoPath() const;
void setPreFekoPath(const QString& preFekoPath);
private:
QString _preFEKOPath;
bool _showUserGuidance{true};
bool _useRibbon{true};
};