bos #24596 [CEA] New MeshGems license

Care of python plugins
This commit is contained in:
eap 2021-08-26 18:23:22 +03:00
parent 499331b207
commit 1ffd1c1245
7 changed files with 46 additions and 2 deletions

View File

@ -44,7 +44,7 @@ namespace SMESHUtils_MGLicenseKeyGen
int nbVol,
std::string& error);
SMESHUtils_EXPORT bool CheckKeyGeLibrary( std::string& error );
SMESHUtils_EXPORT bool CheckKeyGenLibrary( std::string& error );
SMESHUtils_EXPORT std::string GetLibraryName();
}

View File

@ -25,6 +25,8 @@ include_directories(
${PROJECT_SOURCE_DIR}/src/SMDS
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESH_I
${PROJECT_SOURCE_DIR}/src/Driver
${PROJECT_SOURCE_DIR}/src/DriverGMF
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/idl
)
@ -123,7 +125,7 @@ IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
ELSE()
SWIG_ADD_LIBRARY(SMeshHelper LANGUAGE python SOURCES ${SMeshHelper_SOURCES})
ENDIF()
SWIG_LINK_LIBRARIES(SMeshHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SMESHEngine )
SWIG_LINK_LIBRARIES(SMeshHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SMESHEngine MeshDriverGMF )
SWIG_CHECK_GENERATION(SMeshHelper)
IF(WIN32)
SET_TARGET_PROPERTIES(_SMeshHelper PROPERTIES DEBUG_OUTPUT_NAME _SMeshHelper_d)

View File

@ -25,9 +25,35 @@
#include <cstring>
#include <DriverGMF_Read.hxx>
#include <SMESH_MGLicenseKeyGen.hxx>
std::string BuildSMESHInstanceInternal()
{
Engines::EngineComponent_var zeRef = RetrieveSMESHInstance();
CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
return std::string(ior.in());
}
std::string GetMGLicenseKeyImpl(const char* gmfFile)
{
smIdType nbVertex, nbEdge, nbFace, nbVol;
DriverGMF_Read gmfReader;
gmfReader.SetFile( gmfFile );
gmfReader.GetMeshInfo( nbVertex, nbEdge, nbFace, nbVol );
std::string errorTxt;
std::string key = SMESHUtils_MGLicenseKeyGen::GetKey( gmfFile,
FromSmIdType<int>( nbVertex ),
FromSmIdType<int>( nbEdge ),
FromSmIdType<int>( nbFace ),
FromSmIdType<int>( nbVol ),
errorTxt );
if ( !errorTxt.empty() )
{
std::cerr << "Error: Pb with MeshGens license: " << errorTxt << std::endl;
key = "<" + errorTxt + ">";
}
return key;
}

View File

@ -22,3 +22,5 @@
#include <string>
std::string BuildSMESHInstanceInternal();
std::string GetMGLicenseKeyImpl(const char* gmfFile);

View File

@ -31,4 +31,9 @@
{
return BuildSMESHInstanceInternal();
}
std::string GetMGLicenseKey(const char* gmfFile)
{
return GetMGLicenseKeyImpl( gmfFile );
}
}

View File

@ -577,6 +577,11 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
if not self.CB_ComputedOverlapDistance.isChecked(): #computed default
self.commande+=" --overlap_distance " + self.SP_toStr(self.SP_OverlapDistance)
self.commande+=" --overlap_angle " + str(self.SP_OverlapAngle.value())
import SMeshHelper
key = SMeshHelper.GetMGLicenseKey( self.self.fichierIn )
self.commande+=' --key ' + key
if verbose: print(("INFO: MGCCleaner command:\n %s" % self.commande))
return True

View File

@ -545,6 +545,10 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
self.commande+=' --in "' + self.fichierIn +'"'
self.commande+=' --out "' + self.fichierOut +'"'
import SMeshHelper
key = SMeshHelper.GetMGLicenseKey( self.fichierIn )
self.commande+=' --key ' + key
print(self.commande)
return True