]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
bos 32359 - Adaptation of SHAPER model asozinov/32539
authorasozinov <alexey.sozinov@opencascade.com>
Mon, 19 Dec 2022 11:11:22 +0000 (14:11 +0300)
committerasozinov <alexey.sozinov@opencascade.com>
Mon, 19 Dec 2022 11:11:22 +0000 (14:11 +0300)
add projectio and intersection as available (but non convertable) elements

src/SAMConverter/SAMConverter_ConvertPrimitives.py
src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py

index 3243b957585be7bfb814c46558ee7c5db24ad202..4abb0e6cabc9bb26a12e5e5af37664323d4ae86a 100644 (file)
@@ -2,6 +2,7 @@ from sam.catalog_primitive import Arc, Line, Circle, Point
 
 import math
 
+from ModelAPI import *
 from SketchAPI import *
 from GeomAPI import *
 from SAMConverter_Logger import logger
@@ -25,6 +26,10 @@ class ShapertoSAMPrimitive:
             return ShapertoSAMPrimitive.convert_circle(entity)
         if entity_type == 'SketchLine':
             return ShapertoSAMPrimitive.convert_line(entity)
+        if entity_type == 'SketchProjection':
+            return ShapertoSAMPrimitive.convert_projection(entity)
+        if entity_type == 'SketchIntersection':
+            return ShapertoSAMPrimitive.convert_intersection(entity)
         return None, {}
 
     def check_construction(entity):
@@ -70,3 +75,19 @@ class ShapertoSAMPrimitive:
                         angles= [start_angle, end_angle])
         arc.add_points_startend()
         return arc, {(c.x(), c.y(), feat.name()) : arc.center}
+
+    # Not need convert to SAM
+    def convert_intersection(entity):
+        return None, {}
+
+    # Not need convert to SAM
+    def convert_projection(entity):
+        feature_feat = entity.feature()
+        feat =  ModelAPI.objectToFeature(feature_feat)
+        attr = feat.refattr("ProjectedFeature")
+
+        proj_feat = ModelAPI_Feature.feature(attr.object())
+        proj_entity = SketchAPI_SketchEntity(proj_feat)
+        entity_type = proj_entity.getKind()
+
+        return None, {}
index 785f73e686c6db7420c30a3a0066b84fc8ad89c2..5020a8a1955e76baee46761be557d378371114fa 100644 (file)
@@ -26,13 +26,12 @@ from SAMConverter_ConvertConstraints import *
 
 import ModelAPI
 import EventsAPI
+
 from SketchAPI import *
 import salome
 
 from salome.shaper import model
-from GeomDataAPI import *
-from ModelAPI import *
-import math
+
 import os
 
 ## @ingroup Plugins
@@ -90,7 +89,10 @@ class SuggestConstraintsFeature(ModelAPI.ModelAPI_Feature):
                               'SketchPoint',
                               'SketchArc',
                               'SketchCircle',
-                              'SketchLine']
+                              'SketchLine',
+                              # Next entities not compability with SAM, but it's avaliable elements
+                              'SketchProjection',
+                              'SketchIntersection']
         nonConvertablePrimitive = []
         nonConvertableConstraint = []