From: asozinov Date: Mon, 19 Dec 2022 11:11:22 +0000 (+0300) Subject: bos 32359 - Adaptation of SHAPER model X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fasozinov%2F32539;p=modules%2Fshaper.git bos 32359 - Adaptation of SHAPER model add projectio and intersection as available (but non convertable) elements --- diff --git a/src/SAMConverter/SAMConverter_ConvertPrimitives.py b/src/SAMConverter/SAMConverter_ConvertPrimitives.py index 3243b9575..4abb0e6ca 100644 --- a/src/SAMConverter/SAMConverter_ConvertPrimitives.py +++ b/src/SAMConverter/SAMConverter_ConvertPrimitives.py @@ -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, {} diff --git a/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py b/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py index 785f73e68..5020a8a19 100644 --- a/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py +++ b/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py @@ -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 = []