From 6bc13470f793b7fee44ad21dda498f577536bc1c Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Thu, 3 Oct 2024 17:37:37 +0100 Subject: [PATCH] [bos #38044][EDF] (2023-T3) Support for automatic reparation. An attempt to pass to the parent process an ID instead of reference for result object. --- src/RepairGUIAdv/geomrepairadv_execute.py | 4 ++ src/RepairGUIAdv/reparation_plugin_algo.py | 53 +++++++++++++--------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/RepairGUIAdv/geomrepairadv_execute.py b/src/RepairGUIAdv/geomrepairadv_execute.py index f2c959eb4..0a89367e5 100644 --- a/src/RepairGUIAdv/geomrepairadv_execute.py +++ b/src/RepairGUIAdv/geomrepairadv_execute.py @@ -196,6 +196,10 @@ def execute(selected_object, algo_name, args_dict, is_dump_on = True, is_copy_on logger.error('Could not get a result object after exec of %s file!', str(algo_name)) return None + # Temporary case to check of it's safe to passe result as ID instead of object + result_object = geompy.GetObject(result_object) + geompy.addToStudy(result_object, args_dict['result_name']) + if is_dump_on: args_str = make_dump_args(algo_name, args_dict_str, is_dump_on, is_copy_on) save_to_dump(geompy, selected_object, result_object, args_str) diff --git a/src/RepairGUIAdv/reparation_plugin_algo.py b/src/RepairGUIAdv/reparation_plugin_algo.py index f5e3c46ad..6bac81559 100644 --- a/src/RepairGUIAdv/reparation_plugin_algo.py +++ b/src/RepairGUIAdv/reparation_plugin_algo.py @@ -29,7 +29,7 @@ from time import sleep import salome from salome.geom import geomBuilder -from qtsalome import QFileDialog, QApplication, pyqtSignal +from qtsalome import QFileDialog, QApplication import GEOM import SMESH, SALOMEDS @@ -77,27 +77,36 @@ def run(args_dict, progress_emitter): logging.info('\Tol_max: %s', maxTol) logging.info('\Debug: %s', Debug) - progress_emitter.emit() - nbTry = 500 - ratioMin = 0.09 - ratioMax = 0.11 - for i in range(nbTry): - face = geompy.ImportBREP("FatalException.brep") - aire = geompy.BasicProperties(face)[1] - Mesh = smesh.Mesh(face,'Mesh') - MG_CADSurf = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf) - MG_CADSurf_Parameters = MG_CADSurf.Parameters() - MG_CADSurf_Parameters.SetMaxSize( ratioMax * aire ) - MG_CADSurf_Parameters.SetMinSize( ratioMin * aire ) - MG_CADSurf_Parameters.SetPhySize( aire * ((ratioMin+2*ratioMax)/3) ) - MG_CADSurf_Parameters.SetGradation( 1.1 ) - isDone = Mesh.Compute() - if not progress_emitter.emit(): - return False - - progress_emitter.emit() - - return face + # Temporary case to check of it's safe to passe result as ID instead of object + box = geompy.MakeBoxDXDYDZ(200, 400, 300) + entry = box.GetEntry() + print('entry: ', entry) + return entry + + # return entry + # return box + + # progress_emitter.emit() + # nbTry = 500 + # ratioMin = 0.09 + # ratioMax = 0.11 + # for i in range(nbTry): + # face = geompy.ImportBREP("/home/kleontev/dev/38044_auto_repair/ImportBrepCrash/FatalException.brep") + # aire = geompy.BasicProperties(face)[1] + # Mesh = smesh.Mesh(face,'Mesh') + # MG_CADSurf = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf) + # MG_CADSurf_Parameters = MG_CADSurf.Parameters() + # MG_CADSurf_Parameters.SetMaxSize( ratioMax * aire ) + # MG_CADSurf_Parameters.SetMinSize( ratioMin * aire ) + # MG_CADSurf_Parameters.SetPhySize( aire * ((ratioMin+2*ratioMax)/3) ) + # MG_CADSurf_Parameters.SetGradation( 1.1 ) + # isDone = Mesh.Compute() + # if not progress_emitter.emit(): + # return False + + # progress_emitter.emit() + + # return face def test(): -- 2.39.2