466 lines
13 KiB
C++
466 lines
13 KiB
C++
|
#include "OCCTModelOperator.h"
|
|||
|
#include <BRepBuilderAPI_Transform.hxx>
|
|||
|
#include <Bnd_Box.hxx>
|
|||
|
#include <BRepBndLib.hxx>
|
|||
|
|
|||
|
|
|||
|
OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext)
|
|||
|
: QDialog(parent)
|
|||
|
{
|
|||
|
ui.setupUi(this);
|
|||
|
setWindowFlags(Qt::Window);
|
|||
|
setWindowTitle(TopoName);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
this->ui.radioButton_NoCopy->setChecked(true);
|
|||
|
this->ui.radioButton_Time->setChecked(true);
|
|||
|
this->myContext = myContext;
|
|||
|
this->ModelName = TopoName;
|
|||
|
// <20><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>
|
|||
|
|
|||
|
QDoubleValidator* validator = new QDoubleValidator(); // <20><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>
|
|||
|
ui.lineEdit_Move_From_X->setValidator(validator);
|
|||
|
ui.lineEdit_Move_From_Z->setValidator(validator);
|
|||
|
ui.lineEdit_Move_From_Y->setValidator(validator);
|
|||
|
ui.lineEdit_Move_To_X->setValidator(validator);
|
|||
|
ui.lineEdit_Move_To_Y->setValidator(validator);
|
|||
|
ui.lineEdit_Move_To_Z->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Center_X->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Center_Y->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Center_Z->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Axis_X->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Axis_Y->setValidator(validator);
|
|||
|
ui.lineEdit_Rotation_Axis_Z->setValidator(validator);
|
|||
|
|
|||
|
ui.lineEdit_Scale_refrence_point_X->setValidator(validator);
|
|||
|
ui.lineEdit_Scale_refrence_point_Y->setValidator(validator);
|
|||
|
ui.lineEdit_Scale_refrence_point_Z->setValidator(validator);
|
|||
|
|
|||
|
QDoubleValidator* validatorScale = new QDoubleValidator();
|
|||
|
validatorScale->setBottom(0.0);
|
|||
|
ui.lineEdit_ScaleValue->setValidator(validatorScale);
|
|||
|
|
|||
|
// <20><>ʼ<EFBFBD><CABC>
|
|||
|
ui.lineEdit_Move_From_X->setText(u8"0.0");
|
|||
|
ui.lineEdit_Move_From_Z->setText(u8"0.0");
|
|||
|
ui.lineEdit_Move_From_Y->setText(u8"0.0");
|
|||
|
ui.lineEdit_Move_To_X->setText(u8"0.0");
|
|||
|
ui.lineEdit_Move_To_Y->setText(u8"0.0");
|
|||
|
ui.lineEdit_Move_To_Z->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Center_X->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Center_Y->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Center_Z->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Axis_X->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Axis_Y->setText(u8"0.0");
|
|||
|
ui.lineEdit_Rotation_Axis_Z->setText(u8"0.0");
|
|||
|
ui.lineEdit_ScaleValue->setText(u8"1.0");
|
|||
|
ui.lineEdit_Scale_refrence_point_X->setText(u8"0.0");
|
|||
|
ui.lineEdit_Scale_refrence_point_Y->setText(u8"0.0");
|
|||
|
ui.lineEdit_Scale_refrence_point_Z->setText(u8"0.0");
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ui.radioButton_Auto->setChecked(true);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
this->UpdataVariable();
|
|||
|
// <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
if (TopoName.isEmpty()) {
|
|||
|
this->ui.radioButton_Copy->setChecked(true);
|
|||
|
this->ui.radioButton_NoCopy->setEnabled(false);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
OCCTModelOperator::~OCCTModelOperator()
|
|||
|
{}
|
|||
|
|
|||
|
void OCCTModelOperator::setTopoDs_Shape(TopoDS_Shape ds)
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
BRepBuilderAPI_Copy copyBuilder;
|
|||
|
copyBuilder.Perform(ds);
|
|||
|
this->Datashape = copyBuilder.Shape();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
BRepBuilderAPI_Copy copyBuilder2;
|
|||
|
copyBuilder2.Perform(ds);
|
|||
|
this->DataShapeBAK = copyBuilder2.Shape();
|
|||
|
|
|||
|
this->Data_AIS = new AIS_Shape(this->Datashape); // <20><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
this->UpdateScaleRefrencepoint();
|
|||
|
this->UpdataVariable();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
TopoDS_Shape OCCTModelOperator::getTopoDs_Shape()
|
|||
|
{
|
|||
|
return this->Datashape;
|
|||
|
}
|
|||
|
|
|||
|
TopoDS_Shape OCCTModelOperator::getTopoDs_ShapeBAK()
|
|||
|
{
|
|||
|
return this->DataShapeBAK;
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::toString()
|
|||
|
{
|
|||
|
qDebug() << u8"move ";
|
|||
|
qDebug() <<QString("X: %1 --> %1").arg(Move_From_X, 0, 'e', 8).arg(Move_To_X, 0, 'e', 8);
|
|||
|
qDebug() <<QString("Y: %1 --> %1").arg(Move_From_Y, 0, 'e', 8).arg(Move_To_Y, 0, 'e', 8);
|
|||
|
qDebug() <<QString("Z: %1 --> %1").arg(Move_From_Z, 0, 'e', 8).arg(Move_To_Z, 0, 'e', 8);
|
|||
|
qDebug() << u8"Rotatino Center Point ";
|
|||
|
qDebug() <<QString("X: %1").arg(Rotation_Center_X);
|
|||
|
qDebug() <<QString("Y: %1").arg(Rotation_Center_Y);
|
|||
|
qDebug() <<QString("Z: %1").arg(Rotation_Center_Z);
|
|||
|
qDebug() << u8"Rotatino Axis Angle ";
|
|||
|
qDebug() <<QString("%1").arg(Rotation_angle_X); // <20><>X<EFBFBD><58><EFBFBD><EFBFBD>ת<EFBFBD>Ƕ<EFBFBD>
|
|||
|
qDebug() <<QString("%1").arg(Rotation_angle_Y);
|
|||
|
qDebug() <<QString("%1").arg(Rotation_angle_Z);
|
|||
|
qDebug() << u8"Scale ";
|
|||
|
qDebug() <<QString("%1").arg(ScaleDouble);
|
|||
|
qDebug() <<QString("X%1").arg(this->ScaleRefrencePoint_X);
|
|||
|
qDebug() <<QString("Y%1").arg(this->ScaleRefrencePoint_Y);
|
|||
|
qDebug() <<QString("Z%1").arg(this->ScaleRefrencePoint_Z);
|
|||
|
}
|
|||
|
|
|||
|
Handle(AIS_InteractiveObject) OCCTModelOperator::getAIS()
|
|||
|
{
|
|||
|
return new AIS_Shape(this->Datashape);
|
|||
|
}
|
|||
|
|
|||
|
Handle(AIS_InteractiveObject) OCCTModelOperator::getAISBAK()
|
|||
|
{
|
|||
|
return new AIS_Shape(this->DataShapeBAK);
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::ExcuteOperator()
|
|||
|
{
|
|||
|
this->ProcesssModel();
|
|||
|
if (this->ui.radioButton_Copy->isChecked()) { // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
emit this->ResultExportCopyAndCreateNew(this);
|
|||
|
}
|
|||
|
else {
|
|||
|
emit this->ResultExport(this);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::UpdataVariable()
|
|||
|
{
|
|||
|
this->Move_From_X = this->ui.lineEdit_Move_From_X->text().toDouble();
|
|||
|
this->Move_From_Z = this->ui.lineEdit_Move_From_Z->text().toDouble();
|
|||
|
this->Move_From_Y = this->ui.lineEdit_Move_From_Y->text().toDouble();
|
|||
|
this->Move_To_X = this->ui.lineEdit_Move_To_X->text().toDouble();
|
|||
|
this->Move_To_Y = this->ui.lineEdit_Move_To_Y->text().toDouble();
|
|||
|
this->Move_To_Z = this->ui.lineEdit_Move_To_Z->text().toDouble();
|
|||
|
this->Rotation_Center_X = this->ui.lineEdit_Rotation_Center_X->text().toDouble();
|
|||
|
this->Rotation_Center_Y = this->ui.lineEdit_Rotation_Center_Y->text().toDouble();
|
|||
|
this->Rotation_Center_Z = this->ui.lineEdit_Rotation_Center_Z->text().toDouble();
|
|||
|
this->Rotation_angle_X = this->ui.lineEdit_Rotation_Axis_X->text().toDouble();
|
|||
|
this->Rotation_angle_Y = this->ui.lineEdit_Rotation_Axis_Y->text().toDouble();
|
|||
|
this->ScaleDouble = this->ui.lineEdit_ScaleValue->text().toDouble();
|
|||
|
|
|||
|
this->ScaleRefrencePoint_X=this->ui.lineEdit_Scale_refrence_point_X->text().toDouble();
|
|||
|
this->ScaleRefrencePoint_Y=this->ui.lineEdit_Scale_refrence_point_Y->text().toDouble();
|
|||
|
this->ScaleRefrencePoint_Z=this->ui.lineEdit_Scale_refrence_point_Z->text().toDouble();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::UpdateScaleRefrencepoint()
|
|||
|
{
|
|||
|
if (this->ui.radioButton_Auto->isChecked()) {
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> TopoDS_Shape <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
TopoDS_Shape myShape = this->DataShapeBAK; // <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>滻Ϊʵ<CEAA>ʵ<EFBFBD><CAB5><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD>
|
|||
|
GProp_GProps volumeProperties;
|
|||
|
|
|||
|
// <20><><EFBFBD>㼸<EFBFBD><E3BCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
BRepGProp::VolumeProperties(myShape, volumeProperties, Standard_False, Standard_False, Standard_False);
|
|||
|
|
|||
|
//// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
gp_Pnt centerOfMass = volumeProperties.CentreOfMass();
|
|||
|
|
|||
|
this->ui.lineEdit_Scale_refrence_point_X->setText(QString("%1").arg(centerOfMass.X(), 0, 'e', 8));
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Y->setText(QString("%1").arg(centerOfMass.Y(), 0, 'e', 8));
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Z->setText(QString("%1").arg(centerOfMass.Z(), 0, 'e', 8));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::PreViewOperator()
|
|||
|
{
|
|||
|
this->UpdataVariable();
|
|||
|
this->toString();
|
|||
|
|
|||
|
if (this->ui.radioButton_Time->isChecked()) {
|
|||
|
this->ProcesssModel();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::ApplyModel()
|
|||
|
{
|
|||
|
|
|||
|
if (this->myContext) {
|
|||
|
qDebug() << u8"ģ<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>";
|
|||
|
|
|||
|
//this->myContext->Erase(this->Data_AIS, Standard_True);
|
|||
|
this->myContext->Remove(this->Data_AIS, Standard_False);
|
|||
|
this->myContext->UpdateCurrentViewer();
|
|||
|
this->Datashape.Nullify();
|
|||
|
//this->Data_AIS->Delete();
|
|||
|
//this->myContext->Remove(this->Datashape, Standard_True);
|
|||
|
}
|
|||
|
|
|||
|
// ƽ<><C6BD>ģ<EFBFBD><C4A3>
|
|||
|
double move_x = this->Move_To_X - this->Move_From_X;
|
|||
|
double move_y = this->Move_To_Y - this->Move_From_Y;
|
|||
|
double move_z = this->Move_To_Z - this->Move_From_Z;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>
|
|||
|
gp_Trsf translation;
|
|||
|
translation.SetTranslation(gp_Vec(move_x, move_y, move_z));
|
|||
|
BRepBuilderAPI_Transform translateTransform(this->DataShapeBAK, translation);
|
|||
|
|
|||
|
TopoDS_Shape translatedShape = translateTransform.Shape();
|
|||
|
|
|||
|
double Rotation_centor_x = this->Rotation_Center_X;
|
|||
|
double Rotation_centor_y = this->Rotation_Center_Y;
|
|||
|
double Rotation_centor_z = this->Rotation_Center_Z;
|
|||
|
// ȷ<><C8B7><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
gp_Pnt rotationCenter(Rotation_centor_x, Rotation_centor_y, Rotation_centor_z); // <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
gp_Ax1 rotationAxis_X(rotationCenter, gp_Dir(1.0, 0.0, 0.0));
|
|||
|
gp_Ax1 rotationAxis_Y(rotationCenter, gp_Dir(0.0, 1.0, 0.0));
|
|||
|
gp_Ax1 rotationAxis_Z(rotationCenter, gp_Dir(0.0, 0.0, 1.0));
|
|||
|
|
|||
|
double angle_x = this->Rotation_angle_X / 180.0 * M_PI;
|
|||
|
double angle_y = this->Rotation_angle_Y / 180.0 * M_PI;
|
|||
|
double angle_z = this->Rotation_angle_Z / 180.0 * M_PI;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|||
|
gp_Trsf rotation_X;
|
|||
|
rotation_X.SetRotation(rotationAxis_X, angle_x); // X
|
|||
|
BRepBuilderAPI_Transform rotateTransform_X(translatedShape, rotation_X);
|
|||
|
TopoDS_Shape rotatedShape_X = rotateTransform_X.Shape();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|||
|
gp_Trsf rotation_Y;
|
|||
|
rotation_Y.SetRotation(rotationAxis_Y, angle_y); // Y
|
|||
|
BRepBuilderAPI_Transform rotateTransform_Y(rotatedShape_X, rotation_Y);
|
|||
|
TopoDS_Shape rotatedShape_Y = rotateTransform_Y.Shape();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|||
|
gp_Trsf rotation_Z;
|
|||
|
rotation_Z.SetRotation(rotationAxis_Z, angle_z); // Z
|
|||
|
BRepBuilderAPI_Transform rotateTransform_Z(rotatedShape_Y, rotation_Z);
|
|||
|
TopoDS_Shape rotatedShape = rotateTransform_Z.Shape();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> BRepBuilderAPI_Transform <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
gp_Pnt refrenceCenter(ScaleRefrencePoint_X, ScaleRefrencePoint_Y, ScaleRefrencePoint_Z); // <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
gp_Trsf scaleTransform;
|
|||
|
scaleTransform.SetScale(refrenceCenter, ScaleDouble);
|
|||
|
BRepBuilderAPI_Transform scaleTransformBuilder(rotatedShape, scaleTransform);
|
|||
|
|
|||
|
// Ӧ<>ñ任
|
|||
|
if (scaleTransformBuilder.IsDone()) {
|
|||
|
this->Datashape = scaleTransformBuilder.Shape();
|
|||
|
}
|
|||
|
else {
|
|||
|
|
|||
|
}
|
|||
|
// <20>ڴ<EFBFBD><DAB4>ͷ<EFBFBD>
|
|||
|
translatedShape.Nullify();
|
|||
|
rotatedShape_X.Nullify();
|
|||
|
rotatedShape_Y.Nullify();
|
|||
|
rotatedShape.Nullify();
|
|||
|
|
|||
|
if (this->myContext) {
|
|||
|
qDebug() << u8"ͼ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>";
|
|||
|
this->Data_AIS.Nullify();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AIS_Shape
|
|||
|
Handle(AIS_Shape) aisShape = new AIS_Shape(this->Datashape);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|||
|
Quantity_Color redColor(1.0, 0.0, 0.0, Quantity_TOC_RGB); // RGB<47><42>ɫ
|
|||
|
|
|||
|
ChangeModelColor(aisShape, redColor);
|
|||
|
|
|||
|
this->Data_AIS = aisShape;
|
|||
|
|
|||
|
this->myContext->Display(this->Data_AIS, Standard_True); // <20><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>
|
|||
|
this->myContext->AddOrRemoveSelected(this->Data_AIS, Standard_True);
|
|||
|
}
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>
|
|||
|
emit this->RefreshResult(this);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::ProcesssModel()
|
|||
|
{
|
|||
|
this->ApplyModel();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_From_X_returnPressed()
|
|||
|
{
|
|||
|
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_From_Z_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_From_Y_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_To_X_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_To_Y_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Move_To_Z_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Center_X_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Center_Y_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Center_Z_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Axis_X_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Axis_Y_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Rotation_Axis_Z_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Scale_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Scale_refrence_point_X_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Scale_refrence_point_Y_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_Scale_refrence_point_Z_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_lineEdit_ScaleValue_returnPressed()
|
|||
|
{
|
|||
|
this->PreViewOperator();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_radioButton_Auto_toggled(bool flag)
|
|||
|
{
|
|||
|
if (flag) {
|
|||
|
this->ui.lineEdit_Scale_refrence_point_X->setEnabled(false);
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Y->setEnabled(false);
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Z->setEnabled(false);
|
|||
|
this->UpdateScaleRefrencepoint();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_radioButton_NoAuto_toggled(bool flag)
|
|||
|
{
|
|||
|
if (flag) {
|
|||
|
this->ui.lineEdit_Scale_refrence_point_X->setEnabled(true);
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Y->setEnabled(true);
|
|||
|
this->ui.lineEdit_Scale_refrence_point_Z->setEnabled(true);
|
|||
|
this->UpdateScaleRefrencepoint();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void OCCTModelOperator::on_pushButton_ok_clicked()
|
|||
|
{
|
|||
|
this->UpdataVariable();
|
|||
|
|
|||
|
this->ApplyModel();
|
|||
|
|
|||
|
if (this->myContext) {
|
|||
|
qDebug() << u8"ģ<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>";
|
|||
|
this->myContext->Remove(this->Data_AIS, Standard_False);
|
|||
|
this->myContext->UpdateCurrentViewer();
|
|||
|
|
|||
|
}
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
BRepBuilderAPI_Copy copyBuilder;
|
|||
|
copyBuilder.Perform(this->Datashape);
|
|||
|
this->DataShapeBAK = copyBuilder.Shape();
|
|||
|
|
|||
|
if (this->ui.radioButton_Copy->isChecked()) {
|
|||
|
emit this->ResultExportCopyAndCreateNew(this);
|
|||
|
}
|
|||
|
else {
|
|||
|
emit this->ResultExport(this);
|
|||
|
}
|
|||
|
this->close();
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_pushButton_apply_clicked()
|
|||
|
{
|
|||
|
this->UpdataVariable();
|
|||
|
|
|||
|
this->ApplyModel();
|
|||
|
|
|||
|
if (this->myContext) {
|
|||
|
qDebug() << u8"ģ<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>";
|
|||
|
//this->myContext->Erase(this->Data_AIS, Standard_True);
|
|||
|
this->myContext->Remove(this->Data_AIS, Standard_False);
|
|||
|
this->myContext->UpdateCurrentViewer();
|
|||
|
|
|||
|
}
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
BRepBuilderAPI_Copy copyBuilder;
|
|||
|
copyBuilder.Perform(this->Datashape);
|
|||
|
this->DataShapeBAK = copyBuilder.Shape();
|
|||
|
|
|||
|
if (this->ui.radioButton_Copy->isChecked()) {
|
|||
|
emit this->ResultExportCopyAndCreateNew(this);
|
|||
|
}
|
|||
|
else {
|
|||
|
emit this->ResultExport(this);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OCCTModelOperator::on_pushButton_Cancel_clicked()
|
|||
|
{
|
|||
|
this->close();
|
|||
|
}
|