ADD_SUBDIRECTORY (src/ModuleBase)
ADD_SUBDIRECTORY (src/PartSet)
+#
+#ADD_SUBDIRECTORY (src/SketchConstraintsFinder) # Plugin
+ADD_SUBDIRECTORY (src/SAMConverter) # Library
+ADD_SUBDIRECTORY (src/SAMConverterAPI)
+#
+
ADD_SUBDIRECTORY (src/XGUI)
ADD_SUBDIRECTORY (src/ExchangePlugin)
ADD_SUBDIRECTORY (src/GeomValidators)
Config
ExchangeAPI
ModelGeomAlgo
+ SAMConverter
Locale
test_API
)
<plugin library="SketchPlugin" configuration="plugin-SketchCopy.xml"/>
<plugin script="ConnectorPlugin" configuration="plugin-Connector.xml" dependency="GEOM"/>
<plugin library="ParametersPlugin" configuration="plugin-Parameters.xml"/>
+ <plugin script="SAMConverter" configuration="plugin-SAM.xml"/>
+ <!--<plugin script="SAMConverter" configuration="plugin-SAM.xml" dependency="SAM"/>-->
@DEFAULT_SOLVER@
<!--
@ALL_SOLVERS@
--- /dev/null
+# Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(Common)
+INCLUDE(UnitTest)
+
+SET(PYTHON_FILES
+ SAMConverter.py
+ SAMConverter_SuggestConstraintsFeature.py
+ SAMConverter_ConvertSketch.py
+ SAMConverter_ConvertPrimitives.py
+ SAMConverter_ConvertConstraints.py
+ SAMConverter_Logger.py
+)
+
+SET(XML_RESOURCES
+ plugin-SAM.xml
+)
+
+SET(TEXT_RESOURCES
+ SAMConverter_msg_fr.ts
+)
+
+SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
+
+ADD_CUSTOM_TARGET(SAMConverter SOURCES ${PYTHON_FILES} ${XML_RESOURCES} ${TEXT_RESOURCES})
+
+INSTALL(FILES ${PYTHON_FILES} DESTINATION ${SHAPER_INSTALL_PYTHON_FILES})
+INSTALL(FILES ${XML_RESOURCES} ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
+INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/SAMConverter)
+
+ADD_SUBDIRECTORY(Test)
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+## @package Plugins
+# Python plugin for exporting entities into Salome's GEOM module
+
+import ModelAPI
+
+from SAMConverter_SuggestConstraintsFeature import SuggestConstraintsFeature
+
+## @ingroup Plugins
+# The main class for management the construction features as plugin.
+class SAMConverter(ModelAPI.ModelAPI_Plugin):
+
+ ## The constructor.
+ def __init__(self):
+ ModelAPI.ModelAPI_Plugin.__init__(self)
+ pass
+
+ ## Creates the feature objects of this plugin by the feature string ID.
+ def createFeature(self, theFeatureID):
+ if theFeatureID == SuggestConstraintsFeature.ID():
+ return SuggestConstraintsFeature().__disown__()
+ else:
+ print("SAMConverter: No such feature %s" % theFeatureID)
+
+## The plugin created on module importing (from c++)
+isSHAPER_SUGGESTION_GENERATOR = True
+#TODO
+if isSHAPER_SUGGESTION_GENERATOR:
+ plugin = SAMConverter()
+ ## Main session of the application
+ aSession = ModelAPI.ModelAPI_Session.get()
+ aSession.registerPlugin(plugin)
+ pass
--- /dev/null
+from sam.catalog_constraint import *
+
+import math
+
+from SketchAPI import *
+from SAMConverter_Logger import logger
+
+
+def get_params_value(entity):
+ try :
+ value_attr = entity.feature().real("ConstraintValue")
+ if value_attr is not None:
+ return value_attr.value()
+ except Exception as e :
+ logger.info(f'Problem with constraint parameters: {e}')
+ return None
+
+class ShapertoSAMConstraints:
+
+ def convert(entity, refs):
+ entity_type = entity.getKind()
+ if entity_type == 'SketchConstraintAngle':
+ return Angle(references = refs, angle = get_params_value(entity))
+
+ if entity_type == 'SketchConstraintCoincidence':
+ return Coincident(references = refs)
+
+ if entity_type == 'SketchConstraintDistance':
+ return Distance(references = refs, distance_min = get_params_value(entity))
+
+ if entity_type == 'SketchConstraintDistanceHorizontal':
+ return HorizontalDistance(references = refs, distance_min = get_params_value(entity))
+
+ if entity_type == 'SketchConstraintDistanceVertical':
+ return VerticalDistance(references = refs, distance_min = get_params_value(entity))
+
+ if entity_type == 'SketchConstraintEqual':
+ return Equal(references = refs)
+
+ if entity_type == 'SketchConstraintHorizontal':
+ return Horizontal(references = refs)
+
+ if entity_type == 'SketchConstraintMiddle' :
+ return Midpoint(references = refs)
+
+ if entity_type == 'SketchConstraintParallel' :
+ return Parallel(references = refs)
+
+ if entity_type == 'SketchConstraintPerpendicular' :
+ return Perpendicular(references = refs)
+
+ if entity_type == 'SketchConstraintTangent' :
+ return Tangent(references = refs)
+
+ if entity_type == 'SketchConstraintVertical':
+ return Vertical(references = refs)
+
+ if entity_type == 'SketchConstraintRadius':
+ return Radius(references = refs, radius = get_params_value(entity))
+
+ if entity_type == 'SketchConstraintLength':
+ return Length(references = refs, length = get_params_value(entity))
+
+ return None
--- /dev/null
+from sam.catalog_primitive import Arc, Line, Circle, Point
+
+import math
+
+from SketchAPI import *
+from GeomAPI import *
+from SAMConverter_Logger import logger
+
+def convert_angle(angle):
+ a = int(angle / 360)
+ if math.fabs(angle) >= 360. :
+ return angle - a * 360
+ else :
+ return angle
+
+class ShapertoSAMPrimitive:
+
+ def convert(entity):
+ entity_type = entity.getKind()
+ if entity_type == 'SketchPoint':
+ return ShapertoSAMPrimitive.convert_point(entity)
+ if entity_type == 'SketchArc':
+ return ShapertoSAMPrimitive.convert_arc(entity)
+ if entity_type == 'SketchCircle':
+ return ShapertoSAMPrimitive.convert_circle(entity)
+ if entity_type == 'SketchLine':
+ return ShapertoSAMPrimitive.convert_line(entity)
+ return None, {}
+
+ def check_construction(entity):
+ auxAttr = entity.auxiliary()
+ return auxAttr is not None and auxAttr.value()
+
+ def convert_point(entity):
+ feat = SketchAPI_Point(entity)
+ p1 = feat.coordinates()
+ return Point(status_construction= ShapertoSAMPrimitive.check_construction(entity), point = [p1.x(), p1.y()]), {}
+
+ def convert_line(entity):
+ feat = SketchAPI_Line(entity)
+
+ p1 = feat.startPoint()
+ p2 = feat.endPoint()
+ line = Line(status_construction=ShapertoSAMPrimitive.check_construction(entity), pnt1= [p1.x(), p1.y()], pnt2= [p2.x(), p2.y()])
+ return line, {(p1.x(), p1.y(), feat.name()) : line.pnt1, (p2.x(), p2.y(), feat.name()) : line.pnt2}
+
+ def convert_circle(entity):
+ feat = SketchAPI_Circle(entity)
+ c = feat.center()
+ radius = feat.radius()
+
+ circle = Circle(status_construction=ShapertoSAMPrimitive.check_construction(entity),
+ center = [c.x(), c.y()],
+ radius= radius.value())#feat.radius().value())
+ return circle, {(c.x(), c.y(), feat.name()) : circle.center}
+
+ def convert_arc(entity):
+ status = ShapertoSAMPrimitive.check_construction(entity)
+ feat = SketchAPI_Arc(entity)
+ c = feat.center()
+ s = entity.defaultResult()
+ edge = GeomAPI_Edge(s.shape())
+ a0,a1 = edge.getRange()
+ start_angle = convert_angle(math.degrees(a0))
+ end_angle = convert_angle(math.degrees(a1))
+
+ arc = Arc(status_construction=status,
+ center = [c.x(), c.y()],
+ radius= feat.radius().value(),
+ angles= [start_angle, end_angle])
+ arc.add_points_startend()
+ return arc, {(c.x(), c.y(), feat.name()) : arc.center}
--- /dev/null
+from SAMConverter_Logger import logger
+
+from SAMConverter_ConvertPrimitives import ShapertoSAMPrimitive
+from SAMConverter_ConvertConstraints import ShapertoSAMConstraints
+from sam.sketch import Sketch
+
+from ModelAPI import *
+from SketchAPI import *
+from GeomDataAPI import *
+
+
+def convert_sketch(sketch: object): # a shaper sketch
+
+ exchange_sketch = Sketch()
+
+ mapping = {}
+ # Add the primitives
+ for sub in sketch.features().list():
+ feat = ModelAPI.objectToFeature(sub)
+
+ if feat is not None :
+ entity = SketchAPI_SketchEntity(feat)
+ entity_type = entity.getKind()
+ print(entity_type)
+
+ convert, update_mapping = ShapertoSAMPrimitive.convert(entity)
+ if convert is not None:
+ mapping[entity.name()] = convert
+
+ mapping.update(update_mapping)
+
+ if convert is not None:
+ exchange_sketch.add(convert)
+
+ logger.debug(f'Mapping; {mapping}')
+
+ # Add the constraints
+ sketchFeature = featureToCompositeFeature(sketch.feature())
+ n = sketchFeature.numberOfSubs()
+ for i in range(n):
+ entity = sketchFeature.subFeature(i)
+ entity_type = entity.getKind()
+
+ if 'Constraint' in entity_type :
+ refs = []
+ l_attributs = [entity.refattr("ConstraintEntityA"), entity.refattr("ConstraintEntityB"),
+ entity.refattr("ConstraintEntityC"), entity.refattr("ConstraintEntityD")]
+ for ref in l_attributs:
+ if ref is None: continue
+ if ref.isObject():
+ attr = ModelAPI_Feature.feature(ref.object())
+ refs.append(mapping[attr.name()])
+
+ else :
+ attr = ref.attr()
+ owner = objectToFeature(attr.owner())
+ elt = geomDataAPI_Point2D(attr).pnt()
+ refs.append(mapping.get((elt.x(), elt.y(), owner.name()), owner.name()))
+
+ convert = ShapertoSAMConstraints.convert(entity, refs)
+ exchange_sketch.add(convert)
+
+ return exchange_sketch
--- /dev/null
+# Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+## @package Plugins
+# SuggestConstraintsFeature class definition
+
+from SAMConverter_ConvertSketch import *
+from SAMConverter_ConvertPrimitives import *
+from SAMConverter_ConvertConstraints import *
+
+import ModelAPI
+import EventsAPI
+
+from SketchAPI import *
+import salome
+
+from salome.shaper import model
+
+import os
+
+## @ingroup Plugins
+# Feature to suggest constraints using a Machine Learning model
+class SuggestConstraintsFeature(ModelAPI.ModelAPI_Feature):
+
+ ## The constructor.
+ def __init__(self):
+ ModelAPI.ModelAPI_Feature.__init__(self)
+ pass
+
+ @staticmethod
+ ## Export kind. Static.
+ def ID():
+ return "SuggestConstraints"
+
+ ## Returns the kind of a feature.
+ def getKind(self):
+ return SuggestConstraintsFeature.ID()
+
+ ## True: This feature is action: has no property panel and executes immediately.
+ ## False: Otherwise.
+ def isAction(self):
+ return False
+ #TODO
+ #return True
+
+ def isMacro(self):
+ """
+ Override Feature.isMacro().
+ Rectangle feature is macro: removes itself on the creation transaction finish.
+ """
+ return True
+
+ ## Init attributes
+ def initAttributes(self):
+ pass
+
+ ## Check that sketch can convert in SAM format
+ def isConvertedSketch(self, sketch):
+ avaliable_elements = ['SketchConstraintAngle',
+ 'SketchConstraintCoincidence',
+ 'SketchConstraintDistance',
+ 'SketchConstraintDistanceHorizontal',
+ 'SketchConstraintDistanceVertical',
+ 'SketchConstraintEqual',
+ 'SketchConstraintHorizontal',
+ 'SketchConstraintMiddle',
+ 'SketchConstraintParallel',
+ 'SketchConstraintPerpendicular',
+ 'SketchConstraintTangent',
+ 'SketchConstraintVertical',
+ 'SketchConstraintRadius',
+ 'SketchConstraintLength',
+ 'SketchPoint',
+ 'SketchArc',
+ 'SketchCircle',
+ 'SketchLine']
+ nonConvertablePrimitive = []
+ nonConvertableConstraint = []
+
+ for sub in sketch.features().list():
+ feat = ModelAPI.objectToFeature(sub)
+ if feat is None :
+ continue
+
+ entity = SketchAPI_SketchEntity(feat)
+ entity_type = entity.getKind()
+ if not entity_type in avaliable_elements:
+ if 'Constraint' in entity_type :
+ nonConvertableConstraint.append(entity_type)
+ else:
+ nonConvertablePrimitive.append(entity_type)
+ return nonConvertablePrimitive, nonConvertableConstraint
+
+ ## convert result in SAM format
+ def convertToSAM(self):
+ ## Check that all primitives and constraints is compability with SAM
+ nonConvertablePrimitive, nonConvertableConstraint = self.isConvertedSketch(aSketch)
+ if len(nonConvertablePrimitive) > 0 or len(nonConvertableConstraint) > 0 :
+ print("Primitives and constraints are incompatible with the SAM format. The sequence therefore cannot be translated.")
+ print(f'List of primitives not compatible with SAM: {nonConvertablePrimitive}')
+ print(f'List of constraints not compatible with SAM: {nonConvertableConstraint}')
+ return
+
+ convert_sketch(aSketch)
+ print("SuggestConstraintsFeature: convertToSAM")
+
+ pass
+
+ ## Exports all shapes and groups into the GEOM module.
+ def execute(self):
+ ## Find skecth
+ aSession = ModelAPI.ModelAPI_Session.get()
+ aPartSet = aSession.moduleDocument()
+ self.Part = model.activeDocument()
+ for feat in self.Part.allFeatures():
+ if feat.getKind() == "Sketch":
+ self.Sketch = SketchAPI_Sketch(feat)
+ break
+
+ print("SuggestConstraintsFeature: execute")
+ self.convertToSAM()
+ # TODO: Lot3 and Lot4
+
+ pass
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+ <context>
+ <name>SketchToSAMConverter</name>
+ <message>
+ <source>Impossible to apply the suggested constraints. The primitives %1 and constraints %2 are not currently considered by the model.</source>
+ <translation>Impossible d'appliquer la suggestion de contraintes. Les primitives %1 et contraintes %2 ne sont pour le moment pas prises en compte par le modele.</translation>
+ </message>
+ </context>
+</TS>
--- /dev/null
+# Copyright (C) 2021-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include(tests.set)
+
+ADD_UNIT_TESTS(${TEST_NAMES})
+
+if(${HAVE_SALOME})
+ enable_testing()
+ set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/SAMConverter")
+
+ install(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+ install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
+
+ set(TMP_TESTS_NAMES)
+ foreach(tfile ${TEST_NAMES})
+ list(APPEND TMP_TESTS_NAMES "${tfile}")
+ endforeach(tfile ${TEST_NAMES})
+
+ # tests which require SHAPER_SUGGESTION_GENERATOR
+ install(DIRECTORY data DESTINATION ${TEST_INSTALL_DIRECTORY})
+
+ install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
+endif(${HAVE_SALOME})
--- /dev/null
+# Copyright (C) 2021-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include(tests.set)
+
+foreach(tfile ${TEST_NAMES})
+ set(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ add_test(${TEST_NAME} python ${tfile})
+ set_tests_properties(${TEST_NAME} PROPERTIES LABELS "${SALOME_TEST_LABEL_ADV}")
+endforeach()
--- /dev/null
+# Copyright (C) 2021-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(TEST_NAMES
+ TestSAMConverter_Primitives.py
+ TestSAMConverter_Constraints.py
+ TestSAMConverter_Sketch.py
+)
--- /dev/null
+
+.. _sAMPlugin:
+
+SAM plug-in
+================
+
+SAM plug-in implements features for Sketch conversion to SAM format and to call Suggest Constraints macro.
+It provides the following features:
+
+.. toctree::
+ :titlesonly:
+ :maxdepth: 1
+
+ suggestConstraintsFeature.rst
--- /dev/null
+<plugin>
+ <workbench id="Sketch">
+ <group id="Automatic constraints">
+ <feature
+ id="SuggestConstraints"
+ title="Suggest constraints"
+ tooltip="Suggest constraints using a Machine Learning model"
+ icon="icons/SAM/suggest_constraints.png"
+ helpfile="SAMConverter/SAMPlugin.html"/>
+ </group>
+ </workbench>
+</plugin>
--- /dev/null
+# Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ SAMConverterAPI.h
+ SAMConverterAPI_SAMConverter.h
+)
+
+SET(PROJECT_SOURCES
+ SAMConverterAPI_SAMConverter.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ConnectorPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/SAMConverter
+)
+
+#TODO(spo): is ${OpenCASCADE_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONNECTORAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
+ADD_LIBRARY(SAMConverterAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(SAMConverterAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(SAMConverterAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(SAMConverterAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ SAMConverterAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_SAMConverterAPI_EXTRA_DEPS ${SWIG_MODULE_SAMConverterAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+SET(CMAKE_SWIG_FLAGS -threads -w325,321,302,362,322,383,403)
+
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+ SWIG_ADD_LIBRARY(SAMConverterAPI LANGUAGE python SOURCES SAMConverterAPI.i ${PROJECT_HEADERS})
+ELSE()
+ SWIG_ADD_MODULE(SAMConverterAPI python SAMConverterAPI.i ${PROJECT_HEADERS})
+ENDIF()
+SWIG_LINK_LIBRARIES(SAMConverterAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_SAMConverterAPI PROPERTIES DEBUG_OUTPUT_NAME _SAMConverterAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _SAMConverterAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS SAMConverterAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SAMConverterAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+#IF(${HAVE_SALOME})
+# ENABLE_TESTING()
+# ADD_SUBDIRECTORY(Test)
+#ENDIF(${HAVE_SALOME})
--- /dev/null
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SAMCONVERTERAPI_H
+#define SAMCONVERTERAPI_H
+
+#if defined SAMCONVERTERAPI_EXPORTS
+#if defined WIN32
+#define SAMCONVERTERAPI_EXPORT __declspec( dllexport )
+#else
+#define SAMCONVERTERAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SAMCONVERTERAPI_EXPORT __declspec( dllimport )
+#else
+#define SAMCONVERTERAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+/* SAMConverterAPI.i */
+
+%module SAMConverterAPI
+
+%{
+ #include "SAMConverterAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define SAMCONVERTERAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// all supported interfaces
+%include "SAMConverterAPI_SAMConverter.h"
--- /dev/null
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SAMConverterAPI_SAMConverter.h"
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+//--------------------------------------------------------------------------------------
+void suggestConstraints(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature("SuggestConstraints");
+}
--- /dev/null
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_PART_H_
+#define SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_PART_H_
+
+//--------------------------------------------------------------------------------------
+#include "SAMConverterAPI.h"
+//--------------------------------------------------------------------------------------
+#include <memory>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/**\ingroup CPPHighAPI
+ * \brief Export to GEOM
+ */
+SAMCONVERTERAPI_EXPORT
+void suggestConstraints(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_PART_H_ */
--- /dev/null
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_SWIG_H_
+#define SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "SAMConverterAPI_SAMConverter.h"
+
+#endif /* SRC_SAMCONVERTERAPI_SAMCONVERTERAPI_SWIG_H_ */
--- /dev/null
+solid
+ facet normal -1.000000e+00 0.000000e+00 0.000000e+00
+ outer loop
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ vertex 0.000000e+00 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 8.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal -1.000000e+00 0.000000e+00 0.000000e+00
+ outer loop
+ vertex 0.000000e+00 0.000000e+00 5.000000e+00
+ vertex 0.000000e+00 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal 1.000000e+00 0.000000e+00 0.000000e+00
+ outer loop
+ vertex 1.400000e+01 0.000000e+00 0.000000e+00
+ vertex 1.400000e+01 8.000000e+00 0.000000e+00
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ endloop
+ endfacet
+ facet normal 1.000000e+00 -0.000000e+00 0.000000e+00
+ outer loop
+ vertex 1.400000e+01 0.000000e+00 5.000000e+00
+ vertex 1.400000e+01 0.000000e+00 0.000000e+00
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 -1.000000e+00 -0.000000e+00
+ outer loop
+ vertex 1.400000e+01 0.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ vertex 1.400000e+01 0.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal -0.000000e+00 -1.000000e+00 0.000000e+00
+ outer loop
+ vertex 1.400000e+01 0.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 1.000000e+00 0.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ vertex 1.400000e+01 8.000000e+00 0.000000e+00
+ vertex 0.000000e+00 8.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 1.000000e+00 0.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 8.000000e+00 0.000000e+00
+ vertex 0.000000e+00 8.000000e+00 5.000000e+00
+ endloop
+ endfacet
+ facet normal -0.000000e+00 0.000000e+00 -1.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 0.000000e+00
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ vertex 0.000000e+00 8.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 -0.000000e+00 -1.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 0.000000e+00
+ vertex 1.400000e+01 0.000000e+00 0.000000e+00
+ vertex 0.000000e+00 0.000000e+00 0.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 0.000000e+00 1.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 5.000000e+00
+ endloop
+ endfacet
+ facet normal 0.000000e+00 0.000000e+00 1.000000e+00
+ outer loop
+ vertex 1.400000e+01 8.000000e+00 5.000000e+00
+ vertex 0.000000e+00 0.000000e+00 5.000000e+00
+ vertex 1.400000e+01 0.000000e+00 5.000000e+00
+ endloop
+ endfacet
+endsolid
SketchConstraintMirror SketchConstraintAngle
SketchMultiRotation SketchMultiTranslation
SketchOffset
- SketchConstraintCollinear SketchConstraintMiddle"
+ SketchConstraintCollinear SketchConstraintMiddle SuggestConstraints"
when_nested="accept abort"
title="Sketch"
tooltip="Create sketch"