Salome HOME
Merge commit 'refs/tags/V9_2_0^{}'
authormpv <mpv@opencascade.com>
Tue, 11 Dec 2018 12:59:51 +0000 (15:59 +0300)
committermpv <mpv@opencascade.com>
Tue, 11 Dec 2018 12:59:51 +0000 (15:59 +0300)
719 files changed:
CMakeLists.txt
doc/gui/Introduction.rst
doc/gui/tutorial.py
env.sh
lcov_reports.sh [changed mode: 0644->0755]
src/BuildAPI/BuildAPI_Filling.cpp
src/BuildAPI/BuildAPI_Filling.h
src/BuildPlugin/BuildPlugin_Compound.cpp
src/BuildPlugin/BuildPlugin_Edge.cpp
src/BuildPlugin/BuildPlugin_Face.cpp
src/BuildPlugin/BuildPlugin_Filling.cpp
src/BuildPlugin/BuildPlugin_Filling.h
src/BuildPlugin/BuildPlugin_Interpolation.cpp
src/BuildPlugin/BuildPlugin_Polyline.cpp
src/BuildPlugin/BuildPlugin_Shell.cpp
src/BuildPlugin/BuildPlugin_Solid.cpp
src/BuildPlugin/BuildPlugin_SubShapes.cpp
src/BuildPlugin/BuildPlugin_Validators.cpp
src/BuildPlugin/BuildPlugin_Vertex.cpp
src/BuildPlugin/BuildPlugin_Wire.cpp
src/BuildPlugin/CMakeLists.txt
src/BuildPlugin/Test/Test1920.py
src/BuildPlugin/Test/Test2398.py
src/BuildPlugin/Test/Test2415.py
src/BuildPlugin/Test/Test2439.py
src/BuildPlugin/Test/Test2454.py
src/BuildPlugin/Test/TestCompSolid.py
src/BuildPlugin/Test/TestCompound.py
src/BuildPlugin/Test/TestCompound_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestEdge_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestFace.py
src/BuildPlugin/Test/TestFace_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestFilling.py [new file with mode: 0644]
src/BuildPlugin/Test/TestFilling_ByEdges.py
src/BuildPlugin/Test/TestFilling_ByWires.py
src/BuildPlugin/Test/TestFilling_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestFilling_Mixed.py
src/BuildPlugin/Test/TestInterpolation.py
src/BuildPlugin/Test/TestPolyline.py
src/BuildPlugin/Test/TestSolid.py
src/BuildPlugin/Test/TestSolid_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestSubShapes.py
src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestVertex_ErrorMsg.py [new file with mode: 0644]
src/BuildPlugin/Test/TestWire.py
src/BuildPlugin/Test/TestWire_ErrorMsg.py [new file with mode: 0644]
src/CollectionAPI/CollectionAPI_Group.cpp
src/CollectionAPI/CollectionAPI_Group.h
src/CollectionPlugin/CMakeLists.txt
src/CollectionPlugin/Test/TestField.py
src/CollectionPlugin/Test/TestGroup.py
src/CollectionPlugin/Test/TestGroup1799.py
src/CollectionPlugin/Test/TestGroupMove.py
src/CollectionPlugin/Test/TestGroupMove2.py
src/CollectionPlugin/Test/TestGroupShareTopology.py [new file with mode: 0644]
src/CollectionPlugin/doc/groupFeature.rst
src/CollectionPlugin/doc/images/group_property_panel.png
src/CollectionPlugin/group_widget.xml
src/Config/CMakeLists.txt
src/Config/ConfigAPI.i
src/Config/Config_AttributeMessage.cpp
src/Config/Config_AttributeMessage.h
src/Config/Config_FeatureReader.cpp
src/Config/Config_Keywords.h
src/Config/Config_PropManager.cpp
src/Config/Config_PropManager.h
src/Config/Config_XMLReader.cpp
src/Config/Test/TestConfig.py [new file with mode: 0644]
src/ConnectorAPI/Test/TestExportToGEOM.py
src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Axis.cpp
src/ConstructionPlugin/ConstructionPlugin_Plane.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Validators.cpp
src/ConstructionPlugin/Test/TestAxisCreation.py
src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPlane_FaceValidator.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_Edge.py
src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py
src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py
src/ConstructionPlugin/Test/TestPoint_IntersectLines.py
src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py
src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py
src/ConstructionPlugin/Test/TestPoint_VertexSelection.py
src/ConstructionPlugin/axis_widget.xml
src/ConstructionPlugin/plane_widget.xml
src/ConstructionPlugin/point_widget.xml
src/ExchangePlugin/CMakeLists.txt
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp
src/ExchangePlugin/Test/Test2459.py
src/ExchangePlugin/Test/TestExport.py
src/ExchangePlugin/Test/TestExportToXAOWithGroupNotUpdated.py
src/ExchangePlugin/Test/TestExport_FiniteValidator.py [new file with mode: 0644]
src/ExchangePlugin/Test/TestImport.py
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Boolean.h
src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h
src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h
src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h
src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp
src/FeaturesPlugin/FeaturesPlugin_Fillet.h
src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp
src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp
src/FeaturesPlugin/FeaturesPlugin_Intersection.h
src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp
src/FeaturesPlugin/FeaturesPlugin_Partition.cpp
src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp
src/FeaturesPlugin/FeaturesPlugin_Pipe.h
src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.h
src/FeaturesPlugin/FeaturesPlugin_Recover.cpp
src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.h
src/FeaturesPlugin/FeaturesPlugin_Scale.cpp
src/FeaturesPlugin/FeaturesPlugin_Scale.h
src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
src/FeaturesPlugin/FeaturesPlugin_Symmetry.h
src/FeaturesPlugin/FeaturesPlugin_Tools.cpp
src/FeaturesPlugin/FeaturesPlugin_Tools.h
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp
src/FeaturesPlugin/FeaturesPlugin_Translation.h
src/FeaturesPlugin/FeaturesPlugin_Union.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/Test/Test1379.py
src/FeaturesPlugin/Test/Test1467.py
src/FeaturesPlugin/Test/Test1816.py
src/FeaturesPlugin/Test/Test1915.py
src/FeaturesPlugin/Test/Test1922.py
src/FeaturesPlugin/Test/Test1942.py
src/FeaturesPlugin/Test/Test2023.py
src/FeaturesPlugin/Test/Test2038.py
src/FeaturesPlugin/Test/Test2046.py
src/FeaturesPlugin/Test/Test2172.py
src/FeaturesPlugin/Test/Test2194.py
src/FeaturesPlugin/Test/Test2197_1.py
src/FeaturesPlugin/Test/Test2197_2.py
src/FeaturesPlugin/Test/Test2197_3.py
src/FeaturesPlugin/Test/Test2197_4.py
src/FeaturesPlugin/Test/Test2215.py
src/FeaturesPlugin/Test/Test2222.py
src/FeaturesPlugin/Test/Test2231.py
src/FeaturesPlugin/Test/Test2233.py
src/FeaturesPlugin/Test/Test2240.py
src/FeaturesPlugin/Test/Test2246.py
src/FeaturesPlugin/Test/Test2248.py
src/FeaturesPlugin/Test/Test2251.py
src/FeaturesPlugin/Test/Test2255.py
src/FeaturesPlugin/Test/Test2289.py
src/FeaturesPlugin/Test/Test2304.py
src/FeaturesPlugin/Test/Test2304_2.py
src/FeaturesPlugin/Test/Test2375.py
src/FeaturesPlugin/Test/Test2377.py
src/FeaturesPlugin/Test/Test2394.py
src/FeaturesPlugin/Test/Test2395.py
src/FeaturesPlugin/Test/Test2419_1.py
src/FeaturesPlugin/Test/Test2419_2.py
src/FeaturesPlugin/Test/Test2419_3.py
src/FeaturesPlugin/Test/Test2465.py
src/FeaturesPlugin/Test/Test2495.py
src/FeaturesPlugin/Test/Test2514.py
src/FeaturesPlugin/Test/Test2520.py
src/FeaturesPlugin/Test/Test2545.py
src/FeaturesPlugin/Test/Test2588.py
src/FeaturesPlugin/Test/Test2592.py
src/FeaturesPlugin/Test/Test2596.py
src/FeaturesPlugin/Test/Test2617.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2631.py
src/FeaturesPlugin/Test/Test2650.py
src/FeaturesPlugin/Test/Test2681.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2686.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2689.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2692.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2693.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2698.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2701.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2724.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2729.py [new file with mode: 0644]
src/FeaturesPlugin/Test/Test2751.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBoolean.py [deleted file]
src/FeaturesPlugin/Test/TestBoolean1.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBoolean2.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBoolean3.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py
src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py
src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py
src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py
src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py
src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py
src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py
src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py
src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py
src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py
src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py
src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py
src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py
src/FeaturesPlugin/Test/TestBooleanCompSolids.py
src/FeaturesPlugin/Test/TestBooleanCut_CompSolidCompound_CompSolidCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_CompSolid_CompSolid.py
src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_EdgeCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_Solid.py
src/FeaturesPlugin/Test/TestBooleanCut_Edge_Edge.py
src/FeaturesPlugin/Test/TestBooleanCut_Edge_Face.py
src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_FaceCompound_FaceCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_Face_Face.py
src/FeaturesPlugin/Test/TestBooleanCut_Face_Solid.py
src/FeaturesPlugin/Test/TestBooleanCut_ShellCompound_ShellCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_Shell_Shell.py
src/FeaturesPlugin/Test/TestBooleanCut_SolidCompound_SolidCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_Solid_Solid.py
src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_Solid.py
src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_VertexCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_Vertex_Vertex.py
src/FeaturesPlugin/Test/TestBooleanCut_WireCompound_WireCompound.py
src/FeaturesPlugin/Test/TestBooleanCut_Wire_Face.py
src/FeaturesPlugin/Test/TestBooleanCut_Wire_Wire.py
src/FeaturesPlugin/Test/TestBooleanFill.py
src/FeaturesPlugin/Test/TestBooleanFillWithPlane.py
src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py
src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py
src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py
src/FeaturesPlugin/Test/TestBooleanFuse_RemoveEdges.py
src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py
src/FeaturesPlugin/Test/TestBooleanFuse_SimpleMode.py
src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py
src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py
src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py
src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py
src/FeaturesPlugin/Test/TestBooleanSmash.py
src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanSmash_Face_Face.py
src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py
src/FeaturesPlugin/Test/TestExtrusion.py
src/FeaturesPlugin/Test/TestExtrusionCut.py
src/FeaturesPlugin/Test/TestExtrusionFuse.py
src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestExtrusion_ZeroOffsetError.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestFillCompFaceSolid.py
src/FeaturesPlugin/Test/TestFillCompsolidPlane.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestFillEdgeEdge.py
src/FeaturesPlugin/Test/TestFillEdgeEdgeIntersected.py
src/FeaturesPlugin/Test/TestFillEdgeFace.py
src/FeaturesPlugin/Test/TestFillEdgeShell.py
src/FeaturesPlugin/Test/TestFillEdgeSolid.py
src/FeaturesPlugin/Test/TestFillEdgeSolidIntersected.py
src/FeaturesPlugin/Test/TestFillEdgeVertex.py
src/FeaturesPlugin/Test/TestFillEdgeWire.py
src/FeaturesPlugin/Test/TestFillFaceEdge.py
src/FeaturesPlugin/Test/TestFillFaceEdgeInside.py
src/FeaturesPlugin/Test/TestFillFaceEdgePerpendicular.py
src/FeaturesPlugin/Test/TestFillFaceFace.py
src/FeaturesPlugin/Test/TestFillFaceShell.py
src/FeaturesPlugin/Test/TestFillFaceSolid.py
src/FeaturesPlugin/Test/TestFillFaceVertex.py
src/FeaturesPlugin/Test/TestFillFaceWire.py
src/FeaturesPlugin/Test/TestFillShellConstrPlane.py
src/FeaturesPlugin/Test/TestFillShellEdge.py
src/FeaturesPlugin/Test/TestFillShellFace.py
src/FeaturesPlugin/Test/TestFillShellShell.py
src/FeaturesPlugin/Test/TestFillShellSolid.py
src/FeaturesPlugin/Test/TestFillShellVertex.py
src/FeaturesPlugin/Test/TestFillShellWire.py
src/FeaturesPlugin/Test/TestFillSolid2ConstructionPlanes.py
src/FeaturesPlugin/Test/TestFillSolidCompFace.py
src/FeaturesPlugin/Test/TestFillSolidCompShell.py
src/FeaturesPlugin/Test/TestFillSolidEdge.py
src/FeaturesPlugin/Test/TestFillSolidFace.py
src/FeaturesPlugin/Test/TestFillSolidShell.py
src/FeaturesPlugin/Test/TestFillWireEdge.py
src/FeaturesPlugin/Test/TestFillWireFace.py
src/FeaturesPlugin/Test/TestFillWireShell.py
src/FeaturesPlugin/Test/TestFillWireSolid.py
src/FeaturesPlugin/Test/TestFillWireVertex.py
src/FeaturesPlugin/Test/TestFillWireWire.py
src/FeaturesPlugin/Test/TestFillet.py
src/FeaturesPlugin/Test/TestFillet1.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestFusionFaces.py
src/FeaturesPlugin/Test/TestIntersection.py
src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMeasurementAngle.py
src/FeaturesPlugin/Test/TestMeasurementAngle3Points.py
src/FeaturesPlugin/Test/TestMeasurementDistance.py
src/FeaturesPlugin/Test/TestMeasurementLength.py
src/FeaturesPlugin/Test/TestMeasurementPresentation.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMeasurementRadius.py
src/FeaturesPlugin/Test/TestMultiBoolean.py
src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMultiRotation_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMultiTranslation_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPartition.py
src/FeaturesPlugin/Test/TestPartition2Faces.py
src/FeaturesPlugin/Test/TestPartition2Solids.py
src/FeaturesPlugin/Test/TestPartition2Wires.py
src/FeaturesPlugin/Test/TestPartitionBox4Planes.py
src/FeaturesPlugin/Test/TestPartitionEdgeSolid.py
src/FeaturesPlugin/Test/TestPartitionFace2Solid.py
src/FeaturesPlugin/Test/TestPartitionFaceWire.py
src/FeaturesPlugin/Test/TestPartitionInclinedFaceSolid.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py
src/FeaturesPlugin/Test/TestPartitionWireFaceSolid.py
src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPipe_Compound.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPipe_Edge.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPipe_Wire.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement.py [deleted file]
src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Face_Face.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Part_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestRecover1798.py
src/FeaturesPlugin/Test/TestRemoveSubShapes3.py
src/FeaturesPlugin/Test/TestRemoveSubShapes4.py
src/FeaturesPlugin/Test/TestRemoveSubShapes5.py
src/FeaturesPlugin/Test/TestRemoveSubShapes6.py
src/FeaturesPlugin/Test/TestRevolution.py
src/FeaturesPlugin/Test/TestRevolutionCut.py
src/FeaturesPlugin/Test/TestRevolutionFuse.py
src/FeaturesPlugin/Test/TestRotation.py
src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestSerialBoolean.py
src/FeaturesPlugin/Test/TestSymmetry_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestTranslation.py
src/FeaturesPlugin/Test/TestTranslation_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py
src/FeaturesPlugin/Test/TestUnion4CurvedFaces_2.py
src/FeaturesPlugin/Test/TestUnion4Faces.py
src/FeaturesPlugin/Test/TestUnionFaces.py
src/FeaturesPlugin/Test/TestUnionOfUnion.py
src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/multirotation_widget.xml
src/FeaturesPlugin/multitranslation_widget.xml
src/FeaturesPlugin/placement_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutioncut_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/FeaturesPlugin/rotation_widget.xml
src/FeaturesPlugin/symmetry_widget.xml
src/FeaturesPlugin/translation_widget.xml
src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp
src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp
src/GeomAPI/GeomAPI_Edge.h
src/GeomAPI/GeomAPI_PlanarEdges.cpp
src/GeomAPI/GeomAPI_PlanarEdges.h
src/GeomAPI/GeomAPI_Pln.cpp
src/GeomAPI/GeomAPI_Pln.h
src/GeomAPI/GeomAPI_Tools.cpp
src/GeomAPI/GeomAPI_XYZ.h
src/GeomAPI/Test/Test2675.py
src/GeomAPI/Test/TestBox.py
src/GeomAPI/Test/TestCone.py
src/GeomAPI/Test/TestCylinder.py
src/GeomAPI/Test/TestPolygon.py
src/GeomAPI/Test/TestSphere.py
src/GeomAPI/Test/TestTorus.py
src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h
src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp
src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h
src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp
src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h
src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp
src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h
src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Tools.h
src/GeomValidators/CMakeLists.txt
src/GeomValidators/GeomValidators_DifferentShapes.cpp
src/GeomValidators/GeomValidators_Face.cpp
src/GeomValidators/GeomValidators_PartitionArguments.cpp [deleted file]
src/GeomValidators/GeomValidators_PartitionArguments.h [deleted file]
src/GeomValidators/GeomValidators_Plugin.cpp
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ShapeType.h
src/GeomValidators/GeomValidators_ZeroOffset.cpp
src/Model/CMakeLists.txt
src/Model/Model_AttributeRefList.cpp
src/Model/Model_AttributeRefList.h
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/Model/Model_AttributeSelectionList.cpp
src/Model/Model_AttributeSelectionList.h
src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/Model/Model_Data.cpp
src/Model/Model_Data.h
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Objects.cpp
src/Model/Model_Objects.h
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultBody.h
src/Model/Model_ResultConstruction.cpp
src/Model/Model_ResultConstruction.h
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/Model/Model_SelectionNaming.cpp [deleted file]
src/Model/Model_SelectionNaming.h [deleted file]
src/Model/Model_Session.cpp
src/Model/Model_Update.cpp
src/Model/Model_Validator.cpp
src/Model/Model_Validator.h
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_AttributeRefList.h
src/ModelAPI/ModelAPI_AttributeSelection.h
src/ModelAPI/ModelAPI_AttributeSelectionList.h
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_CompositeFeature.cpp
src/ModelAPI/ModelAPI_CompositeFeature.h
src/ModelAPI/ModelAPI_Expression.cpp
src/ModelAPI/ModelAPI_Feature.cpp
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/ModelAPI_Result.cpp
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultConstruction.h
src/ModelAPI/ModelAPI_ResultPart.h
src/ModelAPI/ModelAPI_Validator.h
src/ModelAPI/Test/Test1064.py
src/ModelAPI/Test/Test1512.py
src/ModelAPI/Test/Test1562.py [new file with mode: 0644]
src/ModelAPI/Test/Test1757.py
src/ModelAPI/Test/Test1995.py
src/ModelAPI/Test/Test1998.py
src/ModelAPI/Test/Test2170.py
src/ModelAPI/Test/Test2228.py
src/ModelAPI/Test/Test2241.py
src/ModelAPI/Test/Test2252.py
src/ModelAPI/Test/Test2276.py
src/ModelAPI/Test/Test2358_1.py
src/ModelAPI/Test/Test2358_2.py
src/ModelAPI/Test/Test2389.py
src/ModelAPI/Test/Test2391.py
src/ModelAPI/Test/Test2396.py
src/ModelAPI/Test/Test2401.py
src/ModelAPI/Test/Test2413.py
src/ModelAPI/Test/Test2496.py
src/ModelAPI/Test/Test2510.py
src/ModelAPI/Test/Test2685.py [new file with mode: 0644]
src/ModelAPI/Test/TestContainerSelector.py [new file with mode: 0644]
src/ModelAPI/Test/TestCustomName_BooleanCut.py
src/ModelAPI/Test/TestCustomName_CommonCompSolid.py
src/ModelAPI/Test/TestCustomName_CutCompSolid.py
src/ModelAPI/Test/TestCustomName_CutGroup.py
src/ModelAPI/Test/TestCustomName_ExtrudeFace.py
src/ModelAPI/Test/TestCustomName_ExtrusionCut.py
src/ModelAPI/Test/TestCustomName_ExtrusionCutFace.py
src/ModelAPI/Test/TestCustomName_MultiTranslation.py
src/ModelAPI/Test/TestCustomName_Placement.py
src/ModelAPI/Test/TestCustomName_RotateGroup.py
src/ModelAPI/Test/TestCustomName_Translation.py
src/ModelAPI/Test/TestFeatureSelection_2.py
src/ModelAPI/Test/TestFolder_CustomName.py
src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py [new file with mode: 0644]
src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py [new file with mode: 0644]
src/ModelAPI/Test/TestGeomNamingPlacement.py [new file with mode: 0644]
src/ModelAPI/Test/TestGeomNamingRevolution.py [new file with mode: 0644]
src/ModelAPI/Test/TestGeomNamingSketchPlane.py [new file with mode: 0644]
src/ModelAPI/Test/TestSaveOpen.py [new file with mode: 0644]
src/ModelAPI/Test/TestSelectionScope.py
src/ModelAPI/Test/TestSelectorShell.py [new file with mode: 0644]
src/ModelAPI/Test/TestWeakNaming2125.py
src/ModelAPI/Test/TestWeakNaming2222.py
src/ModelAPI/Test/TestWeakNaming2291.py
src/ModelAPI/Test/TestWeakNaming2375.py
src/ModelAPI/Test/TestWeakNaming2437.py
src/ModelAPI/Test/TestWeakNaming2452.py
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_Tools.cpp
src/ModelHighAPI/ModelHighAPI_Tools.h
src/ModelHighAPI/Test/Test2488.py
src/ModelHighAPI/Test/TestDeflectionDump.py
src/ModuleBase/ModuleBase_ISelection.cpp
src/ModuleBase/ModuleBase_ITreeNode.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetPointInput.cpp
src/ModuleBase/ModuleBase_WidgetPointInput.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ParametersAPI/ParametersAPI_Parameter.cpp
src/ParametersAPI/ParametersAPI_Parameter.h
src/ParametersPlugin/CMakeLists.txt
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_Validators.cpp
src/ParametersPlugin/Test/TestParameterDelete.py [new file with mode: 0644]
src/ParametersPlugin/Test/TestParameterErrorMsg.py [new file with mode: 0644]
src/ParametersPlugin/Test/TestParameterRename.py
src/ParametersPlugin/Test/TestParametersMgr.py [new file with mode: 0644]
src/PartSet/PartSet_OverconstraintListener.cpp
src/PartSet/PartSet_PreviewPlanes.cpp
src/PartSet/PartSet_PreviewSketchPlane.cpp
src/PartSet/PartSet_ResultSketchPrs.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp
src/PrimitivesPlugin/cone_widget.xml
src/PrimitivesPlugin/cylinder_widget.xml
src/PrimitivesPlugin/torus_widget.xml
src/PythonAPI/examples/MakeBrick1.py
src/PythonAPI/examples/MakeBrick2.py
src/PythonAPI/examples/Platine.py
src/PythonAPI/model/parameter/__init__.py
src/PythonAPI/model/tests/tests.py
src/SHAPERGUI/SHAPERGUI_DataModel.cpp
src/Selector/CMakeLists.txt [new file with mode: 0644]
src/Selector/Selector.h [new file with mode: 0644]
src/Selector/Selector_Algo.cpp [new file with mode: 0644]
src/Selector/Selector_Algo.h [new file with mode: 0644]
src/Selector/Selector_AlgoWithSubs.cpp [new file with mode: 0644]
src/Selector/Selector_AlgoWithSubs.h [new file with mode: 0644]
src/Selector/Selector_Container.cpp [new file with mode: 0644]
src/Selector/Selector_Container.h [new file with mode: 0644]
src/Selector/Selector_FilterByNeighbors.cpp [new file with mode: 0644]
src/Selector/Selector_FilterByNeighbors.h [new file with mode: 0644]
src/Selector/Selector_Intersect.cpp [new file with mode: 0644]
src/Selector/Selector_Intersect.h [new file with mode: 0644]
src/Selector/Selector_Modify.cpp [new file with mode: 0644]
src/Selector/Selector_Modify.h [new file with mode: 0644]
src/Selector/Selector_NExplode.cpp [new file with mode: 0644]
src/Selector/Selector_NExplode.h [new file with mode: 0644]
src/Selector/Selector_NameGenerator.cpp [new file with mode: 0644]
src/Selector/Selector_NameGenerator.h [new file with mode: 0644]
src/Selector/Selector_Primitive.cpp [new file with mode: 0644]
src/Selector/Selector_Primitive.h [new file with mode: 0644]
src/Selector/Selector_Selector.cpp [new file with mode: 0644]
src/Selector/Selector_Selector.h [new file with mode: 0644]
src/Selector/Selector_WeakName.cpp [new file with mode: 0644]
src/Selector/Selector_WeakName.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_Constraint.cpp
src/SketchAPI/SketchAPI_Constraint.h
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_ConstraintBase.cpp [deleted file]
src/SketchPlugin/SketchPlugin_ConstraintBase.h
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Line.h
src/SketchPlugin/SketchPlugin_MacroArc.cpp
src/SketchPlugin/SketchPlugin_MacroCircle.cpp
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Point.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/SketchPlugin/SketchPlugin_SketchDrawer.cpp [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_SketchDrawer.h [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_SketchEntity.h
src/SketchPlugin/SketchPlugin_Split.cpp
src/SketchPlugin/SketchPlugin_Split.h
src/SketchPlugin/SketchPlugin_Trim.cpp
src/SketchPlugin/Test/Test2034_3.py
src/SketchPlugin/Test/Test2119.py
src/SketchPlugin/Test/Test2280.py
src/SketchPlugin/Test/Test2287.py
src/SketchPlugin/Test/Test2341.py
src/SketchPlugin/Test/Test2390.py
src/SketchPlugin/Test/Test2393.py
src/SketchPlugin/Test/Test2440.py
src/SketchPlugin/Test/Test2654.py
src/SketchPlugin/Test/Test2741.py [new file with mode: 0644]
src/SketchPlugin/Test/Test2810.py [new file with mode: 0644]
src/SketchPlugin/Test/TestConstraintDistance.py
src/SketchPlugin/Test/TestConstraintEqual.py
src/SketchPlugin/Test/TestConstraintRadiusFailure.py [new file with mode: 0644]
src/SketchPlugin/Test/TestCreateArcByCenterStartEnd.py
src/SketchPlugin/Test/TestEdgesOrder.py
src/SketchPlugin/Test/TestFilletAfterFolder.py
src/SketchPlugin/Test/TestIntersectionChangeEdge.py
src/SketchPlugin/Test/TestIntersectionWithCircle.py
src/SketchPlugin/Test/TestIntersectionWithLine.py
src/SketchPlugin/Test/TestIntersectionWithSpline.py
src/SketchPlugin/Test/TestMovementComplex.py
src/SketchPlugin/Test/TestMultiRotationWithParameter.py
src/SketchPlugin/Test/TestPresentation.py [new file with mode: 0644]
src/SketchPlugin/Test/TestProjection.py
src/SketchPlugin/Test/TestProjectionIntoResult.py
src/SketchPlugin/Test/TestSketchDrawer.py [new file with mode: 0644]
src/SketchPlugin/Test/TestSplitLine.py [new file with mode: 0644]
src/SketchPlugin/Test/TestSplitPreview.py [new file with mode: 0644]
src/SketchPlugin/Test/TestTrimArc08.py [new file with mode: 0644]
src/SketchPlugin/Test/TestTrimLine03.py [new file with mode: 0644]
src/SketchPlugin/Test/TestTrimPreview.py [new file with mode: 0644]
src/SketchPlugin/doc/SketchPlugin.rst
src/SketchPlugin/doc/images/SketchDrawer.png [new file with mode: 0644]
src/SketchPlugin/doc/images/SketchDrawer_panel.png [new file with mode: 0644]
src/SketchPlugin/doc/images/SketchDrawer_res.png [new file with mode: 0644]
src/SketchPlugin/doc/sketchDrawer.rst [new file with mode: 0644]
src/SketchPlugin/icons/drawer.png [new file with mode: 0644]
src/SketchPlugin/plugin-Sketch.xml
src/SketchSolver/SketchSolver_ConstraintDistance.cpp
src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SketchSolver_Storage.cpp
src/SketcherPrs/SketcherPrs_Coincident.cpp
src/XGUI/XGUI_DataModel.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Workshop.cpp
test.API/SHAPER/Primitives/TestBox.py
test.API/SHAPER/Primitives/TestCylinder.py
test.API/SHAPER/Transformations/TestMultiTranslation.py
test.API/SHAPER/Transformations/TestScale.py
test.API/SHAPER/Transformations/TestSymmetry.py
test.API/SHAPER/Transformations/TestTranslation_1.py
test.API/SHAPER/Transformations/TestTranslation_2.py
test.API/SHAPER/Transformations/TestTranslation_3.py
test.API/SHAPER/Transformations/TestTranslation_5.py
test.models/CSWA.py
test.models/angle30.py
test.models/bearing_puller.py
test.models/bobine_film_reel.py
test.models/bracket32.py
test.models/bushing.py
test.models/case24.py
test.models/clothespin.py
test.models/ecran.py
test.models/flange.py
test.models/gear.py
test.models/idler_plate.py
test.models/piece_02.py
test.models/piece_09.py
test.models/piece_12.py
test.models/plug.py
test.models/sprocket.py
test.models/wheel_rim.py

index 79938bc10eb03e5c09eee7b9bb81680c3418eef0..b5e1b365697490cdb2e3dbb9c2a8ff195db3cec1 100644 (file)
@@ -118,6 +118,7 @@ SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
 
 ADD_SUBDIRECTORY (src/Config)
 ADD_SUBDIRECTORY (src/Events)
+ADD_SUBDIRECTORY (src/Selector)
 ADD_SUBDIRECTORY (src/Model)
 ADD_SUBDIRECTORY (src/XAO)
 ADD_SUBDIRECTORY (src/GeomAPI)
index f1163d65a6c50a4f440eab12f9fe2b15ee3bce82..ae5c997e9acaf47d8600c95fe0e373f922a2bbf5 100644 (file)
@@ -241,7 +241,7 @@ Each feature, result, construction, group, field, parameter can be renamed using
 .. centered::\r
    Construction pop-up menu\r
 \r
-The order of features can be changed using *Move to the end* pop-up menu command. The selected feature will be moved to the end of feature list.\r
+The order of features can be changed using *Move to the end* pop-up menu command. It works only for Group features. The selected group will be moved to the end of features list.\r
 \r
 Folders can be used to arrange long Tree View for features.\r
 \r
@@ -411,6 +411,7 @@ Parameters
 Model parametrization can be done using parameters.\r
 \r
 A parameter can be created in the active partset or part by:\r
+\r
 - :ref:`parameter`;\r
 - :ref:`parameters`;\r
 - :ref:`parameter_expression`.\r
index 64e0c404e5fddd1c82b72124d4280db17e1332b0..0af565892d7acaaefa532884660a53a9befeeaf7 100644 (file)
@@ -64,9 +64,9 @@ Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Polyline_1_1")])
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 
 # Step5. Extrusion.
-Wire = model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")
-To = model.selection("FACE", "Revolution_1_1/Generated_Face_6")
-From = model.selection("FACE", "Revolution_1_1/Generated_Face_1")
+Wire = model.selection("WIRE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_1r_wire")
+To = model.selection("FACE", "Revolution_1_1/Generated_Face&Face_1_1/Edge_2")
+From = model.selection("FACE", "Revolution_1_1/Generated_Face&Face_1_1/Edge_7")
 
 Extrusion_1 = model.addExtrusion(Part_1_doc, [Wire], model.selection("EDGE", "PartSet/OZ"), To, 0, From, 0)
 
@@ -74,7 +74,7 @@ Extrusion_1 = model.addExtrusion(Part_1_doc, [Wire], model.selection("EDGE", "Pa
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Extrusion_1_1")])
 
 # Step7. Fillet.
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Common_1_1/Modified_Face_11")], 10)
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_3][Common_1_1/Modified_Face&Face_1_1/Edge_4]")], 10)
 
 # Step8. Box.
 Box_1 = model.addBox(Part_1_doc, 20, 120, 20)
diff --git a/env.sh b/env.sh
index f3aa50d1ce92e8f891baa1726cb61734d2fc0120..eb892afc7bf925545b94309b4296c3b79c03c6e7 100644 (file)
--- a/env.sh
+++ b/env.sh
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 
-export SALOME_DIR=/dn46/SALOME/series9x/current-2018-09-28
+export SALOME_DIR=/dn46/SALOME/series9x/current-2018-11-16
 
 
 # Path to sources
old mode 100644 (file)
new mode 100755 (executable)
index ff376c9..9211c70
@@ -4,12 +4,12 @@ source env.sh
 
 cd ${BUILD_DIR}
 
-lcov --capture --directory /data/mpv/build --no-external --base-directory=/data/mpv/sources --output-file coverage.info.noext -q
+lcov --capture --directory ${BUILD_DIR} --no-external --base-directory ${SOURCES_DIR} --output-file coverage.info.noext -q
 
 # make a working copy of report
 cp -f coverage.info.noext covfile
 # remove all reports of GUI and external parts (for all the next kinds of reports)
-for MASK in '*wrap*' 'moc_*' 'XAO_*' 'SketcherPrs_*' 'GeomAlgoImpl_*' 'ModuleBase_*' 'Primitives*' '*Widget*' '*Splitter*'; do
+for MASK in '*wrap*' 'moc_*' 'XAO_*' 'SketcherPrs_*' 'GeomAlgoImpl_*' 'ModuleBase_*' '*Widget*' '*Splitter*'; do
 lcov -r covfile ${MASK} --output-file covfile_res -q
 mv -f covfile_res covfile
 done
@@ -18,17 +18,17 @@ done
 # prepare API report
 cp -f covfile covAPI
 # remove plugins
-for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
+for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Primitives' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
 lcov -r covAPI *${MASK}Plugin* --output-file covAPI_res -q
 mv -f covAPI_res covAPI
 done
 # remove low level API
-for MASK in 'GDML' 'Geom' 'GeomAlgo' 'GeomData' 'Model'; do
+for MASK in 'Geom' 'GeomAlgo' 'GeomData' 'Model'; do
 lcov -r covAPI *${MASK}API* --output-file covAPI_res -q
 mv -f covAPI_res covAPI
 done
 # remove others
-for MASK in 'Config' 'Events' 'GeomData' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'SketchSolver'; do
+for MASK in 'Config' 'Events' 'GeomData' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'Selector' 'SketchSolver'; do
 lcov -r covAPI *${MASK}* --output-file covAPI_res -q
 mv -f covAPI_res covAPI
 done
@@ -39,18 +39,18 @@ genhtml covAPI --output-directory lcov_htmlAPI -q
 # prepare Direct report
 cp -f covfile covDirect
 # remove plugins
-for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
+for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Primitives' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
 str=$startmask$MASK$endmask
 lcov -r covDirect *${MASK}Plugin* --output-file covDirect_res -q
 mv -f covDirect_res covDirect
 done
 # remove low level API
-for MASK in 'GDML' 'Builder' 'Collection' 'Connector' 'Construction' 'Model' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build' 'GeomData'; do
+for MASK in 'GDML' 'Primitives' 'Builder' 'Collection' 'Connector' 'Construction' 'Model' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build' 'GeomData'; do
 lcov -r covDirect *${MASK}API* --output-file covDirect_res -q
 mv -f covDirect_res covDirect
 done
 # remove others
-for MASK in 'Config' 'Events' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'SketchSolver' 'GeomData'; do
+for MASK in 'Config' 'Events' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'Selector' 'SketchSolver' 'GeomData'; do
 lcov -r covDirect *${MASK}* --output-file covDirect_res -q
 mv -f covDirect_res covDirect
 done
@@ -60,17 +60,19 @@ genhtml covDirect --output-directory lcov_htmlDirect -q
 
 # prepare Else report
 cp -f covfile covElse
-# remove plugins
-for MASK in 'GDML'; do
-str=$startmask$MASK$endmask
-lcov -r covElse *${MASK}Plugin* --output-file covElse_res -q
-mv -f covElse_res covElse
-done
 # remove low level API
-for MASK in 'Geom' 'GeomAlgo' 'GDML' 'Builder' 'Collection' 'Connector' 'Construction' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build'; do
+for MASK in 'Geom' 'GeomAlgo' 'GDML' 'Primitives' 'Builder' 'Collection' 'Connector' 'Construction' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build'; do
 lcov -r covElse *${MASK}API* --output-file covElse_res -q
 mv -f covElse_res covElse
 done
+# remove SketchPlugin's Ellipse feature (unsupported yet)
+lcov -r covElse SketchPlugin*Ellipse* --output-file covElse_res -q
+mv -f covElse_res covElse
+# remove GUI related files from Config plugin
+for MASK in 'DataModelReader' 'FeatureMessage' 'Translator' 'PointerMessage'; do
+lcov -r covElse *Config_${MASK}* --output-file covElse_res -q
+mv -f covElse_res covElse
+done
 rm -rf lcov_htmlElse
 genhtml covElse --output-directory lcov_htmlElse -q
 
index 8951bd8d43ef2f03dbcebccf152d9443a73f864e..22f25611669b39d871e6dc3c56e0b2b4f841c713 100644 (file)
@@ -33,8 +33,10 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theF
                                    const std::list<ModelHighAPI_Selection>& theBaseObjects)
   : ModelHighAPI_Interface(theFeature)
 {
-  if(initialize())
+  if (initialize()) {
+    setAdvancedOptions(false);
     setBase(theBaseObjects);
+  }
 }
 
 BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -48,7 +50,7 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theF
                                    const bool theApproximate)
   : ModelHighAPI_Interface(theFeature)
 {
-  if(initialize()) {
+  if (initialize()) {
     setOrientationMethod(theOrientCorrection);
     setMinDegree(theMinDegree);
     setMaxDegree(theMaxDegree);
@@ -133,9 +135,9 @@ void BuildAPI_Filling::setApproximation(const bool theApproximate)
   execIfBaseNotEmpty();
 }
 
-void BuildAPI_Filling::setAdvancedOptions()
+void BuildAPI_Filling::setAdvancedOptions(bool isEnabled)
 {
-  feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue("true");
+  feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue(isEnabled ? "true" : "");
 }
 
 void BuildAPI_Filling::dump(ModelHighAPI_Dumper& theDumper) const
index 8ccab1feedc18603db06367f702d1e4c830293d2..73d5df74f10d2d20d03ac4e31bd6306eb6bb41c4 100644 (file)
@@ -114,7 +114,7 @@ public:
 
 private:
   void execIfBaseNotEmpty();
-  void setAdvancedOptions();
+  void setAdvancedOptions(bool isEnabled = true);
 };
 
 /// Pointer on Face object.
index 69c8551bbbc6ee15bb9625feb7433c0858631ea6..6d6c0c79f9a3f70b284d5969ba31e5e7fb54cafd 100644 (file)
@@ -70,24 +70,16 @@ void BuildPlugin_Compound::execute()
   // Build compound.
   GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(anOriginalShapes);
   // Copy shape.
-  GeomAlgoAPI_Copy aCopyAlgo(aCompound);
-  GeomShapePtr aCopyCompound = aCopyAlgo.shape();
+  GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aCompound));
+  GeomShapePtr aCopyCompound = aCopyAlgo->shape();
 
   int anIndexToRemove = 0;
   if (aCopyCompound) {
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = aCopyAlgo.mapOfSubShapes();
-
     ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++);
     aResultBody->store(aCopyCompound);
-    aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX,
-                                              1, "Modified_Vertex", *aMapOfShapes.get(),
-                                              true, false, true);
-    aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::EDGE,
-                                              100000, "Modified_Edge", *aMapOfShapes.get(),
-                                              true, false, true);
-    aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::FACE,
-                                              200000, "Modified_Face", *aMapOfShapes.get(),
-                                              true, false, true);
+    aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX);
+    aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::FACE);
     setResult(aResultBody);
   }
   removeResults(anIndexToRemove);
index 253de35b573f465e337c72eac1e9af642759c138..28be282f6055237a5de19eb62dc3147b443a67a7 100644 (file)
@@ -24,6 +24,7 @@
 #include <ModelAPI_ResultBody.h>
 
 #include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
 
 //=================================================================================================
 BuildPlugin_Edge::BuildPlugin_Edge()
@@ -76,35 +77,18 @@ void BuildPlugin_Edge::execute()
     }
 
     // Copy shape.
-    GeomAlgoAPI_Copy aCopyAlgo(aShape);
+    GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
 
-    // Check that algo is done.
-    if(!aCopyAlgo.isDone()) {
-      setError("Error: " + getKind() + " algorithm failed.");
-      return;
-    }
-
-    // Check if shape is not null.
-    if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
-      setError("Error: Resulting shape is null.");
-      return;
-    }
-
-    // Check that resulting shape is valid.
-    if(!aCopyAlgo.isValid()) {
-      setError("Error: Resulting shape is not valid.");
+    std::string anError;
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     // Store result.
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    aResultBody->storeModified(aShape, aCopyAlgo.shape());
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aCopyAlgo.mapOfSubShapes();
-    int aModVertexTag = 1;
-    std::string aModVertexName = "Modified_Vertex";
-    aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aShape, GeomAPI_Shape::VERTEX,
-                                             aModVertexTag, aModVertexName, *aSubShapes.get(),
-                                             true);
+    aResultBody->storeModified(aShape, aCopyAlgo->shape());
+    aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
 
     setResult(aResultBody, aResultIndex);
     ++aResultIndex;
index 391ea4bd908365dd7bfc51564660f58fe3686c1a..c7992999ad4dbe04b768aabb5c37e6561cf547ad 100644 (file)
@@ -107,7 +107,7 @@ void BuildPlugin_Face::execute()
     int anEdgeIndex = 1;
     for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
       GeomShapePtr anEdge = anExp.current();
-      aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex), anEdgeIndex);
+      aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex));
       ++anEdgeIndex;
     }
 
index 4aff9c942bdca78ac2c1f54fc59be893f3fc0845..dcf51a8b540186976cef84f2b8370ba9e9108568 100644 (file)
@@ -30,6 +30,7 @@
 #include <GeomAlgoAPI_Copy.h>
 #include <GeomAlgoAPI_Filling.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_ShapeExplorer.h>
@@ -67,8 +68,8 @@ void BuildPlugin_Filling::initAttributes()
   data()->addAttribute(TOLERANCE_3D_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(APPROXIMATION_ID(), ModelAPI_AttributeBoolean::typeId());
 
-  restoreDefaultParameters();
-  string(ADVANCED_OPTIONS_ID())->setValue("");
+  if (string(ADVANCED_OPTIONS_ID())->value().empty())
+    restoreDefaultParameters();
 }
 
 //=================================================================================================
@@ -95,8 +96,10 @@ void BuildPlugin_Filling::execute()
 
   // get base objects list
   AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
-  if (aSelectionList->size() <= 1)
+  if (aSelectionList->size() <= 1) {
+    setError("Not enough objects is selected");
     return;
+  }
 
   // collect base shapes
   for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
@@ -114,7 +117,9 @@ void BuildPlugin_Filling::execute()
 
   // build result
   aFilling->build(aParameters.isApprox);
-  if (isAlgorithmFailed(aFilling)) {
+  std::string anError;
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilling, getKind(), anError)) {
+    setError(anError);
     removeResults(0);
     return;
   }
@@ -127,37 +132,11 @@ void BuildPlugin_Filling::execute()
   int anEdgeInd = 0;
   for(GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
     GeomShapePtr anEdge = anExp.current();
-    aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd), ++anEdgeInd);
+    aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd));
   }
   setResult(aResultBody, 0);
 }
 
-bool BuildPlugin_Filling::isAlgorithmFailed(
-    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
-{
-  if (!theAlgorithm->isDone()) {
-    static const std::string aFeatureError = "Error: filling algorithm failed.";
-    std::string anAlgoError = theAlgorithm->getError();
-    if (anAlgoError.empty())
-      anAlgoError = aFeatureError;
-    else
-      anAlgoError = aFeatureError + " " + anAlgoError;
-    setError(anAlgoError);
-    return true;
-  }
-  if (theAlgorithm->shape()->isNull()) {
-    static const std::string aShapeError = "Error: Resulting shape of filling is Null.";
-    setError(aShapeError);
-    return true;
-  }
-  if (!theAlgorithm->isValid()) {
-    std::string aFeatureError = "Error: Resulting shape of filling is not valid.";
-    setError(aFeatureError);
-    return true;
-  }
-  return false;
-}
-
 //=================================================================================================
 void BuildPlugin_Filling::attributeChanged(const std::string& theID)
 {
index cb19f063f0efe373ac3846126d5e424ebdc2ed34..aadc2292dc0e2cff4f6a1c3a13455ee96189aa90 100644 (file)
@@ -164,9 +164,6 @@ public:
   BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
 private:
-  /// Check the filling algorithm is failed
-  bool isAlgorithmFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
-
   /// Convert shape to edge according to construction method
   std::shared_ptr<GeomAPI_Edge> toEdge(const std::shared_ptr<GeomAPI_Shape>& theShape,
                                        const std::string& theMethod);
index 4af802725d2602ab120461a2c1cd9fc511e40b56..481a51ff1fe3d039528d1cf1277645fc1a85ae57 100644 (file)
@@ -128,12 +128,12 @@ void BuildPlugin_Interpolation::execute()
   ResultBodyPtr aResultBody = document()->createBody(data());
   std::set<GeomShapePtr>::const_iterator aContextIt = aContexts.begin();
   for (; aContextIt != aContexts.end(); aContextIt++) {
-    aResultBody->storeModified(*aContextIt, anEdge, aContextIt == aContexts.begin() ? 0 : -2);
+    aResultBody->storeModified(*aContextIt, anEdge, aContextIt == aContexts.begin());
   }
   int aVertexIndex = 1;
   for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) {
     std::string aVertexName = "Vertex_" + std::to_string((long long)aVertexIndex);
-    aResultBody->generated(anExp.current(), aVertexName, aVertexIndex++);
+    aResultBody->generated(anExp.current(), aVertexName);
   }
 
   setResult(aResultBody);
index 7d2369c20897f2ea51f28a8bbbf4da0b885b4c88..da0bbfb99e99a84abdc1d69439a15bf2495e0919 100644 (file)
@@ -92,10 +92,10 @@ void BuildPlugin_Polyline::execute()
 
   // Create wire from edges
   GeomShapePtr aWire = GeomAlgoAPI_WireBuilder::wire(anEdges);
-       if (!aWire.get()) {
-               setError("Error: Result polyline is empty.");
-               return;
-       }
+  if (!aWire.get()) {
+    setError("Error: Result polyline is empty.");
+    return;
+  }
 
   // Check the wire.
   if (GeomAlgoAPI_WireBuilder::isSelfIntersected(aWire)) {
@@ -107,7 +107,7 @@ void BuildPlugin_Polyline::execute()
   ResultBodyPtr aResultBody = document()->createBody(data());
   std::set<GeomShapePtr>::const_iterator aContextIt = aContexts.begin();
   for (; aContextIt != aContexts.end(); aContextIt++) {
-    aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin() ? 0 : -2);
+    aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin());
   }
 
   aPointsIt = aPoints.cbegin();
@@ -115,7 +115,7 @@ void BuildPlugin_Polyline::execute()
   for (; anExp.more() && aPointsIt != aPoints.cend(); anExp.next(), ++aPointsIt) {
     GeomShapePtr aPoint = *aPointsIt;
     GeomShapePtr anEdge = anExp.current();
-    aResultBody->generated(aPoint, anEdge, "Edge", 1);
+    aResultBody->generated(aPoint, anEdge);
   }
 
   if (!isClosed) {
@@ -125,8 +125,8 @@ void BuildPlugin_Polyline::execute()
       aResPoints.push_back(anExp.current());
     }
 
-    aResultBody->generated(aResPoints.front(), "FirstVertex", 2);
-    aResultBody->generated(aResPoints.back(), "LastVertex", 3);
+    aResultBody->generated(aResPoints.front(), "FirstVertex");
+    aResultBody->generated(aResPoints.back(), "LastVertex");
   }
 
   setResult(aResultBody);
index 725f8d336949c7de467ce1b871ba516d8261b69b..bd73c2f1fd1ac6ec5486cab5f7032a6d0561ebe4 100644 (file)
@@ -25,6 +25,7 @@
 #include <ModelAPI_ResultConstruction.h>
 
 #include <GeomAlgoAPI_Sewing.h>
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAPI_ShapeExplorer.h>
 
 //=================================================================================================
@@ -56,29 +57,16 @@ void BuildPlugin_Shell::execute()
   }
 
   // Sew faces.
-  GeomAlgoAPI_Sewing aSewingAlgo(aShapes);
+  GeomMakeShapePtr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes));
 
-  // Check that algo is done.
-  if(!aSewingAlgo.isDone()) {
-    setError("Error: " + getKind() + " algorithm failed.");
-    return;
-  }
-
-  // Check if shape is not null.
-  if(!aSewingAlgo.shape().get() || aSewingAlgo.shape()->isNull()) {
-    setError("Error: Resulting shape is null.");
-    return;
-  }
-
-  // Check that resulting shape is valid.
-  if(!aSewingAlgo.isValid()) {
-    setError("Error: Resulting shape is not valid.");
+  std::string anError;
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), anError)) {
+    setError(anError);
     return;
   }
 
   // Store result.
-  GeomShapePtr aResult = aSewingAlgo.shape();
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = aSewingAlgo.mapOfSubShapes();
+  GeomShapePtr aResult = aSewingAlgo->shape();
 
   int anIndex = 0;
   for(GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::SHELL); anExp.more(); anExp.next()) {
@@ -86,23 +74,25 @@ void BuildPlugin_Shell::execute()
     ResultBodyPtr aResultBody = document()->createBody(data(), anIndex);
     aResultBody->store(aShell);
     for(ListOfShape::const_iterator anIt = aShapes.cbegin(); anIt != aShapes.cend(); ++anIt) {
-      for(GeomAPI_ShapeExplorer
-          aFaceExp(*anIt, GeomAPI_Shape::FACE); aFaceExp.more(); aFaceExp.next()) {
+      for (GeomAPI_ShapeExplorer aFaceExp(*anIt, GeomAPI_Shape::FACE);
+           aFaceExp.more();
+           aFaceExp.next())
+      {
         GeomShapePtr aFace = aFaceExp.current();
         ListOfShape aHistory;
-        aSewingAlgo.modified(aFace, aHistory);
-        for(ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
-            aHistoryIt != aHistory.cend();
-            ++aHistoryIt) {
+        aSewingAlgo->modified(aFace, aHistory);
+        for (ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
+             aHistoryIt != aHistory.cend();
+             ++aHistoryIt)
+        {
           GeomShapePtr aHistoryShape = *aHistoryIt;
-          if(aMapOfShapes->isBound(aHistoryShape)) {
-            aHistoryShape = aMapOfShapes->find(aHistoryShape);
-          }
-          if(aShell->isSubShape(aHistoryShape)) {
-            aResultBody->loadAndOrientModifiedShapes(&aSewingAlgo, aFace, GeomAPI_Shape::EDGE,
-                                                     1, "Modified_Edge", *aMapOfShapes.get());
-            aResultBody->loadAndOrientModifiedShapes(&aSewingAlgo, aFace, GeomAPI_Shape::FACE,
-                                                     2, "Modified_Face", *aMapOfShapes.get());
+          if (aShell->isSubShape(aHistoryShape, false)) {
+            aResultBody->loadModifiedShapes(aSewingAlgo,
+                                            aFace,
+                                            GeomAPI_Shape::EDGE);
+            aResultBody->loadModifiedShapes(aSewingAlgo,
+                                            aFace,
+                                            GeomAPI_Shape::FACE);
             break;
           }
         }
index 0f044564e5a0355f4c340ee5af970fd53f127953..dc0c57ed54d37afb59bca4fb74b1f75aadaa2f36 100644 (file)
@@ -60,19 +60,18 @@ void BuildPlugin_Solid::execute()
 
 void BuildPlugin_Solid::storeResult(const ListOfShape& theOriginalShapes,
                                     const GeomShapePtr& theResultShape,
-                                    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
+                                    const GeomMakeShapePtr& theAlgorithm)
 {
   ResultBodyPtr aResultBody = document()->createBody(data());
   aResultBody->store(theResultShape);
 
   // Store faces
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubs = theAlgorithm->mapOfSubShapes();
-  int aModifiedTag = 1;
-  for(ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
-      anIt != theOriginalShapes.cend(); ++anIt) {
+  for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
+       anIt != theOriginalShapes.cend();
+       ++anIt)
+  {
     GeomShapePtr aShape = *anIt;
-    aResultBody->loadAndOrientModifiedShapes(theAlgorithm.get(), aShape, GeomAPI_Shape::FACE,
-        aModifiedTag, "Modified_Face", *aMapOfSubs.get(), false, true, true);
+    aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::FACE);
   }
   setResult(aResultBody);
 }
index 35aa48914036197f31628a583661cfce70f9c210..c919828c72c853119dd907ee22e7e15d28f7ee2b 100644 (file)
@@ -105,9 +105,9 @@ void BuildPlugin_SubShapes::execute()
   if(!aBaseShape.get()) {
     return;
   }
-  GeomAlgoAPI_ShapeBuilder aBuilder;
-  aBuilder.removeInternal(aBaseShape);
-  GeomShapePtr aResultShape = aBuilder.shape();
+  std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder());
+  aBuilder->removeInternal(aBaseShape);
+  GeomShapePtr aResultShape = aBuilder->shape();
 
   // Get list of shapes.
   ListOfShape aShapesToAdd;
@@ -118,8 +118,8 @@ void BuildPlugin_SubShapes::execute()
 
   // Copy sub-shapes from list to new shape.
   if(!aShapesToAdd.empty()) {
-    aBuilder.addInternal(aResultShape, aShapesToAdd);
-    aResultShape = aBuilder.shape();
+    aBuilder->addInternal(aResultShape, aShapesToAdd);
+    aResultShape = aBuilder->shape();
   }
 
   // Store result.
@@ -127,15 +127,15 @@ void BuildPlugin_SubShapes::execute()
   const int aModEdgeTag = 2;
   ResultBodyPtr aResultBody = document()->createBody(data());
   aResultBody->storeModified(aBaseShape, aResultShape);
-  aResultBody->loadAndOrientModifiedShapes(&aBuilder, aBaseShape, GeomAPI_Shape::EDGE, aModEdgeTag,
-                                          "Modified_Edge", *aBuilder.mapOfSubShapes().get());
-  for(ListOfShape::const_iterator
-      anIt = aShapesToAdd.cbegin(); anIt != aShapesToAdd.cend(); ++anIt) {
+  aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE);
+  for (ListOfShape::const_iterator anIt = aShapesToAdd.cbegin();
+       anIt != aShapesToAdd.cend();
+       ++anIt)
+  {
     GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType();
-    aResultBody->loadAndOrientModifiedShapes(&aBuilder, *anIt, aShType,
-                        aShType == GeomAPI_Shape::VERTEX ? aModVertexTag : aModEdgeTag,
-                        aShType == GeomAPI_Shape::VERTEX ? "Modified_Vertex" : "Modified_Edge",
-                        *aBuilder.mapOfSubShapes().get());
+    aResultBody->loadModifiedShapes(aBuilder,
+                                    *anIt,
+                                    aShType);
   }
   setResult(aResultBody);
 }
index 1dc69c0a38c5566aaf2b651693ef48bd452604cb..3b4c4b950c4d645d2f844163f730110eb815196f 100644 (file)
@@ -26,6 +26,7 @@
 #include <GeomAPI_PlanarEdges.h>
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_PaveFiller.h>
@@ -34,8 +35,7 @@
 #include <GeomAlgoAPI_SketchBuilder.h>
 #include <GeomAlgoAPI_WireBuilder.h>
 #include <GeomAlgoAPI_MakeVolume.h>
-#include <GeomAPI_ShapeIterator.h>
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomValidators_FeatureKind.h>
 #include <GeomValidators_ShapeType.h>
@@ -292,16 +292,9 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid(
   std::shared_ptr<GeomAlgoAPI_MakeVolume> anAlgorithm(
     new GeomAlgoAPI_MakeVolume(anOriginalShapes, false));
 
-  if (!anAlgorithm->isDone()) {
-    theError = "MakeVolume algorithm failed.";
-    return false;
-  }
-  if (anAlgorithm->shape()->isNull()) {
-    theError = "Resulting shape of MakeVolume is Null.";
-    return false;
-  }
-  if (!anAlgorithm->isValid()) {
-    theError = "Resulting shape of MakeVolume is not valid.";
+  std::string anErr;
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgorithm, "MakeVolume", anErr)) {
+    theError = anErr;
     return false;
   }
 
index 585682a32ff6bde03ee202ab3a898ce1bdbc975f..a2475d8702a5d3566deb1eae6387316b51d43610 100644 (file)
@@ -24,6 +24,7 @@
 #include <ModelAPI_ResultBody.h>
 
 #include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
 
 //=================================================================================================
 BuildPlugin_Vertex::BuildPlugin_Vertex()
@@ -76,29 +77,17 @@ void BuildPlugin_Vertex::execute()
     }
 
     // Copy shape.
-    GeomAlgoAPI_Copy aCopyAlgo(aShape);
+    std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
 
-    // Check that algo is done.
-    if(!aCopyAlgo.isDone()) {
-      setError("Error: " + getKind() + " algorithm failed.");
-      return;
-    }
-
-    // Check if shape is not null.
-    if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
-      setError("Error: Resulting shape is null.");
-      return;
-    }
-
-    // Check that resulting shape is valid.
-    if(!aCopyAlgo.isValid()) {
-      setError("Error: Resulting shape is not valid.");
+    std::string anError;
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     // Store result.
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    aResultBody->storeModified(aShape, aCopyAlgo.shape());
+    aResultBody->storeModified(aShape, aCopyAlgo->shape());
     setResult(aResultBody, aResultIndex);
     ++aResultIndex;
   }
index 54ae7a95bac6b5594c4508390b269ee9c90ac8c0..a941765b7d1d0771a3e699995de647c5a1f3b3da 100644 (file)
@@ -88,7 +88,7 @@ void BuildPlugin_Wire::execute()
     for(ListOfShape::const_iterator anIt = anEdges.cbegin(); anIt != anEdges.cend(); ++anIt) {
       std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(*anIt));
       if(anEdgeInList->isEqual(anEdgeInResult)) {
-        aResultBody->modified(anEdgeInList, anEdgeInResult, "Edge");
+        aResultBody->modified(anEdgeInList, anEdgeInResult);
         break;
       }
     }
index d99d69f68f1a0d26372648c8174d0a180d8beaee..ac7d138a2689cc8451a73a684913c371ae130510 100644 (file)
@@ -105,19 +105,28 @@ INSTALL(FILES ${XML_RESOURCES} ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XM
 INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Build)
 
 ADD_UNIT_TESTS(TestVertex.py
+               TestVertex_ErrorMsg.py
                TestEdge.py
+               TestEdge_ErrorMsg.py
                TestWire.py
+               TestWire_ErrorMsg.py
                TestPolyline.py
                TestInterpolation.py
                TestFace.py
+               TestFace_ErrorMsg.py
                TestShell.py
                TestSolid.py
+               TestSolid_ErrorMsg.py
                TestCompSolid.py
                TestCompound.py
+               TestCompound_ErrorMsg.py
                TestSubShapes.py
+               TestSubShapes_ErrorMsg.py
+               TestFilling.py
                TestFilling_ByEdges.py
                TestFilling_ByWires.py
                TestFilling_Mixed.py
+               TestFilling_ErrorMsg.py
                Test1920.py
                Test2398.py
                Test2415.py
index 96f8eb6dcbb80fe919a7336f71c594deef7630e2..112c283385971c022d25d727a895ca95b095443e 100644 (file)
@@ -41,10 +41,10 @@ SketchLine_5 = Sketch_1.addLine(50, 50, 50, 0)
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_5f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OY"), 100)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/Translated_Edge_1"), model.selection("EDGE", "Translation_1_1/Translated_Edge_2"), model.selection("EDGE", "Translation_1_1/Translated_Edge_3"), model.selection("EDGE", "Translation_1_1/Translated_Edge_4"), model.selection("EDGE", "Translation_1_2/Translated_Edge_1"), model.selection("EDGE", "Translation_1_2/Translated_Edge_2"), model.selection("EDGE", "Translation_1_2/Translated_Edge_3"), model.selection("EDGE", "Translation_1_2/Translated_Edge_4")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_4"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_3"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_2"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_1"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_4"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_3"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_2"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_1")])
 aGroupFeature = Group_1.feature()
 aSelectionList = aGroupFeature.selectionList("group_list")
 model.end()
@@ -56,4 +56,4 @@ for index in range(0, aSelectionList.size()):
     assert(shape.isEdge())
     assert(name)
 
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
index 2331d87226104bea233e001e34f17eb7b5f9d4a6..12d8417f1427f7f657217d1d68029aae6b90b223 100644 (file)
@@ -34,7 +34,7 @@ SketchCircle_1 = Sketch_1.addCircle(0, 0, 30.79356776198042)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
 model.do()
 
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 100, 100)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2f_wire")], model.selection(), 100, 100)
 
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
@@ -72,7 +72,7 @@ SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_5.result(), Sk
 SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result())
 model.do()
 
-Edge_1_objects = [model.selection("EDGE", "Sketch_3/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_3")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_2"), model.selection("EDGE", "Sketch_3/SketchLine_1"), model.selection("EDGE", "Sketch_3/SketchLine_4"), model.selection("EDGE", "Sketch_3/SketchLine_3")]
 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
 
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OZ"), 135)
index 64e30318c094e092257a4965aeabf18c8d396218..8d1b283e7f5a65d051e4738449dafa57d313490a 100644 (file)
@@ -52,10 +52,10 @@ SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 80)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 150)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2r")], model.selection(), 200, 0)
-Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 200, 0)
+Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")]
 Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
-Compound_2_objects = [model.selection("EDGE", "Compound_1_1_2/Modified_Edge_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Compound_1_1_3/Modified_Edge_2")]
+Compound_2_objects = [model.selection("EDGE", "[Compound_1_1_2/Compound_1_1_2&Sketch_1/SketchLine_4][weak_name_4]"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "[Compound_1_1_3/Compound_1_1_3&Sketch_1/SketchLine_5][weak_name_4]")]
 Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
 model.do()
 
index 3a66d39305aad2a220c035fd93bd5409816c48ab..6d3d8fc704780e930bf7b08e6821466b0e2dc40e 100644 (file)
@@ -38,8 +38,8 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f_wire")], model.selection(), 100, 0)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")])
 model.do()
 
 model.testHaveNamingSubshapes(Edge_1, model, Part_1_doc)
index f56d1d1220a0dd881e0dce3f92e26efe3296d762..7792bf2a36e1a2c6155c2126f5bf9b93706241ea 100644 (file)
@@ -27,11 +27,11 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_1.addCircle(0.1822176134072968, -1.34047565209109, 35.08968954114807)
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0)
 Recover_1 = model.addRecover(Part_1_doc, Extrusion_1, [Wire_1.result()])
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Recover_1_1")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge_1")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge")])
 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
 model.end()
 
index f27cb0a8b956d6c9eadc67b03c2a5c967df873e5..63fe298582a851ae1b02e040561ccba671053adb 100644 (file)
@@ -45,7 +45,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0)
 SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20)
@@ -58,7 +58,7 @@ SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(),
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_9 = SketchProjection_2.createdFeature()
 SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint())
@@ -75,7 +75,7 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
 SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
 SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result())
 model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")])
 AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0)
@@ -90,17 +90,17 @@ SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint()
 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
 SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result())
 SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result())
-SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
 SketchPoint_3 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates())
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
 SketchPoint_4 = SketchProjection_5.createdFeature()
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0)
 Box_1 = model.addBox(Part_1_doc, 20, 20, 20)
 model.do()
 
@@ -127,12 +127,12 @@ def createCompSolidStepByStep(theSelection, theExpectedType):
 # =============================================================================
 boundaries1 = [model.selection("FACE", "Face_1_1"),
                model.selection("SHELL", "Shell_1_1"),
-               model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+               model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+               model.selection("FACE", "Extrusion_2_1/To_Face"),
                model.selection("FACE", "Box_1_1/Front")]
 expectType1 = [GeomAPI_Shape.SHAPE,
                GeomAPI_Shape.SHAPE,
@@ -153,14 +153,14 @@ model.testHaveNamingSubshapes(CompSolid_1, model, Part_1_doc)
 # =============================================================================
 boundaries2 = [model.selection("FACE", "Face_1_1"),
                model.selection("SHELL", "Shell_1_1"),
-               model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+               model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+               model.selection("FACE", "Extrusion_2_1/To_Face"),
                model.selection("FACE", "Box_1_1/Front"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
                model.selection("SOLID", "Extrusion_1_1")]
 expectType2 = [GeomAPI_Shape.SHAPE,
                GeomAPI_Shape.SHAPE,
index c55dda70f52760e56c428c414db66884ff2556d9..58e88e20601d7026344ec31987cedeece2584674 100644 (file)
@@ -45,9 +45,9 @@ SketchCircle_1 = Sketch_1.addCircle(51.0302184611028, -58.25492948210744, 14.676
 SketchCircle_2 = Sketch_1.addCircle(57.27434431552349, -55.3477547099222, 30.40870102508203)
 model.do()
 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")])
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_5")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_6 = Sketch_2.addLine(73.69205241424749, 19.68979803478298, 29.86213888681927, 19.68979803478298)
 SketchLine_7 = Sketch_2.addLine(29.86213888681927, 19.68979803478298, 29.86213888681927, 46.16063196348271)
@@ -62,18 +62,18 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result())
 model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")])
-AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), 120, 2)
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r_wire")])
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/SketchLine_6"), 120, 2)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
 Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_2_1/Front"), 5, True)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("FACE", "Plane_1")])
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"),
-                      model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"),
-                      model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"),
-                      model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"),
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"),
+                      model.selection("EDGE", "Sketch_1/SketchLine_1"),
+                      model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire"),
+                      model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"),
                       model.selection("VERTEX", "Vertex_1_1"),
                       model.selection("EDGE", "Edge_1_1"),
                       model.selection("WIRE", "Wire_1_1"),
diff --git a/src/BuildPlugin/Test/TestCompound_ErrorMsg.py b/src/BuildPlugin/Test/TestCompound_ErrorMsg.py
new file mode 100644 (file)
index 0000000..c821271
--- /dev/null
@@ -0,0 +1,43 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Compound_1 = aPart.addFeature("Compound")
+Compound_1.execute()
+assert(Compound_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Compound_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Compound_1.execute()
+assert(Compound_1.error() != "")
+aSession.finishOperation()
diff --git a/src/BuildPlugin/Test/TestEdge_ErrorMsg.py b/src/BuildPlugin/Test/TestEdge_ErrorMsg.py
new file mode 100644 (file)
index 0000000..84476cd
--- /dev/null
@@ -0,0 +1,61 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+aBoxResult = aBox.firstResult()
+aBoxShape = aBoxResult.shape()
+
+aSession.startOperation()
+Edge_1 = aPart.addFeature("Edge")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Edge_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList.removeLast()
+aBaseObjectsList.append("Box_1_1/Top", "FACE")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
index a64a2f913a125e963a829e1192f189e10333f5d4..0dfab8afc6a57a3d72c2ce0cb4673395efe80000 100644 (file)
@@ -107,7 +107,7 @@ aCylinderShape = aCylinderResult.shape()
 aSession.startOperation()
 aFaceFeature2 = aPart.addFeature("Face")
 aBaseObjectsList = aFaceFeature2.selectionList("base_objects")
-aBaseObjectsList.append("Cylinder_1_1/Face_1&Cylinder_1_1/Face_2", "EDGE")
+aBaseObjectsList.append("[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]", "EDGE")
 aSession.finishOperation()
 assert (len(aFaceFeature2.results()) > 0)
 
diff --git a/src/BuildPlugin/Test/TestFace_ErrorMsg.py b/src/BuildPlugin/Test/TestFace_ErrorMsg.py
new file mode 100644 (file)
index 0000000..4c3a5b9
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+assert(Face_1.feature().error() != "")
+Part_1_doc.removeFeature(Face_1.feature())
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "PartSet/XOY")])
+assert(Face_1.feature().error() != "")
+Part_1_doc.removeFeature(Face_1.feature())
+
+model.end()
diff --git a/src/BuildPlugin/Test/TestFilling.py b/src/BuildPlugin/Test/TestFilling.py
new file mode 100644 (file)
index 0000000..3ea33ff
--- /dev/null
@@ -0,0 +1,40 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
+Point_3 = model.addPoint(Part_1_doc, 20, 10, 0)
+Point_4 = model.addPoint(Part_1_doc, 0, 20, 10)
+Point_5 = model.addPoint(Part_1_doc, 30, 0, 10)
+Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False)
+Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4")], False)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")])
+Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")], "curve_info", 5, 8, 0, 0.0001, 0.0001, True)
+model.do()
+
+assert(Filling_1.feature().error() == "")
+assert(Filling_2.feature().error() == "")
+
+model.end()
index 08b3aea568de66ef5e91feb80c73f9a9f867a272..3b056f060752cf953d7ab8be6bcacd0f29eaf97b 100644 (file)
@@ -82,6 +82,7 @@ aSession.finishOperation()
 # Create filling
 aSession.startOperation()
 aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
 aBaseObjectsList = aFillingFeature.selectionList("base_objects")
 aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape())
 aSession.finishOperation()
index 1529a3c09f6fb07813b6fd00b0cf5048c0535c9f..09382bdff47c65d565607ccce352e983da4c9fcc 100644 (file)
@@ -104,6 +104,7 @@ aSession.finishOperation()
 # Create filling
 aSession.startOperation()
 aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
 aBaseObjectsList = aFillingFeature.selectionList("base_objects")
 aBaseObjectsList.append(aWire1.lastResult(), None)
 aSession.finishOperation()
diff --git a/src/BuildPlugin/Test/TestFilling_ErrorMsg.py b/src/BuildPlugin/Test/TestFilling_ErrorMsg.py
new file mode 100644 (file)
index 0000000..23ed7e4
--- /dev/null
@@ -0,0 +1,92 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
+Point_3 = model.addPoint(Part_1_doc, 20, 10, 0)
+Point_4 = model.addPoint(Part_1_doc, 0, 20, 10)
+Point_5 = model.addPoint(Part_1_doc, 30, 0, 10)
+Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False)
+Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4")], False)
+model.do()
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")], "curve_info", 9, 8, 0, 0.0001, 0.0001, True)
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1")])
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")])
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aSession.startOperation()
+aFillingFeature = featureToCompositeFeature(Part_1.feature()).addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
+aFillingFeature.execute()
+assert(aFillingFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = aFillingFeature.selectionList("base_objects")
+aBaseObjectsList.append("Polyline_1_1/Generated_Edge&Point_1/Point_1", "EDGE")
+aBaseObjectsList.append("Box_1_1/Top", "FACE")
+aFillingFeature.execute()
+assert(aFillingFeature.error() != "")
+aSession.finishOperation()
+
+
+model.begin()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", ""), model.selection("EDGE", "Sketch_1/SketchLine_1")], "auto_correct", 1, 1, 0, 0.0001, 0.0001, False)
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1")], "auto_correct", 1, 1, 0, 0.0001, 0.0001, False)
+assert(Filling_1.feature().error() != "")
+model.end()
index c020982eddcd79f83774a80fc6cb19133c9a0429..6d5d50976b52729857acad750fe9b45a9a5ea9a1 100644 (file)
@@ -89,6 +89,7 @@ aSession.finishOperation()
 # Create filling
 aSession.startOperation()
 aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
 aBaseObjectsList = aFillingFeature.selectionList("base_objects")
 aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape())
 aSession.finishOperation()
index 656351a488264cbf118aaaafa9a8965802cb7b52..b3d8684441a34e933fe4533172866a5eed9f4b92 100644 (file)
@@ -45,12 +45,12 @@ SketchLine_2 = Sketch_1.addLine(0, 0, 45, 45)
 model.do()
 
 # Get sketch points
-base_name = "Sketch_1/Vertex-SketchPoint_"
+base_name = "Sketch_1/SketchPoint_"
 p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)]
 
 # Get sketch edges
-Tangent_1 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")
-Tangent_2 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")
+Tangent_1 = model.selection("EDGE", "Sketch_1/SketchLine_1")
+Tangent_2 = model.selection("EDGE", "Sketch_1/SketchLine_2")
 
 # =============================================================================
 # Test 1. Create curve 1-2-3-4-5, closed off, reorder off, without tangents
@@ -117,14 +117,14 @@ Part_2 = model.addPart(partSet)
 Part_2_doc = Part_2.document()
 Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
 
-point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom",
-               "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top",
-               "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top",
-               "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom",
-               "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom",
-               "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top",
-               "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top",
-               "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom")
+point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]",
+               "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]",
+               "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]",
+               "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]",
+               "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]",
+               "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]",
+               "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]",
+               "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")
 points = [model.selection("VERTEX", name) for name in point_names]
 
 Interpolation_8 = model.addInterpolation(Part_2_doc, points, False, False)
@@ -140,8 +140,8 @@ Part_3_doc = Part_3.document()
 Box_1 = model.addBox(Part_3_doc, 20, 30, 40)
 
 points = [model.selection("VERTEX", name) for name in point_names]
-Tangent_1 = model.selection("EDGE", "Box_1_1/Back&Box_1_1/Top")
-Tangent_2 = model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")
+Tangent_1 = model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")
+Tangent_2 = model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")
 
 Interpolation_9 = model.addInterpolation(Part_3_doc, points,
                                          Tangent_1, Tangent_2, False, False)
@@ -175,4 +175,4 @@ model.end()
 # =============================================================================
 # Test 12. Check Python dump
 # =============================================================================
-assert(model.checkPythonDump())
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
index ba399cc5470f2411cc41735bb3c51959bc7e558e..88da7504aa8bf7ccf4375eb4632792c7bde5beeb 100644 (file)
@@ -42,7 +42,7 @@ SketchPoint_5 = Sketch_1.addPoint(50, 0)
 model.do()
 
 # Get sketch points
-base_name = "Sketch_1/Vertex-SketchPoint_"
+base_name = "Sketch_1/SketchPoint_"
 p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)]
 
 # =============================================================================
@@ -100,14 +100,14 @@ Part_2 = model.addPart(partSet)
 Part_2_doc = Part_2.document()
 Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
 
-point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom",
-               "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top",
-               "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top",
-               "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom",
-               "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom",
-               "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top",
-               "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top",
-               "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom")
+point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]",
+               "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]",
+               "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]",
+               "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]",
+               "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]",
+               "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]",
+               "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]",
+               "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")
 points = [model.selection("VERTEX", name) for name in point_names]
 
 Polyline_7 = model.addPolyline3D(Part_2_doc, points, False)
@@ -154,4 +154,4 @@ model.end()
 # =============================================================================
 # Test 11. Check Python dump
 # =============================================================================
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
index f0be3f0a06fafafbe339a52671da8d3f6b0d38a8..050cf7238e110288a110db55ff9b425941feb1ff 100644 (file)
@@ -45,7 +45,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0)
 SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20)
@@ -58,7 +58,7 @@ SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(),
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_9 = SketchProjection_2.createdFeature()
 SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint())
@@ -75,7 +75,7 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
 SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
 SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result())
 model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")])
 AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0)
@@ -90,17 +90,17 @@ SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint()
 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
 SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result())
 SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result())
-SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
 SketchPoint_3 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates())
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
 SketchPoint_4 = SketchProjection_5.createdFeature()
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0)
 Box_1 = model.addBox(Part_1_doc, 20, 20, 20)
 model.do()
 
@@ -125,12 +125,12 @@ def createSolidStepByStep(theSelection, theExpected):
 # =============================================================================
 boundaries1 = [model.selection("FACE", "Face_1_1"),
                model.selection("SHELL", "Shell_1_1"),
-               model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+               model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+               model.selection("FACE", "Extrusion_2_1/To_Face"),
                model.selection("FACE", "Box_1_1/Front")]
 expectSolid1 = [False, False, False, False, False, False, False, True, False]
 Solid_1 = createSolidStepByStep(boundaries1, expectSolid1)
@@ -141,12 +141,12 @@ assert(Solid_1 is None)
 # =============================================================================
 boundaries2 = [model.selection("FACE", "Face_1_1"),
                model.selection("SHELL", "Shell_1_1"),
-               model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_1_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
-               model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
-               model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+               model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+               model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+               model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+               model.selection("FACE", "Extrusion_2_1/To_Face"),
                model.selection("FACE", "Box_1_1/Front")]
 expectSolid2 = [False, False, False, False, False, False, False, False, True]
 Solid_2 = createSolidStepByStep(boundaries2, expectSolid2)
diff --git a/src/BuildPlugin/Test/TestSolid_ErrorMsg.py b/src/BuildPlugin/Test/TestSolid_ErrorMsg.py
new file mode 100644 (file)
index 0000000..be02055
--- /dev/null
@@ -0,0 +1,35 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Solid_1 = aPart.addFeature("Solid")
+aSession.finishOperation()
+assert(Solid_1.error() != "")
index 7fc9813c776a113f28fdb0b04a5d3d329765b9ef..b10358a4cfc814abb49bd93fa6d109c5e90371d7 100644 (file)
@@ -160,9 +160,9 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(),
 SketchPoint_1 = Sketch_1.addPoint(-490.566037735849, 50.600343053173)
 SketchPoint_2 = Sketch_1.addPoint(-423.670668953688, 50.600343053173)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2r")])
-SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
 SubShapes_1.setBaseShape(model.selection("FACE", "Face_2_1"))
 model.end()
 
diff --git a/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py b/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py
new file mode 100644 (file)
index 0000000..4260d36
--- /dev/null
@@ -0,0 +1,78 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Polyline_1_objects = [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]")]
+Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, False)
+model.do()
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "Polyline_1_1/Generated_Edge&weak_name_4")])
+assert(SubShapes_1.feature().error() == "")
+
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aSession.startOperation()
+SubShapes_2 = featureToCompositeFeature(Part_1.feature()).addFeature("SubShapes")
+SubShapes_2.execute()
+assert(SubShapes_2.error() == "")
+aSession.finishOperation()
+
+model.begin()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine4r-SketchLine3r-SketchLine2r-SketchLine1r"), [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+model.end()
diff --git a/src/BuildPlugin/Test/TestVertex_ErrorMsg.py b/src/BuildPlugin/Test/TestVertex_ErrorMsg.py
new file mode 100644 (file)
index 0000000..0acbeba
--- /dev/null
@@ -0,0 +1,43 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Vertex_1 = aPart.addFeature("Vertex")
+Vertex_1.execute()
+assert(Vertex_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Vertex_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Vertex_1.execute()
+assert(Vertex_1.error() != "")
+aSession.finishOperation()
index 25dd4ecb24e203e9f26f5107eb2b5684e8bf372d..a489904432033f0ecd2f4d927ffe05a9f420adaa 100644 (file)
@@ -111,7 +111,7 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
 Wire_1.addContour()
 model.end()
 
@@ -134,12 +134,12 @@ aBoxShape = aBoxResult.shape()
 aSession.startOperation()
 aWireFeature2 = aPart.addFeature("Wire")
 aBaseObjectsList = aWireFeature2.selectionList("base_objects")
-aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Bottom", "EDGE")
-aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Right", "EDGE")
-aBaseObjectsList.append("Box_1_1/Right&Box_1_1/Top", "EDGE")
-aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Top", "EDGE")
-aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Left", "EDGE")
-aBaseObjectsList.append("Box_1_1/Left&Box_1_1/Bottom", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Bottom]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Right]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Right][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Left]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Bottom]", "EDGE")
 aSession.finishOperation()
 
 # Test results
@@ -177,4 +177,4 @@ aSession.startOperation()
 aPart.removeFeature(aWireFeature3)
 aSession.finishOperation()
 
-assert(model.checkPythonDump())
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/BuildPlugin/Test/TestWire_ErrorMsg.py b/src/BuildPlugin/Test/TestWire_ErrorMsg.py
new file mode 100644 (file)
index 0000000..d09d5da
--- /dev/null
@@ -0,0 +1,88 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+aBoxResult = aBox.firstResult()
+aBoxShape = aBoxResult.shape()
+
+aSession.startOperation()
+Wire_1 = aPart.addFeature("Wire")
+Wire_1.execute()
+assert(Wire_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Wire_1.selectionList("base_objects")
+aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Right][Box_1_1/Top]", "EDGE")
+Wire_1.execute()
+assert(Wire_1.error() != "")
+aSession.finishOperation()
+
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Wire_1 = model.addWire(Part_1_doc, [])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(26.2037104714363, 14.67693246486999, 44.63854591961698, 30.23007341140914)
+SketchLine_2 = Sketch_1.addLine(44.63854591961698, 30.23007341140914, 20.93564110678636, 53.45762191102688)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+model.do()
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+model.end()
index e6660beec193d03309016dfeceed7ef0d8bc018e..19fd1a44e7d77247a3f794db1a84a2db793a6195 100644 (file)
@@ -64,13 +64,19 @@ void CollectionAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const
 
   AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_Group::LIST_ID());
 
-  theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList << ")" << std::endl;
+  theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList;
+  if (anAttrList->isGeometricalSelection())
+    theDumper <<", True";
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
 GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
-                  const std::list<ModelHighAPI_Selection>& theGroupList)
+                  const std::list<ModelHighAPI_Selection>& theGroupList,
+                  const bool theShareSameTopology)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(CollectionAPI_Group::ID());
+  if (theShareSameTopology)
+    aFeature->selectionList(CollectionPlugin_Group::LIST_ID())->setGeometricalSelection(true);
   return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList));
 }
index bb92ff1b81a5e64c0fc2b0359ac716a47ded3335..fe28fc2f4074c06afe35cb18665cc80502c3ab14 100644 (file)
@@ -70,6 +70,7 @@ typedef std::shared_ptr<CollectionAPI_Group> GroupPtr;
 /// \brief Create Group feature.
 COLLECTIONAPI_EXPORT
 GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
-                  const std::list<ModelHighAPI_Selection>& theGroupList);
+                  const std::list<ModelHighAPI_Selection>& theGroupList,
+                  const bool theShareSameTopology = false);
 
 #endif // CollectionAPI_Group_H_
index 674ea7e083acd72af5fce5378bfa0a70f9553283..d383ace114368b75e2831039c10583e96cd3338a 100644 (file)
@@ -109,4 +109,5 @@ ADD_UNIT_TESTS(
                TestGroup1799.py
                TestGroupMove.py
                TestGroupMove2.py
+               TestGroupShareTopology.py
 )
index 3fc6ade66f4cf2391f22de93e4df1b5cdd051ca3..de927057b2ad0fe8e505b44cf7b0d8e566d1602b 100644 (file)
@@ -73,16 +73,10 @@ aLineCEndPoint.setValue(-100., 0.)
 aSession.finishOperation()
 # Build sketch faces
 aSession.startOperation()
-aSketchResult = aTriangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aTriangleSketchFeature.firstResult())
 # Create extrusion on them
 anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(50)
@@ -98,9 +92,9 @@ aSession.startOperation()
 aField = aSession.activeDocument().addFeature("Field")
 aSelectionListAttr = aField.selectionList("selected")
 aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
 aComponentNames = aField.stringArray("components_names")
 aComponentNames.setSize(2) # two components
 aComponentNames.setValue(0, "temperatue")
@@ -127,7 +121,7 @@ aSession.startOperation()
 aField = aSession.activeDocument().addFeature("Field")
 aSelectionListAttr = aField.selectionList("selected")
 aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
 aComponentNames = aField.stringArray("components_names")
 aComponentNames.setSize(1) # one component
 aComponentNames.setValue(0, "description")
@@ -153,7 +147,7 @@ aSession.startOperation()
 aField = aSession.activeDocument().addFeature("Field")
 aSelectionListAttr = aField.selectionList("selected")
 aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
 aComponentNames = aField.stringArray("components_names")
 aComponentNames.setSize(1) # one component
 aComponentNames.setValue(0, "description")
@@ -177,7 +171,7 @@ aSession.startOperation()
 aField = aSession.activeDocument().addFeature("Field")
 aSelectionListAttr = aField.selectionList("selected")
 aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
 aComponentNames = aField.stringArray("components_names")
 aComponentNames.setSize(1) # one component
 aComponentNames.setValue(0, "description")
index 0ecbd0ddcc35cf5f50bed2d186012f50daaac617..cab94e1024400b7e800a41defb48df963d0213f5 100644 (file)
@@ -73,21 +73,13 @@ aLineCEndPoint.setValue(-100., 0.)
 aSession.finishOperation()
 # Build sketch faces
 aSession.startOperation()
-aSketchResult = aTriangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aTriangleSketchFeature.firstResult())
 # Create extrusion on them
 anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(50)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
 anExtrusionFt.execute()
 aSession.finishOperation()
 anExtrusionBody = modelAPI_ResultBody(anExtrusionFt.firstResult())
@@ -98,12 +90,12 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -118,15 +110,15 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("edge")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -175,7 +167,7 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/To_Face")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -206,26 +198,17 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert(len(aCircleSketchFaces) > 0)
-assert(aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert(aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(50)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
 anExtrusionFt.execute()
 aSession.finishOperation()
 aCylinderBody = modelAPI_ResultBody(anExtrusionFt.firstResult())
index cacc2aeacd67405ed469f03040c55ae5273ecb8d..2bf63ad69f05c331d6ad95af08aa75ac690b97c0 100644 (file)
@@ -114,13 +114,13 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 250)
 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result())
 SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_2.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_5f-SketchLine_6f-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchCircle_1_2r-SketchLine_7f-SketchLine_9f-SketchLine_12r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchCircle_1_2r-SketchLine_8f-SketchLine_11r-SketchLine_12f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchCircle_1_2r-SketchLine_10f-SketchLine_11f")], model.selection(), 150, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_2")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), 150, True)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), 150, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_10r-SketchCircle_1_2r-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_9f-SketchCircle_1_2r-SketchLine_12r-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_12f-SketchCircle_1_2r-SketchLine_11r-SketchLine_8f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_11f-SketchCircle_1_2r-SketchLine_10f")], model.selection(), 150, 0)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_6"), 150, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"), 150, True)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_2")])
-Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face_2_4"), 110, True)
-Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face_3_4"), 380, True)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face&Sketch_1/SketchLine_3"), 110, True)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face&Sketch_1/SketchLine_8"), 380, True)
 Partition_2 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_3"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_4")])
 model.do()
 
index dd1e0c17fe94db20a141747e9a65980988ca4702..604989e39385f35ba50ed42bf8a6a4ed11b436e8 100644 (file)
@@ -30,8 +30,8 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 20, 10, 10)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
 model.do()
 # move groups
index 0f06d1dfdf8676f54d427fed562080ee26e4f388..2fc004aec2b128c0bf49f2ecc76d652d5f27f649 100644 (file)
@@ -28,8 +28,8 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 20)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"))
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"))
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1"))
 Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")])
diff --git a/src/CollectionPlugin/Test/TestGroupShareTopology.py b/src/CollectionPlugin/Test/TestGroupShareTopology.py
new file mode 100644 (file)
index 0000000..6b0b69e
--- /dev/null
@@ -0,0 +1,51 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from GeomAPI import *
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 3, [model.selection("SOLID", "Box_1_1")])
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.69238908106919, 4.989364948318125, 5.746414396356567)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Top&weak_name_1")])
+model.do()
+# enable geometrical selection mode => 4 faces must be selected as one compound
+Group_1.groupList().setGeometricalSelection(True)
+model.do()
+assert(Group_1.groupList().size() == 1)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.COMPOUND)
+
+# disable geometrical selection mode => 4 faces must be selected as 4 group elements
+Group_1.groupList().setGeometricalSelection(False)
+model.end()
+
+assert(Group_1.groupList().size() == 4)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(1).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(2).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(3).value().shapeType() == GeomAPI_Shape.FACE)
index 0ff1eefb3646d319e1d10eb58940ac22416b635c..ccb658d4de8e72eb398e5f674cd99538dd937589 100644 (file)
@@ -43,10 +43,9 @@ Input fields:
          :align: left         
     Solids;
  
-- The list of selected entities of the given type.  Multiple selection can be done manually in OCC 3D Viewer by mouse click with Shift button pressed or by rectangle selection.
-
-To delete entities from the list, select them and call pop-up menu *Delete* item.
+- The list of selected entities of the given type.  Multiple selection can be done manually in OCC 3D Viewer by mouse click with Shift button pressed or by rectangle selection. To delete entities from the list, select them and call pop-up menu *Delete* item.
 
+- Control **Add elements that share the same topology** allows to add automatically all elements laying on the same topology that was selected and remove these elements if they are disappeared due to the parametrical update. They will be represented as one line in the list of selection and managed in the viewer as one object if this flag is enabled. If flag becomes disabled when such elements are already in the list, they will become divided in one line per one shape.
 
 **TUI Command**: *model.addGroup(Part_1_doc, [model.selection("EDGE", "Cone_1_1/Face_1&Cone_1_1/Face_2"), model.selection("EDGE", "Cone_1_1/Face_1")])*
 
index 4302628d381beaf2b88e6b5372428b9ac9d7cf64..1ae6dea67d541640fe0c36936b3704154f7957a7 100644 (file)
Binary files a/src/CollectionPlugin/doc/images/group_property_panel.png and b/src/CollectionPlugin/doc/images/group_property_panel.png differ
index 4696d9e790ce3ce22d81dcecab882b42034414e5..f892893bb12d716c006e748d865c5da21740bf13 100644 (file)
@@ -29,7 +29,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     type_choice="Vertices Edges Faces Solids"
     use_choice="true"
     clear_in_neutral_point="false"
-    filter_points="false" >
+    filter_points="false"
+    same_topology="true">
     <validator id="GeomValidators_BodyShapes"/>
   </multi_selector>
 </source>
\ No newline at end of file
index 05bafb324a93a8baff93cdcc2706b9aa02ba3209..1918d4fa454c4afc1bd6982a90451637cebfa4ee 100644 (file)
@@ -19,6 +19,7 @@
 ##
 
 INCLUDE(Common)
+INCLUDE(UnitTest)
 INCLUDE(XMLProcessing)
 FIND_PACKAGE(SWIG REQUIRED)
 INCLUDE(${SWIG_USE_FILE})
@@ -150,3 +151,8 @@ INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 
 INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG})
 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
+
+
+ADD_UNIT_TESTS(
+  TestConfig.py
+)
index 2bf42f1a044bdbab5330e527da8cfb1d5dde10c8..f5fb5461a90ffd1f97ed64e6efdd742bb91aa47d 100644 (file)
 #define CONFIG_EXPORT
 
 %include "typemaps.i"
+%include "std_list.i"
 %include "std_string.i"
+%include "std_vector.i"
 
 %include "Config_ModuleReader.h"
 %include "Config_PropManager.h"
 %include "Config_Prop.h"
+
+// std::list -> []
+%template(ListOfString) std::list< std::string >;
+%template(listOfProp) std::list< Config_Prop* >;
+// std::vector -> []
+%template(VectorOfInteger) std::vector<int>;
index 32051337cd23c0e703978d8cd3146387bb639565..d8f2f23e8704f3817f51a22b5d4b3d5a47485131 100644 (file)
@@ -27,6 +27,7 @@ Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, const vo
   myFeatureId = std::string(); // Feature unique id
   myIsObligatory = true;
   myIsConcealment = false;
+  myIsGeometricalSelection = false;
 }
 
 Config_AttributeMessage::~Config_AttributeMessage()
@@ -94,3 +95,13 @@ void Config_AttributeMessage::setMainArgument(bool isMainArg)
 {
   myIsMainArgument = isMainArg;
 }
+
+bool Config_AttributeMessage::isGeometricalSelection() const
+{
+  return myIsGeometricalSelection;
+}
+
+void Config_AttributeMessage::setGeometricalSelection(bool isGeometricalSelection)
+{
+  myIsGeometricalSelection = isGeometricalSelection;
+}
index cb4ef232c79b2740c8768b8a49ccf716e3a57484..4df9cd8b474845d5b05003f199095464a0cb94c3 100644 (file)
@@ -42,6 +42,7 @@ class Config_AttributeMessage : public Events_Message
   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
   bool myIsConcealment; ///< If true, conceals features used as input
   bool myIsMainArgument; ///< Mark attribute as a main argument of the feature
+  bool myIsGeometricalSelection; ///< If true selects geometry instead of shape;
   ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
   std::list<std::pair<std::string, std::string> > myCases;
 
@@ -69,6 +70,8 @@ public:
   CONFIG_EXPORT bool isConcealment() const;
   /// Returns true if attribute is a main argument of the feature
   CONFIG_EXPORT bool isMainArgument() const;
+  /// Returns true if attribute selects geometry instead of shape;
+  CONFIG_EXPORT bool isGeometricalSelection() const;
   /// Returns container of ids of pair of a case and switches
   CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
   /// Sets ids of pair of a case and switches
@@ -84,6 +87,8 @@ public:
   CONFIG_EXPORT void setObligatory(bool isObligatory);
   /// Set a state that the attribute is a main argument of the feature
   CONFIG_EXPORT void setMainArgument(bool isMainArg);
+  /// Set attribute's geometrical selection state
+  CONFIG_EXPORT void setGeometricalSelection(bool isGeometricalSelection);
 };
 
 #endif // ATTRIBUTE_MESSAGE_H
index 377cb364e10d69e818bc5899874219317fbd9e42..ac7fdbe6caac5b10537d5caeb06531f93ee8750e 100644 (file)
@@ -89,6 +89,9 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
         aMessage->setConcealment(isConcealment);
         bool isMainArg = isConcealment && getBooleanAttribute(theNode, ATTR_MAIN_ARG, false);
         aMessage->setMainArgument(isMainArg);
+        aMessage->setGeometricalSelection(getBooleanAttribute(theNode,
+                                                              ATTR_GEOMETRICAL_SELECTION,
+                                                              false));
 
         std::list<std::pair<std::string, std::string> > aCases;
         xmlNodePtr aCaseNode = hasParentRecursive(theNode,
index beb599b206d87450a827f5692f1d08c75881dc10..eb3085ce6e5b6d46b6ef29a6dfa136929284793d 100644 (file)
@@ -100,6 +100,8 @@ const static char* ATTR_USE_RESET = "use_reset";
 const static char* ATTR_GREED = "greed";
 const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit";
 const static char* ATTR_MAIN_ARG = "main_argument";
+const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection";
+
 
 // WDG_INFO properties
 const static char* INFO_WDG_TEXT = FEATURE_TEXT;
index 4f6530dd38ee216084b6a5e8f87d2b70cb6d22f8..e754039e3a01436c45455057987d3431a17fa962 100644 (file)
@@ -24,7 +24,10 @@ std::vector<int> stringToRGB(const std::string& theColor);
 int stringToInteger(const std::string& theInt);
 bool stringToBoolean(const std::string& theInt);
 
-Config_Properties Config_PropManager::myProps;
+Config_Properties& Config_PropManager::props() {
+  static Config_Properties* confProps = new Config_Properties();
+  return *confProps;
+}
 
 
 Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
@@ -54,7 +57,7 @@ Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
   else {
     aProp =
       new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue, theMin, theMax);
-    myProps.push_back(aProp);
+    props().push_back(aProp);
   }
   return aProp;
 }
@@ -62,7 +65,8 @@ Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
 Config_Prop* Config_PropManager::findProp(const std::string& theSection, const std::string& theName)
 {
   Config_Properties::const_iterator aIt;
-  for (aIt = myProps.cbegin(); aIt != myProps.cend(); ++aIt) {
+  Config_Properties aProps = props();
+  for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
     Config_Prop* aProp = (*aIt);
     if ((aProp->section() == theSection) && (aProp->name() == theName))
       return aProp;
@@ -74,7 +78,8 @@ Config_Properties Config_PropManager::getProperties()
 {
   Config_Properties aRes;
   Config_Properties::const_iterator aIt;
-  for (aIt = myProps.cbegin(); aIt != myProps.cend(); aIt++) {
+  Config_Properties aProps = props();
+  for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) {
     Config_Prop* aProp = (*aIt);
     if (aProp->type() != Config_Prop::Disabled)
       aRes.push_back(aProp);
@@ -87,7 +92,8 @@ std::list<std::string> Config_PropManager::getSections()
   // Return only non disabled sections
   std::list<std::string> aSections;
   Config_Properties::const_iterator aIt;
-  for (aIt = myProps.cbegin(); aIt != myProps.cend(); aIt++) {
+  Config_Properties aProps = props();
+  for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) {
     const Config_Prop* aProp = (*aIt);
     if (aProp->type() != Config_Prop::Disabled)
       aSections.push_back(aProp->section());
@@ -100,7 +106,8 @@ Config_Properties Config_PropManager::getProperties(const std::string& theSectio
 {
   Config_Properties aRes;
   Config_Properties::iterator aIt;
-  for (aIt = myProps.begin(); aIt != myProps.end(); aIt++) {
+  Config_Properties aProps = props();
+  for (aIt = aProps.begin(); aIt != aProps.end(); aIt++) {
     Config_Prop* aProp = (*aIt);
     if ((aProp->section() == theSection) && (aProp->type() != Config_Prop::Disabled))
       aRes.push_back(aProp);
index 00dd75b738ef4162cd9c7ed09df20f9b1e9c34e1..7e03659ad2e6d1423e4416ee7478aef4a1baf123 100644 (file)
@@ -91,7 +91,7 @@ class Config_PropManager
   CONFIG_EXPORT static double stringToDouble(const std::string& theDouble);
 
  private:
-  CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties
+  CONFIG_EXPORT static Config_Properties& props(); ///< List of all stored properties
 };
 
 #endif
index f7af50c8f21e7a9ead3ecf0652948525c84bbe84..2149feba08c113ed6850c7cef0c14c50c9bcabb1 100644 (file)
@@ -60,6 +60,7 @@ Config_XMLReader::~Config_XMLReader()
   xmlFreeDoc(myXmlDoc);
 }
 
+// LCOV_EXCL_START
 std::string Config_XMLReader::resourcesConfigFile()
 {
   std::string aValue;
@@ -91,6 +92,7 @@ std::string Config_XMLReader::pluginConfigFile()
   }
   return aValue;
 }
+// LCOV_EXCL_STOP
 
 std::string Config_XMLReader::findConfigFile(const std::string theFileName, const int theFindIndex)
 {
@@ -115,6 +117,7 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons
       if (!anEnv)
         continue;
       if (aSolution > 2) { // there may be several paths separated by ";" symbol
+// LCOV_EXCL_START
         std::string anEnvPart = anEnv;
         size_t aPosStart = 0, aPosEnd;
         for(int aSubNum = 0; aSubNum < aSolution - 3; aSubNum++) {
@@ -130,6 +133,7 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons
         aPosEnd = anEnvPart.find(';', aPosStart);
         aFileName = anEnvPart.substr(aPosStart,
           aPosEnd == std::string::npos ? aPosEnd : aPosEnd - aPosStart) + FSEP;
+// LCOV_EXCL_STOP
       } else {
         aFileName = std::string(anEnv) + FSEP;
       }
@@ -189,10 +193,12 @@ void Config_XMLReader::cleanup(xmlNodePtr)
   // do nothing;
 }
 
+// LCOV_EXCL_START
 bool Config_XMLReader::processChildren(xmlNodePtr aNode)
 {
   return true;
 }
+// LCOV_EXCL_STOP
 
 xmlNodePtr Config_XMLReader::findRoot(const std::string theDocumentPath)
 {
@@ -234,10 +240,12 @@ void Config_XMLReader::readRecursively(xmlNodePtr theParent)
   }
 }
 
+// LCOV_EXCL_START
 xmlNodePtr Config_XMLReader::node(void* theNode)
 {
   return static_cast<xmlNodePtr>(theNode);
 }
+// LCOV_EXCL_STOP
 
 std::string Config_XMLReader::getNodeName(xmlNodePtr theNode)
 {
@@ -258,10 +266,12 @@ void Config_XMLReader::storeAttribute(xmlNodePtr theNode, const char* theAttribu
   }
 }
 
+// LCOV_EXCL_START
 std::string Config_XMLReader::restoreAttribute(xmlNodePtr theNode, const char* theAttribute)
 {
   return restoreAttribute(getNodeName(theNode).c_str(), theAttribute);
 }
+// LCOV_EXCL_STOP
 
 std::string Config_XMLReader::restoreAttribute(const char* theNodeName, const char* theAttribute)
 {
@@ -290,7 +300,9 @@ bool Config_XMLReader::cleanupAttribute(const char* theNodeName, const char* the
   return result;
 }
 
+// LCOV_EXCL_START
 const char* Config_XMLReader::encoding() const
 {
   return (const char*) myXmlDoc->encoding;
-}
\ No newline at end of file
+}
+// LCOV_EXCL_STOP
diff --git a/src/Config/Test/TestConfig.py b/src/Config/Test/TestConfig.py
new file mode 100644 (file)
index 0000000..a98d534
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+from ConfigAPI import *
+
+# register boolean property
+Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean)
+# check property once again
+Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean, "true")
+# check property value
+assert(Config_PropManager().boolean("TestSection", "PropBool"))
+
+# register real property
+Config_PropManager().registerProp("TestSection", "PropDouble", "PropTitle", Config_Prop.Double, "12,5")
+# check property (',' should be substituted by ".")
+assert(Config_PropManager().real("TestSection", "PropDouble") == 12.5)
+
+# register color property
+Config_PropManager().registerProp("TestSection", "PropColor", "PropTitle", Config_Prop.Color, "#B00F00")
+assert(len(Config_PropManager().color("TestSection", "PropColor")) == 3)
+
+# check sections and properties are not empty
+assert(len(Config_PropManager().getSections()) > 0)
+assert(len(Config_PropManager().getProperties()) > 0)
index c5e567add8944df4d4ab177ef1482015576a11a4..96f8ce509eb6fe03ca30cc66c90f04e8b37463b6 100644 (file)
@@ -86,8 +86,8 @@ def testSeveralExportsToGEOM():
   Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
   Box_2 = model.addBox(Part_1_doc, 20, 20, 20)
   Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), -10)
-  Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
-  Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face_1_2"), model.selection("FACE", "Box_2_1/Top")])
+  Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Box_2_1")])
+  Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Box_2_1/Top")])
   model.do()
   model.end()
 
index ca2b9045a3183ea3692be57ab8d3035dfa5b5562..114ca9f617447c8e9090d71043642f894104ce25 100644 (file)
@@ -89,13 +89,13 @@ def testGroupsAndFieldsExportToGEOM():
   Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
   Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), 20)
   Translation_2.result().setName("Translation_2_1")
-  Group_1_objects = [model.selection("FACE", "Translation_1_1/Translated_Face_1"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/Translated_Face_1")]
+  Group_1_objects = [model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Top")]
   Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
   Group_1.result().setName("faces_top")
-  Group_2_objects = [model.selection("EDGE", "Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_2&Partition_1_1_2/Modified_Face_2_1"), model.selection("EDGE", "Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2")]
+  Group_2_objects = [model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Left][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]")]
   Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
   Group_2.result().setName("edges_x")
-  Group_3_objects = [model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_6&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Partition_1_1_1/Modified_Face_1_1&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2")]
+  Group_3_objects = [model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Back][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_2_1/Back&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]")]
   Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
   Group_3.result().setName("vertices_bottom")
   Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Translation_2_1")])
@@ -104,15 +104,15 @@ def testGroupsAndFieldsExportToGEOM():
   Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_1_objects)
   Field_1.result().setName("Field_solids")
   Field_1.addStep(0, 0, [[0], [1], [2], [3]])
-  Field_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face_1_2"), model.selection("FACE", "Partition_1_1_2/Modified_Face_2_1"), model.selection("FACE", "Translation_2_1/Translated_Face_2"), model.selection("FACE", "Translation_1_1/Translated_Face_1"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/Translated_Face_1")]
+  Field_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_2_1/Bottom"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Top")]
   Field_2 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_2_objects)
   Field_2.result().setName("Field_faces")
   Field_2.addStep(0, 0, [[0], [1], [1], [1], [2], [2], [2]])
-  Field_3_objects = [model.selection("EDGE", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4"), model.selection("EDGE", "Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_2&Partition_1_1_2/Modified_Face_2_1"), model.selection("EDGE", "Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("EDGE", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3"), model.selection("EDGE", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3"), model.selection("EDGE", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3"), model.selection("EDGE", "Box_2_1/Front&Box_2_1/Right"), model.selection("EDGE", "Box_2_1/Right&Box_2_1/Top"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right"), model.selection("EDGE", "Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1")]
+  Field_3_objects = [model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Left][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right]"), model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[Box_2_1/Front][Box_2_1/Right]"), model.selection("EDGE", "[Box_2_1/Right][Box_2_1/Top]"), model.selection("EDGE", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right]"), model.selection("EDGE", "[Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]")]
   Field_3 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_3_objects)
   Field_3.result().setName("Field_edges")
   Field_3.addStep(0, 0, [[0], [1], [1], [1], [2], [2], [2], [2], [3], [3], [3], [3]])
-  Field_4_objects = [model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Partition_1_1_1/Modified_Face_1_1&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Translation_2_1/Translated_Face_6&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Translation_1_1/Translated_Face_1"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_1"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Partition_1_1_2/Modified_Face_2_2&Box_2_1/Top"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Box_2_1/Top"), model.selection("VERTEX", "Box_2_1/Front&Partition_1_1_2/Modified_Face_2_2&Box_2_1/Top"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Box_2_1/Top"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_1"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_1")]
+  Field_4_objects = [model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_2_1/Back&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Back][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Partition_1_1_2/Modified_Face&Box_2_1/Left][Box_2_1/Top]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Box_2_1/Top]"), model.selection("VERTEX", "[Box_2_1/Front][Partition_1_1_2/Modified_Face&Box_2_1/Left][Box_2_1/Top]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Box_2_1/Top]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Top]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Top]")]
   Field_4 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_4_objects)
   Field_4.result().setName("Field_vertices")
   Field_4.addStep(0, 0, [[0], [1], [1], [1], [1], [1], [1], [1], [1], [2], [2], [2], [2], [3], [3], [3], [3]])
index 3c5423b1f0833b4a3090ac3a94aa4371a68f8b05..9ddd0a2e3823417660c9d1fd50513704d1828fd0 100644 (file)
@@ -78,6 +78,7 @@ INCLUDE_DIRECTORIES(
 
 
 ADD_UNIT_TESTS(TestAxisCreation.py
+               TestAxis_ErrorMsg.py
                UnitTestAxis.py
                TestPoint_XYZ.py
                TestPoint_IntersectLines.py
@@ -90,4 +91,9 @@ ADD_UNIT_TESTS(TestAxisCreation.py
                TestPoint_GeometricalPropertyCenterOfCircle.py
                TestPoint_VertexSelection.py
                TestPointName.py
-               TestPlane.py)
+               TestPoint_ErrorMsg.py
+               TestPoint_FiniteValidator.py
+               TestPlane.py
+               TestPlane_ErrorMsg.py
+               TestPlane_FaceValidator.py
+)
index 5f4b2f8d65fb45391d3dd4567dfc0fd923a970c3..857dfd739750cc0c309b42bdf6a9e50d0dce901e 100644 (file)
@@ -33,7 +33,9 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
+#include <GeomAPI_XYZ.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -162,16 +164,26 @@ void ConstructionPlugin_Axis::createAxisByPointAndDirection()
 
 void ConstructionPlugin_Axis::createAxisByCylindricalFace()
 {
-    std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
-     // update arguments due to the selection value
-    if (aSelection && !aSelection->isNull() && aSelection->isFace()) {
-      std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
-
-      ResultConstructionPtr aConstr = document()->createConstruction(data());
-      aConstr->setInfinite(true);
-      aConstr->setShape(anEdge);
-      setResult(aConstr);
-    }
+  std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
+    // update arguments due to the selection value
+
+  if (!aSelection.get() || aSelection->isNull()) {
+    return;
+  }
+
+  if (aSelection->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aSelection);
+    aSelection = anIt.current();
+  }
+
+  if (aSelection->isFace()) {
+    std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
+
+    ResultConstructionPtr aConstr = document()->createConstruction(data());
+    aConstr->setInfinite(true);
+    aConstr->setShape(anEdge);
+    setResult(aConstr);
+  }
 }
 
 void ConstructionPlugin_Axis::createAxisByDimensions()
@@ -203,7 +215,36 @@ void ConstructionPlugin_Axis::createAxisByLine()
   if(!aLineShape.get()) {
     aLineShape = anEdgeSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+  GeomEdgePtr anEdge;
+  if (aLineShape->isEdge()) {
+    anEdge = aLineShape->edge();
+  }
+  else if (aLineShape->isCompound()) {
+    // create an edge which covers all edges from compounds (they are on the same line)
+    GeomPointPtr aFirst, aLast;
+    GeomXYZPtr aLineVec;
+    for(GeomAPI_ShapeIterator anIt(aLineShape); anIt.more(); anIt.next()) {
+      GeomEdgePtr aSub = anIt.current()->edge();
+      if (aSub.get() && aSub->isLine()) {
+        if (!aLineVec.get()) {
+          aFirst = aSub->firstPoint();
+          aLast = aSub->lastPoint();
+        } else { // set aFirst and aLast by extreme points
+          GeomXYZPtr aFirstVec = aSub->firstPoint()->xyz()->decreased(aFirst->xyz());
+          bool aSameDirection =
+            aSub->lastPoint()->xyz()->decreased(aSub->firstPoint()->xyz())->dot(aLineVec) > 0;
+          if (aLineVec->dot(aFirstVec) < -1.e-7) { // first point is changed
+            aFirst = aSameDirection ? aSub->firstPoint() : aSub->lastPoint();
+          } else { // last point is changed
+            aLast = aSameDirection ? aSub->lastPoint() : aSub->firstPoint();
+          }
+        }
+        aLineVec = aLast->xyz()->decreased(aFirst->xyz());
+      }
+    }
+    if (aLineVec.get())
+      anEdge = GeomAlgoAPI_EdgeBuilder::line(aFirst, aLast);
+  }
 
   ResultConstructionPtr aConstr = document()->createConstruction(data());
   aConstr->setInfinite(true);
@@ -219,7 +260,16 @@ void ConstructionPlugin_Axis::createAxisByPlaneAndPoint()
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+  GeomFacePtr aFace;
+  if (aFaceShape->isFace()) {
+    aFace = aFaceShape->face();
+  }
+  else if (aFaceShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape);
+    aFace = anIt.current()->face();
+  }
+  if (!aFace)
+    return;
   std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
 
   // Get point.
@@ -253,7 +303,16 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes()
   if(!aFaceShape1.get()) {
     aFaceShape1 = aFaceSelection1->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
+  std::shared_ptr<GeomAPI_Face> aFace1;
+  if (aFaceShape1->isFace()) {
+    aFace1 = aFaceShape1->face();
+  }
+  else if (aFaceShape1->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape1);
+    aFace1 = anIt.current()->face();
+  }
+  if (!aFace1)
+    return;
   std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
 
   std::string useOffset1 = string(USE_OFFSET1())->value();
@@ -272,7 +331,16 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes()
   if(!aFaceShape2.get()) {
     aFaceShape2 = aFaceSelection2->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
+  std::shared_ptr<GeomAPI_Face> aFace2;
+  if (aFaceShape2->isFace()) {
+    aFace2 = aFaceShape2->face();
+  }
+  else if (aFaceShape2->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape2);
+    aFace2 = anIt.current()->face();
+  }
+  if (!aFace2)
+    return;
   std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
 
   std::string useOffset2 = string(USE_OFFSET2())->value();
index ad046394a37ac7a5685644dcb02678c1eb7528d8..9c3770bd40b61a700f6de1365441c21da667fde0 100644 (file)
@@ -33,6 +33,7 @@
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Pnt2d.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_XYZ.h>
 
@@ -231,7 +232,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByLineAndPoint()
   if(!aLineShape.get()) {
     aLineShape = anEdgeSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  if (aLineShape->isEdge()) {
+    anEdge = aLineShape->edge();
+  }
+  else if (aLineShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aLineShape);
+    anEdge = anIt.current()->edge();
+  }
+  if (!anEdge)
+    return GeomShapePtr();
 
   // Get point.
   AttributeSelectionPtr aPointSelection = selection(POINT());
@@ -277,7 +287,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByDistanceFromOth
     bool anIsReverse = boolean(REVERSE())->value();
     if(anIsReverse) aDist = -aDist;
     GeomShapePtr aShape = aFaceAttr->value();
-    if (!aShape.get()) {
+    if (!aShape.get() && aFaceAttr->context()) {
       aShape = aFaceAttr->context()->shape();
     }
 
@@ -285,7 +295,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByDistanceFromOth
       return aPlane;
     }
 
-    std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
+    std::shared_ptr<GeomAPI_Face> aFace;
+    if (aShape->isFace()) {
+      aFace = aShape->face();
+    }
+    else if (aShape->isCompound()) {
+      GeomAPI_ShapeIterator anIt(aShape);
+      aFace = anIt.current()->face();
+    }
+    if (!aFace)
+      return GeomShapePtr();
 
     std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
     std::shared_ptr<GeomAPI_Pnt> aOrig = aPln->location();
@@ -308,7 +327,14 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByCoincidentPoint
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+  std::shared_ptr<GeomAPI_Face> aFace;
+  if (aFaceShape->isFace()) {
+    aFace = aFaceShape->face();
+  }
+  else if (aFaceShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape);
+    aFace = anIt.current()->face();
+  }
 
   // Get point.
   AttributeSelectionPtr aPointSelection = selection(COINCIDENT_POINT());
@@ -316,7 +342,9 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByCoincidentPoint
   if(!aPointShape.get()) {
     aPointShape = aPointSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
+  std::shared_ptr<GeomAPI_Vertex> aVertex = aPointShape->vertex();
+  if (!aVertex)
+    return GeomShapePtr();
 
   std::shared_ptr<GeomAPI_Pnt> anOrig = aVertex->point();
   std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
@@ -336,7 +364,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+  std::shared_ptr<GeomAPI_Face> aFace;
+  if (aFaceShape->isFace()) {
+    aFace = aFaceShape->face();
+  }
+  else if (aFaceShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape);
+    aFace = anIt.current()->face();
+  }
+  if (!aFace)
+    return GeomShapePtr();
   aFace = makeRectangularFace(aFace, aFace->getPlane());
 
   // Get axis.
@@ -345,7 +382,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
   if(!anAxisShape.get()) {
     anAxisShape = anAxisSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anAxisShape));
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  if (anAxisShape->isEdge()) {
+    anEdge = anAxisShape->edge();
+  }
+  else if (anAxisShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(anAxisShape);
+    anEdge = anIt.current()->edge();
+  }
+  if (!anEdge)
+    return GeomShapePtr();
 
   std::shared_ptr<GeomAPI_Ax1> anAxis =
     std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
@@ -378,7 +424,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByTwoParallelPlan
   if(!aFaceShape1.get()) {
     aFaceShape1 = aFaceSelection1->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
+  std::shared_ptr<GeomAPI_Face> aFace1;
+  if (aFaceShape1->isFace()) {
+    aFace1 = aFaceShape1->face();
+  }
+  else if (aFaceShape1->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape1);
+    aFace1 = anIt.current()->face();
+  }
+  if (!aFace1)
+    return GeomShapePtr();
   std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
 
   // Get plane 2.
@@ -387,7 +442,16 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByTwoParallelPlan
   if(!aFaceShape2.get()) {
     aFaceShape2 = aFaceSelection2->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
+  std::shared_ptr<GeomAPI_Face> aFace2;
+  if (aFaceShape2->isFace()) {
+    aFace2 = aFaceShape2->face();
+  }
+  else if (aFaceShape2->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aFaceShape2);
+    aFace2 = anIt.current()->face();
+  }
+  if (!aFace2)
+    return GeomShapePtr();
   std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
 
   std::shared_ptr<GeomAPI_Pnt> anOrig1 = aPln1->location();
index bb59c3d550acee82307197fd38c07ec3a372ee5b..51432b609b7f269b390759b8a7a0f934973793b3 100644 (file)
@@ -36,6 +36,7 @@
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
 
 //==================================================================================================
 ConstructionPlugin_Point::ConstructionPlugin_Point()
@@ -143,6 +144,7 @@ void ConstructionPlugin_Point::execute()
 
   removeResults(1); // for case the point type was switched from multi-results type
   std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+  aConstr->setInfinite(true);
   aConstr->setShape(aShape);
   setResult(aConstr);
 }
@@ -270,7 +272,14 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   if(!aLineShape.get()) {
     aLineShape = aLineSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+  GeomEdgePtr anEdge;
+  if (aLineShape->isEdge()) {
+    anEdge = aLineShape->edge();
+  }
+  else if (aLineShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aLineShape);
+    anEdge = anIt.current()->edge();
+  }
 
   // Get plane.
   AttributeSelectionPtr aPlaneSelection= selection(INTERSECTION_PLANE());
@@ -278,7 +287,14 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   if(!aPlaneShape.get()) {
     aPlaneShape = aPlaneSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aPlaneShape));
+  GeomFacePtr aFace;
+  if (aPlaneShape->isFace()) {
+    aFace = aPlaneShape->face();
+  }
+  else if (aPlaneShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(aPlaneShape);
+    aFace = anIt.current()->face();
+  }
 
   if (!string(USE_OFFSET())->value().empty()) {
     double anOffset = real(OFFSET())->value();
index 2390b83a4eec2b9e9327890a0c3d83f748dc02c5..a06ef0fdadc9a5cfe2915f6fa743c7334e7be00a 100644 (file)
@@ -27,6 +27,7 @@
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_Pnt.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
 #include <ModelAPI_AttributeSelection.h>
@@ -35,6 +36,7 @@
 #include <Events_InfoMessage.h>
 
 static std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape);
+static std::shared_ptr<GeomAPI_Face> getFace(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pnt> getPnt(const GeomShapePtr theShape);
@@ -114,7 +116,7 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid(
   AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
 
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<GeomAPI_Pln> aPln;
+  std::shared_ptr<GeomAPI_Face> aFace;
 
   GeomShapePtr aShape1 = anAttribute1->value();
   ResultPtr aContext1 = anAttribute1->context();
@@ -137,20 +139,20 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid(
 
   bool isPlaneFirst = false;
   anEdge = getEdge(aShape1);
-  aPln = getPln(aShape2);
-  if(!anEdge.get() || !aPln.get()) {
+
+  aFace = getFace(aShape2);
+  if(!anEdge.get() || !aFace.get()) {
     anEdge = getEdge(aShape2);
-    aPln = getPln(aShape1);
+    aFace = getFace(aShape1);
     isPlaneFirst = true;
   }
 
-  if(!anEdge.get() || !aPln.get()) {
+  if(!anEdge.get() || !aFace.get()) {
     theError = "Wrong shape types selected.";
     return false;
   }
 
-  std::shared_ptr<GeomAPI_Face> aPlaneFace(new GeomAPI_Face(isPlaneFirst ? aShape1 : aShape2));
-  if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aPlaneFace)) {
+  if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aFace)) {
     theError = "Plane and edge are parallel.";
     return false;
   }
@@ -474,25 +476,51 @@ bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid(
 
 std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
 {
-  if(!theShape->isEdge()) {
-    return std::shared_ptr<GeomAPI_Edge>();
-  }
+  GeomEdgePtr anEdge;
 
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+  if(theShape->isEdge()) {
+    anEdge = theShape->edge();
+  }
+  else if (theShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(theShape);
+    anEdge = anIt.current()->edge();
+  }
 
   return anEdge;
 }
 
+GeomFacePtr getFace(const GeomShapePtr theShape)
+{
+  GeomFacePtr aFace;
+
+  if (theShape->isFace()) {
+    aFace = theShape->face();
+  }
+  else if (theShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(theShape);
+    aFace = anIt.current()->face();
+  }
+
+  return aFace;
+}
+
 std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape)
 {
   std::shared_ptr<GeomAPI_Lin> aLin;
 
-  if(!theShape->isEdge()) {
+  GeomEdgePtr anEdge;
+
+  if (theShape->isEdge()) {
+    anEdge = theShape->edge();
+  }
+  else if (theShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(theShape);
+    anEdge = anIt.current()->edge();
+  }
+  else {
     return aLin;
   }
 
-  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
-
   if(!anEdge->isLine()) {
     return aLin;
   }
@@ -506,13 +534,20 @@ std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape)
 {
   std::shared_ptr<GeomAPI_Pln> aPln;
 
-  if(!theShape->isFace()) {
+  GeomFacePtr aFace;
+
+  if(theShape->isFace()) {
+    aFace = theShape->face();
+  }
+  else if (theShape->isCompound()) {
+    GeomAPI_ShapeIterator anIt(theShape);
+    aFace = anIt.current()->face();
+  }
+  else {
     return aPln;
   }
 
-  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
-
-  if(!aFace->isPlanar()) {
+  if(!aFace || !aFace->isPlanar()) {
     return aPln;
   }
 
index 642d83bde2f2c73dccb4e13df86a46334d4eb885..c106b2dcbf2f7d5595ecaf451e1d1dccccbb8240 100644 (file)
@@ -107,22 +107,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(100)
 anExtrusionFt.real("from_size").setValue(0)
@@ -145,7 +138,7 @@ anAxisFeature = aPart.addFeature("Axis")
 anAxisFeatureData = anAxisFeature.data()
 assert(anAxisFeatureData is not None)
 anAxisFeatureData.string("CreationMethod").setValue("AxisByCylindricalFaceCase")
-anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
+anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")
 anAxisFeature.execute()
 aSession.finishOperation()
 
diff --git a/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py b/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py
new file mode 100644 (file)
index 0000000..3215128
--- /dev/null
@@ -0,0 +1,120 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Axis by cylindrical face
+aSession.startOperation()
+Axis_1 = aPart.addFeature("Axis")
+Axis_1.string("CreationMethod").setValue("AxisByCylindricalFaceCase")
+Axis_1.selection("CylindricalFace").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+aSession.finishOperation()
+assert(Axis_1.error() != "")
+
+# Axis by dimensions
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("AxisByDimensionsCase")
+Axis_1.real("DX").setValue(0)
+Axis_1.real("DY").setValue(0)
+Axis_1.real("DZ").setValue(0)
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by line
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_line")
+Axis_1.selection("line").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by plane and point
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_plane_and_point")
+Axis_1.selection("point").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.selection("plane").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by two planes
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_two_planes")
+Axis_1.selection("plane1").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.selection("plane2").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Axis_1.selection("plane1").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.string("use_offset1").setValue("true")
+Axis_1.real("offset1").setValue(10)
+Axis_1.boolean("reverse_offset1").setValue(True)
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
diff --git a/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py b/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py
new file mode 100644 (file)
index 0000000..506b78b
--- /dev/null
@@ -0,0 +1,133 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Plane by line and point
+aSession.startOperation()
+Plane_1 = aPart.addFeature("Plane")
+Plane_1.string("creation_method").setValue("by_line_and_point")
+Plane_1.selection("line").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.selection("point").selectSubShape("VERTEX", "PartSet/Origin")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# Unsupported type
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_rotation")
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.selection("axis").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By two parallel planes
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_two_parallel_planes")
+Plane_1.selection("plane1").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.selection("plane2").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Plane_1.selection("plane1").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By distance from other plane
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_other_plane")
+Plane_1.string("by_other_plane_option").setValue("by_distance_from_other")
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.real("distance").setValue(10)
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By coincident point
+aSession.startOperation()
+Plane_1.string("by_other_plane_option").setValue("by_coincident_to_point")
+Plane_1.selection("coincident_point").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By rotation
+aSession.startOperation()
+Plane_1.string("by_other_plane_option").setValue("by_rotation")
+Plane_1.selection("axis").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.real("angle").setValue(90)
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
diff --git a/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py b/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py
new file mode 100644 (file)
index 0000000..d2890a4
--- /dev/null
@@ -0,0 +1,38 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sphere_1_1/Face_1")])
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("COMPOUND", (0, 0, 0)), 10, False)
+assert(Plane_1.feature().error() != "")
+Part_1_doc.removeFeature(Plane_1.feature())
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Compound_1_1_1/Compound_1_1_1&Sphere_1_1/Face_1][weak_name_3]"), 10, False)
+assert(Plane_1.feature().error() != "")
+Part_1_doc.removeFeature(Plane_1.feature())
+
+model.end()
index 4f6c5ef88d3778e524a88c5f0ab5030bcb39c7d2..d7f0db6fcd3c14fbe9cdebaa30a014fa92c7914c 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by coordinates.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -35,15 +34,17 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
 model.do()
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False)
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False)
-Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 50, False, False)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, False)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, True)
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10)
-Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False)
-Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True)
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, False)
+Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, True)
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
diff --git a/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py b/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py
new file mode 100644 (file)
index 0000000..2d71164
--- /dev/null
@@ -0,0 +1,77 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Point by line and plane
+aSession.startOperation()
+Point_1 = aPart.addFeature("Point")
+Point_1.string("creation_method").setValue("by_intersection")
+Point_1.string("intersection_type").setValue("intersection_type_by_line_and_plane")
+Point_1.selection("intersection_line").selectSubShape("COMPOUND", "Compound_1_1")
+Point_1.selection("intersection_plane").selectSubShape("COMPOUND", "Compound_2_1")
+Point_1.execute()
+assert(Point_1.error() != "")
+aSession.finishOperation()
diff --git a/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py b/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py
new file mode 100644 (file)
index 0000000..485b888
--- /dev/null
@@ -0,0 +1,31 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), 10, False, False)
+assert(Point_2.feature().error() != "")
+
+model.end()
index e08fa1158e6a2dad2b82438bb83ae1594ea28b40..57a34b5510ea45ffed5f9f8e03229c038b299a07 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by center of gravity.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -34,12 +33,14 @@ SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25)
 SketchArc_1 = Sketch_1.addArc(50, 25, 25, 25, 75, 25, True)
 model.do()
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), True)
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), True)
-Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchArc_1_2"), True)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True)
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(-50, 25, 0)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index 933252369cc1a72db0c86021354c8bbb6707539f..d9a0a5b3819b54c4fe52b9e178b20d2a2ae911b0 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by center of gravity.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -37,10 +36,12 @@ Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
 Point_2 = model.addPoint(Part_1_doc, model.selection("COMPOUND", "Sketch_1"))
 Point_3 = model.addPoint(Part_1_doc, model.selection("SOLID", "Box_1_1"))
 Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
-Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"))
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"))
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(0, 0, 25)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index 635ab81022712e7006f9cb2fb7e094be06f9ef2d..5ff71ee02fa813c05363b12a9e89aebdbf835401 100644 (file)
@@ -38,14 +38,14 @@ SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0
 model.do()
 
 # point by sketch face and a line
-Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
+Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
 model.do()
 # check the point position
 rightPosition = GeomAPI_Vertex(-15, 0, 0)
 assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
 
 # point by sketch face and an arc, intersection outside of the face, offset is defined
-Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
+Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
 # check the point position
 rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index f3b08471afcb13373e704090d330aa15934c9a02..239d4eadd3007404d11ea68aefe4f0792d2bd840 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by lines intersection.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -35,11 +34,13 @@ SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50)
 model.do()
 Box_1 = model.addBox(Part_1_doc, 25, 100, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "Sketch_1/SketchLine_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"))
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(0, 50, 0)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index af44576ac973d54707d09c2608334c299f3f80c3..0bfe96d4bd6fb0d3d1d0250a114f05fda1b49981 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by coordinates.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -34,11 +33,13 @@ SketchCircle_1 = Sketch_1.addCircle(0, 0, 100)
 SketchPoint_1 = Sketch_1.addPoint(100, 100)
 model.do()
 Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"))
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index 1b5218ea7caf9aaea793ef10e250bfde2d7095c3..0ed88039c048389216e7f7464265c2baa220f4f2 100644 (file)
@@ -23,7 +23,6 @@ Test case for Construction Point feature by projection point on face.
 """
 
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -33,11 +32,13 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchPoint_1 = Sketch_1.addPoint(50, 50)
 model.do()
 Box_1 = model.addBox(Part_1_doc, 10, 100, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(10, 0, 50)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index 8180742aa599c5960b67a217896c39f00f9da20f..de2e7b8c96c618bb9b8f9929a419caff59a05693 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
-from GeomAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"))
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 10)
 model.do()
 model.end()
 
+from GeomAPI import GeomAPI_Vertex
+
 assert (len(Point_2.results()) > 0)
 rightPosition = GeomAPI_Vertex(10, 0, 10)
 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
index 928d0302256c95e84fcba78a2cbd44de8cdde5a5..4ccefe0118ee526c315b9769bfa49dd1d987395c 100644 (file)
@@ -50,7 +50,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Line"
                       tooltip="Select line."
                       icon="icons/Construction/edge.png"
-                      shape_types="edge">
+                      shape_types="edge"
+                      geometrical_selection="true">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
     </box>
@@ -59,7 +60,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         label="Main object"
         icon="icons/Construction/circle.png"
         tooltip="Select a cylindrical object"
-        shape_types="face">
+        shape_types="face"
+        geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="cylinder"/>
       </shape_selector>
     </box>
@@ -68,7 +70,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
       </shape_selector>
       <shape_selector id="point"
@@ -83,7 +86,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="1st plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane2"/>
       </shape_selector>
@@ -95,7 +99,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="2nd plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane1"/>
       </shape_selector>
index f23a4f40604f8053683bf81bf5461866a8ddd343..dfe2007b3a45f38006ece69b7ca5a9ffc4d93a7a 100644 (file)
@@ -55,7 +55,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Line"
                       tooltip="Select line."
                       icon="icons/Construction/edge.png"
-                      shape_types="edge">
+                      shape_types="edge"
+                      geometrical_selection="true">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
         <validator id="ConstructionPlugin_ValidatorPlaneLinePoint" parameters="point,perpendicular"/>
       </shape_selector>
@@ -79,7 +80,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
       </shape_selector>
       <toolbox id="by_other_plane_option">
@@ -118,7 +120,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Axis"
                           tooltip="Select line for axis."
                           icon="icons/Construction/axis.png"
-                          shape_types="edge">
+                          shape_types="edge"
+                          geometrical_selection="true">
             <validator id="GeomValidators_ShapeType" parameters="line"/>
           </shape_selector>
           <doublevalue id="angle"
@@ -140,7 +143,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="1st plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane2"/>
       </shape_selector>
@@ -148,7 +152,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="2nd plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face">
+                      shape_types="face"
+                      geometrical_selection="true">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane1"/>
       </shape_selector>
index bd7439f8acc791f8f7d68c814c8b3e17ac248792..3ccf7755052a34edf6309881123bcfc1481c65e2 100644 (file)
@@ -141,7 +141,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Line"
                           tooltip="Line for intersection."
                           icon="icons/Construction/edge.png"
-                          shape_types="edge">
+                          shape_types="edge"
+                          geometrical_selection="true">
             <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
                        parameters="intersection_plane"/>
           </shape_selector>
@@ -149,7 +150,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane"
                           tooltip="Plane for intersection."
                           icon="icons/Construction/face.png"
-                          shape_types="face">
+                          shape_types="face"
+                          geometrical_selection="true">
             <validator id="GeomValidators_Face" parameters="plane"/>
             <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
                        parameters="intersection_line"/>
index 91dcb66901c699a0ce4c68d95a2a14e5b06efd64..345b44fed8e5aeed956da38f83746aa419cf485d 100644 (file)
@@ -83,4 +83,6 @@ ADD_UNIT_TESTS(TestImport.py
                TestExport.py
                Test2290.py
                Test2459.py
-               TestExportToXAOWithGroupNotUpdated.py)
+               TestExportToXAOWithGroupNotUpdated.py
+               TestExport_FiniteValidator.py
+)
index ef70f9a6619a9ec1ca3428dd3cabc422b4862b42..b8b864acc2d034e259d31729d56ee1932a88bd0f 100644 (file)
@@ -410,5 +410,5 @@ void ExchangePlugin_ImportFeature::loadNamingDS(
 
   int aTag(1);
   std::string aNameMS = "Shape";
-  theResultBody->loadFirstLevel(theGeomShape, aNameMS, aTag);
+  theResultBody->loadFirstLevel(theGeomShape, aNameMS);
 }
index 9cd57811e0372a40026adfbfb8fae57ccc382420..a08d419eec40137a5e90de6904fbe1df4f231ad6 100644 (file)
@@ -109,7 +109,7 @@ SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_15.endPoint(),
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchAPI_Arc(SketchArc_12).startPoint())
 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchAPI_Arc(SketchArc_6).endPoint())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2r-SketchArc_5_2r-SketchCircle_1_2r-SketchArc_6_2r-SketchArc_7_2r-SketchLine_6f-SketchLine_7f-SketchArc_8_2f-SketchArc_9_2f-SketchLine_8f-SketchLine_9f-SketchArc_10_2f-SketchArc_11_2f-SketchLine_10f-SketchLine_11f-SketchArc_12_2r-SketchArc_13_2r-SketchCircle_2_2r-SketchCircle_3_2r-SketchArc_14_2f-SketchArc_15_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2f-SketchLine_4f-SketchArc_5_2r-SketchArc_3_2f-SketchArc_6_2r-SketchLine_6f-SketchArc_8_2f-SketchLine_8f-SketchArc_10_2f-SketchLine_10f-SketchArc_12_2r-SketchArc_15_2f-SketchArc_7_2r-SketchLine_7f-SketchArc_9_2f-SketchLine_9f-SketchArc_11_2f-SketchLine_11f-SketchArc_13_2r-SketchArc_14_2f-SketchArc_4_2r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 10, 0)
 model.do()
 model.end()
 
index 8a6f1e320eceb40448228fe50d0d0c27ec3085b4..468cee23ea1dd7623b4ed46efaa18f410cc30539 100644 (file)
@@ -108,16 +108,16 @@ def testExportXAO(theFile):
     aGroupFeature.data().setName("")
     aSelectionListAttr = aGroupFeature.selectionList("group_list")
     aSelectionListAttr.setSelectionType("face")
-    aSelectionListAttr.append("box1_1/Shape1")
-    aSelectionListAttr.append("box1_1/Shape2")
+    aSelectionListAttr.append("box1_1/Shape_1")
+    aSelectionListAttr.append("box1_1/Shape_2")
     aSession.finishOperation()
 
     aSession.startOperation("Create a field")
     aField = aSession.activeDocument().addFeature("Field")
     aSelectionListAttr = aField.selectionList("selected")
     aSelectionListAttr.setSelectionType("face")
-    aSelectionListAttr.append("box1_1/Shape1")
-    aSelectionListAttr.append("box1_1/Shape2")
+    aSelectionListAttr.append("box1_1/Shape_1")
+    aSelectionListAttr.append("box1_1/Shape_2")
     aComponentNames = aField.stringArray("components_names")
     aComponentNames.setSize(2) # two components
     aComponentNames.setValue(0, "temperatue")
index 40e9e80889cddcea3366352041edbf69e586eec4..d5555653eed19ccabe06fe9fc7637ef8de14bed8 100644 (file)
@@ -39,14 +39,14 @@ SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchL
 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
 # Create a group with the faces of the box
-Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 Group_1.setName("Group_faces")
 Group_1.result().setName("Group_faces")
 # Create a field on the box
-Field_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Field_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
 Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_1_objects)
 Field_1.addStep(0, 0, [[0], [1], [2], [3], [4], [5], [6]])
 # Create a plane to split the box in two parts
diff --git a/src/ExchangePlugin/Test/TestExport_FiniteValidator.py b/src/ExchangePlugin/Test/TestExport_FiniteValidator.py
new file mode 100644 (file)
index 0000000..d42015e
--- /dev/null
@@ -0,0 +1,41 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+
+aSession = ModelAPI_Session.get()
+
+# Import a reference part
+aSession.startOperation("Add part")
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+
+# Export a part
+aSession.startOperation("Export part")
+anExportFeature = aPart.addFeature("Export")
+anExportFeature.string("file_format").setValue("BREP")
+anExportFeature.string("file_path").setValue("file.brep")
+anExportFeature.string("ExportType").setValue("Regular")
+aSelectionListAttr = anExportFeature.selectionList("selection_list")
+aSelectionListAttr.setSelectionType("solids")
+aSelectionListAttr.append("PartSet/OX", "EDGE")
+aSession.finishOperation()
+assert(anExportFeature.error() != "")
index 0d42f92072977e94f3994665b252aa4c08efe7fa..e32246013288db99bbb8274313e1cda5405196d3 100644 (file)
@@ -112,9 +112,8 @@ def testImportXAO():
     aSelectionList = aFeature2.selectionList("group_list")
     assert aSelectionList.selectionType() == "face"
     assert aSelectionList.size() == 2
-    assert aSelectionList.value(0).namingName("") == "mygeom_1/Shape1"
-    print(aSelectionList.value(1).namingName(""))
-    assert aSelectionList.value(1).namingName("") == "mygeom_1/Shape2"
+    assert aSelectionList.value(0).namingName("") == "mygeom_1/Shape_1"
+    assert aSelectionList.value(1).namingName("") == "mygeom_1/Shape_2"
 
     aFeature3 = aCompositeFeature.subFeature(2, False)
     assert aFeature3.getKind() == "Field"
index e2ede78a66a7869b535f16be0383e710da0d84ee..35459c7f348fc297960e938edc875152c03dc6b3 100644 (file)
@@ -73,6 +73,7 @@ SET(PROJECT_SOURCES
     FeaturesPlugin_BooleanFuse.cpp
     FeaturesPlugin_BooleanCommon.cpp
     FeaturesPlugin_BooleanSmash.cpp
+    FeaturesPlugin_BooleanFill.cpp
     FeaturesPlugin_Intersection.cpp
     FeaturesPlugin_Partition.cpp
     FeaturesPlugin_Pipe.cpp
@@ -170,24 +171,48 @@ INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 ADD_UNIT_TESTS(TestExtrusion.py
                TestExtrusionCut.py
                TestExtrusionFuse.py
+               TestExtrusion_ErrorMsg.py
+               TestExtrusion_ZeroOffsetError.py
                TestRevolution.py
                TestRevolutionCut.py
                TestRevolutionFuse.py
                TestCompositeFeaturesOnCompSolids.py
                TestPartition.py
-               TestPlacement.py
+               TestPartition_ErrorMsg.py
+               TestPlacement_Vertex_Vertex.py
+               TestPlacement_Edge_Vertex.py
+               TestPlacement_Edge_Edge.py
+               TestPlacement_Face_Vertex.py
+               TestPlacement_Face_Edge.py
+               TestPlacement_Face_Face.py
+               TestPlacement_Part_Part.py
+               TestPlacement_ErrorMsg.py
+               TestPlacement_BodyShapesValidator.py
                TestTranslation.py
+               TestTranslation_Part.py
                TestRotation.py
-               TestBoolean.py
+               TestRotation_ErrorMsg.py
+               TestMultiRotation_Part.py
+               TestMultiRotation_ErrorMsg.py
+               TestMultiTranslation_Part.py
+               TestMultiTranslation_ErrorMsg.py
+               TestSymmetry_Part.py
+               TestBoolean1.py
+               TestBoolean2.py
+               TestBoolean3.py
                TestBooleanCompSolids.py
                TestBooleanSmash.py
                TestBooleanFill.py
                TestBooleanFillWithPlane.py
+               TestBooleanFill_ErrorMsg.py
                TestMultiBoolean.py
                TestSerialBoolean.py
+               TestBoolean_ErrorMsg.py
                TestIntersection.py
+               TestIntersection_ErrorMsg.py
                TestUnion.py
                TestUnionFaces.py
+               TestUnion_ErrorMsg.py
                TestRemoveSubShapes.py
                TestRemoveSubShapes2.py
                TestRemoveSubShapes3.py
@@ -195,6 +220,10 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestRemoveSubShapes5.py
                TestRemoveSubShapes6.py
                TestPipe.py
+               TestPipe_Edge.py
+               TestPipe_Wire.py
+               TestPipe_Compound.py
+               TestPipe_ErrorMsg.py
                TestRecover.py
                TestRecover1798.py
                TestFillEdgeVertex.py
@@ -233,6 +262,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestFillSolidCompFace.py
                TestFillSolidShell.py
                TestFillSolidCompShell.py
+               TestFillCompsolidPlane.py
                TestPartition2Faces.py
                TestPartition2Solids.py
                TestPartition2Wires.py
@@ -251,6 +281,8 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestMeasurementDistance.py
                TestMeasurementRadius.py
                TestMeasurementAngle.py
+               TestMeasurementAngle3Points.py
+               TestMeasurementPresentation.py
                TestFusionFaces.py
                Test1379.py
                Test1922.py
@@ -307,9 +339,15 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCut_Wire_Face.py
                TestBooleanCut_Wire_Wire.py
                TestBooleanCut_WireCompound_WireCompound.py
+               TestBooleanCut_Compound_Solid.py
+               TestBooleanCut_ErrorMsg.py
                TestBooleanSmash_Face_Face.py
+               TestBooleanSmash_SubSolid_Solid.py
+               TestBooleanSmash_CompSolid_Solid.py
+               TestBooleanSmash_ErrorMsg.py
                TestBooleanFuse_SimpleMode.py
                TestBooleanFuse_RemoveEdges.py
+               TestBooleanFuse_ErrorMsg.py
                TestBooleanCommon_Vertex_Vertex.py
                TestBooleanCommon_VertexCompound_VertexCompound.py
                TestBooleanCommon_Edge_Edge.py
@@ -317,6 +355,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCommon_Wire_Wire.py
                TestBooleanCommon_WireCompound_WireCompound.py
                TestBooleanCommon_Face_Face.py
+               TestBooleanCommon_Face_Plane.py
                TestBooleanCommon_FaceCompound_FaceCompound.py
                TestBooleanCommon_Shell_Shell.py
                TestBooleanCommon_ShellCompound_ShellCompound.py
@@ -326,19 +365,22 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCommon_SolidCompound_Face.py
                TestBooleanCommon_SolidCompound_Shell.py
                TestBooleanCommon_SolidCompound_SolidCompound.py
+               TestBooleanCommon_SubCompound_Solid.py
+               TestBooleanCommon_SubSolid_Solid.py
                TestBooleanCommon_CompSolid_Face.py
                TestBooleanCommon_CompSolid_Shell.py
                TestBooleanCommon_CompSolid_CompSolid.py
                TestBooleanCommon_CompSolidCompound_Face.py
                TestBooleanCommon_CompSolidCompound_Shell.py
                TestBooleanCommon_CompSolidCompound_CompSolidCompound.py
+               TestBooleanCommon_ErrorMsg.py
                Test2596.py
                Test2592.py
                Test2588.py
                Test1467.py
-               TestPartitionSubCompsolidWithCompsolid1.py
-               TestPartitionSubCompsolidWithCompsolid2.py
-               TestPartitionSubCompsolidWithCompsolid3.py
+               TestPartitionSubCompsolidWithCompSolid1.py
+               TestPartitionSubCompsolidWithCompSolid2.py
+               TestPartitionSubCompsolidWithCompSolid3.py
                TestPartitionSubCompsolidWithSolid1.py
                TestPartitionSubCompsolidWithSolid2.py
                TestPartitionSubCompsolidWithSolid3.py
@@ -366,9 +408,24 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanFuse_ShellCompound_ShellCompound.py
                TestBooleanFuse_Solid_Solid.py
                TestBooleanFuse_SolidCompound_SolidCompound.py
+               TestBooleanFuse_CompSolid_Face.py
                TestBooleanFuse_CompSolid_CompSolid.py
                TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
+               TestFillet.py
+               TestFillet1.py
+               TestFillet_ErrorMsg.py
                Test1816.py
                Test2631.py
                Test2650.py
+               Test2681.py
+               Test2686.py
+               Test2689.py
+               Test2693.py
+               Test2698.py
+               Test2701.py
+               Test2724.py
+               Test2692.py
+               Test2617.py
+               Test2729.py
+               Test2751.py
 )
index 99afc6e8dbf6d78c1c37838d639f26fad7caf9f4..e9e3cbf9f5ed8cbe34d657b4b886bcad4a2bbc73 100644 (file)
@@ -63,683 +63,41 @@ void FeaturesPlugin_Boolean::initAttributes()
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
 }
 
-//=================================================================================================
-std::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::string& theAttrName)
-{
-  std::shared_ptr<ModelAPI_AttributeReference> aObjRef = std::dynamic_pointer_cast<
-      ModelAPI_AttributeReference>(data()->attribute(theAttrName));
-  if (aObjRef) {
-    std::shared_ptr<ModelAPI_ResultBody> aConstr = std::dynamic_pointer_cast<
-        ModelAPI_ResultBody>(aObjRef->value());
-    if (aConstr)
-      return aConstr->shape();
-  }
-  return std::shared_ptr<GeomAPI_Shape>();
-}
-
 //=================================================================================================
 FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
 {
   return myOperationType;
 }
 
-//=================================================================================================
-void FeaturesPlugin_Boolean::execute()
-{
-  ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
-  std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
-
-  // Getting objects.
-  AttributeSelectionListPtr anObjectsSelList =
-    selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
-  for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
-    AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
-    std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
-    if(!anObject.get()) {
-      return;
-    }
-    ResultPtr aContext = anObjectAttr->context();
-    ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
-    if(aResCompSolidPtr.get()
-        && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
-      std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
-      std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
-        anIt = aCompSolidsObjects.begin();
-      for(; anIt != aCompSolidsObjects.end(); anIt++) {
-        if(anIt->first->isEqual(aContextShape)) {
-          aCompSolidsObjects[anIt->first].push_back(anObject);
-          break;
-        }
-      }
-      if(anIt == aCompSolidsObjects.end()) {
-        aCompSolidsObjects[aContextShape].push_back(anObject);
-      }
-    } else {
-      if(myOperationType != BOOL_FILL
-        && (anObject->shapeType() == GeomAPI_Shape::EDGE
-          || anObject->shapeType() == GeomAPI_Shape::FACE))
-      {
-        anEdgesAndFaces.push_back(anObject);
-      }
-      else
-      {
-        anObjects.push_back(anObject);
-      }
-    }
-  }
-
-  // Getting tools.
-  AttributeSelectionListPtr aToolsSelList = selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
-  for(int aToolsIndex = 0; aToolsIndex < aToolsSelList->size(); aToolsIndex++) {
-    AttributeSelectionPtr aToolAttr = aToolsSelList->value(aToolsIndex);
-    GeomShapePtr aTool = aToolAttr->value();
-    if(!aTool.get()) {
-      // It could be a construction plane.
-      ResultPtr aContext = aToolAttr->context();
-      aPlanes.push_back(aToolAttr->context()->shape());
-    }
-    else if (myOperationType != BOOL_FILL
-      && (aTool->shapeType() == GeomAPI_Shape::EDGE
-        || aTool->shapeType() == GeomAPI_Shape::FACE))
-    {
-      anEdgesAndFaces.push_back(aTool);
-    } else {
-      aTools.push_back(aTool);
-    }
-  }
-
-  int aResultIndex = 0;
-
-  switch(myOperationType) {
-    case BOOL_CUT:
-    case BOOL_COMMON:
-    case BOOL_FILL: {
-      if((anObjects.empty() && aCompSolidsObjects.empty())
-          || (aTools.empty() && aPlanes.empty())) {
-        std::string aFeatureError = "Error: Not enough objects for boolean operation.";
-        setError(aFeatureError);
-        return;
-      }
-
-      // For solids cut each object with all tools.
-      for(ListOfShape::iterator
-          anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
-        std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
-        ListOfShape aListWithObject;
-        aListWithObject.push_back(anObject);
-        GeomAlgoAPI_MakeShapeList aMakeShapeList;
-        std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
-        GeomShapePtr aResShape;
-
-        switch(myOperationType) {
-          case BOOL_CUT: {
-            aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
-                                                    aTools,
-                                                    GeomAlgoAPI_Boolean::BOOL_CUT));
-            aResShape = aBoolAlgo->shape();
-            break;
-          }
-          case BOOL_COMMON: {
-            aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
-                                                    aTools,
-                                                    GeomAlgoAPI_Boolean::BOOL_COMMON));
-            aResShape = aBoolAlgo->shape();
-            break;
-          }
-          case BOOL_FILL: {
-              std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
-                GeomAlgoAPI_ShapeTools::getBoundingBox(aListWithObject, 1.0);
-
-            // Resize planes.
-            ListOfShape aToolsWithPlanes = aTools;
-            for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
-                                            anIt != aPlanes.cend();
-                                            ++anIt)
-            {
-              GeomShapePtr aPlane = *anIt;
-              GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
-              std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
-                new GeomAlgoAPI_MakeShapeCustom);
-              aMkShCustom->addModified(aPlane, aTool);
-              aMakeShapeList.appendAlgo(aMkShCustom);
-              aToolsWithPlanes.push_back(aTool);
-            }
-
-            aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes));
-            aResShape = aBoolAlgo->shape();
-            if (aResShape.get() && aResShape->shapeType() == GeomAPI_Shape::COMPOUND) {
-              int aSubResultsNb = 0;
-              GeomAPI_ShapeIterator anIt(aResShape);
-              for(; anIt.more(); anIt.next()) {
-                ++aSubResultsNb;
-              }
-              if(aSubResultsNb == 1) {
-                anIt.init(aResShape);
-                if(anIt.more()) {
-                  aResShape = anIt.current();
-                }
-              }
-            }
-            break;
-          }
-        }
-
-        // Checking that the algorithm worked properly.
-        if(!aBoolAlgo->isDone()) {
-          static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-          setError(aFeatureError);
-          return;
-        }
-        if(aResShape->isNull()) {
-          static const std::string aShapeError = "Error: Resulting shape is Null.";
-          setError(aShapeError);
-          return;
-        }
-        if(!aBoolAlgo->isValid()) {
-          std::string aFeatureError = "Error: Resulting shape is not valid.";
-          setError(aFeatureError);
-          return;
-        }
-
-        aMakeShapeList.appendAlgo(aBoolAlgo);
-
-        if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27
-           || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
-        {
-          std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-            document()->createBody(data(), aResultIndex);
-
-          ListOfShape aUsedTools = aTools;
-          if (myOperationType == BOOL_FILL) {
-            aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
-          }
-
-          loadNamingDS(aResultBody, anObject, aUsedTools, aResShape,
-                       aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()),
-                       myOperationType == BOOL_FILL);
-          setResult(aResultBody, aResultIndex);
-          aResultIndex++;
-        }
-      }
-
-      // Compsolids handling
-      for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
-          anIt = aCompSolidsObjects.begin();
-          anIt != aCompSolidsObjects.end(); anIt++) {
-        std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
-        ListOfShape& aUsedInOperationSolids = anIt->second;
-
-        // Collecting solids from compsolids which will not be modified in boolean operation.
-        ListOfShape aNotUsedSolids;
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
-          ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
-          for(; anIt != aUsedInOperationSolids.end(); anIt++) {
-            if(aSolidInCompSolid->isEqual(*anIt)) {
-              break;
-            }
-          }
-          if(anIt == aUsedInOperationSolids.end()) {
-            aNotUsedSolids.push_back(aSolidInCompSolid);
-          }
-        }
-
-        GeomAlgoAPI_MakeShapeList aMakeShapeList;
-        std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
-
-        switch(myOperationType) {
-          case BOOL_CUT: {
-            aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
-                                                    aTools,
-                                                    GeomAlgoAPI_Boolean::BOOL_CUT));
-            break;
-          }
-          case BOOL_COMMON: {
-            aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
-                                                    aTools,
-                                                    GeomAlgoAPI_Boolean::BOOL_COMMON));
-            break;
-          }
-          case BOOL_FILL: {
-            std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
-              GeomAlgoAPI_ShapeTools::getBoundingBox(aUsedInOperationSolids, 1.0);
-
-            // Resize planes.
-            ListOfShape aToolsWithPlanes = aTools;
-            for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
-                                            anIt != aPlanes.cend();
-                                            ++anIt)
-            {
-              GeomShapePtr aPlane = *anIt;
-              GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
-              std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
-                new GeomAlgoAPI_MakeShapeCustom);
-              aMkShCustom->addModified(aPlane, aTool);
-              aMakeShapeList.appendAlgo(aMkShCustom);
-              aToolsWithPlanes.push_back(aTool);
-            }
-
-            aBoolAlgo.reset(new GeomAlgoAPI_Partition(aUsedInOperationSolids, aToolsWithPlanes));
-            break;
-          }
-        }
-
-        // Checking that the algorithm worked properly.
-        if(!aBoolAlgo->isDone()) {
-          static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-          setError(aFeatureError);
-          return;
-        }
-        if(aBoolAlgo->shape()->isNull()) {
-          static const std::string aShapeError = "Error: Resulting shape is Null.";
-          setError(aShapeError);
-          return;
-        }
-        if(!aBoolAlgo->isValid()) {
-          std::string aFeatureError = "Error: Resulting shape is not valid.";
-          setError(aFeatureError);
-          return;
-        }
-
-        aMakeShapeList.appendAlgo(aBoolAlgo);
-        GeomAPI_DataMapOfShapeShape aMapOfShapes;
-        aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
-        GeomShapePtr aResultShape = aBoolAlgo->shape();
-
-        // Add result to not used solids from compsolid.
-        if(!aNotUsedSolids.empty()) {
-          ListOfShape aShapesToAdd = aNotUsedSolids;
-          aShapesToAdd.push_back(aBoolAlgo->shape());
-          std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
-            new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
-          if(!aFillerAlgo->isDone()) {
-            std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-            setError(aFeatureError);
-            return;
-          }
-
-          aMakeShapeList.appendAlgo(aFillerAlgo);
-          aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
-          aResultShape = aFillerAlgo->shape();
-        }
-
-        if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27
-           || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
-        {
-          std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-            document()->createBody(data(), aResultIndex);
-
-          ListOfShape aUsedTools = aTools;
-          if (myOperationType == BOOL_FILL) {
-            aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
-          }
-
-          loadNamingDS(aResultBody,
-                       aCompSolid,
-                       aUsedTools,
-                       aResultShape,
-                       aMakeShapeList,
-                       aMapOfShapes,
-                       myOperationType == BOOL_FILL);
-          setResult(aResultBody, aResultIndex);
-          aResultIndex++;
-        }
-      }
-      break;
-    }
-    case BOOL_FUSE: {
-      if((anObjects.size() + aTools.size() +
-          aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) {
-        std::string aFeatureError = "Error: Not enough objects for boolean operation.";
-        setError(aFeatureError);
-        return;
-      }
-
-      // Collecting all solids which will be fused.
-      ListOfShape aSolidsToFuse;
-      aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end());
-      aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end());
-
-      // Collecting solids from compsolids which will not be modified
-      // in boolean operation and will be added to result.
-      ListOfShape aShapesToAdd;
-      for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
-          anIt = aCompSolidsObjects.begin();
-          anIt != aCompSolidsObjects.end(); anIt++) {
-        std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
-        ListOfShape& aUsedInOperationSolids = anIt->second;
-        aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
-                             aUsedInOperationSolids.end());
-
-        // Collect solids from compsolid which will not be modified in boolean operation.
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
-          ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
-          for(; anIt != aUsedInOperationSolids.end(); anIt++) {
-            if(aSolidInCompSolid->isEqual(*anIt)) {
-              break;
-            }
-          }
-          if(anIt == aUsedInOperationSolids.end()) {
-            aShapesToAdd.push_back(aSolidInCompSolid);
-          }
-        }
-      }
-
-      ListOfShape anOriginalShapes = aSolidsToFuse;
-      anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), aShapesToAdd.end());
-
-      // Cut edges and faces(if we have any) with solids.
-      GeomAlgoAPI_MakeShapeList aMakeShapeList;
-      GeomAPI_DataMapOfShapeShape aMapOfShapes;
-      std::shared_ptr<GeomAPI_Shape> aCuttedEdgesAndFaces;
-      if(!anEdgesAndFaces.empty()) {
-        std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces,
-                                            anOriginalShapes, GeomAlgoAPI_Boolean::BOOL_CUT));
-        if(aCutAlgo->isDone()) {
-          aCuttedEdgesAndFaces = aCutAlgo->shape();
-          aMakeShapeList.appendAlgo(aCutAlgo);
-          aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
-        }
-      }
-      anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
-                              anEdgesAndFaces.end());
-
-      // If we have compsolids then cut with not used solids all others.
-      if(!aShapesToAdd.empty()) {
-        aSolidsToFuse.clear();
-        for(ListOfShape::iterator
-            anIt = anOriginalShapes.begin(); anIt != anOriginalShapes.end(); anIt++) {
-          ListOfShape aOneObjectList;
-          aOneObjectList.push_back(*anIt);
-          std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(
-            new GeomAlgoAPI_Boolean(aOneObjectList, aShapesToAdd, GeomAlgoAPI_Boolean::BOOL_CUT));
-
-          if(GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-27) {
-            aSolidsToFuse.push_back(aCutAlgo->shape());
-            aMakeShapeList.appendAlgo(aCutAlgo);
-            aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
-          }
-        }
-      }
-
-      if(!aSolidsToFuse.empty()) {
-        anObjects.clear();
-        anObjects.push_back(aSolidsToFuse.back());
-        aSolidsToFuse.pop_back();
-        aTools = aSolidsToFuse;
-      }
-
-      // Fuse all objects and all tools.
-      std::shared_ptr<GeomAPI_Shape> aShape;
-      if(anObjects.size() == 1 && aTools.empty()) {
-        aShape = anObjects.front();
-      } else if(anObjects.empty() && aTools.size() == 1) {
-        aShape = aTools.front();
-      } else if((anObjects.size() + aTools.size()) > 1){
-        std::shared_ptr<GeomAlgoAPI_Boolean> aFuseAlgo(new GeomAlgoAPI_Boolean(anObjects,
-                                                                aTools,
-                                                                GeomAlgoAPI_Boolean::BOOL_FUSE));
-
-        // Checking that the algorithm worked properly.
-        if(!aFuseAlgo->isDone()) {
-          static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-          setError(aFeatureError);
-          return;
-        }
-        if(aFuseAlgo->shape()->isNull()) {
-          static const std::string aShapeError = "Error: Resulting shape is Null.";
-          setError(aShapeError);
-          return;
-        }
-        if(!aFuseAlgo->isValid()) {
-          std::string aFeatureError = "Error: Resulting shape is not valid.";
-          setError(aFeatureError);
-          return;
-        }
-
-        aShape = aFuseAlgo->shape();
-        aMakeShapeList.appendAlgo(aFuseAlgo);
-        aMapOfShapes.merge(aFuseAlgo->mapOfSubShapes());
-      }
-
-      // Combine result with not used solids from compsolid and edges and faces (if we have any).
-      if(aCuttedEdgesAndFaces.get() && !aCuttedEdgesAndFaces->isNull()) {
-        aShapesToAdd.push_back(aCuttedEdgesAndFaces);
-      } else {
-        aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), anEdgesAndFaces.end());
-      }
-      if(!aShapesToAdd.empty()) {
-        if(aShape.get()) {
-          aShapesToAdd.push_back(aShape);
-        }
-        std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
-          new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
-        if(!aFillerAlgo->isDone()) {
-          std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-          setError(aFeatureError);
-          return;
-        }
-        if(aFillerAlgo->shape()->isNull()) {
-          static const std::string aShapeError = "Error: Resulting shape is Null.";
-          setError(aShapeError);
-          return;
-        }
-        if(!aFillerAlgo->isValid()) {
-          std::string aFeatureError = "Error: Resulting shape is not valid.";
-          setError(aFeatureError);
-          return;
-        }
-
-        aShape = aFillerAlgo->shape();
-        aMakeShapeList.appendAlgo(aFillerAlgo);
-        aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
-      }
-
-      std::shared_ptr<GeomAPI_Shape> aBackShape = anOriginalShapes.back();
-      anOriginalShapes.pop_back();
-      std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-        document()->createBody(data(), aResultIndex);
-      loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
-                   aShape, aMakeShapeList, aMapOfShapes);
-      setResult(aResultBody, aResultIndex);
-      aResultIndex++;
-      break;
-    }
-    case BOOL_SMASH: {
-      if((anObjects.empty() && aCompSolidsObjects.empty()) || aTools.empty()) {
-        std::string aFeatureError = "Error: Not enough objects for boolean operation.";
-        setError(aFeatureError);
-        return;
-      }
-
-      // List of original solids for naming.
-      ListOfShape anOriginalShapes;
-      anOriginalShapes.insert(anOriginalShapes.end(), anObjects.begin(), anObjects.end());
-      anOriginalShapes.insert(anOriginalShapes.end(), aTools.begin(), aTools.end());
-
-      // Collecting all solids which will be smashed.
-      ListOfShape aShapesToSmash;
-      aShapesToSmash.insert(aShapesToSmash.end(), anObjects.begin(), anObjects.end());
-
-      // Collecting solids from compsolids which will not be modified in
-      // boolean operation and will be added to result.
-      ListOfShape aShapesToAdd;
-      for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
-        anIt = aCompSolidsObjects.begin();
-        anIt != aCompSolidsObjects.end(); anIt++) {
-        std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
-        ListOfShape& aUsedInOperationSolids = anIt->second;
-        anOriginalShapes.push_back(aCompSolid);
-        aShapesToSmash.insert(aShapesToSmash.end(), aUsedInOperationSolids.begin(),
-                              aUsedInOperationSolids.end());
-
-        // Collect solids from compsolid which will not be modified in boolean operation.
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
-          ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
-          for(; anIt != aUsedInOperationSolids.end(); anIt++) {
-            if(aSolidInCompSolid->isEqual(*anIt)) {
-              break;
-            }
-          }
-          if(anIt == aUsedInOperationSolids.end()) {
-            aShapesToAdd.push_back(aSolidInCompSolid);
-          }
-        }
-      }
-
-      GeomAlgoAPI_MakeShapeList aMakeShapeList;
-      GeomAPI_DataMapOfShapeShape aMapOfShapes;
-      if(!aShapesToAdd.empty()) {
-        // Cut objects with not used solids.
-        std::shared_ptr<GeomAlgoAPI_Boolean> anObjectsCutAlgo(new GeomAlgoAPI_Boolean(
-                                                              aShapesToSmash,
-                                                              aShapesToAdd,
-                                                              GeomAlgoAPI_Boolean::BOOL_CUT));
-
-        if(GeomAlgoAPI_ShapeTools::volume(anObjectsCutAlgo->shape()) > 1.e-27) {
-          aShapesToSmash.clear();
-          aShapesToSmash.push_back(anObjectsCutAlgo->shape());
-          aMakeShapeList.appendAlgo(anObjectsCutAlgo);
-          aMapOfShapes.merge(anObjectsCutAlgo->mapOfSubShapes());
-        }
-
-        // Cut tools with not used solids.
-        std::shared_ptr<GeomAlgoAPI_Boolean> aToolsCutAlgo(new GeomAlgoAPI_Boolean(aTools,
-                                                              aShapesToAdd,
-                                                              GeomAlgoAPI_Boolean::BOOL_CUT));
-
-        if(GeomAlgoAPI_ShapeTools::volume(aToolsCutAlgo->shape()) > 1.e-27) {
-          aTools.clear();
-          aTools.push_back(aToolsCutAlgo->shape());
-          aMakeShapeList.appendAlgo(aToolsCutAlgo);
-          aMapOfShapes.merge(aToolsCutAlgo->mapOfSubShapes());
-        }
-      }
-
-      // Cut objects with tools.
-      std::shared_ptr<GeomAlgoAPI_Boolean> aBoolAlgo(new GeomAlgoAPI_Boolean(aShapesToSmash,
-                                                                aTools,
-                                                                GeomAlgoAPI_Boolean::BOOL_CUT));
-
-      // Checking that the algorithm worked properly.
-      if(!aBoolAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if(aBoolAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if(!aBoolAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
-        return;
-      }
-      aMakeShapeList.appendAlgo(aBoolAlgo);
-      aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
-
-      // Put all (cut result, tools and not used solids) to PaveFiller.
-      aShapesToAdd.push_back(aBoolAlgo->shape());
-      aShapesToAdd.insert(aShapesToAdd.end(), aTools.begin(), aTools.end());
-
-      std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(new GeomAlgoAPI_PaveFiller(aShapesToAdd,
-                                                                                     true));
-      if(!aFillerAlgo->isDone()) {
-        std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if(aFillerAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if(!aFillerAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
-        return;
-      }
-
-      std::shared_ptr<GeomAPI_Shape> aShape = aFillerAlgo->shape();
-      aMakeShapeList.appendAlgo(aFillerAlgo);
-      aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
-
-      std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
-      anOriginalShapes.pop_front();
-      std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-        document()->createBody(data(), aResultIndex);
-      loadNamingDS(aResultBody, aFrontShape, anOriginalShapes,
-        aShape, aMakeShapeList, aMapOfShapes);
-      setResult(aResultBody, aResultIndex);
-      aResultIndex++;
-
-      break;
-    }
-    default: {
-      std::string anOperationError = "Error: Wrong type of operation";
-      setError(anOperationError);
-      return;
-    }
-  }
-  // remove the rest results if there were produced in the previous pass
-  removeResults(aResultIndex);
-}
-
 //=================================================================================================
 void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                           const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                                           const ListOfShape& theTools,
                                           const std::shared_ptr<GeomAPI_Shape> theResultShape,
-                                          GeomAlgoAPI_MakeShape& theMakeShape,
-                                          GeomAPI_DataMapOfShapeShape& theMapOfShapes,
-                                          const bool theIsStoreAsGenerated)
+                                          const GeomMakeShapePtr& theMakeShape)
 {
   //load result
   if(theBaseShape->isEqual(theResultShape)) {
     theResultBody->store(theResultShape, false);
-  } else {
-    const int aModifyTag = 1;
-    const int aModifyEdgeTag = 2;
-    const int aModifyFaceTag = 3;
-    const int aDeletedTag = 4;
-    /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-    const int aSubsolidsTag = 5;
+    return;
+  }
+
+  theResultBody->storeModified(theBaseShape, theResultShape);
 
-    theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
+  theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
+  theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
 
-    const std::string aModName = "Modified";
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
+  theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
 
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
-      aModifyEdgeTag, aModEName, theMapOfShapes, false, theIsStoreAsGenerated, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-      aModifyFaceTag, aModFName, theMapOfShapes, false, theIsStoreAsGenerated, true);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::FACE, aDeletedTag);
+  for (ListOfShape::const_iterator anIter = theTools.begin();
+       anIter != theTools.end();
+       ++anIter)
+  {
+    GeomAPI_Shape::ShapeType aShapeType =
+      (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE
+                                                    : GeomAPI_Shape::EDGE;
+    theResultBody->loadModifiedShapes(theMakeShape, *anIter, aShapeType);
 
-    int aTag;
-    std::string aName;
-    for(ListOfShape::const_iterator
-        anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
-      if((*anIter)->shapeType() <= GeomAPI_Shape::FACE) {
-        aTag = aModifyFaceTag;
-        aName = aModFName;
-      } else {
-        aTag = aModifyEdgeTag;
-        aName = aModEName;
-      }
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter,
-        aName == aModEName ? GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE,
-        aTag, aName, theMapOfShapes, false, theIsStoreAsGenerated, true);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
-    }
+    theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
   }
 }
index ce70e57bc619a23adb39ed2f23015eab795ec68b..70aaad5915eb0e52b9d6c9a880b0518b90091de4 100644 (file)
@@ -59,9 +59,6 @@ public:
   /// \return boolean operation type.
   FEATURESPLUGIN_EXPORT OperationType operationType();
 
-  /// Creates a new part document if needed.
-  FEATURESPLUGIN_EXPORT virtual void execute();
-
   /// Request for initialization of data model of the feature: adding all attributes.
   FEATURESPLUGIN_EXPORT virtual void initAttributes();
 
@@ -70,17 +67,12 @@ protected:
   /// Use plugin manager for features creation.
   FeaturesPlugin_Boolean(const OperationType theOperationType);
 
-private:
-  std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
-
   /// Load Naming data structure of the feature to the document
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                     const ListOfShape& theTools,
                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
-                    GeomAlgoAPI_MakeShape& theMakeShape,
-                    GeomAPI_DataMapOfShapeShape& theMapOfShapes,
-                    const bool theIsStoreAsGenerated = false);
+                    const GeomMakeShapePtr& theMakeShape);
 
 private:
   OperationType myOperationType;
index c8cee631839272fbef71d96a584e6e4fad907cae..df16a3149b6764ad80f33797b6e6fc1ad915d95d 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "FeaturesPlugin_BooleanCommon.h"
 
+#include "FeaturesPlugin_Tools.h"
+
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeString.h>
@@ -34,6 +36,7 @@
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
 
 
 //==================================================================================================
@@ -76,7 +79,8 @@ void FeaturesPlugin_BooleanCommon::execute()
     }
     ResultPtr aContext = anObjectAttr->context();
     ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
-    if (aResCompSolidPtr.get())
+    if (!isSimpleMode
+        && aResCompSolidPtr.get())
     {
       std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
       GeomAPI_Shape::ShapeType aShapeType = aResCompSolidPtr->shape()->shapeType();
@@ -117,7 +121,7 @@ void FeaturesPlugin_BooleanCommon::execute()
     }
   }
 
-  if ((anObjects.empty() && aCompSolidsObjects.empty())
+  if ((anObjects.empty() && aCompSolidsObjects.empty() && aCompoundObjects.empty())
       || (!isSimpleMode && aTools.empty() && aPlanes.empty())) {
     std::string aFeatureError = "Error: Not enough objects for boolean operation.";
     setError(aFeatureError);
@@ -125,8 +129,10 @@ void FeaturesPlugin_BooleanCommon::execute()
   }
 
   int aResultIndex = 0;
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
-  GeomAPI_DataMapOfShapeShape aMapOfShapes;
+  std::string anError;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+  std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+  ListOfShape aResultShapesList;
 
   if (isSimpleMode)
   {
@@ -138,25 +144,13 @@ void FeaturesPlugin_BooleanCommon::execute()
                                 *anObjectsIt,
                                 GeomAlgoAPI_Boolean::BOOL_COMMON));
 
-      if (!aCommonAlgo->isDone()) {
-        std::string aFeatureError = "Error: An algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if (aCommonAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if (!aCommonAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+        setError(anError);
         return;
       }
 
       aShape = aCommonAlgo->shape();
-      aMakeShapeList.appendAlgo(aCommonAlgo);
-      aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
+      aMakeShapeList->appendAlgo(aCommonAlgo);
     }
 
     GeomAPI_ShapeIterator aShapeIt(aShape);
@@ -164,9 +158,23 @@ void FeaturesPlugin_BooleanCommon::execute()
       std::shared_ptr<ModelAPI_ResultBody> aResultBody =
         document()->createBody(data(), aResultIndex);
 
-      loadNamingDS(aResultBody, anObjects.front(), anObjects, aShape, aMakeShapeList, aMapOfShapes);
+      GeomShapePtr aBaseShape = anObjects.front();
+      anObjects.pop_front();
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aBaseShape,
+                                               anObjects,
+                                               aMakeShapeList,
+                                               aShape);
       setResult(aResultBody, aResultIndex);
       aResultIndex++;
+
+      aTools = anObjects;
+      FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+      aRBA.resultBody = aResultBody;
+      aRBA.baseShape = aBaseShape;
+      aRBA.makeShape = aMakeShapeList;
+      aResultBaseAlgoList.push_back(aRBA);
+      aResultShapesList.push_back(aShape);
     }
   } else {
     for (ListOfShape::iterator anObjectsIt = anObjects.begin();
@@ -176,7 +184,7 @@ void FeaturesPlugin_BooleanCommon::execute()
       std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
       ListOfShape aListWithObject;
       aListWithObject.push_back(anObject);
-      GeomAlgoAPI_MakeShapeList aMakeShapeList;
+      std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
       std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
       GeomShapePtr aResShape;
 
@@ -193,7 +201,7 @@ void FeaturesPlugin_BooleanCommon::execute()
         std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
           new GeomAlgoAPI_MakeShapeCustom);
         aMkShCustom->addModified(aPlane, aTool);
-        aMakeShapeList.appendAlgo(aMkShCustom);
+        aMakeShapeList->appendAlgo(aMkShCustom);
         aToolsWithPlanes.push_back(aTool);
       }
 
@@ -203,33 +211,32 @@ void FeaturesPlugin_BooleanCommon::execute()
       aResShape = aBoolAlgo->shape();
 
       // Checking that the algorithm worked properly.
-      if (!aBoolAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if (aResShape->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if (!aBoolAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+        setError(anError);
         return;
       }
 
-      aMakeShapeList.appendAlgo(aBoolAlgo);
+      aMakeShapeList->appendAlgo(aBoolAlgo);
 
       GeomAPI_ShapeIterator aShapeIt(aResShape);
       if (aShapeIt.more() || aResShape->shapeType() == GeomAPI_Shape::VERTEX) {
         std::shared_ptr<ModelAPI_ResultBody> aResultBody =
           document()->createBody(data(), aResultIndex);
 
-        loadNamingDS(aResultBody, anObject, aTools, aResShape,
-                     aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()));
+        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                                 anObject,
+                                                 aTools,
+                                                 aMakeShapeList,
+                                                 aResShape);
         setResult(aResultBody, aResultIndex);
         aResultIndex++;
+
+        FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+        aRBA.resultBody = aResultBody;
+        aRBA.baseShape = anObject;
+        aRBA.makeShape = aMakeShapeList;
+        aResultBaseAlgoList.push_back(aRBA);
+        aResultShapesList.push_back(aResShape);
       }
     }
 
@@ -267,25 +274,12 @@ void FeaturesPlugin_BooleanCommon::execute()
           GeomAlgoAPI_Boolean::BOOL_COMMON));
 
       // Checking that the algorithm worked properly.
-      if (!aCommonAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if (aCommonAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if (!aCommonAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+        setError(anError);
         return;
       }
 
       aMakeShapeList->appendAlgo(aCommonAlgo);
-      GeomAPI_DataMapOfShapeShape aMapOfShapes;
-      aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
       GeomShapePtr aResultShape = aCommonAlgo->shape();
 
       // Add result to not used solids from compsolid.
@@ -301,7 +295,6 @@ void FeaturesPlugin_BooleanCommon::execute()
         }
 
         aMakeShapeList->appendAlgo(aFillerAlgo);
-        aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
         aResultShape = aFillerAlgo->shape();
       }
 
@@ -311,14 +304,20 @@ void FeaturesPlugin_BooleanCommon::execute()
         std::shared_ptr<ModelAPI_ResultBody> aResultBody =
           document()->createBody(data(), aResultIndex);
 
-        loadNamingDS(aResultBody,
-          aCompSolid,
-          aTools,
-          aResultShape,
-          *aMakeShapeList,
-          aMapOfShapes);
+        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                                 aCompSolid,
+                                                 aTools,
+                                                 aMakeShapeList,
+                                                 aResultShape);
         setResult(aResultBody, aResultIndex);
         aResultIndex++;
+
+        FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+        aRBA.resultBody = aResultBody;
+        aRBA.baseShape = aCompSolid;
+        aRBA.makeShape = aMakeShapeList;
+        aResultBaseAlgoList.push_back(aRBA);
+        aResultShapesList.push_back(aResultShape);
       }
     }
 
@@ -356,25 +355,12 @@ void FeaturesPlugin_BooleanCommon::execute()
           GeomAlgoAPI_Boolean::BOOL_COMMON));
 
       // Checking that the algorithm worked properly.
-      if (!aCommonAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-        setError(aFeatureError);
-        return;
-      }
-      if (aCommonAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        return;
-      }
-      if (!aCommonAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+        setError(anError);
         return;
       }
 
       aMakeShapeList->appendAlgo(aCommonAlgo);
-      GeomAPI_DataMapOfShapeShape aMapOfShapes;
-      aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
       GeomShapePtr aResultShape = aCommonAlgo->shape();
 
       // Add result to not used shape from compound.
@@ -402,82 +388,30 @@ void FeaturesPlugin_BooleanCommon::execute()
         std::shared_ptr<ModelAPI_ResultBody> aResultBody =
           document()->createBody(data(), aResultIndex);
 
-        loadNamingDS(aResultBody,
-          aCompound,
-          aTools,
-          aResultShape,
-          *aMakeShapeList,
-          aMapOfShapes);
+        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                                 aCompound,
+                                                 aTools,
+                                                 aMakeShapeList,
+                                                 aResultShape);
         setResult(aResultBody, aResultIndex);
         aResultIndex++;
+
+        FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+        aRBA.resultBody = aResultBody;
+        aRBA.baseShape = aCompound;
+        aRBA.makeShape = aMakeShapeList;
+        aResultBaseAlgoList.push_back(aRBA);
+        aResultShapesList.push_back(aResultShape);
       }
     }
 
   }
 
+  // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
+  // result shape has been deleted, but in another it was modified or stayed.
+  GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+  FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
+
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
 }
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCommon::loadNamingDS(ResultBodyPtr theResultBody,
-                                                const GeomShapePtr theBaseShape,
-                                                const ListOfShape& theTools,
-                                                const GeomShapePtr theResultShape,
-                                                GeomAlgoAPI_MakeShape& theMakeShape,
-                                                GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
-  //load result
-  if (theBaseShape->isEqual(theResultShape)) {
-    theResultBody->store(theResultShape, false);
-  } else {
-    const int aModifyVTag = 1;
-    const int aModifyETag = 2;
-    const int aModifyFTag = 3;
-    const int aDeletedTag = 4;
-    /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-    const int aSubsolidsTag = 5;
-
-    theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
-    const std::string aModVName = "Modified_Vertex";
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
-
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aModifyVTag, aModVName, theMapOfShapes, false,
-                                               false, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
-                                               aModifyETag, aModEName, theMapOfShapes, false,
-                                               false, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-                                               aModifyFTag, aModFName, theMapOfShapes, false,
-                                               false, true);
-
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::VERTEX, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::EDGE, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::FACE, aDeletedTag);
-
-    for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
-    {
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
-                                                 aModifyVTag, aModVName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
-                                                 aModifyETag, aModEName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
-                                                 aModifyFTag, aModFName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
-    }
-  }
-}
index caf67d38e76c1c90999d0bca2eeda1ccd583a49c..d7dafcd6714ab29d823391392ba84fb10c9930e1 100644 (file)
@@ -91,17 +91,6 @@ public:
 
   /// Use plugin manager for features creation.
   FeaturesPlugin_BooleanCommon();
-
-private:
-
-  /// Load Naming data structure of the feature to the document
-  void loadNamingDS(ResultBodyPtr theResultBody,
-                    const GeomShapePtr theBaseShape,
-                    const ListOfShape& theTools,
-                    const GeomShapePtr theResultShape,
-                    GeomAlgoAPI_MakeShape& theMakeShape,
-                    GeomAPI_DataMapOfShapeShape& theMapOfShapes);
-
 };
 
 #endif
index 79b959e9b0531737345e9344fe49d12dc539ae44..bfe0fdc2c26127ce96e9ba425a361a57dc3dc82b 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "FeaturesPlugin_BooleanCut.h"
 
+#include "FeaturesPlugin_Tools.h"
+
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_Tools.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
 
-//==================================================================================================
-const int ModifyVTag = 1;
-const int ModifyETag = 2;
-const int ModifyFTag = 3;
-const int DeletedTag = 4;
-/// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-const int SubsolidsTag = 5;
-
-
 //==================================================================================================
 FeaturesPlugin_BooleanCut::FeaturesPlugin_BooleanCut()
 : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT)
@@ -108,8 +103,9 @@ void FeaturesPlugin_BooleanCut::execute()
     return;
   }
 
-  std::vector<ResultBaseAlgo> aResultBaseAlgoList;
+  std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
   ListOfShape aResultShapesList;
+  std::string anError;
 
   // For solids cut each object with all tools.
   for(ListOfShape::iterator anObjectsIt = anObjects.begin();
@@ -124,19 +120,8 @@ void FeaturesPlugin_BooleanCut::execute()
     GeomShapePtr aResShape = aCutAlgo->shape();
 
     // Checking that the algorithm worked properly.
-    if (!aCutAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if(aResShape->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aCutAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
@@ -148,13 +133,15 @@ void FeaturesPlugin_BooleanCut::execute()
       std::shared_ptr<ModelAPI_ResultBody> aResultBody =
         document()->createBody(data(), aResultIndex);
 
-      loadNamingDS(aResultBody, anObject, aTools, aResShape,
-                   *aMakeShapeList, *(aCutAlgo->mapOfSubShapes()),
-                   false);
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               anObject,
+                                               aTools,
+                                               aMakeShapeList,
+                                               aResShape);
       setResult(aResultBody, aResultIndex);
       aResultIndex++;
 
-      ResultBaseAlgo aRBA;
+      FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
       aRBA.resultBody = aResultBody;
       aRBA.baseShape = anObject;
       aRBA.makeShape = aMakeShapeList;
@@ -197,25 +184,12 @@ void FeaturesPlugin_BooleanCut::execute()
                               GeomAlgoAPI_Boolean::BOOL_CUT));
 
     // Checking that the algorithm worked properly.
-    if (!aCutAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aCutAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aCutAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aMakeShapeList->appendAlgo(aCutAlgo);
-    GeomAPI_DataMapOfShapeShape aMapOfShapes;
-    aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
     GeomShapePtr aResultShape = aCutAlgo->shape();
 
     // Add result to not used solids from compsolid.
@@ -231,7 +205,6 @@ void FeaturesPlugin_BooleanCut::execute()
       }
 
       aMakeShapeList->appendAlgo(aFillerAlgo);
-      aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
       aResultShape = aFillerAlgo->shape();
     }
 
@@ -241,17 +214,15 @@ void FeaturesPlugin_BooleanCut::execute()
       std::shared_ptr<ModelAPI_ResultBody> aResultBody =
         document()->createBody(data(), aResultIndex);
 
-      loadNamingDS(aResultBody,
-                   aCompSolid,
-                   aTools,
-                   aResultShape,
-                   *aMakeShapeList,
-                   aMapOfShapes,
-                   false);
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aCompSolid,
+                                               aTools,
+                                               aMakeShapeList,
+                                               aResultShape);
       setResult(aResultBody, aResultIndex);
       aResultIndex++;
 
-      ResultBaseAlgo aRBA;
+      FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
       aRBA.resultBody = aResultBody;
       aRBA.baseShape = aCompSolid;
       aRBA.makeShape = aMakeShapeList;
@@ -294,25 +265,12 @@ void FeaturesPlugin_BooleanCut::execute()
                               GeomAlgoAPI_Boolean::BOOL_CUT));
 
     // Checking that the algorithm worked properly.
-    if (!aCutAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aCutAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aCutAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aMakeShapeList->appendAlgo(aCutAlgo);
-    GeomAPI_DataMapOfShapeShape aMapOfShapes;
-    aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
     GeomShapePtr aResultShape = aCutAlgo->shape();
 
     // Add result to not used shape from compound.
@@ -338,17 +296,15 @@ void FeaturesPlugin_BooleanCut::execute()
       std::shared_ptr<ModelAPI_ResultBody> aResultBody =
         document()->createBody(data(), aResultIndex);
 
-      loadNamingDS(aResultBody,
-                   aCompound,
-                   aTools,
-                   aResultShape,
-                   *aMakeShapeList,
-                   aMapOfShapes,
-                   false);
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aCompound,
+                                               aTools,
+                                               aMakeShapeList,
+                                               aResultShape);
       setResult(aResultBody, aResultIndex);
       aResultIndex++;
 
-      ResultBaseAlgo aRBA;
+      FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
       aRBA.resultBody = aResultBody;
       aRBA.baseShape = aCompound;
       aRBA.makeShape = aMakeShapeList;
@@ -360,102 +316,8 @@ void FeaturesPlugin_BooleanCut::execute()
   // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
   // result shape has been deleted, but in another it was modified or stayed.
   GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
-  storeDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
+  FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
 
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
 }
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCut::loadNamingDS(ResultBodyPtr theResultBody,
-                                             const GeomShapePtr theBaseShape,
-                                             const ListOfShape& theTools,
-                                             const GeomShapePtr theResultShape,
-                                             GeomAlgoAPI_MakeShape& theMakeShape,
-                                             GeomAPI_DataMapOfShapeShape& theMapOfShapes,
-                                             const bool theIsStoreAsGenerated)
-{
-  //load result
-  if(theBaseShape->isEqual(theResultShape)) {
-    theResultBody->store(theResultShape, false);
-  } else {
-    theResultBody->storeModified(theBaseShape, theResultShape, SubsolidsTag);
-
-    const std::string aModVName = "Modified_Vertex";
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
-
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
-                                               ModifyVTag, aModVName, theMapOfShapes, false,
-                                               theIsStoreAsGenerated, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
-                                               ModifyETag, aModEName, theMapOfShapes, false,
-                                               theIsStoreAsGenerated, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-                                               ModifyFTag, aModFName, theMapOfShapes, false,
-                                               theIsStoreAsGenerated, true);
-
-    for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
-    {
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
-                                                 ModifyVTag, aModVName, theMapOfShapes, false,
-                                                 theIsStoreAsGenerated, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
-                                                 ModifyETag, aModEName, theMapOfShapes, false,
-                                                 theIsStoreAsGenerated, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
-                                                 ModifyFTag, aModFName, theMapOfShapes, false,
-                                                 theIsStoreAsGenerated, true);
-    }
-  }
-}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCut::storeDeletedShapes(
-  std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
-  const ListOfShape& theTools,
-  const GeomShapePtr theResultShapesCompound)
-{
-  for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
-       anIt != theResultBaseAlgoList.end();
-       ++anIt)
-  {
-    ResultBaseAlgo& aRCA = *anIt;
-    aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                       aRCA.baseShape,
-                                       GeomAPI_Shape::VERTEX,
-                                       DeletedTag,
-                                       theResultShapesCompound);
-    aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                       aRCA.baseShape,
-                                       GeomAPI_Shape::EDGE,
-                                       DeletedTag,
-                                       theResultShapesCompound);
-    aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                       aRCA.baseShape,
-                                       GeomAPI_Shape::FACE,
-                                       DeletedTag,
-                                       theResultShapesCompound);
-
-    for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
-    {
-      aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                         *anIter,
-                                         GeomAPI_Shape::VERTEX,
-                                         DeletedTag,
-                                         theResultShapesCompound);
-      aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                         *anIter,
-                                         GeomAPI_Shape::EDGE,
-                                         DeletedTag,
-                                         theResultShapesCompound);
-      aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
-                                         *anIter,
-                                         GeomAPI_Shape::FACE,
-                                         DeletedTag,
-                                         theResultShapesCompound);
-    }
-  }
-}
index 11c154ced95cca7479ef5b131460c7da9e071ece..2cc8048f838de227ec84ce87085c98722b4e892f 100644 (file)
@@ -55,30 +55,6 @@ public:
   /// Use plugin manager for features creation.
   FeaturesPlugin_BooleanCut();
 
-private:
-
-  struct ResultBaseAlgo {
-    ResultBodyPtr resultBody;
-    GeomShapePtr baseShape;
-    std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
-  };
-
-private:
-
-  /// Load Naming data structure of the feature to the document
-  void loadNamingDS(ResultBodyPtr theResultBody,
-                    const GeomShapePtr theBaseShape,
-                    const ListOfShape& theTools,
-                    const GeomShapePtr theResultShape,
-                    GeomAlgoAPI_MakeShape& theMakeShape,
-                    GeomAPI_DataMapOfShapeShape& theMapOfShapes,
-                    const bool theIsStoreAsGenerated = false);
-
-  /// Stores deleted shapes.
-  void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
-                          const ListOfShape& theTools,
-                          const GeomShapePtr theResultShapesCompound);
-
 };
 
 #endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp
new file mode 100644 (file)
index 0000000..d9f7faf
--- /dev/null
@@ -0,0 +1,260 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesPlugin_BooleanFill.h"
+
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
+
+#include <GeomAlgoAPI_Boolean.h>
+#include <GeomAlgoAPI_MakeShapeCustom.h>
+#include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Partition.h>
+#include <GeomAlgoAPI_PaveFiller.h>
+#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
+
+#include <algorithm>
+#include <map>
+
+//=================================================================================================
+FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill()
+  : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL)
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_BooleanFill::execute()
+{
+  std::string anError;
+  ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
+  std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
+
+  // Getting objects.
+  AttributeSelectionListPtr anObjectsSelList =
+    selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
+  for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
+    AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
+    std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
+    if(!anObject.get()) {
+      return;
+    }
+    ResultPtr aContext = anObjectAttr->context();
+    ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
+    if(aResCompSolidPtr.get()
+        && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
+      std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
+      std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+        anIt = aCompSolidsObjects.begin();
+      for(; anIt != aCompSolidsObjects.end(); anIt++) {
+        if(anIt->first->isEqual(aContextShape)) {
+          aCompSolidsObjects[anIt->first].push_back(anObject);
+          break;
+        }
+      }
+      if(anIt == aCompSolidsObjects.end()) {
+        aCompSolidsObjects[aContextShape].push_back(anObject);
+      }
+    } else {
+      anObjects.push_back(anObject);
+    }
+  }
+
+  // Getting tools.
+  AttributeSelectionListPtr aToolsSelList = selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
+  for(int aToolsIndex = 0; aToolsIndex < aToolsSelList->size(); aToolsIndex++) {
+    AttributeSelectionPtr aToolAttr = aToolsSelList->value(aToolsIndex);
+    GeomShapePtr aTool = aToolAttr->value();
+    if(!aTool.get()) {
+      // It could be a construction plane.
+      ResultPtr aContext = aToolAttr->context();
+      aPlanes.push_back(aToolAttr->context()->shape());
+    }
+    else {
+      aTools.push_back(aTool);
+    }
+  }
+
+  int aResultIndex = 0;
+
+  if ((anObjects.empty() && aCompSolidsObjects.empty())
+      || (aTools.empty() && aPlanes.empty())) {
+    std::string aFeatureError = "Error: Not enough objects for boolean operation.";
+    setError(aFeatureError);
+    return;
+  }
+
+  // For solids cut each object with all tools.
+  for(ListOfShape::iterator
+      anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
+    std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
+    ListOfShape aListWithObject;
+    aListWithObject.push_back(anObject);
+    std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+    std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
+    GeomShapePtr aResShape;
+
+    std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
+        GeomAlgoAPI_ShapeTools::getBoundingBox(aListWithObject, 1.0);
+
+    // Resize planes.
+    ListOfShape aToolsWithPlanes = aTools;
+    for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
+                                    anIt != aPlanes.cend();
+                                    ++anIt)
+    {
+      GeomShapePtr aPlane = *anIt;
+      GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
+      std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
+        new GeomAlgoAPI_MakeShapeCustom);
+      aMkShCustom->addModified(aPlane, aTool);
+      aMakeShapeList->appendAlgo(aMkShCustom);
+      aToolsWithPlanes.push_back(aTool);
+    }
+
+    aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes));
+    aResShape = aBoolAlgo->shape();
+    if (aResShape.get() && aResShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+      int aSubResultsNb = 0;
+      GeomAPI_ShapeIterator anIt(aResShape);
+      for(; anIt.more(); anIt.next()) {
+        ++aSubResultsNb;
+      }
+      if(aSubResultsNb == 1) {
+        anIt.init(aResShape);
+        if(anIt.more()) {
+          aResShape = anIt.current();
+        }
+      }
+    }
+
+    // Checking that the algorithm worked properly.
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+      setError(anError);
+      return;
+    }
+
+    aMakeShapeList->appendAlgo(aBoolAlgo);
+
+    std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+        document()->createBody(data(), aResultIndex);
+
+    ListOfShape aUsedTools = aTools;
+    aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
+
+    loadNamingDS(aResultBody, anObject, aUsedTools, aResShape, aMakeShapeList);
+    setResult(aResultBody, aResultIndex);
+    aResultIndex++;
+  }
+
+  // Compsolids handling
+  for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+      anIt = aCompSolidsObjects.begin();
+      anIt != aCompSolidsObjects.end(); anIt++) {
+    std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
+    ListOfShape& aUsedInOperationSolids = anIt->second;
+
+    // Collecting solids from compsolids which will not be modified in boolean operation.
+    ListOfShape aNotUsedSolids;
+    for(GeomAPI_ShapeExplorer
+        anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
+      std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
+      ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
+      for(; anIt != aUsedInOperationSolids.end(); anIt++) {
+        if(aSolidInCompSolid->isEqual(*anIt)) {
+          break;
+        }
+      }
+      if(anIt == aUsedInOperationSolids.end()) {
+        aNotUsedSolids.push_back(aSolidInCompSolid);
+      }
+    }
+
+    std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+    std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
+
+    std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
+      GeomAlgoAPI_ShapeTools::getBoundingBox(aUsedInOperationSolids, 1.0);
+
+    // Resize planes.
+    ListOfShape aToolsWithPlanes = aTools;
+    for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
+                                    anIt != aPlanes.cend();
+                                    ++anIt)
+    {
+      GeomShapePtr aPlane = *anIt;
+      GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
+      std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
+        new GeomAlgoAPI_MakeShapeCustom);
+      aMkShCustom->addModified(aPlane, aTool);
+      aMakeShapeList->appendAlgo(aMkShCustom);
+      aToolsWithPlanes.push_back(aTool);
+    }
+
+    aBoolAlgo.reset(new GeomAlgoAPI_Partition(aUsedInOperationSolids, aToolsWithPlanes));
+
+    // Checking that the algorithm worked properly.
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+      setError(anError);
+      return;
+    }
+
+    aMakeShapeList->appendAlgo(aBoolAlgo);
+    GeomShapePtr aResultShape = aBoolAlgo->shape();
+
+    // Add result to not used solids from compsolid.
+    if(!aNotUsedSolids.empty()) {
+      ListOfShape aShapesToAdd = aNotUsedSolids;
+      aShapesToAdd.push_back(aBoolAlgo->shape());
+      std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
+        new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
+      if(!aFillerAlgo->isDone()) {
+        std::string aFeatureError = "Error: PaveFiller algorithm failed.";
+        setError(aFeatureError);
+        return;
+      }
+
+      aMakeShapeList->appendAlgo(aFillerAlgo);
+      aResultShape = aFillerAlgo->shape();
+    }
+
+    std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+      document()->createBody(data(), aResultIndex);
+
+    ListOfShape aUsedTools = aTools;
+    aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
+
+    loadNamingDS(aResultBody,
+                  aCompSolid,
+                  aUsedTools,
+                  aResultShape,
+                  aMakeShapeList);
+    setResult(aResultBody, aResultIndex);
+    aResultIndex++;
+  }
+
+  // remove the rest results if there were produced in the previous pass
+  removeResults(aResultIndex);
+}
index b4cb73b94a27ab992a577cc44adaf896a164829e..88b53213de41cadcf4ed8a8131ccf4111c5810ce 100644 (file)
@@ -44,10 +44,13 @@ public:
     return MY_KIND;
   }
 
+  /// Creates a new part document if needed.
+  FEATURESPLUGIN_EXPORT virtual void execute();
+
 public:
 
     /// Use plugin manager for features creation.
-  FeaturesPlugin_BooleanFill(): FeaturesPlugin_Boolean(BOOL_FILL) {};
+  FeaturesPlugin_BooleanFill();
 
 };
 
index 0f1ac4f724384ff62e4321a7e50b8bbd1071be19..f6e4599f730e695f2288301057c3d34a5c149211 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "FeaturesPlugin_BooleanFuse.h"
 
+#include "FeaturesPlugin_Tools.h"
+
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeSelectionList.h>
@@ -32,6 +34,7 @@
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAlgoAPI_UnifySameDomain.h>
 #include <GeomAPI_ShapeExplorer.h>
 
@@ -58,14 +61,16 @@ void FeaturesPlugin_BooleanFuse::initAttributes()
 //==================================================================================================
 void FeaturesPlugin_BooleanFuse::execute()
 {
+  std::string anError;
   ListOfShape anObjects, aTools, anEdgesAndFaces;
-  std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
+  std::map<GeomShapePtr, ListOfShape> aCompSolidsObjects;
 
   bool isSimpleCreation = false;
 
   AttributeStringPtr aCreationMethodAttr = string(CREATION_METHOD());
   if (aCreationMethodAttr.get()
-      && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) {
+      && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE())
+  {
     isSimpleCreation = true;
   }
 
@@ -74,7 +79,7 @@ void FeaturesPlugin_BooleanFuse::execute()
     selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
   for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
     AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
-    std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
+    GeomShapePtr anObject = anObjectAttr->value();
     if (!anObject.get()) {
       return;
     }
@@ -82,9 +87,10 @@ void FeaturesPlugin_BooleanFuse::execute()
     ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
     if (!isSimpleCreation
         && aResCompSolidPtr.get()
-        && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
-      std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
-      std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+        && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID)
+    {
+      GeomShapePtr aContextShape = aResCompSolidPtr->shape();
+      std::map<GeomShapePtr, ListOfShape>::iterator
         anIt = aCompSolidsObjects.begin();
       for (; anIt != aCompSolidsObjects.end(); anIt++) {
         if (anIt->first->isEqual(aContextShape)) {
@@ -136,10 +142,11 @@ void FeaturesPlugin_BooleanFuse::execute()
   // Collecting solids from compsolids which will not be modified
   // in boolean operation and will be added to result.
   ListOfShape aShapesToAdd;
-  for (std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
-       anIt = aCompSolidsObjects.begin();
-       anIt != aCompSolidsObjects.end(); anIt++) {
-    std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
+  for (std::map<GeomShapePtr, ListOfShape>::iterator anIt = aCompSolidsObjects.begin();
+       anIt != aCompSolidsObjects.end();
+       ++anIt)
+  {
+    GeomShapePtr aCompSolid = anIt->first;
     ListOfShape& aUsedInOperationSolids = anIt->second;
     aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
                          aUsedInOperationSolids.end());
@@ -147,7 +154,7 @@ void FeaturesPlugin_BooleanFuse::execute()
     // Collect solids from compsolid which will not be modified in boolean operation.
     for (GeomAPI_ShapeExplorer
          anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-      std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
+      GeomShapePtr aSolidInCompSolid = anExp.current();
       ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
       for (; anIt != aUsedInOperationSolids.end(); anIt++) {
         if (aSolidInCompSolid->isEqual(*anIt)) {
@@ -164,16 +171,14 @@ void FeaturesPlugin_BooleanFuse::execute()
   anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), aShapesToAdd.end());
 
   // Cut edges and faces(if we have any) with solids.
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
-  GeomAPI_DataMapOfShapeShape aMapOfShapes;
-  std::shared_ptr<GeomAPI_Shape> aCuttedEdgesAndFaces;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+  GeomShapePtr aCuttedEdgesAndFaces;
   if (!anEdgesAndFaces.empty()) {
     std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces,
       anOriginalShapes, GeomAlgoAPI_Boolean::BOOL_CUT));
     if (aCutAlgo->isDone()) {
       aCuttedEdgesAndFaces = aCutAlgo->shape();
-      aMakeShapeList.appendAlgo(aCutAlgo);
-      aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
+      aMakeShapeList->appendAlgo(aCutAlgo);
     }
   }
   anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
@@ -191,8 +196,7 @@ void FeaturesPlugin_BooleanFuse::execute()
 
       if (GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-27) {
         aSolidsToFuse.push_back(aCutAlgo->shape());
-        aMakeShapeList.appendAlgo(aCutAlgo);
-        aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
+        aMakeShapeList->appendAlgo(aCutAlgo);
       }
     }
   }
@@ -205,7 +209,7 @@ void FeaturesPlugin_BooleanFuse::execute()
   }
 
   // Fuse all objects and all tools.
-  std::shared_ptr<GeomAPI_Shape> aShape;
+  GeomShapePtr aShape;
   if (anObjects.size() == 1 && aTools.empty()) {
     aShape = anObjects.front();
   } else if (anObjects.empty() && aTools.size() == 1) {
@@ -216,25 +220,13 @@ void FeaturesPlugin_BooleanFuse::execute()
       GeomAlgoAPI_Boolean::BOOL_FUSE));
 
     // Checking that the algorithm worked properly.
-    if (!aFuseAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aFuseAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aFuseAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFuseAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aShape = aFuseAlgo->shape();
-    aMakeShapeList.appendAlgo(aFuseAlgo);
-    aMapOfShapes.merge(aFuseAlgo->mapOfSubShapes());
+    aMakeShapeList->appendAlgo(aFuseAlgo);
   }
 
   // Combine result with not used solids from compsolid and edges and faces (if we have any).
@@ -249,25 +241,13 @@ void FeaturesPlugin_BooleanFuse::execute()
     }
     std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
       new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
-    if (!aFillerAlgo->isDone()) {
-      std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aFillerAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aFillerAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aShape = aFillerAlgo->shape();
-    aMakeShapeList.appendAlgo(aFillerAlgo);
-    aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+    aMakeShapeList->appendAlgo(aFillerAlgo);
   }
 
   bool isRemoveEdges = false;
@@ -280,101 +260,35 @@ void FeaturesPlugin_BooleanFuse::execute()
     std::shared_ptr<GeomAlgoAPI_UnifySameDomain> aUnifyAlgo(
       new GeomAlgoAPI_UnifySameDomain(aShape));
 
-    if (!aUnifyAlgo->isDone()) {
-      std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aUnifyAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aUnifyAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aUnifyAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aShape = aUnifyAlgo->shape();
-    aMakeShapeList.appendAlgo(aUnifyAlgo);
-    aMapOfShapes.merge(aUnifyAlgo->mapOfSubShapes());
+    aMakeShapeList->appendAlgo(aUnifyAlgo);
   }
 
   int aResultIndex = 0;
 
-  std::shared_ptr<GeomAPI_Shape> aBackShape = anOriginalShapes.back();
+  GeomShapePtr aBackShape = anOriginalShapes.back();
   anOriginalShapes.pop_back();
-  std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-    document()->createBody(data(), aResultIndex);
-  loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
-               aShape, aMakeShapeList, aMapOfShapes);
+  ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+
+  FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                           aBackShape,
+                                           anOriginalShapes,
+                                           aMakeShapeList,
+                                           aShape);
   setResult(aResultBody, aResultIndex);
   aResultIndex++;
 
+  FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
+                                          aBackShape,
+                                          anOriginalShapes,
+                                          aMakeShapeList,
+                                          aShape);
+
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
 }
-
-//==================================================================================================
-void FeaturesPlugin_BooleanFuse::loadNamingDS(ResultBodyPtr theResultBody,
-                                              const GeomShapePtr theBaseShape,
-                                              const ListOfShape& theTools,
-                                              const GeomShapePtr theResultShape,
-                                              GeomAlgoAPI_MakeShape& theMakeShape,
-                                              GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
-  //load result
-  if (theBaseShape->isEqual(theResultShape)) {
-    theResultBody->store(theResultShape, false);
-  } else {
-    const int aModifyVTag = 1;
-    const int aModifyETag = 2;
-    const int aModifyFTag = 3;
-    const int aDeletedTag = 4;
-    /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-    const int aSubsolidsTag = 5;
-
-    theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
-    const std::string aModVName = "Modified_Vertex";
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
-
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aModifyVTag, aModVName, theMapOfShapes, false,
-                                               false, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
-                                               aModifyETag, aModEName, theMapOfShapes, false,
-                                               false, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-                                               aModifyFTag, aModFName, theMapOfShapes, false,
-                                               false, true);
-
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::VERTEX, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::EDGE, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::FACE, aDeletedTag);
-
-    for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
-    {
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
-                                                 aModifyVTag, aModVName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
-                                                 aModifyETag, aModEName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
-                                                 aModifyFTag, aModFName, theMapOfShapes, false,
-                                                 false, true);
-
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
-    }
-  }
-}
index 950b8223f769e8230eb09b666e435c2b8a0e4c29..1010871c4e0b65e33386738bee4f152e91dc1c27 100644 (file)
@@ -96,15 +96,6 @@ public:
 
   /// Use plugin manager for features creation.
   FeaturesPlugin_BooleanFuse();
-
-private:
-  /// Load Naming data structure of the feature to the document
-  void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                    const ListOfShape& theTools,
-                    const std::shared_ptr<GeomAPI_Shape> theResultShape,
-                    GeomAlgoAPI_MakeShape& theMakeShape,
-                    GeomAPI_DataMapOfShapeShape& theMapOfShapes);
 };
 
 #endif
index 0dbe5a3485dcbc1238587580dd2648057209549a..ee6c3c78538ac45b9210235df7242576d60370ff 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "FeaturesPlugin_BooleanSmash.h"
 
+#include "FeaturesPlugin_Tools.h"
+
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_Tools.h>
@@ -29,6 +31,8 @@
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
 
@@ -48,6 +52,7 @@ void FeaturesPlugin_BooleanSmash::initAttributes()
 //==================================================================================================
 void FeaturesPlugin_BooleanSmash::execute()
 {
+  std::string anError;
   ListOfShape anObjects, aTools;
   std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
 
@@ -144,8 +149,7 @@ void FeaturesPlugin_BooleanSmash::execute()
     }
   }
 
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
-  GeomAPI_DataMapOfShapeShape aMapOfShapes;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
   if (!aShapesToAdd.empty()) {
     // Cut objects with not used solids.
     std::shared_ptr<GeomAlgoAPI_Boolean> anObjectsCutAlgo(
@@ -156,8 +160,7 @@ void FeaturesPlugin_BooleanSmash::execute()
     if (GeomAlgoAPI_ShapeTools::volume(anObjectsCutAlgo->shape()) > 1.e-27) {
       aShapesToSmash.clear();
       aShapesToSmash.push_back(anObjectsCutAlgo->shape());
-      aMakeShapeList.appendAlgo(anObjectsCutAlgo);
-      aMapOfShapes.merge(anObjectsCutAlgo->mapOfSubShapes());
+      aMakeShapeList->appendAlgo(anObjectsCutAlgo);
     }
 
     // Cut tools with not used solids.
@@ -169,8 +172,7 @@ void FeaturesPlugin_BooleanSmash::execute()
     if (GeomAlgoAPI_ShapeTools::volume(aToolsCutAlgo->shape()) > 1.e-27) {
       aTools.clear();
       aTools.push_back(aToolsCutAlgo->shape());
-      aMakeShapeList.appendAlgo(aToolsCutAlgo);
-      aMapOfShapes.merge(aToolsCutAlgo->mapOfSubShapes());
+      aMakeShapeList->appendAlgo(aToolsCutAlgo);
     }
   }
 
@@ -181,23 +183,12 @@ void FeaturesPlugin_BooleanSmash::execute()
                             GeomAlgoAPI_Boolean::BOOL_CUT));
 
   // Checking that the algorithm worked properly.
-  if (!aBoolAlgo->isDone()) {
-    static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-    setError(aFeatureError);
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+    setError(anError);
     return;
   }
-  if (aBoolAlgo->shape()->isNull()) {
-    static const std::string aShapeError = "Error: Resulting shape is Null.";
-    setError(aShapeError);
-    return;
-  }
-  if (!aBoolAlgo->isValid()) {
-    std::string aFeatureError = "Error: Resulting shape is not valid.";
-    setError(aFeatureError);
-    return;
-  }
-  aMakeShapeList.appendAlgo(aBoolAlgo);
-  aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
+
+  aMakeShapeList->appendAlgo(aBoolAlgo);
 
   // Put all (cut result, tools and not used solids) to PaveFiller.
   GeomShapePtr aShape = aBoolAlgo->shape();
@@ -213,105 +204,34 @@ void FeaturesPlugin_BooleanSmash::execute()
   else {
     std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
       new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
-    if (!aFillerAlgo->isDone()) {
-      std::string aFeatureError = "Error: PaveFiller algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if (aFillerAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if (!aFillerAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aShape = aFillerAlgo->shape();
-    aMakeShapeList.appendAlgo(aFillerAlgo);
-    aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+    aMakeShapeList->appendAlgo(aFillerAlgo);
   }
 
   std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
   anOriginalShapes.pop_front();
   std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
-  loadNamingDS(aResultBody,
-               aFrontShape,
-               anOriginalShapes,
-               aShape,
-               aMakeShapeList,
-               aMapOfShapes);
+
+  FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                           aFrontShape,
+                                           anOriginalShapes,
+                                           aMakeShapeList,
+                                           aShape);
 
   setResult(aResultBody, aResultIndex);
   aResultIndex++;
 
+  FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
+                                          aFrontShape,
+                                          anOriginalShapes,
+                                          aMakeShapeList,
+                                          aShape);
+
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
 }
-
-//==================================================================================================
-void FeaturesPlugin_BooleanSmash::loadNamingDS(ResultBodyPtr theResultBody,
-                                             const GeomShapePtr theBaseShape,
-                                             const ListOfShape& theTools,
-                                             const GeomShapePtr theResultShape,
-                                             GeomAlgoAPI_MakeShape& theMakeShape,
-                                             GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
-  //load result
-  if (theBaseShape->isEqual(theResultShape)) {
-    theResultBody->store(theResultShape, false);
-  } else if (theResultShape->isEqual(theTools.front())) {
-    theResultBody->store(theResultShape, false);
-  } else {
-    const int aModifyVTag = 1;
-    const int aModifyETag = 2;
-    const int aModifyFTag = 3;
-    const int aDeletedTag = 4;
-    /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-    const int aSubsolidsTag = 5;
-
-    theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
-    const std::string aModVName = "Modified_Vertex";
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
-
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aModifyVTag, aModVName, theMapOfShapes, false,
-                                               true, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
-                                               aModifyETag, aModEName, theMapOfShapes, false,
-                                               true, true);
-    theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-                                               aModifyFTag, aModFName, theMapOfShapes, false,
-                                               true, true);
-
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::VERTEX, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::EDGE, aDeletedTag);
-    theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
-                                     GeomAPI_Shape::FACE, aDeletedTag);
-
-    for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
-    {
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
-                                                 aModifyVTag, aModVName, theMapOfShapes, false,
-                                                 true, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
-                                                 aModifyETag, aModEName, theMapOfShapes, false,
-                                                 true, true);
-
-      theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
-                                                 aModifyFTag, aModFName, theMapOfShapes, false,
-                                                 true, true);
-
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
-      theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
-    }
-  }
-}
index 0238d271292a3f754c2af746dfa77d488e1e0191..8a0057c9bcf7844550e5d2777adafa31331f09bf 100644 (file)
@@ -70,17 +70,6 @@ public:
 
   /// Use plugin manager for features creation.
   FeaturesPlugin_BooleanSmash();
-
-private:
-
-  /// Load Naming data structure of the feature to the document
-  void loadNamingDS(ResultBodyPtr theResultBody,
-                    const GeomShapePtr theBaseShape,
-                    const ListOfShape& theTools,
-                    const GeomShapePtr theResultShape,
-                    GeomAlgoAPI_MakeShape& theMakeShape,
-                    GeomAPI_DataMapOfShapeShape& theMapOfShapes);
-
 };
 
 #endif
index 6f0d65f4d923f4824950dd9986ed2e64ab49b191..6e3e8796b16493de7e94cbdb991ef587f26db77d 100644 (file)
@@ -29,7 +29,7 @@
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <map>
 
@@ -77,8 +77,6 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()
   for(; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend();
       ++aBoolObjIt, ++aBoolMSIt) {
 
-    int aTag = 1;
-
     ResultBodyPtr aResultBody = myFeature->document()->createBody(myFeature->data(), aResultIndex);
 
     if((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) {
@@ -86,26 +84,25 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean()
     }
     else
     {
-      aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape(), aTag);
-
-      aTag += 5000;
+      aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape());
 
       // Store generation history.
       ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin();
       ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin();
       for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend();
           ++aGenBaseIt, ++aGenMSIt) {
-        storeGenerationHistory(aResultBody, *aGenBaseIt, *aGenMSIt, aTag);
+        std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMSList(new GeomAlgoAPI_MakeShapeList());
+        aMSList->appendAlgo(*aGenMSIt);
+        aMSList->appendAlgo(*aBoolMSIt);
+        storeGenerationHistory(aResultBody, *aGenBaseIt, aMSList);
       }
 
-      int aModTag = aTag;
-      storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt, aModTag);
+      storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt);
 
       ResultBaseAlgo aRBA;
       aRBA.resultBody = aResultBody;
       aRBA.baseShape = *aBoolObjIt;
       aRBA.makeShape = *aBoolMSIt;
-      aRBA.delTag = aModTag;
       aResultBaseAlgoList.push_back(aRBA);
       aResultShapesList.push_back((*aBoolMSIt)->shape());
     }
@@ -199,9 +196,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
 
         // Collecting solids from compsolids which will not be modified in boolean operation.
         ListOfShape aShapesToAdd;
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
           for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) {
             if(aSolidInCompSolid->isEqual(*aUsedShapesIt)) {
@@ -282,9 +281,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
         aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end());
 
         // Collect solids from compsolid which will not be modified in boolean operation.
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::iterator anIt = aUsedShapes.begin();
           for(; anIt != aUsedShapes.end(); anIt++) {
             if(aSolidInCompSolid->isEqual(*anIt)) {
@@ -380,38 +381,16 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
 void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr theResultBody,
                                 const GeomShapePtr theObject,
                                 const ListOfShape& theTools,
-                                const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                int& theTag)
+                                const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
-  int aModTag = theTag;
-  int anEdgesAndFacesTag = ++aModTag;
-  int aDelTag = ++anEdgesAndFacesTag;
-  theTag = aDelTag;
-
-  const std::string aModName = "Modfied";
-
   ListOfShape aTools = theTools;
   aTools.push_back(theObject);
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMap = theMakeShape->mapOfSubShapes();
-
-  int aTag;
-  std::string aName;
   for(ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); anIt++) {
-    if((*anIt)->shapeType() == GeomAPI_Shape::EDGE) {
-      aTag = anEdgesAndFacesTag;
-      aName = aModName + "_Edge";
-    }
-    else if((*anIt)->shapeType() == GeomAPI_Shape::FACE) {
-      aTag = anEdgesAndFacesTag;
-      aName = aModName + "_Face";
-    } else {
-      aTag = aModTag;
-      aName = aModName;
-    }
-    theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt,
-      (*anIt)->shapeType() == GeomAPI_Shape::EDGE ?
-      GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, aTag, aName, *aMap.get(), false, false, true);
+    theResultBody->loadModifiedShapes(theMakeShape, *anIt,
+                                      (*anIt)->shapeType() == GeomAPI_Shape::EDGE ?
+                                                              GeomAPI_Shape::EDGE :
+                                                              GeomAPI_Shape::FACE);
   }
 }
 
@@ -426,18 +405,16 @@ void FeaturesPlugin_CompositeBoolean::storeDeletedShapes(
     ++anIt)
   {
     ResultBaseAlgo& aRCA = *anIt;
-    aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+    aRCA.resultBody->loadDeletedShapes(aRCA.makeShape,
       aRCA.baseShape,
       GeomAPI_Shape::FACE,
-      aRCA.delTag,
       theResultShapesCompound);
 
     for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
     {
-      aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+      aRCA.resultBody->loadDeletedShapes(aRCA.makeShape,
         *anIter,
         GeomAPI_Shape::FACE,
-        aRCA.delTag,
         theResultShapesCompound);
     }
   }
index 3f07d107b14ffc804f1e11285deed8b5ac447e3c..237c62d9d934901b626312c9717b3180e6058de3 100644 (file)
@@ -55,7 +55,6 @@ protected:
     ResultBodyPtr resultBody;
     GeomShapePtr baseShape;
     std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
-    int delTag;
   };
 
 protected:
@@ -80,15 +79,13 @@ protected:
   /// Stores generation history.
   virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
                                       const GeomShapePtr theBaseShape,
-                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                      int& theTag) = 0;
+                                      const GeomMakeShapePtr theMakeShape) = 0;
 
   /// Stores modification history.
   void storeModificationHistory(ResultBodyPtr theResultBody,
                                 const GeomShapePtr theObject,
                                 const ListOfShape& theTools,
-                                const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                int& theTag);
+                                const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 
   /// Stores deleted shapes.
   void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
index 77766fcb58be2cd4dacf071a65bca81d18ae6104..e3d5803ba2ae256197942166cc5d11c3dd031893 100644 (file)
 #include <map>
 #include <sstream>
 
-static void storeSubShape(ResultBodyPtr theResultBody,
+static void storeSubShape(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+                          ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
                           const GeomAPI_Shape::ShapeType theType,
-                          const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
-                          const std::string theName,
-                          int& theShapeIndex,
-                          int& theTag);
+                          const std::string& theName);
 
 //=================================================================================================
 void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int theInitFlags)
@@ -86,11 +84,12 @@ int FeaturesPlugin_CompositeSketch::numberOfSubs(bool forTree) const
 std::shared_ptr<ModelAPI_Feature> FeaturesPlugin_CompositeSketch::subFeature(const int theIndex,
                                                                              bool forTree)
 {
+  FeaturePtr aSubFeature;
   if(theIndex == 0) {
-    return std::dynamic_pointer_cast<ModelAPI_Feature>(data()->reference(SKETCH_ID())->value());
+    aSubFeature =
+        std::dynamic_pointer_cast<ModelAPI_Feature>(data()->reference(SKETCH_ID())->value());
   }
-
-  return std::shared_ptr<ModelAPI_Feature>();
+  return aSubFeature;
 }
 
 //=================================================================================================
@@ -110,14 +109,14 @@ int FeaturesPlugin_CompositeSketch::subFeatureId(const int theIndex) const
 //=================================================================================================
 bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const
 {
+  bool isSubFeature = false;
   // Check is this feature of result
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
-  if(!aFeature.get()) {
-    return false;
+  if (aFeature.get()) {
+    ObjectPtr aSub = data()->reference(SKETCH_ID())->value();
+    isSubFeature = aSub == theObject;
   }
-
-  ObjectPtr aSub = data()->reference(SKETCH_ID())->value();
-  return aSub == theObject;
+  return isSubFeature;
 }
 
 //=================================================================================================
@@ -237,31 +236,6 @@ void FeaturesPlugin_CompositeSketch::getBaseShapes(ListOfShape& theBaseShapesLis
   }
 }
 
-//=================================================================================================
-bool FeaturesPlugin_CompositeSketch::isMakeShapeValid(
-  const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
-{
-  // Check that algo is done.
-  if(!theMakeShape->isDone()) {
-    setError("Error: " + getKind() + " algorithm failed.");
-    return false;
-  }
-
-  // Check if shape is not null.
-  if(!theMakeShape->shape().get() || theMakeShape->shape()->isNull()) {
-    setError("Error: Resulting shape is null.");
-    return false;
-  }
-
-  // Check that resulting shape is valid.
-  if(!theMakeShape->isValid()) {
-    setError("Error: Resulting shape is not valid.");
-    return false;
-  }
-
-  return true;
-}
-
 //=================================================================================================
 void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape,
                                         const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
@@ -274,8 +248,7 @@ void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape
   aResultBody->storeGenerated(theBaseShape, theMakeShape->shape());
 
   // Store generated edges/faces.
-  int aGenTag = 1;
-  storeGenerationHistory(aResultBody, theBaseShape, theMakeShape, aGenTag);
+  storeGenerationHistory(aResultBody, theBaseShape, theMakeShape);
 
   setResult(aResultBody, theIndex);
 }
@@ -283,31 +256,17 @@ void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape
 //=================================================================================================
 void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theResultBody,
                                         const GeomShapePtr theBaseShape,
-                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                        int& theTag)
+                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
   GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
   GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
-  std::string aGenName = "Generated_";
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
   switch(aBaseShapeType) {
     case GeomAPI_Shape::EDGE: {
             aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
       break;
     }
     case GeomAPI_Shape::WIRE: {
-      //std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
-      //GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2);
-      //ListOfShape aV1History, aV2History;
-      //theMakeShape->generated(aV1, aV1History);
-      //theMakeShape->generated(aV2, aV2History);
-      //if(!aV1History.empty()) {
-      //  theResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", theTag++);
-      //}
-      //if(!aV2History.empty()) {
-      //  theResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", theTag++);
-      //}
       aShapeTypeToExplode = GeomAPI_Shape::COMPOUND;
       break;
     }
@@ -321,158 +280,54 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes
     }
   }
 
+  int aLateralIndex = 1;
+  int aBaseEdgeIndex = 1;
+  int aVertexIndex = 1;
+  int aBaseVertexIndex = 1;
+
   if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
       aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
-    theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
-                                                GeomAPI_Shape::VERTEX,
-                                                theTag++, aGenName + "Edge",
-                                                *aMapOfSubShapes.get());
+    theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX);
   }
   if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
       aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
-    theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(),
-                                                theBaseShape, GeomAPI_Shape::EDGE,
-                                                theTag++, aGenName + "Face",
-                                                *aMapOfSubShapes.get());
-  }
-  // issue #2197: make naming of edges generated from vertices
-  if (aShapeTypeToExplode == GeomAPI_Shape::EDGE) {
-    GeomAPI_DataMapOfShapeShape aFacesFromFromEdges;
-    GeomAPI_ShapeExplorer anEdgeExp(theBaseShape, GeomAPI_Shape::EDGE);
-    for(; anEdgeExp.more(); anEdgeExp.next()) {
-      ListOfShape aGenerated;
-      theMakeShape->generated(anEdgeExp.current(), aGenerated);
-      ListOfShape::iterator aGenIter = aGenerated.begin();
-      for(; aGenIter != aGenerated.end(); aGenIter++) {
-        GeomShapePtr aGen = *aGenIter;
-        if (aGen.get() && !aGen->isNull()) {
-          if ((*aGenIter)->shapeType() == GeomAPI_Shape::FACE) { // normal case
-            aFacesFromFromEdges.bind(aGen, anEdgeExp.current());
-          }
-        }
-      }
-    }
-
-    // closed revolution of 1-3 faces can not distinguish lateral and base edges
-    if (aFacesFromFromEdges.size() <= 3) {
-      bool isClosed = false; // lateral edges are closed (in full revolution)
-      GeomAPI_DataMapOfShapeShape anEdgesFromVertices;
-      GeomAPI_ShapeExplorer aVertExp(theBaseShape, GeomAPI_Shape::VERTEX);
-      for(; aVertExp.more(); aVertExp.next()) {
-        ListOfShape aGenerated;
-        theMakeShape->generated(aVertExp.current(), aGenerated);
-        ListOfShape::iterator aGenIter = aGenerated.begin();
-        for(; aGenIter != aGenerated.end(); aGenIter++) {
-          std::shared_ptr<GeomAPI_Shape> aGenerated = *aGenIter;
-          if (anEdgesFromVertices.isBound(aGenerated)) // already here
-            continue;
-          std::ostringstream aStream;
-          aStream<<"Lateral_"<<theTag++;
-          theResultBody->generated(aGenerated, aStream.str(), theTag++);
-
-          anEdgesFromVertices.bind(aGenerated, aVertExp.current());
-          std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aGenerated));
-          isClosed = isClosed || anEdge->isClosed();
-        }
-      }
-      if (isClosed) {
-        GeomAPI_ShapeExplorer anEdgesExp(theMakeShape->shape(), GeomAPI_Shape::EDGE);
-        for(; anEdgesExp.more(); anEdgesExp.next()) {
-          if (!anEdgesFromVertices.isBound(anEdgesExp.current())) {
-            // found a base edge
-            std::ostringstream aStream;
-            aStream<<"Base_Edge_"<<theTag++;
-            theResultBody->generated(anEdgesExp.current(), aStream.str(), theTag++);
-            // only one orientation is needed
-            anEdgesFromVertices.bind(anEdgesExp.current(), anEdgesExp.current());
-          }
-        }
-      } else if (aFacesFromFromEdges.size() == 1) { // 2233: sphere created by the revolution:
-        // vertices at degenerated edges will have the same name
-        GeomAPI_DataMapOfShapeShape aVertices;
-        GeomAPI_ShapeExplorer aVertExp(theMakeShape->shape(), GeomAPI_Shape::VERTEX);
-        for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
-          if (!aVertices.isBound(aVertExp.current())) {
-            // found a base edge
-            std::ostringstream aStream;
-            aStream<<"Vertex_"<<theTag++;
-            theResultBody->generated(aVertExp.current(), aStream.str(), theTag++);
-            // only one orientation is needed
-            aVertices.bind(aVertExp.current(), aVertExp.current());
-          }
-        }
-      }
-    } else { // issue #2197, test case 4 : edges that produce fully-revolved face,
-      // but contain only 2 edges (on apex of revolution)
-      GeomAPI_ShapeExplorer anEdgeExp(theBaseShape, GeomAPI_Shape::EDGE);
-      for(; anEdgeExp.more(); anEdgeExp.next()) {
-        ListOfShape aGenerated;
-        theMakeShape->generated(anEdgeExp.current(), aGenerated);
-        ListOfShape::iterator aGenIter = aGenerated.begin();
-        for(; aGenIter != aGenerated.end(); aGenIter++) {
-          GeomShapePtr aGen = (*aGenIter);
-          if (aGen.get() && !aGen->isNull()) {
-            GeomAPI_ShapeExplorer aFaceEdgeExp(aGen, GeomAPI_Shape::EDGE);
-            int aNumEdges = 0;
-            int aNumClosed = 0;
-            GeomShapePtr aNotClosedEdge;
-            GeomEdgePtr aDegenerateEdge;
-            GeomAPI_DataMapOfShapeShape alreadyIterated;
-            for(; aFaceEdgeExp.more(); aFaceEdgeExp.next()) {
-              std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aFaceEdgeExp.current()));
-              if (anEdge->isDegenerated()) {
-                aDegenerateEdge = anEdge;
-                continue;
-              }
-              if (alreadyIterated.isBound(anEdge))
-                continue;
-              alreadyIterated.bind(anEdge, anEdge);
-              aNumEdges++;
-              if (anEdge->isClosed()) {
-                aNumClosed++;
-              } else {
-                aNotClosedEdge = anEdge;
-              }
-            }
-            if (aNumEdges == 2 && aNumClosed == 1) {
-              std::ostringstream aStream;
-              aStream<<"Base_Edge_"<<theTag++;
-              theResultBody->generated(aNotClosedEdge, aStream.str(), theTag++);
-              if (aDegenerateEdge.get()) { // export vertex of the degenerated edge (apex) #2520
-                GeomAPI_ShapeExplorer anEdgeExp(aDegenerateEdge, GeomAPI_Shape::VERTEX);
-                if (anEdgeExp.more()) {
-                  std::ostringstream aStream;
-                  aStream << "Base_Vertex_" << theTag++;
-                  theResultBody->generated(anEdgeExp.current(), aStream.str(), theTag++);
-                }
-              }
-            }
-          }
-        }
-      }
-    }
+    theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
   }
-
+  std::list<std::shared_ptr<GeomAlgoAPI_MakeSweep> > aSweeps; // all sweeps collected
   std::shared_ptr<GeomAlgoAPI_MakeSweep> aMakeSweep =
     std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
   if(aMakeSweep.get()) {
+    aSweeps.push_back(aMakeSweep);
+  } else {
+    std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeList =
+      std::dynamic_pointer_cast<GeomAlgoAPI_MakeShapeList>(theMakeShape);
+    if (aMakeList.get()) {
+      ListOfMakeShape::const_iterator anIter = aMakeList->list().cbegin();
+      for(; anIter != aMakeList->list().cend(); anIter++) {
+        std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweep =
+          std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(*anIter);
+        if (aSweep.get())
+          aSweeps.push_back(aSweep);
+      }
+    }
+  }
+  std::list<std::shared_ptr<GeomAlgoAPI_MakeSweep> >::iterator aSweep = aSweeps.begin();
+  for(; aSweep != aSweeps.end(); aSweep++) {
     // Store from shapes.
-    storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
-                aMakeSweep->fromShapes(), "From_", theTag);
+    storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->fromShapes(), "From_");
 
     // Store to shapes.
-    storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
-                aMakeSweep->toShapes(), "To_", theTag);
+    storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->toShapes(), "To_");
   }
 }
 
 //=================================================================================================
-void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody,
-                              const GeomAPI_Shape::ShapeType theBaseShapeType,
-                              const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
-                              const ListOfShape& theShapes,
-                              const std::string theName,
-                              int& theTag)
+void FeaturesPlugin_CompositeSketch::storeShapes(
+  const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+  ResultBodyPtr theResultBody,
+  const GeomAPI_Shape::ShapeType theBaseShapeType,
+  const ListOfShape& theShapes,
+  const std::string theName)
 {
   GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE;
   std::string aShapeTypeStr = "Face";
@@ -501,48 +356,36 @@ void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody,
   }
 
   // Store shapes.
-  int aShapeIndex = 1;
-  int aFaceIndex = 1;
   for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) {
     GeomShapePtr aShape = *anIt;
 
     if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
       std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face");
-      storeSubShape(theResultBody,
-                    aShape,
-                    aShape->shapeType(),
-                    theMapOfSubShapes,
-                    aName,
-                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
-                    theTag);
+      storeSubShape(theMakeShape, theResultBody, aShape, aShape->shapeType(), aName);
     } else {
       std::string aName = theName + aShapeTypeStr;
-      storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
-                    theMapOfSubShapes, aName, aShapeIndex, theTag);
+      storeSubShape(theMakeShape, theResultBody, aShape, aShapeTypeToExplore, aName);
       if (theBaseShapeType == GeomAPI_Shape::WIRE) { // issue 2289: special names also for vertices
         aName = theName + "Vertex";
-        storeSubShape(theResultBody, aShape, GeomAPI_Shape::VERTEX,
-                      theMapOfSubShapes, aName, aShapeIndex, theTag);
+        storeSubShape(theMakeShape, theResultBody, aShape, GeomAPI_Shape::VERTEX, aName);
       }
     }
   }
 }
 
-void storeSubShape(ResultBodyPtr theResultBody,
-                   const GeomShapePtr theShape,
-                   const GeomAPI_Shape::ShapeType theType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
-                   const std::string theName,
-                   int& theShapeIndex,
-                   int& theTag)
+void storeSubShape(
+  const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+  ResultBodyPtr theResultBody,
+  const GeomShapePtr theShape,
+  const GeomAPI_Shape::ShapeType theType,
+  const std::string& theName)
 {
   for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
     GeomShapePtr aSubShape = anExp.current();
-    if(theMapOfSubShapes->isBound(aSubShape)) {
-      aSubShape = theMapOfSubShapes->find(aSubShape);
+    if (!theResultBody->generated(aSubShape, theName)) {
+      // store from/to shapes as primitives and then store modification of them by the boolean
+      theResultBody->generated(aSubShape, theName, false);
+      theResultBody->loadModifiedShapes(theMakeShape, aSubShape, theType);
     }
-    std::ostringstream aStr;
-    aStr << theName << "_" << theShapeIndex++;
-    theResultBody->generated(aSubShape, aStr.str(), theTag++);
   }
 }
index 62d5c30f69770e6ea69ff8899aa83742694ecef7..f714351aa3c038b5791dbc7b2b2b2afc4fa7bba0 100644 (file)
@@ -83,9 +83,6 @@ protected:
   /// \param[in] theIsMakeShells if true make shells from faces with shared edges.
   void getBaseShapes(ListOfShape& theBaseShapesList, const bool theIsMakeShells = true);
 
-  /// Checks make shape algo.
-  bool isMakeShapeValid(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
-
   /// Stores result of generation.
   void storeResult(const GeomShapePtr theBaseShape,
                    const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
@@ -94,16 +91,14 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 
-  /// Used to store from and to shapes.
-  void storeShapes(ResultBodyPtr theResultBody,
+  /// Used to store from and to shapes: generated, or in common modified tag
+  void storeShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+                   ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theBaseShapeType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const ListOfShape& theShapes,
-                   const std::string theName,
-                   int& theTag);
+                   const std::string theName);
 
 };
 
index baf8f639769f49b80e20980a6b7761b807be346d..05a31bb3e8b4eea5b2795c38d78fc6764a7e4bd9 100644 (file)
 #include <ModelAPI_Validator.h>
 
 #include <GeomAlgoAPI_Prism.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 
 //=================================================================================================
 FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
@@ -95,16 +97,29 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
   getBaseShapes(theBaseShapes);
 
   //Getting direction.
-  std::shared_ptr<GeomAPI_Dir> aDir;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
+  static const std::string aSelectionError = "Error: The direction shape selection is bad.";
   AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID());
-  if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
-  } else if(aSelection->context().get() &&
-            aSelection->context()->shape().get() &&
-            aSelection->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
+  GeomShapePtr aShape = aSelection->value();
+  if (!aShape.get()) {
+    if (aSelection->context().get()) {
+      aShape = aSelection->context()->shape();
+    }
+  }
+
+  GeomEdgePtr anEdge;
+  if (aShape.get()) {
+    if (aShape->isEdge())
+    {
+      anEdge = aShape->edge();
+    }
+    else if (aShape->isCompound())
+    {
+      GeomAPI_ShapeIterator anIt(aShape);
+      anEdge = anIt.current()->edge();
+    }
   }
+
+  std::shared_ptr<GeomAPI_Dir> aDir;
   if(anEdge.get()) {
     if(anEdge->isLine()) {
       aDir = anEdge->line()->direction();
@@ -134,6 +149,10 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
       if(!aToShape.get() && aSelection->context().get()) {
         aToShape = aSelection->context()->shape();
       }
+      if (aToShape.get() && aToShape->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aToShape);
+        aToShape = anIt.current();
+      }
     }
     aSelection = selection(FROM_OBJECT_ID());
     if(aSelection.get()) {
@@ -141,10 +160,15 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
       if(!aFromShape.get() && aSelection->context().get()) {
         aFromShape = aSelection->context()->shape();
       }
+      if (aFromShape.get() && aFromShape->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aFromShape);
+        aFromShape = anIt.current();
+      }
     }
   }
 
   // Generating result for each base shape.
+  std::string anError;
   for(ListOfShape::const_iterator
       anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
@@ -152,7 +176,8 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
     std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir,
                                                                         aToShape, aToSize,
                                                                         aFromShape, aFromSize));
-    if(!isMakeShapeValid(aPrismAlgo)) {
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), anError)) {
+      setError(anError);
       return false;
     }
 
index 88af05a750c715cb4dd46e280d65eefa8b9b6c9f..24ae1d7bc153ee7062cb02054d384a787dcc380d 100755 (executable)
@@ -38,9 +38,7 @@ bool FeaturesPlugin_ExtrusionBoolean::makeGeneration(ListOfShape& theBaseShapes,
 //=================================================================================================
 void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
                                         const GeomShapePtr theBaseShape,
-                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                        int& theTag)
+                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
-  FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape,
-                                                   theMakeShape, theTag);
+  FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
 }
index ed9f8f3c4d954f964345277dd585ee128b2a571c..8582456f19e75e5a93c9e8619e458fde7c043899 100644 (file)
@@ -44,8 +44,7 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 };
 
 #endif
index 8b0fdab8130349a2b35a6160557a2a2124f6565f..cf1dda3d287a099f5d4b80700c6e06b769673cc1 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <GeomAlgoAPI_Fillet.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_DataMapOfShapeMapOfShapes.h>
 #include <GeomAPI_ShapeExplorer.h>
@@ -147,6 +148,7 @@ void FeaturesPlugin_Fillet::execute()
   GeomAlgoAPI_MakeShapeList aMakeShapeList;
   std::shared_ptr<GeomAlgoAPI_Fillet> aFilletBuilder;
   int aResultIndex = 0;
+  std::string anError;
 
   GeomAPI_DataMapOfShapeMapOfShapes::iterator anIt = aSolidsAndSubs.begin();
   for (; anIt != aSolidsAndSubs.end(); ++anIt) {
@@ -158,45 +160,26 @@ void FeaturesPlugin_Fillet::execute()
       aFilletBuilder.reset(new GeomAlgoAPI_Fillet(aSolid, aFilletEdges, aRadius1));
     else
       aFilletBuilder.reset(new GeomAlgoAPI_Fillet(aSolid, aFilletEdges, aRadius1, aRadius2));
-    if (isFailed(aFilletBuilder))
+
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), anError)) {
+      setError(anError);
       return;
+    }
 
     GeomShapePtr aResult = unwrapCompound(aFilletBuilder->shape());
     std::shared_ptr<ModelAPI_ResultBody> aResultBody =
         document()->createBody(data(), aResultIndex);
 
-    loadNamingDS(aResultBody, aSolid, aFilletEdgesAndVertices, aResult, aFilletBuilder);
+    loadNamingDS(aResultBody, aSolid, aResult, aFilletBuilder);
     setResult(aResultBody, aResultIndex);
     aResultIndex++;
   }
   removeResults(aResultIndex);
 }
 
-bool FeaturesPlugin_Fillet::isFailed(
-    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
-{
-  if (!theAlgorithm->isDone()) {
-    static const std::string aFeatureError = "Error: fillet algorithm failed.";
-    setError(aFeatureError);
-    return true;
-  }
-  if (theAlgorithm->shape()->isNull()) {
-    static const std::string aShapeError = "Error: Resulting shape of fillet is Null.";
-    setError(aShapeError);
-    return true;
-  }
-  if (!theAlgorithm->isValid()) {
-    std::string aFeatureError = "Error: Resulting shape of fillet is not valid.";
-    setError(aFeatureError);
-    return true;
-  }
-  return false;
-}
-
 void FeaturesPlugin_Fillet::loadNamingDS(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-    const ListOfShape& theFilletShapes,
     const std::shared_ptr<GeomAPI_Shape> theResultShape,
     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
 {
@@ -206,32 +189,24 @@ void FeaturesPlugin_Fillet::loadNamingDS(
     return;
   }
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = theMakeShape->mapOfSubShapes();
-
-  const int aDeletedTag = 1;
-  const int aModifyTag = 2;
-  const int aGeneratedTag = 3;
-  /// sub solids will be placed at labels 4, 5, etc. if result is compound of solids
-  const int aSubsolidsTag = 4;
-
-  theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
+  theResultBody->storeModified(theBaseShape, theResultShape);
 
-  const std::string aModFaceName = "Modified_Face";
   const std::string aFilletFaceName = "Fillet_Face";
 
   // Store modified faces
-  theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), theBaseShape,
-      GeomAPI_Shape::FACE, aModifyTag, aModFaceName, *aMapOfShapes);
+  theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
 
   // Store new faces generated from edges and vertices
-  theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
-      GeomAPI_Shape::EDGE, aGeneratedTag, aFilletFaceName, *aMapOfShapes);
-  theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
-      GeomAPI_Shape::VERTEX, aGeneratedTag, aFilletFaceName, *aMapOfShapes);
+  theResultBody->loadGeneratedShapes(theMakeShape,
+                                     theBaseShape,
+                                     GeomAPI_Shape::EDGE,
+                                     aFilletFaceName);
+  theResultBody->loadGeneratedShapes(theMakeShape,
+                                     theBaseShape,
+                                     GeomAPI_Shape::VERTEX,
+                                     aFilletFaceName);
 
   // Deleted shapes
-  theResultBody->loadDeletedShapes(theMakeShape.get(), theBaseShape,
-                                   GeomAPI_Shape::EDGE, aDeletedTag);
-  theResultBody->loadDeletedShapes(theMakeShape.get(), theBaseShape,
-                                   GeomAPI_Shape::FACE, aDeletedTag);
+  theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
+  theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
 }
index d0aa71255a567699072cbc06dbedda56f310d71e..15472e2179684a0b717f7112252aab367ef0c051 100644 (file)
@@ -106,13 +106,9 @@ public:
   FeaturesPlugin_Fillet();
 
 private:
-  /// Check algorithm is finished correctly and store error otherwise
-  bool isFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
-
   /// Load Naming data structure of the feature to the document
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                    const ListOfShape& theFilletShapes,
                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
                     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 };
index b3cc312c52097f8113056fb743f35972132a157e..22e2d8383df9f6321bba22e74ec9e43ac1f0ebdd 100644 (file)
@@ -30,6 +30,7 @@
 #include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_ShapeExplorer.h>
 
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAlgoAPI_UnifySameDomain.h>
 
 
@@ -60,16 +61,9 @@ void FeaturesPlugin_FusionFaces::execute()
   std::shared_ptr<GeomAlgoAPI_UnifySameDomain> anAlgo(new GeomAlgoAPI_UnifySameDomain(aBaseShape));
 
   // Check algo status
-  if (!anAlgo->isDone()) {
-    setError("Error: Fusion algorithm failed.");
-    return;
-  }
-  if (anAlgo->shape()->isNull()) {
-    setError("Error: Resulting shape is Null.");
-    return;
-  }
-  if (!anAlgo->isValid()) {
-    setError("Error: Resulting shape is not valid.");
+  std::string anError;
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) {
+    setError(anError);
     return;
   }
 
@@ -81,15 +75,8 @@ void FeaturesPlugin_FusionFaces::execute()
   } else {
     aResultBody->storeModified(aBaseShape, aResultShape);
 
-    const int aModifyEdgeTag = 1;
-    const int aModifyFaceTag = 2;
-    const std::string aModEName = "Modified_Edge";
-    const std::string aModFName = "Modified_Face";
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = anAlgo->mapOfSubShapes();
-    aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::EDGE,
-      aModifyEdgeTag, aModEName, *aMapOfShapes.get(), true);
-    aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::FACE,
-      aModifyFaceTag, aModFName, *aMapOfShapes.get(), true);
+    aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::FACE);
   }
   setResult(aResultBody);
 }
index 7a33f2d463cf4e09dd340ae3ee9a247beac11f3e..93a02c79fe6399e022263c595acfd5ce5a4f37be 100644 (file)
@@ -27,6 +27,7 @@
 #include <ModelAPI_AttributeSelectionList.h>
 
 #include <GeomAlgoAPI_Intersection.h>
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAPI_ShapeExplorer.h>
 
 #include <sstream>
@@ -68,22 +69,12 @@ void FeaturesPlugin_Intersection::execute()
   int aResultIndex = 0;
 
   // Create result.
-  GeomAlgoAPI_Intersection anIntersectionAlgo(anObjects);
+  GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects));
 
   // Checking that the algorithm worked properly.
-  if (!anIntersectionAlgo.isDone()) {
-    static const std::string aFeatureError = "Error: Intersection algorithm failed.";
-    setError(aFeatureError);
-    return;
-  }
-  if (anIntersectionAlgo.shape()->isNull()) {
-    static const std::string aShapeError = "Error: Resulting shape is Null.";
-    setError(aShapeError);
-    return;
-  }
-  if (!anIntersectionAlgo.isValid()) {
-    std::string aFeatureError = "Error: Resulting shape is not valid.";
-    setError(aFeatureError);
+  std::string anError;
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anIntersectionAlgo, getKind(), anError)) {
+    setError(anError);
     return;
   }
 
@@ -98,66 +89,28 @@ void FeaturesPlugin_Intersection::execute()
 }
 
 //=================================================================================================
-void FeaturesPlugin_Intersection::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+void FeaturesPlugin_Intersection::loadNamingDS(ResultBodyPtr theResultBody,
                                                const ListOfShape& theObjects,
-                                               GeomAlgoAPI_MakeShape& theMakeShape)
+                                               const GeomMakeShapePtr& theMakeShape)
 {
-  std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape.shape();
+  std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape->shape();
+
+  if(theObjects.front()->isEqual(aResultShape)) {
+    theResultBody->store(aResultShape, false);
+    return;
+  }
+
   theResultBody->storeModified(theObjects.front(), aResultShape);
 
-  GeomAPI_DataMapOfShapeShape aShapesMap; // Map to store {result_shape, original_shape}
-  const int aShapeTypesNb = 2;
-  const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] =
-    {GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE};
+  const int aShapeTypesNb = 3;
+  const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] = {GeomAPI_Shape::VERTEX,
+                                                               GeomAPI_Shape::EDGE,
+                                                               GeomAPI_Shape::FACE };
   for (ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
     const GeomShapePtr aShape = *anIt;
     for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
-      for(GeomAPI_ShapeExplorer anOrigShapeExp(aShape, aShapeTypes[anIndex]);
-          anOrigShapeExp.more();
-          anOrigShapeExp.next()) {
-        ListOfShape aHistory;
-        const GeomShapePtr aSubShape = anOrigShapeExp.current();
-        theMakeShape.modified(aSubShape, aHistory);
-        for(ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
-            aHistoryIt != aHistory.cend();
-            ++aHistoryIt) {
-          aShapesMap.bind(*aHistoryIt, aSubShape);
-        }
-      }
-    }
-  }
-
-  int aModifiedVertexIndex(1),
-      aGeneratedVertexIndex(1),
-      aModifiedEdgeIndex(1),
-      aGeneratedEdgeIndex(1);
-  int aTag = 4;
-  GeomAPI_DataMapOfShapeShape aStoredShapes;
-  for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
-    for(GeomAPI_ShapeExplorer aShapeExp(aResultShape, aShapeTypes[anIndex]);
-        aShapeExp.more();
-        aShapeExp.next()) {
-      const GeomShapePtr aSubShape = aShapeExp.current();
-      if(aStoredShapes.isBound(aSubShape)) {
-        continue;
-      }
-      if(aShapesMap.isBound(aSubShape)) {
-        theResultBody->modified(aShapesMap.find(aSubShape),
-          aSubShape,
-          std::string("Modified_")
-            + (anIndex == 0 ? "Vertex_" : "Edge_")
-            + std::to_string((long long)(anIndex == 0 ? aModifiedVertexIndex++
-                                                      : aModifiedEdgeIndex++)),
-          aTag++);
-      } else {
-        theResultBody->generated(aSubShape,
-          std::string("Generated_")
-            + (anIndex == 0 ? "Vertex_" : "Edge_")
-            + std::to_string((long long)(anIndex == 0 ? aGeneratedVertexIndex++
-                                                      : aGeneratedEdgeIndex++)),
-          aTag++);
-      }
-      aStoredShapes.bind(aSubShape, aSubShape);
+      theResultBody->loadModifiedShapes(theMakeShape, aShape, aShapeTypes[anIndex]);
+      theResultBody->loadGeneratedShapes(theMakeShape, aShape, aShapeTypes[anIndex]);
     }
   }
 }
index c4a210fc857ae269dacd0f3a2f6eef998333709d..581c6e8608948677b4ee6ec8c2ca1ae0c0517f78 100644 (file)
@@ -73,7 +73,7 @@ private:
   /// Load Naming data structure of the feature to the document.
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const ListOfShape& theObjects,
-                    GeomAlgoAPI_MakeShape& theMakeShape);
+                    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 };
 
 #endif
index 5deb05c69390980a5990b37627aa39ab2950866e..7d04b88d6103364ca634c3b9ad0d03ddb67dbbff 100644 (file)
@@ -323,6 +323,13 @@ AISObjectPtr FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious)
   if ((aValues->size() == 0) || (aValues->value(0) <= Precision::Confusion()))
     return AISObjectPtr();
 
+  if (!myScreenPlane) {
+    // initialize a default plane for dimension
+    GeomPointPtr anOrigin(new GeomAPI_Pnt(0., 0., 0.));
+    GeomDirPtr aNormal(new GeomAPI_Dir(0., 0., 1.));
+    myScreenPlane = GeomPlanePtr(new GeomAPI_Pln(anOrigin, aNormal));
+  }
+
   AISObjectPtr anAIS;
   std::string aKind = string(MEASURE_KIND())->value();
   if (aKind == MEASURE_LENGTH())
@@ -342,8 +349,6 @@ AISObjectPtr FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious)
 AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePrevious)
 {
   AISObjectPtr aAISObj;
-  if (!myScreenPlane.get())
-    return aAISObj;
 
   AttributeSelectionPtr aSelectedFeature = selection(EDGE_FOR_LENGTH_ID());
 
@@ -404,8 +409,6 @@ AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePreviou
 AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevious)
 {
   AISObjectPtr aAISObj;
-  if (!myScreenPlane.get())
-    return aAISObj;
 
   AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID());
   AttributeSelectionPtr aSecondFeature = selection(DISTANCE_TO_OBJECT_ID());
index 5f8870f5952bb4799b2cf337555b26e35b7a766c..4206e904ff8c8e3927f82c3457d95fe55cc52fbb 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAlgoAPI_Translation.h>
 
 #include <GeomAPI_ShapeExplorer.h>
@@ -15,6 +16,7 @@
 #include <GeomAPI_Ax1.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeDouble.h>
@@ -49,24 +51,29 @@ void FeaturesPlugin_MultiRotation::initAttributes()
   data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(),
                        ModelAPI_AttributeInteger::typeId());
 
-  /*data()->addAttribute(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID(),
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+  data()->addAttribute(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID(),
                        ModelAPI_AttributeString::typeId());
   data()->addAttribute(FeaturesPlugin_MultiRotation::STEP_RADIAL_ID(),
                        ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID(),
-                       ModelAPI_AttributeInteger::typeId());*/
+                       ModelAPI_AttributeInteger::typeId());
+#endif
 }
 
 //=================================================================================================
 void FeaturesPlugin_MultiRotation::execute()
 {
-  /*std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value();
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+  std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value();
   if (useRadialDir.empty()) {
     performRotation1D();
   } else {
     performRotation2D();
-  }*/
+  }
+#else
   performRotation1D();
+#endif
 }
 
 //=================================================================================================
@@ -78,6 +85,7 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
   AttributeSelectionListPtr anObjectsSelList =
     selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID());
   if (anObjectsSelList->size() == 0) {
+    setError("Error: empty selection list");
     return;
   }
   for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
@@ -85,7 +93,6 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -93,21 +100,39 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
   }
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_ANGULAR_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
   }
 
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
+  }
+
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                      anEdge->line()->direction()));
+
   // Getting number of copies.
   int nbCopies =
     integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value();
@@ -149,6 +174,7 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
         aResultIndex++;
       }
     } else {
+      std::string anError;
       ListOfShape aListOfShape;
       std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > aListOfRotationAlgo;
 
@@ -164,19 +190,8 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
         aRotationnAlgo->build();
 
         // Checking that the algorithm worked properly.
-        if (!aRotationnAlgo->isDone()) {
-          static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
-          setError(aFeatureError);
-          break;
-        }
-        if (aRotationnAlgo->shape()->isNull()) {
-          static const std::string aShapeError = "Error : Resulting shape is null.";
-          setError(aShapeError);
-          break;
-        }
-        if (!aRotationnAlgo->isValid()) {
-          static const std::string aFeatureError = "Error : Resulting shape in not valid.";
-          setError(aFeatureError);
+        if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationnAlgo, getKind(), anError)) {
+          setError(anError);
           break;
         }
         aListOfShape.push_back(aRotationnAlgo->shape());
@@ -198,6 +213,7 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
 }
 
 //=================================================================================================
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
 void FeaturesPlugin_MultiRotation::performRotation2D()
 {
   // Getting objects.
@@ -213,7 +229,6 @@ void FeaturesPlugin_MultiRotation::performRotation2D()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -388,34 +403,16 @@ void FeaturesPlugin_MultiRotation::loadNamingDS2(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     std::shared_ptr<GeomAPI_Shape> theBaseShape)
 {
-  int aTag = 1;
-  int anIndex = 1;
-  std::string aRotatedName;
-
   for (std::list<std::shared_ptr<GeomAlgoAPI_Translation> >::const_iterator anIt =
     theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) {
-    std::cout << "LOAD" << std::endl;
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
     // naming of faces
-    aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face");
 
     // naming of edges
-    aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge");
 
     // naming of vertex
-    aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
-
-    ++anIndex;
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex");
   }
 }
 
@@ -425,7 +422,6 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb)
 {
-  int aTag = 6*nb+1;
   int anIndex = nb+1;
   std::string aRotatedName;
 
@@ -438,12 +434,13 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3(
     for(; anExp.more(); anExp.next()) {
        aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
        aRotatedName = aRotatedName + "_" + std::to_string((long long) numFace);
-       theResultBody->generated(anExp.current(), aRotatedName, aTag++);
+       theResultBody->generated(anExp.current(), aRotatedName);
        ++numFace;
     }
     ++anIndex;
   }
 }
+#endif
 
 //=================================================================================================
 void FeaturesPlugin_MultiRotation::loadNamingDS(
@@ -451,31 +448,15 @@ void FeaturesPlugin_MultiRotation::loadNamingDS(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     std::shared_ptr<GeomAPI_Shape> theBaseShape)
 {
-  int aTag = 1;
-  int anIndex = 1;
-  std::string aRotatedName;
-
   for (std::list<std::shared_ptr<GeomAlgoAPI_Rotation> >::const_iterator anIt =
     theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) {
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
     // naming of faces
-    aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face");
 
     // naming of edges
-    aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge");
 
     // naming of vertex
-    aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aTag++, aRotatedName, *aSubShapes.get(),
-                                               false, true);
-    ++anIndex;
+    theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex");
   }
 }
index 45af5b97c9b84cf36168ab0d9110ec27ec5321a2..ba5a7a19637248a817dbf61fba12a3497279a366 100644 (file)
@@ -106,7 +106,8 @@ private:
   /// Perform the multi rotation in one direction.
   void performRotation1D();
 
-  /// Perform the multi totation in two directions.
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+  /// Perform the multi rotation in two directions.
   void performRotation2D();
 
   void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
@@ -116,6 +117,7 @@ private:
   void loadNamingDS3(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
+#endif
 
   void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
index d23742c6df621107ffa698b33a2287421fa3024d..ba1c1e8dfef99da42399c8960a6a2f15449ea977 100644 (file)
 #include <FeaturesPlugin_MultiTranslation.h>
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Ax1.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeDouble.h>
@@ -86,6 +88,7 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
   AttributeSelectionListPtr anObjectsSelList =
     selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
   if (anObjectsSelList->size() == 0) {
+    setError("Error: empty selection list");
     return;
   }
   for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
@@ -93,7 +96,6 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -101,21 +103,39 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
   }
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
 
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+                                                       anEdge->line()->direction()));
+
   // Getting step.
   double aStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
 
@@ -150,6 +170,7 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
         aResultIndex++;
       }
     } else {
+      std::string anError;
       ListOfShape aListOfShape;
       std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
 
@@ -165,19 +186,9 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
         aTranslationAlgo->build();
 
         // Checking that the algorithm worked properly.
-        if (!aTranslationAlgo->isDone()) {
-          static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
-          setError(aFeatureError);
-          break;
-        }
-        if (aTranslationAlgo->shape()->isNull()) {
-          static const std::string aShapeError = "Error : Resulting shape is null.";
-          setError(aShapeError);
-          break;
-        }
-        if (!aTranslationAlgo->isValid()) {
-          static const std::string aFeatureError = "Error : Resulting shape in not valid.";
-          setError(aFeatureError);
+        if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(
+            aTranslationAlgo, getKind(), anError)) {
+          setError(anError);
           break;
         }
         aListOfShape.push_back(aTranslationAlgo->shape());
@@ -207,6 +218,7 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
   AttributeSelectionListPtr anObjectsSelList =
     selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
   if (anObjectsSelList->size() == 0) {
+    setError("Error: empty selection list");
     return;
   }
   for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
@@ -214,7 +226,6 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -222,33 +233,71 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
   }
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> aFirstAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
   }
-  if(anEdge) {
-    aFirstAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                              anEdge->line()->direction()));
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
   }
-  std::shared_ptr<GeomAPI_Ax1> aSecondAxis;
-  anObjRef = selection(FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
-  if(anEdge) {
-    aSecondAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                               anEdge->line()->direction()));
+
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  std::shared_ptr<GeomAPI_Ax1> aFirstAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
+
+  //Getting axis.
+  anObjRef = selection(AXIS_SECOND_DIR_ID());
+  aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
+
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
+  }
+
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax1> aSecondAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                           anEdge->line()->direction()));
+
   // Getting step.
   double aFirstStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
   double aSecondStep = real(FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID())->value();
@@ -310,6 +359,7 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
         }
       }
     } else {
+      std::string anError;
       ListOfShape aListOfShape;
       std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
 
@@ -329,21 +379,11 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
           aTranslationAlgo->build();
 
           // Checking that the algorithm worked properly.
-          if (!aTranslationAlgo->isDone()) {
-            static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
-            setError(aFeatureError);
-            break;
-          }
-          if (aTranslationAlgo->shape()->isNull()) {
-            static const std::string aShapeError = "Error : Resulting shape is null.";
-            setError(aShapeError);
+          if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(
+              aTranslationAlgo, getKind(), anError)) {
+            setError(anError);
             break;
           }
-          if (!aTranslationAlgo->isValid()) {
-            static const std::string aFeatureError = "Error : Resulting shape in not valid.";
-            setError(aFeatureError);
-           break;
-          }
           aListOfShape.push_back(aTranslationAlgo->shape());
           aListOfTranslationAlgo.push_back(aTranslationAlgo);
         }
@@ -368,32 +408,24 @@ void FeaturesPlugin_MultiTranslation::loadNamingDS(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     std::shared_ptr<GeomAPI_Shape> theBaseShape)
 {
-  int aTag = 1;
-  int anIndex = 1;
-  std::string aTranslatedName;
-
   for (std::list<std::shared_ptr<GeomAlgoAPI_Translation> >::const_iterator anIt =
     theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) {
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
     // naming of faces
-    aTranslatedName = "Translated_Face_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
-                                               aTag++, aTranslatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt,
+                                      theBaseShape,
+                                      GeomAPI_Shape::FACE,
+                                      "Translated_Face");
 
     // naming of edges
-    aTranslatedName = "Translated_Edge_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
-                                               aTag++, aTranslatedName, *aSubShapes.get(),
-                                               false, true);
+    theResultBody->loadModifiedShapes(*anIt,
+                                      theBaseShape,
+                                      GeomAPI_Shape::EDGE,
+                                      "Translated_Edge");
 
     // naming of vertex
-    aTranslatedName = "Translated_Vertex_" + std::to_string((long long) anIndex);
-    theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
-                                               aTag++, aTranslatedName, *aSubShapes.get(),
-                                               false, true);
-
-    ++anIndex;
+    theResultBody->loadModifiedShapes(*anIt,
+                                      theBaseShape,
+                                      GeomAPI_Shape::VERTEX,
+                                      "Translated_Vertex");
   }
 }
index cd4f34cd33a915148c3ba1fc8ebf5da5774cd3fb..43ae4130c0fa13b171c932b375b2cab4a6ec431b 100755 (executable)
@@ -38,6 +38,7 @@
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_Partition.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Face.h>
 #include <GeomAPI_ShapeExplorer.h>
@@ -66,9 +67,6 @@ static bool cutUnusedSubs(CompsolidSubs& theObjects, CompsolidSubs& theNotUsed,
                           std::shared_ptr<GeomAlgoAPI_MakeShapeList>& theMakeShapeList,
                           std::string& theError);
 
-static bool isAlgoFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
-                         std::string& theError);
-
 
 //=================================================================================================
 FeaturesPlugin_Partition::FeaturesPlugin_Partition()
@@ -125,7 +123,7 @@ void FeaturesPlugin_Partition::execute()
     new GeomAlgoAPI_Partition(aTargetObjects, aPlanes));
 
   // Checking that the algorithm worked properly.
-  if (isAlgoFailed(aPartitionAlgo, aError)) {
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) {
     setError(aError);
     return;
   }
@@ -143,7 +141,7 @@ void FeaturesPlugin_Partition::execute()
     aPartitionAlgo.reset(new GeomAlgoAPI_Partition(aTargetObjects, ListOfShape()));
 
     // Checking that the algorithm worked properly.
-    if (isAlgoFailed(aPartitionAlgo, aError)) {
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) {
       setError(aError);
       return;
     }
@@ -204,26 +202,18 @@ void FeaturesPlugin_Partition::storeResult(
     return;
   }
 
-  const int aDelTag = 1;
-  /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
-  const int aSubTag = 2;
-  int aModTag = aSubTag + 10000;
-  const std::string aModName = "Modified";
-
-  aResultBody->storeModified(aBaseShape, theResultShape, aSubTag);
+  aResultBody->storeModified(aBaseShape, theResultShape);
 
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
   theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end());
-  int anIndex = 1;
-  for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
+  for (ListOfShape::const_iterator anIt = theObjects.cbegin();
+       anIt != theObjects.cend();
+       ++anIt)
+  {
     GeomShapePtr aShape = *anIt;
-    std::string aModEdgeName = aModName + "_Edge_" + std::to_string((long long)anIndex);
-    aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::EDGE,
-      aModTag, aModEdgeName, *aMapOfSubShapes.get(), false, true, true);
-    std::string aModFaceName = aModName + "_Face_" + std::to_string((long long)anIndex++);
-    aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE,
-      aModTag + 1, aModFaceName, *aMapOfSubShapes.get(), false, true, true);
-    aResultBody->loadDeletedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE, aDelTag);
+    aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
+    aResultBody->loadDeletedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
   }
 
   setResult(aResultBody, theIndex);
@@ -384,7 +374,7 @@ static bool cutSubs(const GeomShapePtr& theFirstArgument,
     // cut from current list of solids
     aCutAlgo.reset(
         new GeomAlgoAPI_Boolean(aUIt->second, theTools, GeomAlgoAPI_Boolean::BOOL_CUT));
-    if (isAlgoFailed(aCutAlgo, theError))
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, "", theError))
       return false;
     theMakeShapeList->appendAlgo(aCutAlgo);
 
@@ -419,22 +409,3 @@ bool cutUnusedSubs(CompsolidSubs& theObjects, CompsolidSubs& theNotUsed,
   return cutSubs(aFirstArgument, theObjects, aToolsForUsed, theMakeShapeList, theError)
       && cutSubs(aFirstArgument, theNotUsed, aToolsForUnused, theMakeShapeList, theError);
 }
-
-bool isAlgoFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo, std::string& theError)
-{
-  if (!theAlgo->isDone()) {
-    theError = "Error: Partition algorithm failed.";
-    return true;
-  }
-  if (theAlgo->shape()->isNull()) {
-    theError = "Error: Resulting shape is Null.";
-    return true;
-  }
-  if (!theAlgo->isValid()) {
-    theError = "Error: Resulting shape is not valid.";
-    return true;
-  }
-
-  theError.clear();
-  return false;
-}
index ca72a5aeb951bc15b49bf129cd14b79e5e0e3508..b81823597a4224558ff4409e4d5e505b32b6f3ba 100644 (file)
@@ -30,6 +30,8 @@
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_Pipe.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
 #include <GeomAPI_PlanarEdges.h>
 #include <GeomAPI_ShapeExplorer.h>
 
 static void storeSubShape(ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
                           const GeomAPI_Shape::ShapeType theType,
-                          const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                           const std::string theName,
-                          int& theShapeIndex,
-                          int& theTag);
+                          int& theShapeIndex);
 
 //==================================================================================================
 FeaturesPlugin_Pipe::FeaturesPlugin_Pipe()
@@ -167,7 +167,7 @@ void FeaturesPlugin_Pipe::execute()
   }
   std::shared_ptr<GeomAPI_Shape> aPathShape =
     std::dynamic_pointer_cast<GeomAPI_Shape>(aPathSelection->value());
-  if(!aPathShape.get()) {
+  if(!aPathShape.get() && aPathSelection->context().get()) {
     // Probaply it is a construction.
     aPathShape = aPathSelection->context()->shape();
   }
@@ -185,7 +185,7 @@ void FeaturesPlugin_Pipe::execute()
       return;
     }
     aBiNormal = std::dynamic_pointer_cast<GeomAPI_Shape>(aBiNormalSelection->value());
-    if(!aBiNormal.get()) {
+    if(!aBiNormal.get() && aBiNormalSelection->context().get()) {
       // Probably it is a construction.
       aBiNormal = aBiNormalSelection->context()->shape();
     }
@@ -210,7 +210,7 @@ void FeaturesPlugin_Pipe::execute()
         return;
       }
       std::shared_ptr<GeomAPI_Shape> aLocationShape = aLocationSelection->value();
-      if(!aLocationShape.get()) {
+      if(!aLocationShape.get() && aLocationSelection->context().get()) {
         // Probably it is a construction.
         aLocationShape = aLocationSelection->context()->shape();
       }
@@ -224,30 +224,22 @@ void FeaturesPlugin_Pipe::execute()
 
   // Generating result for each object.
   int aResultIndex = 0;
+  std::string anError;
   if(aCreationMethod == CREATION_METHOD_SIMPLE() ||
       aCreationMethod == CREATION_METHOD_BINORMAL()) {
     for(ListOfShape::const_iterator
         anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) {
       std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
 
-      GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod ==
-        CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
-                                   GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
+      std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(
+        aCreationMethod == CREATION_METHOD_SIMPLE() ? new GeomAlgoAPI_Pipe(aBaseShape,
+                                                                           aPathShape)
+                                                    : new GeomAlgoAPI_Pipe(aBaseShape,
+                                                                           aPathShape,
+                                                                           aBiNormal));
 
-      if(!aPipeAlgo.isDone()) {
-        setError("Error: Pipe algorithm failed.");
-        aResultIndex = 0;
-        break;
-      }
-
-      // Check if shape is valid
-      if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) {
-        setError("Error: Resulting shape is Null.");
-        aResultIndex = 0;
-        break;
-      }
-      if(!aPipeAlgo.isValid()) {
-        setError("Error: Resulting shape is not valid.");
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) {
+        setError(anError);
         aResultIndex = 0;
         break;
       }
@@ -255,22 +247,12 @@ void FeaturesPlugin_Pipe::execute()
       storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
     }
   } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
-    GeomAlgoAPI_Pipe aPipeAlgo = GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape);
+    std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList,
+                                                                     aLocations,
+                                                                     aPathShape));
 
-    if(!aPipeAlgo.isDone()) {
-      setError("Error: Pipe algorithm failed.");
-      removeResults(0);
-      return;
-    }
-
-    // Check if shape is valid
-    if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) {
-      setError("Error: Resulting shape is Null.");
-      removeResults(0);
-      return;
-    }
-    if(!aPipeAlgo.isValid()) {
-      setError("Error: Resulting shape is not valid.");
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) {
+      setError(anError);
       removeResults(0);
       return;
     }
@@ -286,22 +268,19 @@ void FeaturesPlugin_Pipe::execute()
 
 //==================================================================================================
 void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                      GeomAlgoAPI_Pipe& thePipeAlgo,
+                                      const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                                       const int theResultIndex)
 {
   // Create result body.
   ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
 
   // Store generated shape.
-  aResultBody->storeGenerated(theBaseShape, thePipeAlgo.shape());
+  aResultBody->storeGenerated(theBaseShape, thePipeAlgo->shape());
 
   // Store generated edges/faces.
   GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
   GeomAPI_Shape::ShapeType aShapeTypeToExplode;
-  int aGenTag = 1;
-  std::string aGenName = "Generated_";
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = thePipeAlgo.mapOfSubShapes();
   switch(aBaseShapeType) {
     case GeomAPI_Shape::VERTEX: {
       aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
@@ -312,13 +291,13 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
       std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
       GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2);
       ListOfShape aV1History, aV2History;
-      thePipeAlgo.generated(aV1, aV1History);
-      thePipeAlgo.generated(aV2, aV2History);
+      thePipeAlgo->generated(aV1, aV1History);
+      thePipeAlgo->generated(aV2, aV2History);
       if(!aV1History.empty()) {
-        aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", aGenTag++);
+        aResultBody->generated(aV1, aV1History.front());
       }
       if(!aV2History.empty()) {
-        aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", aGenTag++);
+        aResultBody->generated(aV2, aV2History.front());
       }
     }
     case GeomAPI_Shape::FACE:
@@ -333,52 +312,44 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
 
   if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
       aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
-    aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX,
-                                           aGenTag++, aGenName + "Edge", *aMapOfSubShapes.get());
+    aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX);
   }
   if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
       aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
-    aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE,
-                                           aGenTag++, aGenName + "Face", *aMapOfSubShapes.get());
+    aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE);
   }
 
   // Store from shapes.
-  int aFromTag = aGenTag;
-  storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes,
-              thePipeAlgo.fromShapes(), "From_", aFromTag);
+  storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_");
 
   // Store to shapes.
-  int aToTag = aFromTag;
-  storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes, thePipeAlgo.toShapes(), "To_", aToTag);
+  storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->toShapes(), "To_");
 
   setResult(aResultBody, theResultIndex);
 }
 
 //==================================================================================================
 void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
-                                      GeomAlgoAPI_Pipe& thePipeAlgo,
+                                      const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                                       const int theResultIndex)
 {
   // Create result body.
   ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
 
   // Store generated shape.
-  aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo.shape());
+  aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape());
 
   // Store generated edges/faces.
-  int aGenTag = 1;
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = thePipeAlgo.mapOfSubShapes();
-
-  for(ListOfShape::const_iterator
-      anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
+  for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin();
+      anIter != theBaseShapes.cend();
+      ++anIter)
+  {
     GeomShapePtr aBaseShape = *anIter;
     GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
     GeomAPI_Shape::ShapeType aShapeTypeToExplode;
-    std::string aGenName = "Generated_";
     switch(aBaseShapeType) {
       case GeomAPI_Shape::VERTEX: {
         aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
-        aGenName += "Edge";
         break;
       }
       case GeomAPI_Shape::EDGE:
@@ -386,31 +357,25 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
         std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
         GeomAlgoAPI_ShapeTools::findBounds(aBaseShape, aV1, aV2);
         ListOfShape aV1History, aV2History;
-        thePipeAlgo.generated(aV1, aV1History);
-        thePipeAlgo.generated(aV2, aV2History);
-        aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", aGenTag++);
-        aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", aGenTag++);
+        thePipeAlgo->generated(aV1, aV1History);
+        thePipeAlgo->generated(aV2, aV2History);
+        aResultBody->generated(aV1, aV1History.front());
+        aResultBody->generated(aV2, aV2History.front());
       }
       case GeomAPI_Shape::FACE:
       case GeomAPI_Shape::SHELL: {
         aShapeTypeToExplode = GeomAPI_Shape::EDGE;
-        aGenName += "Face";
         break;
       }
     }
-    aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, aBaseShape, aShapeTypeToExplode,
-                                              aGenTag++, aGenName, *aMapOfSubShapes.get());
+    aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode);
   }
 
   // Store from shapes.
-  int aFromTag = aGenTag;
-  storeShapes(aResultBody, theBaseShapes.front()->shapeType(), aMapOfSubShapes,
-              thePipeAlgo.fromShapes(), "From", aFromTag);
+  storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_");
 
   // Store to shapes.
-  int aToTag = aFromTag;
-  storeShapes(aResultBody, theBaseShapes.back()->shapeType(),
-              aMapOfSubShapes, thePipeAlgo.toShapes(), "To", aToTag);
+  storeShapes(aResultBody, theBaseShapes.back()->shapeType(), thePipeAlgo->toShapes(), "To_");
 
 
   setResult(aResultBody, theResultIndex);
@@ -418,11 +383,9 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
 
 //==================================================================================================
 void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
-                              const GeomAPI_Shape::ShapeType theBaseShapeType,
-                              const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
-                              const ListOfShape& theShapes,
-                              const std::string theName,
-                              int& theTag)
+                                      const GeomAPI_Shape::ShapeType theBaseShapeType,
+                                      const ListOfShape& theShapes,
+                                      const std::string theName)
 {
   GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE;
   std::string aShapeTypeStr = "Face";
@@ -458,17 +421,13 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
 
     if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
       std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face");
-      storeSubShape(theResultBody,
-                    aShape,
+      storeSubShape(theResultBody, aShape,
                     aShape->shapeType(),
-                    theMapOfSubShapes,
                     aName,
-                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
-                    theTag);
+                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex);
     } else {
       std::string aName = theName + aShapeTypeStr;
-      storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
-                    theMapOfSubShapes, aName, aShapeIndex, theTag);
+      storeSubShape(theResultBody, aShape, aShapeTypeToExplore, aName, aShapeIndex);
     }
   }
 }
@@ -477,18 +436,13 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
 void storeSubShape(ResultBodyPtr theResultBody,
                    const GeomShapePtr theShape,
                    const GeomAPI_Shape::ShapeType theType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const std::string theName,
-                   int& theShapeIndex,
-                   int& theTag)
+                   int& theShapeIndex)
 {
   for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
     GeomShapePtr aSubShape = anExp.current();
-    if(theMapOfSubShapes->isBound(aSubShape)) {
-      aSubShape = theMapOfSubShapes->find(aSubShape);
-    }
     std::ostringstream aStr;
     aStr << theName << "_" << theShapeIndex++;
-    theResultBody->generated(aSubShape, aStr.str(), theTag++);
+    theResultBody->generated(aSubShape, aStr.str());
   }
 }
index 074c8b088ec90222c437c5899f284be467d9d2a6..2699ef56f23353591ce00f1436001ea273e0f344 100644 (file)
@@ -121,19 +121,17 @@ public:
 
 private:
   void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                   GeomAlgoAPI_Pipe& thePipeAlgo,
+                   const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                    const int theResultIndex = 0);
 
   void storeResult(const ListOfShape& theBaseShapes,
-                   GeomAlgoAPI_Pipe& thePipeAlgo,
+                   const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                    const int theResultIndex = 0);
 
   void storeShapes(ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theBaseShapeType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const ListOfShape& theShapes,
-                   const std::string theName,
-                   int& theTag);
+                   const std::string theName);
 };
 
 #endif
index ab932f01d6c21ac5993a434a9846b0253f926bda..b4ae07c3dfaced96bf43be420a91111e024ae5ff 100644 (file)
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_Placement.h>
 #include <GeomAlgoAPI_Transform.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <FeaturesPlugin_Tools.h>
 
@@ -67,7 +69,6 @@ void FeaturesPlugin_Placement::execute()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -121,21 +122,8 @@ void FeaturesPlugin_Placement::execute()
   // Verify planarity of faces and linearity of edges
   std::shared_ptr<GeomAPI_Shape> aShapes[2] = {aStartShape, anEndShape};
   for (int i = 0; i < 2; i++) {
-    if (aShapes[i]->isFace()) {
-      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
-      if (!aFace->isPlanar()) {
-        static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
-        setError(aPlanarityError);
-        return;
-      }
-    }
-    else if (aShapes[i]->isEdge()) {
-      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
-      if (!anEdge->isLine()) {
-        static const std::string aLinearityError = "Error: One of selected endges is not linear.";
-        setError(aLinearityError);
-        return;
-      }
+    if (!isShapeValid(aShapes[i])) {
+      return;
     }
   }
 
@@ -155,6 +143,7 @@ void FeaturesPlugin_Placement::execute()
 
   // Applying transformation to each object.
   int aResultIndex = 0;
+  std::string anError;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
       anObjectsIt++, aContext++) {
@@ -167,29 +156,19 @@ void FeaturesPlugin_Placement::execute()
       setResult(aResultPart, aResultIndex);
     } else {
       std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
-      GeomAlgoAPI_Transform aTransformAlgo(aBaseShape, aTrsf);
+      std::shared_ptr<GeomAlgoAPI_Transform> aTransformAlgo(new GeomAlgoAPI_Transform(aBaseShape,
+                                                                                      aTrsf));
 
       // Checking that the algorithm worked properly.
-      if(!aTransformAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Transform algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aTransformAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aTransformAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       //LoadNamingDS
-      std::shared_ptr<ModelAPI_ResultBody> aResultBody =
-        document()->createBody(data(), aResultIndex);
-      loadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
+      ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+      aResultBody->storeModified(aBaseShape, aTransformAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aTransformAlgo, "Placed");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -199,18 +178,44 @@ void FeaturesPlugin_Placement::execute()
   removeResults(aResultIndex);
 }
 
-//============================================================================
-void FeaturesPlugin_Placement::loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
-                                            std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                            std::shared_ptr<GeomAPI_Shape> theBaseShape)
+//==================================================================================================
+bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape)
 {
-  //load result
-  theResultBody->storeModified(theBaseShape, theTransformAlgo.shape());
+  if (theShape->isCompound()) {
+    GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
+    for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
+      GeomShapePtr aCurrentShape = anIt.current();
+      if (aShapeType == GeomAPI_Shape::SHAPE) {
+        aShapeType = aCurrentShape->shapeType();
+      }
+      else if (aShapeType != aCurrentShape->shapeType()) {
+        static const std::string aLinearityError =
+          "Error: Selected compound contains shapes with different types.";
+        setError(aLinearityError);
+        return false;
+      }
 
-  std::string aPlacedName = "Placed";
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
+      if (!isShapeValid(aCurrentShape)) {
+        return false;
+      }
+    }
+  }
+  else if (theShape->isFace()) {
+    std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
+    if (!aFace->isPlanar()) {
+      static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
+      setError(aPlanarityError);
+      return false;
+    }
+  }
+  else if (theShape->isEdge()) {
+    std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+    if (!anEdge->isLine()) {
+      static const std::string aLinearityError = "Error: One of selected edges is not linear.";
+      setError(aLinearityError);
+      return false;
+    }
+  }
 
-  FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody,
-                                            theBaseShape, 1, 2, 3, aPlacedName,
-                                            *aSubShapes.get());
+  return true;
 }
index 1b8a7b6bd0e1bcf5d27adc62b6d050ee0e62af0b..4b8e94c6459b98bc692765fd3daf8cca031c45fe 100644 (file)
@@ -96,10 +96,8 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature
   /// Use plugin manager for features creation
   FeaturesPlugin_Placement();
 private:
-  /// Load Naming data structure of the feature to the document
-  void loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
+  /// Checks validity of passed shape.
+  bool isShapeValid(GeomShapePtr theShape);
 };
 
 #endif
index cf16130b979520cbe8f40c9d3cd43f0aad4b6716..0bf95c30101e7c1f39b3b5396c1cd6460522b8ab 100644 (file)
@@ -31,6 +31,7 @@
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_Tools.h>
 #include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
 
 FeaturesPlugin_Recover::FeaturesPlugin_Recover()
 {
@@ -45,6 +46,7 @@ void FeaturesPlugin_Recover::initAttributes()
 
 void FeaturesPlugin_Recover::execute()
 {
+  std::string anError;
   int aResultIndex = 0;
   AttributeRefListPtr aRecovered = reflist(RECOVERED_ENTITIES());
   for(int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) {
@@ -59,31 +61,20 @@ void FeaturesPlugin_Recover::execute()
       continue;
 
     // Copy shape.
-    GeomAlgoAPI_Copy aCopyAlgo(aShape);
+    std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
     // Check that algo is done.
-    if(!aCopyAlgo.isDone()) {
-      setError("Error: recover algorithm failed.");
-      return;
-    }
-    // Check if shape is not null.
-    if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
-      setError("Error: resulting shape is null.");
-      return;
-    }
-    // Check that resulting shape is valid.
-    if(!aCopyAlgo.isValid()) {
-      setError("Error: resulting shape is not valid.");
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     // Store result.
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    aResultBody->store(aCopyAlgo.shape());//, aCopyAlgo.shape());
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aCopyAlgo.mapOfSubShapes();
-    // like in import: forget any history
-    int aTag(1);
-    std::string aNameMS = "Shape";
-    aResultBody->loadFirstLevel(aCopyAlgo.shape(), aNameMS, aTag);
+    aResultBody->store(aCopyAlgo->shape());//, aCopyAlgo.shape());
+
+    aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
+    aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::FACE);
 
     setResult(aResultBody, aResultIndex);
     ++aResultIndex;
index e4d61f163b0066fa38a4ecd7ef87fe8dd4cc6b78..d2bd7e5dea977411440b3e49077b9165b450b8cb 100644 (file)
@@ -232,7 +232,7 @@ void FeaturesPlugin_RemoveSubShapes::execute()
     aResultShape = anAttrSelectionInList->value();
   }
   // deleted and copied must be jointed to one list which keeps all the history
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
 
   // find all removed shapes
   std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aDeletedSubs(new GeomAlgoAPI_MakeShapeCustom);
@@ -263,11 +263,11 @@ void FeaturesPlugin_RemoveSubShapes::execute()
       }
     }
   }
-  aMakeShapeList.appendAlgo(aDeletedSubs);
+  aMakeShapeList->appendAlgo(aDeletedSubs);
 
   std::shared_ptr<GeomAlgoAPI_Copy> aCopy(new GeomAlgoAPI_Copy(aResultShape));
   aResultShape = aCopy->shape();
-  aMakeShapeList.appendAlgo(aCopy);
+  aMakeShapeList->appendAlgo(aCopy);
 
   if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
     aResultShape = GeomAlgoAPI_ShapeTools::groupSharedTopology(aResultShape);
@@ -283,15 +283,22 @@ void FeaturesPlugin_RemoveSubShapes::execute()
 
   // Store result.
   ResultBodyPtr aResultBody = document()->createBody(data());
-  aResultBody->storeModified(aBaseShape, aResultShape, 1);
-  std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
-  for(; aTypeIter != aTypes.end(); aTypeIter++)
-    aResultBody->loadDeletedShapes(&aMakeShapeList, aBaseShape, *aTypeIter, 1);
-  aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::FACE,
-      2, "Modified_Face", *aMakeShapeList.mapOfSubShapes().get(), true, false, true);
-  aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::EDGE,
-      3, "Modified_Edge", *aMakeShapeList.mapOfSubShapes().get(), false, false, true);
-  aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::VERTEX,
-      4, "Modified_Vertex", *aMakeShapeList.mapOfSubShapes().get());
+  aResultBody->storeModified(aBaseShape, aResultShape);
+  for (std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
+       aTypeIter != aTypes.end();
+       ++aTypeIter)
+  {
+    aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, *aTypeIter);
+  }
+
+  aResultBody->loadModifiedShapes(aMakeShapeList,
+                                  aBaseShape,
+                                  GeomAPI_Shape::FACE);
+  aResultBody->loadModifiedShapes(aMakeShapeList,
+                                  aBaseShape,
+                                  GeomAPI_Shape::EDGE);
+  aResultBody->loadModifiedShapes(aMakeShapeList,
+                                  aBaseShape,
+                                  GeomAPI_Shape::VERTEX);
   setResult(aResultBody);
 }
index 4a643318083edd19d5ba970d0452f74c18c0c355..bbd7b41f30071a2b91a4e1c23fb83589d5c4494b 100644 (file)
 #include <ModelAPI_Validator.h>
 
 #include <GeomAlgoAPI_Revolution.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 
 //=================================================================================================
 FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
@@ -92,17 +94,37 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
   // Getting base shapes.
   getBaseShapes(theBaseShapes);
 
-  //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
+  // Getting axis.
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
   AttributeSelectionPtr aSelection = selection(AXIS_OBJECT_ID());
-  if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
-  } else if(aSelection->context().get() &&
-            aSelection->context()->shape().get() &&
-            aSelection->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
+  GeomShapePtr aShape = aSelection->value();
+  if (!aShape.get()) {
+    if (aSelection->context().get()) {
+      aShape = aSelection->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return false;
+  }
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
+  else
+  {
+    setError(aSelectionError);
+    return false;
+  }
+
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
   if(anEdge.get()) {
     if(anEdge->isLine()) {
       anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
@@ -137,6 +159,10 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
       if(!aToShape.get() && aSelection->context().get()) {
         aToShape = aSelection->context()->shape();
       }
+      if (aToShape.get() && aToShape->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aToShape);
+        aToShape = anIt.current();
+      }
     }
     aSelection = selection(FROM_OBJECT_ID());
     if(aSelection.get()) {
@@ -144,10 +170,15 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
       if(!aFromShape.get() && aSelection->context().get()) {
         aFromShape = aSelection->context()->shape();
       }
+      if (aFromShape.get() && aFromShape->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aFromShape);
+        aFromShape = anIt.current();
+      }
     }
   }
 
   // Generating result for each base shape.
+  std::string anError;
   for(ListOfShape::const_iterator
       anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
     GeomShapePtr aBaseShape = *anIter;
@@ -156,7 +187,8 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
                                                        aBaseShape, anAxis,
                                                        aToShape, aToAngle,
                                                        aFromShape, aFromAngle));
-    if(!isMakeShapeValid(aRevolAlgo)) {
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRevolAlgo, getKind(), anError)) {
+      setError(anError);
       return false;
     }
 
index 50c03fa4ef1a58ddc9aed69e1f3637bad3273ac7..107fecc8efb7c18bf086735c662916d9145f5cf6 100644 (file)
@@ -38,9 +38,7 @@ bool FeaturesPlugin_RevolutionBoolean::makeGeneration(ListOfShape& theBaseShapes
 //=================================================================================================
 void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
                                       const GeomShapePtr theBaseShape,
-                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                      int& theTag)
+                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
-  FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape,
-                                                    theMakeShape, theTag);
+  FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
 }
index 8aceb322b95fcb46a3cfc74391b469d5e26c6ccb..a89288faa7c8deccfa492d6bed32364c13ba8401 100644 (file)
@@ -44,8 +44,7 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 };
 
 #endif
index 07d2d575c109924f51fbb72a73d1174913faded6..01547d62f91c041c62b0414019ec2f1c46b9dc73 100755 (executable)
 #include <ModelAPI_ResultPart.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <FeaturesPlugin_Tools.h>
@@ -99,25 +101,44 @@ void FeaturesPlugin_Rotation::performTranslationByAxisAndAngle()
   }
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
+
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+                                                       anEdge->line()->direction()));
+
   // Getting angle.
   double anAngle = real(FeaturesPlugin_Rotation::ANGLE_ID())->value();
 
   // Rotating each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -134,34 +155,26 @@ void FeaturesPlugin_Rotation::performTranslationByAxisAndAngle()
       aResultPart->setTrsf(*aContext, aTrsf);
       setResult(aResultPart, aResultIndex);
     } else {
-      GeomAlgoAPI_Rotation aRotationAlgo(aBaseShape, anAxis, anAngle);
+      std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(new GeomAlgoAPI_Rotation(aBaseShape,
+                                                                                   anAxis,
+                                                                                   anAngle));
 
-      if (!aRotationAlgo.check()) {
-        setError(aRotationAlgo.getError());
+      if (!aRotationAlgo->check()) {
+        setError(aRotationAlgo->getError());
         return;
       }
 
-      aRotationAlgo.build();
+      aRotationAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aRotationAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Rotation algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aRotationAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aRotationAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      loadNamingDS(aRotationAlgo, aResultBody, aBaseShape);
+      aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -203,16 +216,17 @@ void FeaturesPlugin_Rotation::performTranslationByThreePoints()
     selection(FeaturesPlugin_Rotation::START_POINT_ID());
   std::shared_ptr<ModelAPI_AttributeSelection> anEndPointRef =
     selection(FeaturesPlugin_Rotation::END_POINT_ID());
-  if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL)
-      && (anEndPointRef.get() != NULL)) {
+  if ((aCenterRef.get() != NULL) &&
+      (aStartPointRef.get() != NULL) &&
+      (anEndPointRef.get() != NULL)) {
     GeomShapePtr aCenterShape = aCenterRef->value();
-    if (!aCenterShape.get())
+    if (!aCenterShape.get() && aCenterRef->context().get())
       aCenterShape = aCenterRef->context()->shape();
     GeomShapePtr aStartShape = aStartPointRef->value();
-    if (!aStartShape.get())
+    if (!aStartShape.get() && aStartPointRef->context().get())
       aStartShape = aStartPointRef->context()->shape();
-      GeomShapePtr anEndShape = anEndPointRef->value();
-    if (!anEndShape.get())
+    GeomShapePtr anEndShape = anEndPointRef->value();
+    if (!anEndShape.get() && anEndPointRef->context().get())
       anEndShape = anEndPointRef->context()->shape();
     if (aStartShape && anEndShape && aCenterShape) {
       aCenterPoint = GeomAlgoAPI_PointBuilder::point(aCenterShape);
@@ -222,6 +236,7 @@ void FeaturesPlugin_Rotation::performTranslationByThreePoints()
   }
 
   // Rotating each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -238,52 +253,29 @@ void FeaturesPlugin_Rotation::performTranslationByThreePoints()
        aResultPart->setTrsf(*aContext, aTrsf);
        setResult(aResultPart, aResultIndex);
     } else {
-      GeomAlgoAPI_Rotation aRotationAlgo(aBaseShape, aCenterPoint, aStartPoint, anEndPoint);
+      std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(new GeomAlgoAPI_Rotation(aBaseShape,
+                                                                                   aCenterPoint,
+                                                                                   aStartPoint,
+                                                                                   anEndPoint));
 
-      if (!aRotationAlgo.check()) {
-        setError(aRotationAlgo.getError());
+      if (!aRotationAlgo->check()) {
+        setError(aRotationAlgo->getError());
         return;
       }
 
-      aRotationAlgo.build();
+      aRotationAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aRotationAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Rotation algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aRotationAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error : Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aRotationAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      loadNamingDS(aRotationAlgo, aResultBody, aBaseShape);
+      aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
   }
 }
-
-//=================================================================================================
-void FeaturesPlugin_Rotation::loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
-                                           std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                           std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
-  // Store result.
-  theResultBody->storeModified(theBaseShape, theRotaionAlgo.shape());
-
-  std::string aRotatedName = "Rotated";
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
-
-  FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody,
-                                            theBaseShape, 1, 2, 3, aRotatedName,
-                                            *aSubShapes.get());
-}
index ce064ca2176c484f32f38380680ed0c904dea0c8..0c8a24aeee8f54415790f672ec9c414a300b0a8c 100755 (executable)
@@ -125,10 +125,6 @@ private:
 
   ///Perform the rotation using a center and two points.
   void performTranslationByThreePoints();
-
-  void loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
 };
 
 #endif
index 4e854c22a5f491e742f68ad57121d9b4c916382b..a2c6105c8bce9258524498c03f1714a582f61f9f 100644 (file)
@@ -21,6 +21,7 @@
 #include <FeaturesPlugin_Scale.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelectionList.h>
@@ -90,7 +91,6 @@ void FeaturesPlugin_Scale::performScaleByFactor()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -115,39 +115,31 @@ void FeaturesPlugin_Scale::performScaleByFactor()
   double aScaleFactor = real(FeaturesPlugin_Scale::SCALE_FACTOR_ID())->value();
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
         anObjectsIt++, aContext++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
-    GeomAlgoAPI_Scale aScaleAlgo(aBaseShape, aCenterPoint, aScaleFactor);
+    std::shared_ptr<GeomAlgoAPI_Scale> aScaleAlgo(
+      new GeomAlgoAPI_Scale(aBaseShape, aCenterPoint, aScaleFactor));
 
-    if (!aScaleAlgo.check()) {
-      setError(aScaleAlgo.getError());
+    if (!aScaleAlgo->check()) {
+      setError(aScaleAlgo->getError());
       return;
     }
 
-    aScaleAlgo.build();
+    aScaleAlgo->build();
 
     // Checking that the algorithm worked properly.
-    if(!aScaleAlgo.isDone()) {
-      static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
-      setError(aFeatureError);
-      break;
-    }
-    if(aScaleAlgo.shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      break;
-    }
-    if(!aScaleAlgo.isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) {
+      setError(anError);
       break;
     }
 
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    loadNamingDS(aScaleAlgo, aResultBody, aBaseShape);
+    aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
+    FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
     setResult(aResultBody, aResultIndex);
     aResultIndex++;
   }
@@ -172,7 +164,6 @@ void FeaturesPlugin_Scale::performScaleByDimensions()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -199,40 +190,34 @@ void FeaturesPlugin_Scale::performScaleByDimensions()
   double aScaleFactorZ = real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID())->value();
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
         anObjectsIt++, aContext++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
-    GeomAlgoAPI_Scale aScaleAlgo(aBaseShape, aCenterPoint,
-                                 aScaleFactorX, aScaleFactorY, aScaleFactorZ);
-
-    if (!aScaleAlgo.check()) {
-      setError(aScaleAlgo.getError());
+    std::shared_ptr<GeomAlgoAPI_Scale> aScaleAlgo(new GeomAlgoAPI_Scale(aBaseShape,
+                                                                        aCenterPoint,
+                                                                        aScaleFactorX,
+                                                                        aScaleFactorY,
+                                                                        aScaleFactorZ));
+
+    if (!aScaleAlgo->check()) {
+      setError(aScaleAlgo->getError());
       return;
     }
 
-    aScaleAlgo.build();
+    aScaleAlgo->build();
 
     // Checking that the algorithm worked properly.
-    if(!aScaleAlgo.isDone()) {
-      static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
-      setError(aFeatureError);
-      break;
-    }
-    if(aScaleAlgo.shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      break;
-    }
-    if(!aScaleAlgo.isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) {
+      setError(anError);
       break;
     }
 
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    loadNamingDS(aScaleAlgo, aResultBody, aBaseShape);
+    aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
+    FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
     setResult(aResultBody, aResultIndex);
     aResultIndex++;
   }
@@ -240,19 +225,3 @@ void FeaturesPlugin_Scale::performScaleByDimensions()
   // Remove the rest results if there were produced in the previous pass.
   removeResults(aResultIndex);
 }
-
-//=================================================================================================
-void FeaturesPlugin_Scale::loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
-                                        std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                        std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
-  // Store and name the result.
-  theResultBody->storeModified(theBaseShape, theScaleAlgo.shape());
-
-  // Name the faces
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theScaleAlgo.mapOfSubShapes();
-  std::string aScaledName = "Scaled";
-  FeaturesPlugin_Tools::storeModifiedShapes(theScaleAlgo, theResultBody,
-                                            theBaseShape, 1, 2, 3, aScaledName,
-                                            *aSubShapes.get());
-}
index 519dec4e4b529cbca3ce9ee92e65324b012e2c10..9700331f7b391e2c694d121c7d59d19e47d5ed07 100644 (file)
@@ -126,11 +126,6 @@ private:
 
   /// Perform symmetry using a central point and three dimensions
   void performScaleByDimensions();
-
-  /// Perform the naming
-  void loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
 };
 
 #endif // FEATURESPLUGIN_SCALE_H_
\ No newline at end of file
index d50b74aa2088b65f7e4930cac773dc6ab1a69163..333820a8d32146e6a5f42d9073efb70a68ccab55 100644 (file)
 #include <GeomAlgoAPI_FaceBuilder.h>
 #include <GeomAlgoAPI_Copy.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeBoolean.h>
@@ -101,7 +103,6 @@ bool FeaturesPlugin_Symmetry::collectSourceObjects(ListOfShape& theSourceShapes,
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if (!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return false;
     }
     theSourceShapes.push_back(anObject);
@@ -134,6 +135,7 @@ void FeaturesPlugin_Symmetry::performSymmetryByPoint()
   }
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -160,19 +162,8 @@ void FeaturesPlugin_Symmetry::performSymmetryByPoint()
       aSymmetryAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aSymmetryAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aSymmetryAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aSymmetryAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
@@ -195,22 +186,42 @@ void FeaturesPlugin_Symmetry::performSymmetryByAxis()
     return;
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_Symmetry::AXIS_OBJECT_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
 
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+                                                       anEdge->line()->direction()));
+
+
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -237,19 +248,8 @@ void FeaturesPlugin_Symmetry::performSymmetryByAxis()
       aSymmetryAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aSymmetryAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aSymmetryAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aSymmetryAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
@@ -271,25 +271,43 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane()
   if (!collectSourceObjects(anObjects, aContextes))
     return;
 
-  //Getting axis.
-  std::shared_ptr<GeomAPI_Ax2> aPlane;
-  std::shared_ptr<GeomAPI_Pln> aPln;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID());
-  if (anObjRef && anObjRef->value() && anObjRef->value()->isFace()) {
-    aPln = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->value()))->getPlane();
+  //Getting plane.
+  static const std::string aSelectionError = "Error: The plane shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(PLANE_OBJECT_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
   }
-  else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isFace()) {
-    aPln =
-      std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->context()->shape()))->getPlane();
+
+  GeomFacePtr aFace;
+  if (aShape->isFace())
+  {
+    aFace = aShape->face();
   }
-  if (aPln) {
-    aPlane = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aPln->location(),
-                                                          aPln->direction()));
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    aFace = anIt.current()->face();
   }
 
+  if (!aFace.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax2> aPlane(new GeomAPI_Ax2(aFace->getPlane()->location(),
+                                                      aFace->getPlane()->direction()));
+
+
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -315,19 +333,8 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane()
       aSymmetryAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aSymmetryAlgo->isDone()) {
-        static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aSymmetryAlgo->shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aSymmetryAlgo->isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
@@ -345,8 +352,8 @@ void FeaturesPlugin_Symmetry::buildResult(
   std::shared_ptr<GeomAlgoAPI_Symmetry>& theSymmetryAlgo,
   std::shared_ptr<GeomAPI_Shape> theBaseShape, int theResultIndex)
 {
-  GeomAlgoAPI_MakeShapeList anAlgoList;
-  anAlgoList.appendAlgo(theSymmetryAlgo);
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> anAlgoList(new GeomAlgoAPI_MakeShapeList());
+  anAlgoList->appendAlgo(theSymmetryAlgo);
   // Compose source shape and the result of symmetry.
   GeomShapePtr aCompound;
   if (boolean(KEEP_ORIGINAL_RESULT())->value()) {
@@ -354,7 +361,7 @@ void FeaturesPlugin_Symmetry::buildResult(
     // add a copy of a base shape otherwise selection of this base shape is bad (2592)
     std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(theBaseShape));
     aShapes.push_back(aCopyAlgo->shape());
-    anAlgoList.appendAlgo(aCopyAlgo);
+    anAlgoList->appendAlgo(aCopyAlgo);
 
     aShapes.push_back(theSymmetryAlgo->shape());
     aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
@@ -364,7 +371,7 @@ void FeaturesPlugin_Symmetry::buildResult(
   // Store and name the result.
   ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
   aResultBody->storeModified(theBaseShape, aCompound);
-  loadNamingDS(anAlgoList, aResultBody, theBaseShape);
+  FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theBaseShape, anAlgoList, "Symmetried");
   setResult(aResultBody, theResultIndex);
 }
 
@@ -385,16 +392,3 @@ void FeaturesPlugin_Symmetry::buildResult(ResultPartPtr theOriginal,
   aResultPart->setTrsf(theOriginal, theTrsf);
   setResult(aResultPart, theResultIndex);
 }
-
-//=================================================================================================
-void FeaturesPlugin_Symmetry::loadNamingDS(GeomAlgoAPI_MakeShapeList& theAlgo,
-                                           std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                           std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
-  // Name the faces
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theAlgo.mapOfSubShapes();
-  std::string aReflectedName = "Symmetried";
-  FeaturesPlugin_Tools::storeModifiedShapes(theAlgo, theResultBody,
-                                            theBaseShape, 1, 2, 3, aReflectedName,
-                                            *aSubShapes.get());
-}
index a19d143cfa73448e098563a67d761957e3560310..d03cc141bcc3c9b447c566a5d60efcff3723e1de 100644 (file)
@@ -137,11 +137,6 @@ private:
   /// Perform symmetry with respect to a plane.
   void performSymmetryByPlane();
 
-  /// Perform the naming
-  void loadNamingDS(GeomAlgoAPI_MakeShapeList& theSymmetryAlgo,
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
-
   /// Create new result on given shapes and the index of result
   void buildResult(std::shared_ptr<GeomAlgoAPI_Symmetry>& theSymmetryAlgo,
                    std::shared_ptr<GeomAPI_Shape> theBaseShape,
index 07709d1ed7fa2a2056346f9e0f0c28ebed31b07e..efdee580134ed3afa36a9cb0b81da35e8df9655b 100644 (file)
 
 #include <GeomAPI_ShapeIterator.h>
 
-void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
-                                               std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                               std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                               const int theFaceTag,
-                                               const int theEdgeTag,
-                                               const int theVertexTag,
-                                               const std::string theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes)
+//==================================================================================================
+void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
+                                              const GeomShapePtr theBaseShape,
+                                              const ListOfShape& theTools,
+                                              const GeomMakeShapePtr& theMakeShape,
+                                              const GeomShapePtr theResultShape)
+{
+  if (theBaseShape->isEqual(theResultShape)) {
+    theResultBody->store(theResultShape, false);
+    return;
+  }
+
+  theResultBody->storeModified(theBaseShape, theResultShape);
+
+  ListOfShape aShapes = theTools;
+  aShapes.push_front(theBaseShape);
+
+  for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
+  {
+    theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX);
+    theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE);
+    theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
+  }
+}
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
+                                              const GeomShapePtr theBaseShape,
+                                              const GeomMakeShapePtr& theMakeShape,
+                                              const std::string theName)
 {
   switch(theBaseShape->shapeType()) {
     case GeomAPI_Shape::COMPOUND: {
       for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
       {
-        storeModifiedShapes(theAlgo,
-                            theResultBody,
-                            anIt.current(),
-                            theFaceTag,
-                            theEdgeTag,
-                            theVertexTag,
-                            theName,
-                            theSubShapes);
+        loadModifiedShapes(theResultBody,
+                           anIt.current(),
+                           theMakeShape,
+                           theName);
       }
       break;
     }
     case GeomAPI_Shape::COMPSOLID:
     case GeomAPI_Shape::SOLID:
     case GeomAPI_Shape::SHELL: {
-      theResultBody->loadAndOrientModifiedShapes(&theAlgo,
-                                theBaseShape, GeomAPI_Shape::FACE,
-                                theFaceTag, theName + "_Face", theSubShapes, false, true);
+      theResultBody->loadModifiedShapes(theMakeShape,
+                                        theBaseShape,
+                                        GeomAPI_Shape::FACE,
+                                        theName);
     }
     case GeomAPI_Shape::FACE:
     case GeomAPI_Shape::WIRE: {
-      theResultBody->loadAndOrientModifiedShapes(&theAlgo,
-                                theBaseShape, GeomAPI_Shape::EDGE,
-                                theEdgeTag, theName + "_Edge", theSubShapes, false, true);
+      theResultBody->loadModifiedShapes(theMakeShape,
+                                        theBaseShape,
+                                        GeomAPI_Shape::EDGE,
+                                        theName);
     }
     case GeomAPI_Shape::EDGE: {
-      theResultBody->loadAndOrientModifiedShapes(&theAlgo,
-                              theBaseShape, GeomAPI_Shape::VERTEX,
-                              theVertexTag, theName + "_Vertex", theSubShapes, false, true);
+      theResultBody->loadModifiedShapes(theMakeShape,
+                                        theBaseShape,
+                                        GeomAPI_Shape::VERTEX,
+                                        theName);
     }
   }
 }
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadDeletedShapes(ResultBodyPtr theResultBody,
+  const GeomShapePtr theBaseShape,
+  const ListOfShape& theTools,
+  const GeomMakeShapePtr& theMakeShape,
+  const GeomShapePtr theResultShapesCompound)
+{
+  ListOfShape aShapes = theTools;
+  aShapes.push_front(theBaseShape);
+
+  for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
+  {
+    theResultBody->loadDeletedShapes(theMakeShape,
+                                     *anIter,
+                                     GeomAPI_Shape::VERTEX,
+                                     theResultShapesCompound);
+    theResultBody->loadDeletedShapes(theMakeShape,
+                                     *anIter,
+                                     GeomAPI_Shape::EDGE,
+                                     theResultShapesCompound);
+    theResultBody->loadDeletedShapes(theMakeShape,
+                                     *anIter,
+                                     GeomAPI_Shape::FACE,
+                                     theResultShapesCompound);
+  }
+}
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadDeletedShapes(
+  std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+  const ListOfShape& theTools,
+  const GeomShapePtr theResultShapesCompound)
+{
+  for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
+       anIt != theResultBaseAlgoList.end();
+       ++anIt)
+  {
+    ResultBaseAlgo& aRCA = *anIt;
+    loadDeletedShapes(aRCA.resultBody,
+                      aRCA.baseShape,
+                      theTools,
+                      aRCA.makeShape,
+                      theResultShapesCompound);
+  }
+}
index 02a0b5e454b95a2b09a778e0ec165c77398b7805..22b269b045e915f24d6ad7f94b5766b3ba53f923 100644 (file)
 #ifndef FeaturesPlugin_Tools_H_
 #define FeaturesPlugin_Tools_H_
 
-#include <GeomAlgoAPI_Translation.h>
+#include <GeomAlgoAPI_MakeShape.h>
+#include <ModelAPI_ResultBody.h>
 
-class ModelAPI_ResultBody;
+#include <vector>
 
 class FeaturesPlugin_Tools {
 public:
-  static void storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
-                                  std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                  std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                  const int theFaceTag,
-                                  const int theEdgeTag,
-                                  const int theVertexTag,
-                                  const std::string theName,
-                                  GeomAPI_DataMapOfShapeShape& theSubShapes);
+  struct ResultBaseAlgo {
+    ResultBodyPtr resultBody;
+    GeomShapePtr baseShape;
+    GeomMakeShapePtr makeShape;
+  };
+
+public:
+  static void loadModifiedShapes(ResultBodyPtr theResultBody,
+                                 const GeomShapePtr theBaseShape,
+                                 const ListOfShape& theTools,
+                                 const GeomMakeShapePtr& theMakeShape,
+                                 const GeomShapePtr theResultShape);
+
+  static void loadModifiedShapes(ResultBodyPtr theResultBody,
+                                 const GeomShapePtr theBaseShape,
+                                 const GeomMakeShapePtr& theMakeShape,
+                                 const std::string theName);
+
+    /// Stores deleted shapes.
+  static void loadDeletedShapes(ResultBodyPtr theResultBody,
+                                const GeomShapePtr theBaseShape,
+                                const ListOfShape& theTools,
+                                const GeomMakeShapePtr& theMakeShape,
+                                const GeomShapePtr theResultShapesCompound);
+
+  /// Stores deleted shapes.
+  static void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+                                const ListOfShape& theTools,
+                                const GeomShapePtr theResultShapesCompound);
 };
 
 #endif /* FeaturesPlugin_Tools_H_ */
index 0da4b6acc7fcfa4f99de679fa38c1efd7db4e183..e303f2b125c2def5ee388fcf618885bc56292b9d 100644 (file)
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
 
 #include <FeaturesPlugin_Tools.h>
 
@@ -104,7 +106,6 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -112,25 +113,45 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance()
   }
 
   //Getting axis.
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
-    selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
-  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+  GeomShapePtr aShape = anObjRef->value();
+  if (!aShape.get()) {
+    if (anObjRef->context().get()) {
+      aShape = anObjRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
+
+  GeomEdgePtr anEdge;
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
+  }
+
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                      anEdge->line()->direction()));
+
+
   // Getting distance.
   double aDistance = real(FeaturesPlugin_Translation::DISTANCE_ID())->value();
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -147,34 +168,28 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance()
       aResultPart->setTrsf(*aContext, aTrsf);
       setResult(aResultPart, aResultIndex);
     } else {
-      GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, anAxis, aDistance);
+      std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+        new GeomAlgoAPI_Translation(aBaseShape, anAxis, aDistance));
 
-      if (!aTranslationAlgo.check()) {
-        setError(aTranslationAlgo.getError());
+      if (!aTranslationAlgo->check()) {
+        setError(aTranslationAlgo->getError());
         return;
       }
 
-      aTranslationAlgo.build();
+      aTranslationAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aTranslationAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Translation algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aTranslationAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aTranslationAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+      aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aBaseShape,
+                                               aTranslationAlgo,
+                                               "Translated");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -200,7 +215,6 @@ void FeaturesPlugin_Translation::performTranslationByDimensions()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -213,6 +227,7 @@ void FeaturesPlugin_Translation::performTranslationByDimensions()
   double aDZ = real(FeaturesPlugin_Translation::DZ_ID())->value();
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -229,34 +244,28 @@ void FeaturesPlugin_Translation::performTranslationByDimensions()
       aResultPart->setTrsf(*aContext, aTrsf);
       setResult(aResultPart, aResultIndex);
     } else {
-      GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, aDX, aDY, aDZ);
+      std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+        new GeomAlgoAPI_Translation(aBaseShape, aDX, aDY, aDZ));
 
-      if (!aTranslationAlgo.check()) {
-        setError(aTranslationAlgo.getError());
+      if (!aTranslationAlgo->check()) {
+        setError(aTranslationAlgo->getError());
         return;
       }
 
-      aTranslationAlgo.build();
+      aTranslationAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aTranslationAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Translation algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aTranslationAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aTranslationAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+      aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aBaseShape,
+                                               aTranslationAlgo,
+                                               "Translated");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -282,7 +291,6 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints()
       anObjectsSelList->value(anObjectsIndex);
     std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
     if(!anObject.get()) { // may be for not-activated parts
-      eraseResults();
       return;
     }
     anObjects.push_back(anObject);
@@ -308,6 +316,7 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints()
   }
 
   // Moving each object.
+  std::string anError;
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
   for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
@@ -324,34 +333,28 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints()
       aResultPart->setTrsf(*aContext, aTrsf);
       setResult(aResultPart, aResultIndex);
     } else {
-      GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, aFirstPoint, aSecondPoint);
+      std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+        new GeomAlgoAPI_Translation(aBaseShape, aFirstPoint, aSecondPoint));
 
-      if (!aTranslationAlgo.check()) {
-        setError(aTranslationAlgo.getError());
+      if (!aTranslationAlgo->check()) {
+        setError(aTranslationAlgo->getError());
         return;
       }
 
-      aTranslationAlgo.build();
+      aTranslationAlgo->build();
 
       // Checking that the algorithm worked properly.
-      if(!aTranslationAlgo.isDone()) {
-        static const std::string aFeatureError = "Error: Translation algorithm failed.";
-        setError(aFeatureError);
-        break;
-      }
-      if(aTranslationAlgo.shape()->isNull()) {
-        static const std::string aShapeError = "Error: Resulting shape is Null.";
-        setError(aShapeError);
-        break;
-      }
-      if(!aTranslationAlgo.isValid()) {
-        std::string aFeatureError = "Error: Resulting shape is not valid.";
-        setError(aFeatureError);
+      if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+        setError(anError);
         break;
       }
 
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+      aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+      FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                               aBaseShape,
+                                               aTranslationAlgo,
+                                               "Translated");
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -360,19 +363,3 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints()
   // Remove the rest results if there were produced in the previous pass.
   removeResults(aResultIndex);
 }
-
-//=================================================================================================
-void FeaturesPlugin_Translation::loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
-                                              std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                              std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
-  // Store result.
-  theResultBody->storeModified(theBaseShape, theTranslationAlgo.shape());
-
-  std::string aTranslatedName = "Translated";
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTranslationAlgo.mapOfSubShapes();
-
-  FeaturesPlugin_Tools::storeModifiedShapes(theTranslationAlgo, theResultBody,
-                                            theBaseShape, 1, 2, 3, aTranslatedName,
-                                            *aSubShapes.get());
-}
index 191f208ab2201124903c1d1c31d31c0422d3f4e0..624d8de393c49c8c40984baae44ef4df4de5eb73 100644 (file)
@@ -149,10 +149,6 @@ private:
 
   ///Perform the translation usind two points
   void performTranslationByTwoPoints();
-
-  void loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
 };
 
 #endif
index 775da23a3416a93956b2801ec6f296d7a5165766..fe7122c4a705b398d3e1ed55d071f7d572a230d7 100644 (file)
@@ -23,6 +23,7 @@
 #include <GeomAlgoAPI_Boolean.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_PaveFiller.h>
+#include <GeomAlgoAPI_Tools.h>
 #include <GeomAlgoAPI_UnifySameDomain.h>
 
 #include <GeomAPI_ShapeExplorer.h>
@@ -109,6 +110,7 @@ void FeaturesPlugin_Union::execute()
   }
 
   // Fuse objects.
+  std::string anError;
   std::shared_ptr<GeomAlgoAPI_MakeShape> anAlgo;
   ListOfShape aTools;
   if (anObjects.front()->shapeType() == GeomAPI_Shape::SOLID) {
@@ -121,23 +123,15 @@ void FeaturesPlugin_Union::execute()
   }
 
   // Checking that the algorithm worked properly.
-  GeomAlgoAPI_MakeShapeList aMakeShapeList;
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
   GeomAPI_DataMapOfShapeShape aMapOfShapes;
-  if(!anAlgo->isDone()) {
-    setError("Error: Boolean algorithm failed.");
-    return;
-  }
-  if(anAlgo->shape()->isNull()) {
-    setError("Error: Resulting shape is Null.");
-    return;
-  }
-  if(!anAlgo->isValid()) {
-    setError("Error: Resulting shape is not valid.");
+  if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) {
+    setError(anError);
     return;
   }
 
   GeomShapePtr aShape = anAlgo->shape();
-  aMakeShapeList.appendAlgo(anAlgo);
+  aMakeShapeList->appendAlgo(anAlgo);
   aMapOfShapes.merge(anAlgo->mapOfSubShapes());
 
   // Store original shapes for naming.
@@ -149,44 +143,25 @@ void FeaturesPlugin_Union::execute()
     aShapesToAdd.push_back(aShape);
     std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
       new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
-    if(!aFillerAlgo->isDone()) {
-      setError("Error: PaveFiller algorithm failed.");
-      return;
-    }
-    if(aFillerAlgo->shape()->isNull()) {
-      setError("Error: Resulting shape is Null.");
-      return;
-    }
-    if(!aFillerAlgo->isValid()) {
-      setError("Error: Resulting shape is not valid.");
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
     aShape = aFillerAlgo->shape();
-    aMakeShapeList.appendAlgo(aFillerAlgo);
+    aMakeShapeList->appendAlgo(aFillerAlgo);
     aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
   }
   // workaround: make copy to name edges correctly
 
   // Store result and naming.
-  const int aModifyEdgeTag = 1;
-  const int aModifyFaceTag = 2;
-  const int aDeletedTag = 3;
-  /// sub solids will be placed at labels 4, 5 etc. if result is compound of solids
-  const int aSubsolidsTag = 4;
-  const std::string aModEName = "Modified_Edge";
-  const std::string aModFName = "Modified_Face";
 
   std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
-  aResultBody->storeModified(anObjects.front(), aShape, aSubsolidsTag);
+  aResultBody->storeModified(anObjects.front(), aShape);
 
   for(ListOfShape::const_iterator anIter = anObjects.begin(); anIter != anObjects.end(); ++anIter) {
-    aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::EDGE,
-                                             aModifyEdgeTag, aModEName, aMapOfShapes,
-                                             false, true, true);
-    aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE,
-                                             aModifyFaceTag, aModFName, aMapOfShapes,
-                                             false, true, true);
+    aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::EDGE);
+    aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::FACE);
     //aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
   }
 
index aa78551d6b665e30f0dcf7a03d678694efa7bb1a..4f9b5f1f1d4379f0a86584382ff0bebc5db5dfad 100644 (file)
@@ -411,7 +411,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
     if (aContext.get())
       aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
     if(aConstruction.get()) {
-      // Construciotn selected. Check that is is not infinite.
+      // Construction selected. Check that it is not infinite.
       if(aConstruction->isInfinite()) {
         theError = "Error: Infinite constructions is not allowed as base.";
         return false;
@@ -430,7 +430,6 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
           return true;
         }
       }
-
       return false;
     }
 
@@ -547,10 +546,16 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid(
       if(aContext.get()) {
         aDirShape = aContext->shape();
       }
+
+      if (aDirShape.get() && aDirShape->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aDirShape);
+        aDirShape = anIt.current();
+      }
     }
   }
 
-  if(!aDirShape.get()) {
+  if(!aDirShape.get() || aDirShape->isNull() ||
+     aDirShape->shapeType() != GeomAPI_Shape::EDGE) {
     // Check that dir can be empty.
     if(!isShapesCanBeEmpty(aCheckAttribute, theError)) {
       theError = "Error: Base objects list contains vertex or edge, so attribute \"%1\" "
@@ -1163,75 +1168,44 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
     return false;
   }
 
-  int anObjectsNb = 0, aToolsNb = 0;
-  //int anOperationType = 0;
+  int anObjectsToolsNb[2] = { 0,  0 };
 
   std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
 
   bool isAllInSameCompSolid = true;
   ResultBodyPtr aCompSolid;
 
-  AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
-  if (anAttrSelList)
-  {
-    anObjectsNb = anAttrSelList->size();
-    for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex)
-    {
-      AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
-      ResultPtr aContext = anAttr->context();
-      ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
-      if (aResCompSolidPtr.get())
-      {
-        if (aCompSolid.get())
-        {
-          isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
-        }
-        else
-        {
-          aCompSolid = aResCompSolidPtr;
-        }
-      }
-      else
-      {
-        isAllInSameCompSolid = false;
-        break;
-      }
-    }
-  }
-  anIt++;
-
-
-  anAttrSelList = theFeature->selectionList(*anIt);
-  if (anAttrSelList)
-  {
-    aToolsNb = anAttrSelList->size();
-    if (isAllInSameCompSolid)
+  for (int* anArgNbIt = anObjectsToolsNb; anIt != aLast; ++anIt, ++anArgNbIt) {
+    AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
+    if (anAttrSelList)
     {
-      for (int anIndex = 0; anIndex < aToolsNb; ++anIndex)
-      {
-        AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
-        ResultPtr aContext = anAttr->context();
-        ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
-        if (aResCompSolidPtr.get())
+      *anArgNbIt = anAttrSelList->size();
+      if (isAllInSameCompSolid) {
+        for (int anIndex = 0; anIndex < *anArgNbIt; ++anIndex)
         {
-          if (aCompSolid.get())
+          AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+          ResultPtr aContext = anAttr->context();
+          ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
+          if (aResCompSolidPtr.get())
           {
-            isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+            if (aCompSolid.get())
+            {
+              isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+            }
+            else
+            {
+              aCompSolid = aResCompSolidPtr;
+            }
           }
           else
           {
-            aCompSolid = aResCompSolidPtr;
+            isAllInSameCompSolid = false;
+            break;
           }
         }
-        else
-        {
-          isAllInSameCompSolid = false;
-          break;
-        }
       }
     }
   }
-  anIt++;
 
   std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
     std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theFeature);
@@ -1240,7 +1214,7 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
   if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE)
   {
     // Fuse operation
-    if (anObjectsNb + aToolsNb < 2)
+    if (anObjectsToolsNb[0] + anObjectsToolsNb[1] < 2)
     {
       theError = "Not enough arguments for Fuse operation.";
       return false;
@@ -1253,12 +1227,12 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
   }
   else
   {
-    if (anObjectsNb < 1)
+    if (anObjectsToolsNb[0] < 1) // check number of objects
     {
       theError = "Objects not selected.";
       return false;
     }
-    if (aToolsNb < 1)
+    if (anObjectsToolsNb[1] < 1) // check number of tools
     {
       theError = "Tools not selected.";
       return false;
index a9d0762a96791ab2139ecaa7924c286ce3ceabb9..9fdb8f1be5f8b201bc1ab7c5febb4129d235b543 100644 (file)
@@ -19,7 +19,6 @@
 ##
 
 # -*- coding: utf-8 -*-
-from SketchAPI import *
 
 from salome.shaper import model
 
@@ -30,7 +29,7 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OZ"), False
 SketchLine_1 = SketchProjection_1.createdFeature()
 SketchLine_1.setName("SketchLine_5")
 SketchLine_1.result().setName("SketchLine_5")
-SketchLine_2 = Sketch_1.addLine(0.008, 0.0005000000000000006, 0.0075, -1.258295422426014e-035)
+SketchLine_2 = Sketch_1.addLine(0.008, 0.0005000000000000006, 0.0075, -1.258295422426014e-35)
 SketchLine_2.setName("SketchLine_9")
 SketchLine_2.result().setName("SketchLine_9")
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False)
@@ -39,7 +38,7 @@ SketchLine_3.setName("SketchLine_10")
 SketchLine_3.result().setName("SketchLine_10")
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result())
 SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_12")
-SketchLine_4 = Sketch_1.addLine(0.0075, -1.258295422426014e-035, 0.005, 0)
+SketchLine_4 = Sketch_1.addLine(0.0075, -1.258295422426014e-35, 0.005, 0)
 SketchLine_4.setName("SketchLine_11")
 SketchLine_4.result().setName("SketchLine_11")
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_4.startPoint())
@@ -60,7 +59,7 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
 SketchConstraintVertical_1.setName("SketchConstraintVertical_3")
 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result())
 SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_3")
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 45)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 45.00000000000001)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 0.02)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), 0.005)
 SketchConstraintLength_2.setName("SketchConstraintLength_4")
@@ -95,14 +94,14 @@ SketchLine_11.setName("SketchLine_16")
 SketchLine_11.result().setName("SketchLine_16")
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17")
-SketchLine_12 = Sketch_1.addLine(0.008999999999999999, 0.042, -5.446629538236431e-036, 0.042)
+SketchLine_12 = Sketch_1.addLine(0.008999999999999999, 0.042, -5.446629538236431e-36, 0.042)
 SketchLine_12.setName("SketchLine_17")
 SketchLine_12.result().setName("SketchLine_17")
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18")
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
-SketchLine_13 = Sketch_1.addLine(-5.446629538236431e-036, 0.042, 0, 0.02)
+SketchLine_13 = Sketch_1.addLine(-5.446629538236431e-36, 0.042, 0, 0.02)
 SketchLine_13.setName("SketchLine_18")
 SketchLine_13.result().setName("SketchLine_18")
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
@@ -141,16 +140,16 @@ SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_22")
 model.do()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_9r-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_7f-SketchLine_8f-SketchArc_1_2r-SketchLine_14f-SketchArc_2_2r-SketchLine_15f-SketchLine_16f-SketchLine_17f-SketchLine_18f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_7f-SketchLine_8f-SketchArc_1_2r-SketchLine_14f-SketchArc_2_2r-SketchLine_15f-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_9r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchLine_14 = Sketch_2.addLine(-5.446629538236431e-036, 0.042, 5.172728347136208e-022, 0.03963932022500211)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/Vertex-SketchLine_18s-SketchLine_17e"), False)
+SketchLine_14 = Sketch_2.addLine(-5.446629538236431e-36, 0.042, 5.172728347136208e-22, 0.03963932022500211)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_17_EndVertex"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_1.result())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_18"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/SketchLine_18"), False)
 SketchLine_15 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result())
-SketchArc_3 = Sketch_2.addArc(0.02, 0.062, 5.172728347136208e-022, 0.03963932022500211, 0.02, 0.032, False)
+SketchArc_3 = Sketch_2.addArc(0.02, 0.062, 5.172728347136208e-22, 0.03963932022500211, 0.02, 0.032, False)
 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_3.startPoint())
 SketchLine_16 = Sketch_2.addLine(0.02, 0.032, 0.02, 0.042)
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_16.startPoint())
@@ -166,9 +165,9 @@ SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"
 SketchLine_18 = SketchProjection_5.createdFeature()
 SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_18.result(), SketchArc_3.center(), 0.062, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_1_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0.008999999999999999, 0.008999999999999999)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0.008999999999999999, 0.008999999999999999)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_13"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_7"))
 RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 10, 28, [model.selection("SOLID", "Fuse_1_1")])
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_19 = Sketch_3.addLine(0.029, 0.042, 0.029, 0.03267384683690003)
@@ -183,7 +182,7 @@ SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_19.result())
 SketchLine_21 = Sketch_3.addLine(0.008999999999999999, 0.042, 0.029, 0.042)
 SketchLine_21.setName("SketchLine_9")
 SketchLine_21.result().setName("SketchLine_9")
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_22 = SketchProjection_6.createdFeature()
 SketchLine_22.setName("SketchLine_10")
 SketchLine_22.result().setName("SketchLine_10")
@@ -195,9 +194,11 @@ SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_21.startPoint
 SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_11")
 SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_21.result())
 SketchConstraintAngle_2 = Sketch_3.setAngle(SketchLine_20.result(), SketchLine_21.result(), 25)
-SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/Vertex-SketchLine_17s-SketchLine_16e"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_16_EndVertex"), False)
+SketchPoint_2 = SketchProjection_7.createdFeature()
 SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_21.result(), 0.02)
 RevolutionCut_1.setNestedSketch(Sketch_3)
+model.do()
 model.end()
 
 # check that result was created
index 9347af3ff51c162aafb42bb4ae0af0c29587568d..70dac95921f5d41d618e6f377facfe93448e238b 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
-# Create document
 model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-
-# Create base and path for pipe
 Point_2 = model.addPoint(Part_1_doc, 5, 20, 0)
 Point_3 = model.addPoint(Part_1_doc, 0, 40, 30)
 Point_4 = model.addPoint(Part_1_doc, 10, 50, 70)
@@ -59,7 +58,7 @@ SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], Sketch
 SketchConstraintRigid_1 = Sketch_1.setFixed(SketchArc_1.startPoint())
 SketchConstraintRigid_2 = Sketch_1.setFixed(SketchLine_2.endPoint())
 model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")]
 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_4 = Sketch_2.addLine(9.525599451781, 2.539525405208, -21.231656152164, 2.539525405208)
@@ -87,18 +86,11 @@ SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_5.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_7.result())
 model.do()
-
-# Create pipe on the entire path (big pipe)
 Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("WIRE", "Wire_1_1"))
-
-# Create pipe on the fisrt segment of the path (small pipe)
-Pipe_2 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"))
-
-# Cut big pipe from the small pipe
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_1/SketchArc_2_2"))
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Pipe_2_1")], [model.selection("SOLID", "Pipe_1_1")])
 model.do()
+model.end()
 
 # Check that the small pipe is a part of the big one
 assert(len(Cut_1.results()) == 0)
-
-model.end()
index 3fe9e47ee38298292739b4d0d4c192efd91bfb1a..f06b0e7d874452358eba53a995d97c124b37e9db 100644 (file)
@@ -60,28 +60,28 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Lgz")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "Lgx")
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Ray")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchArc_1_2f-SketchLine_4r-SketchLine_6r")], model.selection(), 0, "Lgy")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_1r")], model.selection(), 0, "Lgy")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
 SketchLine_7 = Sketch_2.addLine(0, -75, 0, 0)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
 SketchPoint_2 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_2.result())
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False)
 SketchPoint_3 = SketchProjection_5.createdFeature()
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_3.result())
 SketchLine_8 = Sketch_2.addLine(0, 0, 60, 0)
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
-SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
 SketchPoint_4 = SketchProjection_6.createdFeature()
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_4.result())
 SketchLine_9 = Sketch_2.addLine(60, 0, 59.99999999999999, -62.5)
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
 SketchLine_10 = SketchProjection_7.createdFeature()
 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.result())
 SketchLine_11 = Sketch_2.addLine(0, -75, 47.49999999999999, -75)
 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
-SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"), False)
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False)
 SketchLine_12 = SketchProjection_8.createdFeature()
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
 SketchArc_2 = Sketch_2.addArc(47.49999999999999, -62.5, 59.99999999999999, -62.5, 47.49999999999999, -75, True)
@@ -91,8 +91,9 @@ SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(),
 SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_11.result())
 SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_9.result(), SketchArc_2.results()[1])
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_11f-SketchArc_2_2f")], model.selection(), 0, "Lgx")
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchArc_2_2f-SketchLine_9r-SketchLine_8r-SketchLine_7r")], model.selection(), 0, "Lgx")
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
+model.do()
 model.end()
 
 assert(len(Common_1.results()) == 1)
index 3d4de21bfc2ccac3a36cfb4cacc775594b39895a..388ccab83bd8e11ab2e07e2f8e7363020eb7cd7b 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -33,7 +35,8 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_2 = Sketch_2.addCircle(-111.0503834053735, -148.4878232655183, 89.21253106334201)
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
+model.do()
 model.end()
 
 assert(model.checkPythonDump())
index 8b1fc660b7715b59a850e78602b78790d4e0671c..12444649834609abe290210eaec8abef04620d3a 100644 (file)
@@ -18,7 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
-from ModelAPI import *
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -90,45 +91,47 @@ SketchPoint_11 = Sketch_1.addPoint(-342.6051560379917, -180.9380775505472)
 SketchPoint_11.setName("SketchPoint_13")
 SketchPoint_11.result().setName("SketchPoint_13")
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_11.coordinates(), SketchLine_5.result())
-SketchPoint_12 = Sketch_1.addPoint(-584.124830393487, -180.9380775505472)
+SketchPoint_12 = Sketch_1.addPoint(-584.1248303934869, -180.9380775505472)
 SketchPoint_12.setName("SketchPoint_14")
 SketchPoint_12.result().setName("SketchPoint_14")
 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_5.result())
 model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_7"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_11"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_10"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_8"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_9"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_13"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_6e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_14"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_6"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_5")])
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2"), model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4"), model.selection("VERTEX", "Vertex_1_5"), model.selection("VERTEX", "Vertex_1_6"), model.selection("VERTEX", "Vertex_1_7"), model.selection("VERTEX", "Vertex_1_8"), model.selection("VERTEX", "Vertex_1_9"), model.selection("VERTEX", "Vertex_1_10"), model.selection("VERTEX", "Vertex_1_11"), model.selection("VERTEX", "Vertex_1_12"), model.selection("VERTEX", "Vertex_1_13"), model.selection("VERTEX", "Vertex_1_14"), model.selection("VERTEX", "Vertex_1_15"), model.selection("VERTEX", "Vertex_1_16"), model.selection("VERTEX", "Vertex_1_17"), model.selection("VERTEX", "Vertex_1_18")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
+Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_7"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_11"), model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_10"), model.selection("VERTEX", "Sketch_1/SketchPoint_8"), model.selection("VERTEX", "Sketch_1/SketchPoint_9"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_13"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_14"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_6"), model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_4"), model.selection("VERTEX", "Sketch_1/SketchPoint_5")]
+Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects)
+Extrusion_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2"), model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4"), model.selection("VERTEX", "Vertex_1_5"), model.selection("VERTEX", "Vertex_1_6"), model.selection("VERTEX", "Vertex_1_7"), model.selection("VERTEX", "Vertex_1_8"), model.selection("VERTEX", "Vertex_1_9"), model.selection("VERTEX", "Vertex_1_10"), model.selection("VERTEX", "Vertex_1_11"), model.selection("VERTEX", "Vertex_1_12"), model.selection("VERTEX", "Vertex_1_13"), model.selection("VERTEX", "Vertex_1_14"), model.selection("VERTEX", "Vertex_1_15"), model.selection("VERTEX", "Vertex_1_16"), model.selection("VERTEX", "Vertex_1_17"), model.selection("VERTEX", "Vertex_1_18")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OZ"), 100, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_1_12/To_Vertex"), model.selection("VERTEX", "Extrusion_1_13/To_Vertex"), model.selection("VERTEX", "Extrusion_1_3/To_Vertex"))
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_7 = Sketch_2.addLine(-717.0963364993213, -45.06817090071282, -717.0963364993213, -180.9380775505473)
-SketchPoint_13 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"))
+SketchPoint_13 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_12/To_Vertex"))
 SketchPoint_13.setName("SketchPoint_15")
 SketchPoint_13.result().setName("SketchPoint_15")
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_13.result())
-SketchPoint_14 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/To_Vertex_1"))
+SketchPoint_14 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/To_Vertex"))
 SketchPoint_14.setName("SketchPoint_16")
 SketchPoint_14.result().setName("SketchPoint_16")
 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_14.result())
 SketchLine_8 = Sketch_2.addLine(-717.0963364993213, -180.9380775505473, -102.0809741405142, -180.9380775505473)
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
-SketchPoint_15 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
+SketchPoint_15 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_3/To_Vertex"))
 SketchPoint_15.setName("SketchPoint_17")
 SketchPoint_15.result().setName("SketchPoint_17")
 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_15.result())
 SketchLine_9 = Sketch_2.addLine(-102.0809741405142, -180.9380775505473, -102.0809741405142, 193.0685819822336)
 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchPoint_16 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_10/To_Vertex_1"))
+SketchPoint_16 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_10/To_Vertex"))
 SketchPoint_16.setName("SketchPoint_18")
 SketchPoint_16.result().setName("SketchPoint_18")
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_16.result())
 SketchLine_10 = Sketch_2.addLine(-102.0809741405142, 193.0685819822336, -254.8675173043772, 193.0685819822336)
 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchPoint_17 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_5/To_Vertex_1"))
+SketchPoint_17 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_5/To_Vertex"))
 SketchPoint_17.setName("SketchPoint_19")
 SketchPoint_17.result().setName("SketchPoint_19")
 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_17.result())
 SketchLine_11 = Sketch_2.addLine(-254.8675173043772, 193.0685819822336, -254.8675173043772, -45.06817090071281)
 SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchPoint_18 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_9/To_Vertex_1"))
+SketchPoint_18 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_9/To_Vertex"))
 SketchPoint_18.setName("SketchPoint_20")
 SketchPoint_18.result().setName("SketchPoint_20")
 SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_18.result())
@@ -136,18 +139,18 @@ SketchLine_12 = Sketch_2.addLine(-254.8675173043772, -45.06817090071281, -717.09
 SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
 SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_12.endPoint())
 SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchPoint_13.coordinates(), SketchLine_12.endPoint())
-SketchLine_13 = Sketch_2.addLine(-599.2405881202537, -45.06817090071282, -584.124830393487, -180.9380775505472)
+SketchLine_13 = Sketch_2.addLine(-599.2405881202537, -45.06817090071282, -584.1248303934869, -180.9380775505472)
 SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_13.startPoint(), SketchLine_12.result())
-SketchPoint_19 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"))
+SketchPoint_19 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_13/To_Vertex"))
 SketchPoint_19.setName("SketchPoint_21")
 SketchPoint_19.result().setName("SketchPoint_21")
 SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchPoint_19.result())
 SketchLine_14 = Sketch_2.addLine(-356.1736770691994, -45.06817090071282, -342.6051560379917, -180.9380775505472)
-SketchPoint_20 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_15/To_Vertex_1"))
+SketchPoint_20 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_15/To_Vertex"))
 SketchPoint_20.setName("SketchPoint_22")
 SketchPoint_20.result().setName("SketchPoint_22")
 SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_20.result())
-SketchPoint_21 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_11/To_Vertex_1"))
+SketchPoint_21 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_11/To_Vertex"))
 SketchPoint_21.setName("SketchPoint_23")
 SketchPoint_21.result().setName("SketchPoint_23")
 SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_21.result())
@@ -157,12 +160,17 @@ SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_18.coordinat
 SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint())
 SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_9.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7f-SketchLine_8f-SketchLine_12f-SketchLine_13r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_12f-SketchLine_13f-SketchLine_14r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_9f-SketchLine_12f-SketchLine_14f-SketchLine_15r")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_15f")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1"), model.selection("EDGE", "Extrusion_1_2"), model.selection("EDGE", "Extrusion_1_3"), model.selection("EDGE", "Extrusion_1_4"), model.selection("EDGE", "Extrusion_1_5"), model.selection("EDGE", "Extrusion_1_6"), model.selection("EDGE", "Extrusion_1_7"), model.selection("EDGE", "Extrusion_1_8"), model.selection("EDGE", "Extrusion_1_9"), model.selection("EDGE", "Extrusion_1_10"), model.selection("EDGE", "Extrusion_1_11"), model.selection("EDGE", "Extrusion_1_12"), model.selection("EDGE", "Extrusion_1_13"), model.selection("EDGE", "Extrusion_1_14"), model.selection("EDGE", "Extrusion_1_15"), model.selection("EDGE", "Extrusion_1_16"), model.selection("EDGE", "Extrusion_1_17"), model.selection("EDGE", "Extrusion_1_18"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_8f-SketchLine_13r-SketchLine_12f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8f-SketchLine_14r-SketchLine_12f-SketchLine_13f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_15r-SketchLine_12f-SketchLine_14f_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_15f_wire")])
+Partition_1_objects = [model.selection("EDGE", "Extrusion_1_1"), model.selection("EDGE", "Extrusion_1_2"), model.selection("EDGE", "Extrusion_1_3"), model.selection("EDGE", "Extrusion_1_4"), model.selection("EDGE", "Extrusion_1_5"), model.selection("EDGE", "Extrusion_1_6"), model.selection("EDGE", "Extrusion_1_7"), model.selection("EDGE", "Extrusion_1_8"), model.selection("EDGE", "Extrusion_1_9"), model.selection("EDGE", "Extrusion_1_10"), model.selection("EDGE", "Extrusion_1_11"), model.selection("EDGE", "Extrusion_1_12"), model.selection("EDGE", "Extrusion_1_13"), model.selection("EDGE", "Extrusion_1_14"), model.selection("EDGE", "Extrusion_1_15"), model.selection("EDGE", "Extrusion_1_16"), model.selection("EDGE", "Extrusion_1_17"), model.selection("EDGE", "Extrusion_1_18"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
 model.end()
+
+from ModelAPI import *
+
 PartitionFeature = Partition_1.feature()
 assert(len(PartitionFeature.results()) == 1)
 PartitionResult = modelAPI_ResultBody(PartitionFeature.firstResult())
index b4ffe91438f218b9271aefe20685a41dd60527ba..ada970bc5b44a15aa44acc4652b5f8210ab4589e 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -29,25 +31,25 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 model.addParameter(Part_1_doc, "a", "100")
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/Plane_4"))
-SketchLine_1 = Sketch_1.addLine(-5.023684372475525, -46.5755143466786, -14.75825153820805, -43.01597925234075)
+SketchLine_1 = Sketch_1.addLine(-5.024014514861164, -46.57477619916804, -15.03025649976126, -42.91660461599292)
 SketchLine_1.setName("SketchLine_9")
 SketchLine_1.result().setName("SketchLine_9")
-SketchLine_2 = Sketch_1.addLine(-33.96152175760117, -20.26294727816075, -38.72043789437247, 5.632510332222703)
+SketchLine_2 = Sketch_1.addLine(-34.15308715195452, -20.5925185611531, -39.51293324824182, 6.356619200673476)
 SketchLine_2.setName("SketchLine_10")
 SketchLine_2.result().setName("SketchLine_10")
-SketchLine_3 = Sketch_1.addLine(-5.023684372475525, -46.5755143466786, -30.86227207373359, -37.12739424591874)
+SketchLine_3 = Sketch_1.addLine(-5.024014514861164, -46.57477619916804, -30.86442523156243, -37.12780736470863)
 SketchLine_3.setName("SketchLine_1")
 SketchLine_3.result().setName("SketchLine_1")
 SketchLine_3.setAuxiliary(True)
-SketchLine_4 = Sketch_1.addLine(-30.86227207373359, -37.12739424591874, -38.72043789437247, 5.632510332222703)
+SketchLine_4 = Sketch_1.addLine(-30.86442523156243, -37.12780736470863, -39.51293324824182, 6.356619200673476)
 SketchLine_4.setName("SketchLine_2")
 SketchLine_4.result().setName("SketchLine_2")
 SketchLine_4.setAuxiliary(True)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
-SketchLine_5 = Sketch_1.addLine(-20.37351638704503, 39.82660556161157, 5.515492360623621, 50.89855436380311)
+SketchLine_5 = Sketch_1.addLine(-21.88471935002519, 39.79243387785534, 5.516674902531107, 51.5099134867221)
 SketchLine_5.setName("SketchLine_4")
 SketchLine_5.result().setName("SketchLine_4")
-SketchLine_6 = Sketch_1.addLine(5.515492360623621, 50.89855436380311, 32.11790618078412, 35.7788047045564)
+SketchLine_6 = Sketch_1.addLine(5.516674902531107, 51.5099134867221, 32.11790618078412, 35.7788047045564)
 SketchLine_6.setName("SketchLine_5")
 SketchLine_6.result().setName("SketchLine_5")
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
@@ -57,19 +59,19 @@ SketchLine_7.setName("SketchLine_6")
 SketchLine_7.result().setName("SketchLine_6")
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
 SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
-SketchLine_8 = Sketch_1.addLine(51.23593736581751, -10.42185420425237, 33.52439630860805, -30.08966199583723)
+SketchLine_8 = Sketch_1.addLine(51.23593736581751, -10.42185420425237, 33.52471395405271, -30.09043472300023)
 SketchLine_8.setName("SketchLine_7")
 SketchLine_8.result().setName("SketchLine_7")
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
-SketchLine_9 = Sketch_1.addLine(33.52439630860805, -30.08966199583723, -5.023684372475525, -46.5755143466786)
+SketchLine_9 = Sketch_1.addLine(33.52471395405271, -30.09043472300023, -5.024014514861164, -46.57477619916804)
 SketchLine_9.setName("SketchLine_8")
 SketchLine_9.result().setName("SketchLine_8")
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_9.endPoint())
 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
-SketchArc_1 = Sketch_1.addArc(-4.455634849643539, -14.84052735945157, -33.96152175760117, -20.26294727816075, -14.75825153820805, -43.01597925234075, False)
+SketchArc_1 = Sketch_1.addArc(-4.72938863253667, -14.74051331180418, -34.15308715195452, -20.5925185611531, -15.03025649976126, -42.91660461599292, False)
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
@@ -85,7 +87,7 @@ SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13")
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.result())
 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30)
-SketchArc_2 = Sketch_1.addArc(-8.152231059872202, 11.25015706261054, -38.72043789437247, 5.632510332222703, -20.37351638704503, 39.82660556161157, True)
+SketchArc_2 = Sketch_1.addArc(-10.08923472882396, 12.20862445002239, -39.51293324824182, 6.356619200673476, -21.88471935002519, 39.79243387785534, True)
 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 30)
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint())
 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
@@ -175,14 +177,18 @@ SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_10.result(), Sketch
 SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_7.coordinates())
 SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34")
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_10r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_1_2f-SketchArc_2_2f-SketchArc_4_2r-SketchArc_3_2r")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_12"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_2_2f-SketchLine_10r-SketchArc_1_2f-SketchLine_9r-SketchArc_3_2r-SketchArc_4_2r")], model.selection("EDGE", "Sketch_2/SketchLine_12"), 360, 0)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/Plane_4"), model.selection("SOLID", "Revolution_1_1")])
 Recover_1 = model.addRecover(Part_1_doc, Partition_1, [Revolution_1.result()])
 Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/Axis_4"), model.selection("VERTEX", "PartSet/Point_2"), True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Recover_1_1"), model.selection("FACE", "Face_1_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_2_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_2"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_6_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_4_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_3"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_1_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_4"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_3_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_7_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_5_1")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Intersection_1_1_7"), model.selection("EDGE", "Intersection_1_1_6"), model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_11"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1"), model.selection("EDGE", "Intersection_1_1_4"), model.selection("EDGE", "Intersection_1_1_2"), model.selection("EDGE", "Intersection_1_1_10"), model.selection("EDGE", "Intersection_1_1_9"), model.selection("EDGE", "Intersection_1_1_8")])
+Group_1_objects = [model.selection("VERTEX", "[Intersection_1_1_3/Intersection_1_1_3&Face_1_1/Edge_3][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_9/Intersection_1_1_9&Face_1_1/Edge_7][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_7/Intersection_1_1_7&Face_1_1/Edge_5][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_2/Intersection_1_1_2&Face_1_1/Edge_2][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_6/Intersection_1_1_6&Face_1_1/Edge_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_10/Intersection_1_1_10&Face_1_1/Edge_8][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_8/Intersection_1_1_8&Face_1_1/Edge_6][weak_name_1]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("EDGE", "Intersection_1_1_7"), model.selection("EDGE", "Intersection_1_1_6"), model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_11"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1"), model.selection("EDGE", "Intersection_1_1_4"), model.selection("EDGE", "Intersection_1_1_2"), model.selection("EDGE", "Intersection_1_1_10"), model.selection("EDGE", "Intersection_1_1_9"), model.selection("EDGE", "Intersection_1_1_8")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
+model.do()
 model.end()
 
 aGroupFeature = Group_1.feature()
index cfde51a8180d3d226c77776801a989319f542b9e..0c9156338da5c6e0b101d9b777caf0db06cb2002 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -38,8 +40,8 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 SketchLine_5 = Sketch_2.addLine(99.48542024013722, 69.46826758147516, -34.30531732418524, 69.46826758147516)
 SketchLine_6 = Sketch_2.addLine(-34.30531732418524, 69.46826758147516, -34.30531732418524, -62.60720411663805)
 SketchLine_7 = Sketch_2.addLine(-34.30531732418524, -62.60720411663805, 99.48542024013722, -62.60720411663805)
@@ -53,9 +55,10 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 110)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 110)
 Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "Intersection_1_1")], model.selection("EDGE", "PartSet/OZ"), 45)
+model.do()
 model.end()
 
 assert(model.checkPythonDump())
index 8a98df7e97ba911ace53474ea0d8a316dee7599d..8cc936b8e085c25fed28d410cfa6caa1e0928e72 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -37,14 +39,14 @@ SketchLine_5 = Sketch_1.addLine(-379.073756432247, 108.9193825042881, -360.20583
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_5r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_5r")], model.selection(), 100, 0)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f")], model.selection(), 100, 0)
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Extrusion_2_1")])
 Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), 50)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Translation_2_1/Translated_Face_24"), model.selection("FACE", "Translation_2_1/Translated_Face_13"), model.selection("FACE", "Translation_2_1/Translated_Face_16"), model.selection("FACE", "Translation_2_1/Translated_Face_12"), model.selection("FACE", "Translation_2_1/Translated_Face_9"), model.selection("FACE", "Translation_2_1/Translated_Face_10"), model.selection("FACE", "Translation_2_1/Translated_Face_11"), model.selection("FACE", "Translation_2_1/Translated_Face_25"), model.selection("FACE", "Translation_2_1/Translated_Face_20"), model.selection("FACE", "Translation_2_1/Translated_Face_19"), model.selection("FACE", "Translation_2_1/Translated_Face_18"), model.selection("FACE", "Translation_2_1/Translated_Face_27"), model.selection("FACE", "Translation_2_1/Translated_Face_17"), model.selection("FACE", "Translation_2_1/Translated_Face_31"), model.selection("FACE", "Translation_2_1/Translated_Face_32"), model.selection("FACE", "Translation_2_1/Translated_Face_30"), model.selection("FACE", "Translation_2_1/Translated_Face_28"), model.selection("FACE", "Translation_2_1/Translated_Face_29"), model.selection("FACE", "Translation_2_1/Translated_Face_8"), model.selection("FACE", "Translation_2_1/Translated_Face_22"), model.selection("FACE", "Translation_2_1/Translated_Face_7"), model.selection("FACE", "Translation_2_1/Translated_Face_6"), model.selection("FACE", "Translation_2_1/Translated_Face_5"), model.selection("FACE", "Translation_2_1/Translated_Face_3"), model.selection("FACE", "Translation_2_1/Translated_Face_1"), model.selection("FACE", "Translation_2_1/Translated_Face_2"), model.selection("FACE", "Translation_2_1/Translated_Face_21"), model.selection("FACE", "Translation_2_1/Translated_Face_4"), model.selection("FACE", "Translation_2_1/Translated_Face_25"), model.selection("FACE", "Translation_2_1/Translated_Face_27"), model.selection("FACE", "Translation_2_1/Translated_Face_21"), model.selection("FACE", "Translation_2_1/Translated_Face_22"), model.selection("FACE", "Translation_2_1/Translated_Face_26"), model.selection("FACE", "Translation_2_1/Translated_Face_23"), model.selection("FACE", "Translation_2_1/Translated_Face_30"), model.selection("FACE", "Translation_2_1/Translated_Face_23"), model.selection("FACE", "Translation_2_1/Translated_Face_14"), model.selection("FACE", "Translation_2_1/Translated_Face_15")])
-#Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Translation_2_1_6/Translated_Face_1"), model.selection("FACE", "Translation_2_1_5/Translated_Face_1"), model.selection("FACE", "Translation_2_1_5/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_4"), model.selection("FACE", "Translation_2_1_5/Translated_Face_3"), model.selection("FACE", "Translation_2_1_5/Translated_Face_2"), model.selection("FACE", "Translation_2_1_5/Translated_Face_5"), model.selection("FACE", "Translation_2_1_7/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_5"), model.selection("FACE", "Translation_2_1_4/Translated_Face_1"), model.selection("FACE", "Translation_2_1_2/Translated_Face_2"), model.selection("FACE", "Translation_2_1_5/Translated_Face_5"), model.selection("FACE", "Translation_2_1_2/Translated_Face_1"), model.selection("FACE", "Translation_2_1_4/Translated_Face_5"), model.selection("FACE", "Translation_2_1_2/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_5"), model.selection("FACE", "Translation_2_1_1/Translated_Face_3"), model.selection("FACE", "Translation_2_1_4/Translated_Face_2"), model.selection("FACE", "Translation_2_1_2/Translated_Face_3"), model.selection("FACE", "Translation_2_1_1/Translated_Face_4"), model.selection("FACE", "Translation_2_1_1/Translated_Face_1"), model.selection("FACE", "Translation_2_1_1/Translated_Face_2"), model.selection("FACE", "Translation_2_1_3/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_5"), model.selection("FACE", "Translation_2_1_3/Translated_Face_2"), model.selection("FACE", "Translation_2_1_3/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_1"), model.selection("FACE", "Translation_2_1_7/Translated_Face_3"), model.selection("FACE", "Translation_2_1_7/Translated_Face_5"), model.selection("FACE", "Translation_2_1_7/Translated_Face_4"), model.selection("FACE", "Translation_2_1_7/Translated_Face_1"), model.selection("FACE", "Translation_2_1_7/Translated_Face_2"), model.selection("FACE", "Translation_2_1_6/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_2"), model.selection("FACE", "Translation_2_1_6/Translated_Face_3")])
-
+Group_1_objects = [model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "(Translation_2_1_2/MF:Translated&Sketch_1/SketchLine_1)(Translation_2_1_2/MF:Translated&Extrusion_2_1/From_Face&Extrusion_1_1/From_Face)(Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face)(Translation_2_1_2/MF:Translated&Sketch_1/SketchLine_2)"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/From_Face&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_5")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 groupFeature = Group_1.feature()
index 72c1b77f1298b988b0dac10bd0ad60e4e2d47378..bb3cb3670489d3637c1fa631c22f171834a68c4a 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -31,9 +33,11 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(),
 model.do()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_3")])
+Wire_1_objects = [model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1")])
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 model.do()
 model.end()
 
index 993dceb2e55f66aea12ba82aa5cb2c9a6b87bca4..8d9af6b571695ddc891e2c7d4b3e100f46791985 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -36,7 +38,7 @@ SketchLine_5 = Sketch_1.addLine(551.916977573864, -398.3514326277755, -18.083022
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchLine_6 = Sketch_1.addLine(-18.08302242613596, -398.3514326277755, -18.08302242613596, -98.35143262777552)
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchArc_1 = Sketch_1.addArc(0, -7.626897158721915e-023, -85.62958302127123, 51.64856737222455, -18.08302242613596, -98.35143262777552, False)
+SketchArc_1 = Sketch_1.addArc(0, -7.626897158721915e-23, -85.62958302127123, 51.64856737222455, -18.08302242613596, -98.35143262777552, False)
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint())
 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result())
@@ -50,8 +52,8 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), 570)
 SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_5.result(), SketchLine_4.result(), 139.9999999999999)
 SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 124.9999999999987)
 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_6.result(), 300)
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_2.result(), 350)
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 300)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_2.result(), 350, False)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 300, False)
 SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchPoint_1.coordinates())
 SketchCircle_1 = Sketch_1.addCircle(623.3624504738834, 247.4315530304268, 75)
@@ -68,13 +70,15 @@ SketchPoint_2 = Sketch_1.addPoint(557.3438493481349, 211.8430112592427)
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.startPoint())
 SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_7.result(), SketchLine_8.result())
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchCircle_2.results()[1])
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_6.endPoint(), 325)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_6.endPoint(), 325, False)
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1])
-SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325, False)
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2"), model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Base_Edge_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_8"), model.selection("EDGE", "Revolution_2_1/Base_Edge_8"), model.selection("EDGE", "Revolution_2_1/Lateral_2"), model.selection("EDGE", "Revolution_2_1/Lateral_4"), model.selection("EDGE", "Revolution_2_1/Base_Edge_10"), model.selection("EDGE", "Revolution_2_1/Base_Edge_12"), model.selection("EDGE", "Revolution_2_1/Lateral_6")])
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index d42a091f4bbae90c466733cbd0661411913bdc5e..f7d815d2385adb8879051919a461a39ff0ab32e0 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,14 +29,15 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchCircle_1 = Sketch_1.addCircle(-79.57211859899775, 93.0358363165245, 69.46562387481423)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 SketchCircle_2 = Sketch_2.addCircle(-111.8968837135755, 98.96901887198163, 6.57145775571253)
 SketchCircle_3 = Sketch_2.addCircle(-41.97827733564338, 89.35676702647821, 6.102067916018811)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Smash_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Group_1_objects = [model.selection("FACE", "Extrusion_2_2/To_Face"), model.selection("FACE", "Extrusion_2_2/From_Face"), model.selection("FACE", "Extrusion_2_2/Generated_Face&Sketch_2/SketchCircle_3_2"), model.selection("FACE", "Extrusion_2_1/From_Face"), model.selection("FACE", "(Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2)(Extrusion_2_1/From_Face)(Extrusion_2_2/From_Face)"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_2_2/From_Face"), model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_2_2"), model.selection("FACE", "Extrusion_2_1/From_Face"), model.selection("FACE", "Extrusion_2_1/To_Face")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 model.do()
 model.end()
 
index 4375edb71d180f9c4c732660e1128480e1b7d0b6..b013f7602abf72d987a6e06067a78c310ebcdcac 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -25,12 +27,15 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
-SketchCircle_1 = Sketch_1.addCircle(-150, 79, -50, 79)
-SketchCircle_2 = Sketch_1.addCircle(-155, 278, -10, 278)
+SketchCircle_1 = Sketch_1.addCircle(-155, 278, 145)
+SketchCircle_2 = Sketch_1.addCircle(-150, 79, 100)
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f-SketchCircle_2_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][weak_name_1]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Base_Edge_8"), model.selection("EDGE", "Revolution_1_1/Base_Edge_10"), model.selection("EDGE", "Revolution_1_1/Base_Edge_12")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2"), model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Lateral_6")])
 model.end()
 
 # check that resulting group selection is valid
index cedd7f88f41aeb07d5e20fe4737f636e5c5291e1..8c57780a088cefc310240a50d62aac0ac172be6f 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,11 +29,12 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchCircle_1 = Sketch_1.addCircle(-150, 80, 100)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Base_Edge_4")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2")])
-Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Revolution_1_1/Lateral_2&Revolution_1_1/Base_Edge_4")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1][weak_name_1]")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1][weak_name_2]")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1]")])
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index dc6122bb31735e62789ffd2ccc7ccff959231d78..cf01ec2dc9917102fae3e346eaaf46baf9bad67f 100644 (file)
@@ -19,6 +19,7 @@
 ##
 
 # revolution of 3-edges contour (4th is used as axis of rotation) is checking for naming of edges
+
 from salome.shaper import model
 
 model.begin()
@@ -35,8 +36,10 @@ SketchLine_4 = Sketch_1.addLine(138, 234, 138, 47)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Base_Edge_10"), model.selection("EDGE", "Revolution_1_1/Lateral_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_12"), model.selection("EDGE", "Revolution_1_1/Base_Edge_14")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/SketchLine_4"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][weak_name_3]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index 23bb4ff7ba76e595bd3e94aa7ceba19f71a7b87b..cdcd04e6ee3b4ba6bb284dbc90f4acf48413671a 100644 (file)
@@ -51,8 +51,10 @@ SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint())
 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5r-SketchLine_6r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&Revolution_1_1/Generated_Face_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Revolution_1_1/Base_Edge_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5r-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/SketchLine_4"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][weak_name_3]"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index 6c2b3f92d1989079887105630b04bd640ca9972f..f43d3273b46a209cb678d290b64c9b2f1c44d623 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,8 +43,8 @@ SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchL
 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"), 25, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"), 25, True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_5 = Sketch_2.addLine(84.67753244325934, -72.65003691291119, -28.95543815719345, -72.65003691291119)
 SketchLine_6 = Sketch_2.addLine(-28.95543815719345, -72.65003691291119, -28.95543815719345, 10.01640181835304)
@@ -57,7 +59,8 @@ SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
@@ -77,7 +80,7 @@ SketchConstraintParallel_3 = Sketch_3.setParallel(SketchLine_9.result(), SketchL
 SketchConstraintParallel_4 = Sketch_3.setParallel(SketchLine_10.result(), SketchLine_12.result())
 SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular(SketchLine_9.result(), SketchLine_12.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r")], model.selection(), 50, 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r")], model.selection(), 50, 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
 model.do()
 model.end()
index ccbab14c6e810cb435fa59820a3cad3191ede6e7..3143406a91ece6f7737ff2240ca1156cfc27bb18 100644 (file)
@@ -40,10 +40,12 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, False)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Plane_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Partition_1_1_2/Modified_Edge_1_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Partition_1_1_2/Modified_Edge&Face_1_1/Edge_4")])
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index f51ba4f890fb8d65eca861c40696f1877f6e3749..f306093b7e41e7682f05e35d8a92b659912d7a1e 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -72,7 +74,8 @@ SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result())
 SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
 SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_6f-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")], model.selection(), 10, 0)
+Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_6f-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
 model.do()
 model.end()
index c4015977df849cdfc993d76ef0967a62693ae033..1b67c69875dab1b05d0f4e9031bd7e5b47ea8156 100644 (file)
@@ -18,7 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
-# check that revolution that produces a sphere has correctly named 2 vertices with different names
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -37,8 +37,9 @@ SketchLine_2 = Sketch_1.addLine(0, 50, 0, -50)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Revolution_1_1/Vertex_6"), model.selection("VERTEX", "Revolution_1_1/Vertex_8")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 360, 0)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][weak_name_1]"), model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][weak_name_2]")])
+model.do()
 model.end()
 
 # check that resulting group selection is valid and names are different
index dd709a1bc32703df044ecfce68fc61b82a5d7efc..a0b739e7e73b58e81da5f692be6e0785aaa56524 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -52,20 +54,20 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_24")
 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint())
 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_25")
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5, False)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage")
 SketchConstraintLength_1.setName("SketchConstraintLength_2")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "length_assemblage")
@@ -93,27 +95,35 @@ SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552
 SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
 SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
+Face_3 = model.addFace(Part_1_doc, Face_3_objects)
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
+Face_4 = model.addFace(Part_1_doc, Face_4_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 Group_1.result().setName("eau")
 Group_1.result().setColor(0, 170, 255)
 Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_4_1")])
 Group_2.result().setName("acier")
 Group_2.result().setColor(170, 85, 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY"))
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Partition_1_1_1/Modified_Edge_14_15&Partition_1_1_1/Modified_Edge_14_16"))
+SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "[Partition_1_1_1/Modified_Edge&Face_4_1/Edge_7&Face_1_1/Edge_7][Partition_1_1_1/Modified_Edge&Face_4_1/Edge_6&Face_1_1/Edge_6]"))
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
 SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
 SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
 SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
 SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
@@ -125,21 +135,23 @@ SketchConstraintLength_3.setName("SketchConstraintLength_1")
 SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
 SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
 model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
-Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
-MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
-Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
-MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
-Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
-MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
-Recover_4 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
-MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
+LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
+LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
+Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
+LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
+Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
+LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
+Partition_2_objects = [model.selection("COMPOUND", "Partition_1_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
+model.do()
 model.end()
 
 # check that partition constructed correctly
index c178e45ab6e5a74c8f21cb6c301ca77285661698..ad02faa1e5576ac0e0d00a140429500f1a9a8d64 100644 (file)
@@ -37,9 +37,10 @@ SketchLine_2 = Sketch_1.addLine(0, -62, 0, 62)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 360, 0)
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OY"), 150)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Translation_1_1/Translated_Vertex_1"), model.selection("VERTEX", "Translation_1_1/Translated_Vertex_2")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2][weak_name_1]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2][weak_name_2]")])
+model.do()
 model.end()
 
 # check that resulting group selection is valid, names exist and different
index 20e48f5b9a5f339618c0318eef7cf59d027fd460..c3dbdf15df536f5ceddc9a103fee7820a4d79d41 100644 (file)
@@ -48,7 +48,9 @@ SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc
 SketchCircle_1 = Sketch_1.addCircle(-13.45056286489504, 169.4770920976776, 150.6703210346195)
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_9"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_7"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/Generated_Face_5"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/Generated_Face_9"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/Generated_Face_8"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_7")])
+Group_1_objects = [model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_4/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_4/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index c2694960e9d1ce764fb7eed19616c8f1c8fe50f0..d13c620cb0bc8a7c9157706c8ee3b34639ffb148 100644 (file)
@@ -56,7 +56,9 @@ SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], Sketch
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_4.endPoint())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face_19"), model.selection("FACE", "Extrusion_1_1/Generated_Face_18"), model.selection("FACE", "Extrusion_1_1/Generated_Face_16"), model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/From_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_19"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/From_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_9"), model.selection("FACE", "Extrusion_1_1/From_Face_6"), model.selection("FACE", "Extrusion_1_1/Generated_Face_13"), model.selection("FACE", "Extrusion_1_1/To_Face_6"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), model.selection("FACE", "Extrusion_1_1/To_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), model.selection("FACE", "Extrusion_1_1/Generated_Face_9"), model.selection("FACE", "Extrusion_1_1/Generated_Face_13"), model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), model.selection("FACE", "Extrusion_1_1/Generated_Face_14"), model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), model.selection("FACE", "Extrusion_1_1/Generated_Face_18"), model.selection("FACE", "Extrusion_1_1/From_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_11"), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), model.selection("FACE", "Extrusion_1_1/To_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_10"), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), model.selection("FACE", "Extrusion_1_1/To_Face_7"), model.selection("FACE", "Extrusion_1_1/From_Face_7"), model.selection("FACE", "Extrusion_1_1/Generated_Face_17"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_1")])
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_6/From_Face"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_6/To_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_5/To_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_5/From_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchArc_4_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_4_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_7/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_7/To_Face"), model.selection("FACE", "Extrusion_1_1_7/From_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index 92193a3a5dc60c0862c855a8e02c4426fa96859c..4c9921d13cde8c900ad9d80d4bb94ebb818d2f18 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -42,12 +44,13 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchCircle_1 = Sketch_1.addCircle(0, 0, 24.97092001270093)
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.center())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], model.selection(), 50, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_5 = Sketch_2.addLine(49.62901186301215, 25.3130971701971, 39.15939470736273, 25.3130971701971)
 SketchLine_6 = Sketch_2.addLine(39.15939470736273, 25.3130971701971, 39.15939470736273, 38.96586914453801)
 SketchLine_7 = Sketch_2.addLine(39.15939470736273, 38.96586914453801, 49.62901186301215, 38.96586914453801)
@@ -61,7 +64,7 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 50, 50, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 50, 50, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
 model.do()
 model.end()
 
index 90675d37ee7b3e55bb1be7354093e9338da7818a..8540d2dbebf0cd1f53a6dfacd787092cb932b6bc 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -45,7 +47,8 @@ SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_2.result(), Sketc
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result())
 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 10, 0)
 model.do()
 
index cd9c8d6890ac0be2a7539f75fafa6060bad08364..5726b506bd723d3895b53df83126e99d3575600c 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -51,7 +53,8 @@ SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 100, 100)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
 model.do()
 model.end()
index 0558504b80ece3a3047ce022ff57ae68e03d2a5c..cbdc10602069799fca00470dcd8e321f27a9e1bb 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -131,11 +133,11 @@ SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_6.result(),
 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_12.endPoint(), 8.1, False)
 SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_12.result(), 45)
 model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
 Face_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4")]
 Face_1 = model.addFace(Part_1_doc, Face_1_objects)
-Edge_2_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_16"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9")]
+Edge_2_objects = [model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_9")]
 Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
 Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3"), model.selection("EDGE", "Edge_2_4"), model.selection("EDGE", "Edge_2_5"), model.selection("EDGE", "Edge_2_6"), model.selection("EDGE", "Edge_2_7"), model.selection("EDGE", "Edge_2_8"), model.selection("EDGE", "Edge_2_9"), model.selection("EDGE", "Edge_2_10"), model.selection("EDGE", "Edge_2_11")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
index 1fbbd14c55c7ca53e434808b32df29144492f273..b468d2fce692403538ba82a91f0b8db129fd76f0 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -56,9 +58,9 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), 2)
 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_8.result(), 4)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
 SketchCircle_1.setAuxiliary(True)
@@ -67,7 +69,7 @@ SketchCircle_2 = Sketch_2.addCircle(4.113620667976081, 2.375000000000003, 1.1)
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
 SketchCircle_3 = Sketch_2.addCircle(-4.113620667974014, 2.375000000003604, 1.1)
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center())
-SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-012, -4.75000000000001, 1.1)
+SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-12, -4.75000000000001, 1.1)
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center())
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1])
@@ -79,12 +81,12 @@ SketchLine_10 = Sketch_2.addLine(-4.113620667974014, 2.375000000003604, 0, 0)
 SketchLine_10.setAuxiliary(True)
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.endPoint())
-SketchLine_11 = Sketch_2.addLine(4.163806340121522e-012, -4.75000000000001, 0, 0)
+SketchLine_11 = Sketch_2.addLine(4.163806340121522e-12, -4.75000000000001, 0, 0)
 SketchLine_11.setAuxiliary(True)
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_11.startPoint())
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.endPoint())
 SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_12 = SketchProjection_4.createdFeature()
 SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_12.result(), 30.00000000000006)
 SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_10.result(), 119.9999999999498)
@@ -173,49 +175,43 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_16.center(), Sket
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True)
 model.do()
 ExtrusionCut_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_16_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_12_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_12_2f-SketchCircle_10_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_6_2f-SketchCircle_5_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_7_2r_wire")]
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
 Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_3.result().setDeflection(1e-005)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3.result().setDeflection(1e-05)
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_21 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4.934853156880259)
 SketchLine_22 = Sketch_3.addLine(3.5, 4.934853156880259, 6.2, 4.934853156880259)
 SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
 SketchLine_23 = Sketch_3.addLine(6.2, 4.934853156880259, 6.2, 3.008501119175777)
 SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
 SketchLine_24 = SketchProjection_6.createdFeature()
 SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.result())
 SketchLine_25 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
 SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.startPoint())
 SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.endPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_5"), False)
 SketchLine_26 = SketchProjection_7.createdFeature()
 SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_26.result())
 SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_26.result())
 SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_22.result())
 SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_27 = SketchProjection_8.createdFeature()
 SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_25.result(), SketchLine_27.result())
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_28 = SketchProjection_9.createdFeature()
 SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_28.result(), 0.5, True)
 model.do()
 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0)
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
-# skip 3 vertices, limitation
-Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("VERTEX", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1")]
-Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-# skip 3 edges, limitation
-Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_2/Modified_Face_2"), model.selection("EDGE", "Common_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Common_1_1/Modified_Edge_1"), model.selection("EDGE", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
-Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
-Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Common_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Common_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Cut_1_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Common_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Common_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
-Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
+model.do()
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.end()
 
 assert(model.checkPythonDump())
index 36e38d9d5bed5148387d871352c3c412d6beac72..5f794351f7a197e3eaaf9a59128a3cc39bfd2530 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -32,11 +34,11 @@ SketchLine_3 = Sketch_1.addLine(46.08233276157804, -21.30874785591767, -1.039451
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
 SketchCircle_1 = Sketch_2.addCircle(-10.74792845018279, -51.46099937127247, 20.55678647017868)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0)
 model.do()
 model.end()
 
index 13639bba72ffef82aa25760db388a5d75b4dde96..cc0cde10622639ccd51a9ce8bafd02633a814a12 100644 (file)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -20,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from GeomAPI import *
 from SketchAPI import *
 
@@ -29,7 +29,6 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-
 model.addParameter(Part_1_doc, "R", "58")
 model.addParameter(Part_1_doc, "cote_cube", "R/2")
 model.addParameter(Part_1_doc, "theta", "54")
@@ -41,7 +40,6 @@ model.addParameter(Part_1_doc, "z", "R*cos(phi/180*pi)")
 model.addParameter(Part_1_doc, "haut_ext_tuyau", "5")
 model.addParameter(Part_1_doc, "haut_int_tuyau", "14")
 Param_Diam = model.addParameter(Part_1_doc, "diam_tuyau", "10")
-
 Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90, 0)
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
@@ -60,9 +58,8 @@ SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(),
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "R")
 Revolution_1.setNestedSketch(Sketch_1)
-
 Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 0, "cote_cube")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_2"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"))
 SketchLine_4 = Sketch_2.addLine(29, 0, 0, 0)
 SketchLine_5 = Sketch_2.addLine(0, 0, 0, 29)
 SketchLine_6 = Sketch_2.addLine(0, 29, 29, 29)
@@ -77,25 +74,22 @@ SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result())
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result())
 SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_6.result(), "cote_cube")
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_7.result())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/To_Face]"), False)
 SketchLine_8 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_8.result())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/From_Face]"), False)
 SketchLine_9 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result())
 Extrusion_1.setNestedSketch(Sketch_2)
-
 Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-
 Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "[Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face][Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Fill_1_1_2/Modified_Face&Extrusion_1_1/To_Face&Sketch_1/SketchLine_3]"))
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
 Plane_5.result().setName("Plane_2 arrivee tuyau")
-Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), 45)
-Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45)
-Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45")
-
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"), 45)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"), 45)
+Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7]"), "90+45")
 Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
 Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
 Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
@@ -105,11 +99,8 @@ Fill_4.result().subResult(1).setColor(0, 204, 204)
 Fill_4.result().subResult(2).setColor(51, 51, 102)
 Fill_4.result().subResult(3).setColor(102, 204, 102)
 Fill_4.result().subResult(4).setColor(204, 204, 0)
-
 Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")])
-
 Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau"))
-
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2 arrivee tuyau"))
 SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Point_2"), False)
 SketchPoint_2 = SketchProjection_5.createdFeature()
@@ -147,15 +138,13 @@ SketchConstraintEqual_3 = Sketch_3.setEqual(SketchLine_14.result(), SketchLine_1
 SketchConstraintEqual_4 = Sketch_3.setEqual(SketchLine_17.result(), SketchLine_16.result())
 SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_10.result(), "diam_tuyau")
 model.do()
-
-Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_11f-SketchLine_14r-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_10f-SketchLine_14f-SketchLine_17r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_13f-SketchLine_15r-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_12f-SketchLine_15f-SketchLine_16f")]
+Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_14r-SketchLine_11f-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchLine_17r-SketchLine_10f-SketchLine_14f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_15r-SketchLine_13f-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_16f-SketchLine_12f-SketchLine_15f")]
 Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, 0)
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), "haut_int_tuyau", 0)
-
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_3"))
-SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), False)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r")], model.selection(), "haut_int_tuyau", 0)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1_3/To_Face"))
+SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), False)
 SketchPoint_3 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), False)
+SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), False)
 SketchPoint_4 = SketchProjection_7.createdFeature()
 SketchArc_2 = Sketch_4.addArc(0, 0, -7.071067811865476, -7.071067811865472, 7.071067811865476, 7.071067811865472, True)
 SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchPoint_3.result(), SketchArc_2.startPoint())
@@ -163,48 +152,102 @@ SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchPoint_4.result(),
 SketchLine_18 = Sketch_4.addLine(7.071067811865476, 7.071067811865472, -7.071067811865476, -7.071067811865472)
 SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchLine_18.startPoint())
 SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_18.endPoint())
-SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), False)
+SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), False)
 SketchPoint_5 = SketchProjection_8.createdFeature()
 SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates())
 model.do()
-
-Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180)
-
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/SketchLine_18"), 0, 180)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
 Cut_1.result().setName("demi-sphere")
-
-Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4"))
-Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1"))
-Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3"))
-Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4"))
-
+Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"))
+Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/From_Face]"))
+Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_10][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/From_Face]"))
+Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_13][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/From_Face]"))
 Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
-
-Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45")
-Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45")
-Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45")
-Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45)
-
+Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_10"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_10][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_13"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_13][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_12"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_12][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Extrusion_3_1/To_Face"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_11][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), 45)
 Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
 Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
-
+Fill_5.result().subResult(0).setName("Fill_5_1_1")
+Fill_5.result().subResult(1).setName("Fill_5_1_2")
+Fill_5.result().subResult(2).setName("Fill_5_1_3")
+Fill_5.result().subResult(3).setName("Fill_5_1_4")
+Fill_5.result().subResult(4).setName("Fill_5_1_5")
+Fill_5.result().subResult(5).setName("Fill_5_1_6")
+Fill_5.result().subResult(6).setName("Fill_5_1_7")
+Fill_5.result().subResult(7).setName("Fill_5_1_8")
+Fill_5.result().subResult(8).setName("Fill_5_1_9")
+Fill_5.result().subResult(9).setName("Fill_5_1_10")
+Fill_5.result().subResult(10).setName("Fill_5_1_11")
+Fill_5.result().subResult(11).setName("Fill_5_1_12")
+Fill_5.result().subResult(12).setName("Fill_5_1_13")
+Fill_5.result().subResult(13).setName("Fill_5_1_14")
+Fill_5.result().subResult(14).setName("Fill_5_1_15")
+Fill_5.result().subResult(15).setName("Fill_5_1_16")
 Union_2_objects = [model.selection("SOLID", "Fill_5_1_14"), model.selection("SOLID", "Fill_5_1_15"), model.selection("SOLID", "Fill_5_1_16")]
 Union_2 = model.addUnion(Part_1_doc, Union_2_objects)
-Union_3_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")]
+Union_2.result().subResult(0).setName("Union_2_1_1")
+Union_2.result().subResult(1).setName("Union_2_1_2")
+Union_2.result().subResult(2).setName("Union_2_1_3")
+Union_2.result().subResult(3).setName("Union_2_1_4")
+Union_2.result().subResult(4).setName("Union_2_1_5")
+Union_2.result().subResult(5).setName("Union_2_1_6")
+Union_2.result().subResult(6).setName("Union_2_1_7")
+Union_2.result().subResult(7).setName("Union_2_1_8")
+Union_2.result().subResult(8).setName("Union_2_1_9")
+Union_2.result().subResult(9).setName("Union_2_1_10")
+Union_2.result().subResult(10).setName("Union_2_1_11")
+Union_2.result().subResult(11).setName("Union_2_1_12")
+Union_2.result().subResult(12).setName("Union_2_1_13")
+Union_2.result().subResult(13).setName("Union_2_1_14")
+Union_3_objects = [model.selection("SOLID", "Union_2_1_8"), model.selection("SOLID", "Union_2_1_4"), model.selection("SOLID", "Union_2_1_9"), model.selection("SOLID", "Union_2_1_11")]
 Union_3 = model.addUnion(Part_1_doc, Union_3_objects)
-Union_4_objects = [model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_13/Fill_5_1_13")]
+Union_3.result().subResult(0).setName("Union_3_1_1")
+Union_3.result().subResult(1).setName("Union_3_1_2")
+Union_3.result().subResult(2).setName("Union_3_1_3")
+Union_3.result().subResult(3).setName("Union_3_1_4")
+Union_3.result().subResult(4).setName("Union_3_1_5")
+Union_3.result().subResult(5).setName("Union_3_1_6")
+Union_3.result().subResult(6).setName("Union_3_1_7")
+Union_3.result().subResult(7).setName("Union_3_1_8")
+Union_3.result().subResult(8).setName("Union_3_1_9")
+Union_3.result().subResult(9).setName("Union_3_1_10")
+Union_3.result().subResult(10).setName("Union_3_1_11")
+Union_4_objects = [model.selection("SOLID", "Union_3_1_5"), model.selection("SOLID", "Union_3_1_7"), model.selection("SOLID", "Union_3_1_9")]
 Union_4 = model.addUnion(Part_1_doc, Union_4_objects)
-Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3")]
+Union_4.result().subResult(0).setName("Union_4_1_1")
+Union_4.result().subResult(1).setName("Union_4_1_2")
+Union_4.result().subResult(2).setName("Union_4_1_3")
+Union_4.result().subResult(3).setName("Union_4_1_4")
+Union_4.result().subResult(4).setName("Union_4_1_5")
+Union_4.result().subResult(5).setName("Union_4_1_6")
+Union_4.result().subResult(6).setName("Union_4_1_7")
+Union_4.result().subResult(7).setName("Union_4_1_8")
+Union_4.result().subResult(8).setName("Union_4_1_9")
+Union_5_objects = [model.selection("SOLID", "Union_4_1_2"), model.selection("SOLID", "Union_4_1_1"), model.selection("SOLID", "Union_4_1_3")]
 Union_5 = model.addUnion(Part_1_doc, Union_5_objects)
-Union_6_objects = [model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7"), model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12")]
+Union_5.result().subResult(0).setName("Union_5_1_1")
+Union_5.result().subResult(1).setName("Union_5_1_2")
+Union_5.result().subResult(2).setName("Union_5_1_3")
+Union_5.result().subResult(3).setName("Union_5_1_4")
+Union_5.result().subResult(4).setName("Union_5_1_5")
+Union_5.result().subResult(5).setName("Union_5_1_6")
+Union_5.result().subResult(6).setName("Union_5_1_7")
+Union_6_objects = [model.selection("SOLID", "Union_5_1_1"), model.selection("SOLID", "Union_5_1_2"), model.selection("SOLID", "Union_5_1_3")]
 Union_6 = model.addUnion(Part_1_doc, Union_6_objects)
 Union_6.result().setColor(0, 0, 204)
+Union_6.result().subResult(0).setName("Union_6_1_1")
 Union_6.result().subResult(0).setColor(204, 102, 102)
+Union_6.result().subResult(1).setName("Union_6_1_2")
 Union_6.result().subResult(1).setColor(127, 254, 127)
+Union_6.result().subResult(2).setName("Union_6_1_3")
 Union_6.result().subResult(2).setColor(102, 51, 102)
+Union_6.result().subResult(3).setName("Union_6_1_4")
 Union_6.result().subResult(3).setColor(76, 76, 153)
+Union_6.result().subResult(4).setName("Union_6_1_5")
 Union_6.result().subResult(4).setColor(0, 0, 254)
-
 Partition_1_objects = [model.selection("SOLID", "Recover_1_1"), model.selection("COMPSOLID", "Union_1_1"), model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "demi-sphere")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 Partition_1.result().setColor(102, 0, 0)
@@ -227,7 +270,6 @@ Partition_1.result().subResult(15).setColor(254, 127, 254)
 Partition_1.result().subResult(16).setColor(153, 153, 0)
 Partition_1.result().subResult(17).setColor(153, 153, 0)
 Partition_1.result().subResult(18).setColor(204, 0, 204)
-
 Folder_1 = model.addFolder(Part_1_doc, Revolution_1, Union_1)
 Folder_2 = model.addFolder(Part_1_doc, Point_3, Union_6)
 model.do()
@@ -255,4 +297,5 @@ model.testResultsVolumes(Partition_1, [103221.354557478349306620657444])
 
 model.end()
 
+# too long
 #assert(model.checkPythonDump())
index 5364304ea4166eafcf596a2e4dd676df86d88447..e352bbfd4e74f9199bed3768095ee3573368b5ce 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -43,11 +45,11 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_5 = Sketch_2.addLine(0, 0, -37.87650574447493, 64.03712943185892)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_2s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_2.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_5"), 100, 0)
 model.do()
 model.end()
 
index e1366fd36bdaeb30ca78c3c8ca26966db40dc34c..8bb2a8a46ddaf89a7f9186f56be5d9c4ccb0158f 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -52,13 +54,13 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
@@ -79,15 +81,18 @@ SketchConstraintEqual_3.setName("SketchConstraintEqual_4")
 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result())
 SketchConstraintEqual_4.setName("SketchConstraintEqual_5")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_11 = Sketch_2.addLine(40, 0, 30, 0)
 SketchLine_12 = Sketch_2.addLine(30, 0, 30, 10)
 SketchLine_13 = Sketch_2.addLine(30, 10, 40, 10)
 SketchLine_14 = Sketch_2.addLine(40, 10, 40, 0)
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26")
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_11.result())
@@ -101,23 +106,22 @@ SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
 model.do()
 Sketch_2.setName("Sketch_3")
 Sketch_2.result().setName("Sketch_3")
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
 Face_2.setName("Face_5")
 Face_2.result().setName("Face_5_1")
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), 10, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), 10, 2)
 LinearCopy_1.result().setName("LinearCopy")
-LinearCopy_1.result().subResult(0).setName("LinearCopy_1_1_1")
-LinearCopy_1.result().subResult(1).setName("LinearCopy_1_1_2")
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "LinearCopy")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "LinearCopy")])
+model.do()
 model.end()
 
 from GeomAPI import  GeomAPI_Shape
 
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [3])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [3])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [20])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [40])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [3])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [20])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [40])
 
 assert(model.checkPythonDump())
index 4f591ed016aafcc5c2d607921f5ae8b473f65376..b9fdb3b3083cb8857715e11262d9e39e5d9f9be8 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -93,11 +95,11 @@ SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552
 SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
 SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")]
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
 Face_3 = model.addFace(Part_1_doc, Face_3_objects)
-Face_4_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")]
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
 Face_4 = model.addFace(Part_1_doc, Face_4_objects)
 Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
@@ -108,15 +110,19 @@ Group_2.result().setName("acier")
 Group_2.result().setColor(170, 85, 0)
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Face_4_1/Edge_6][Face_4_1/Edge_7]"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
 SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
 SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
 SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
 SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
@@ -128,33 +134,33 @@ SketchConstraintLength_3.setName("SketchConstraintLength_1")
 SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
 SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
 model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
 Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
 LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
 Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
 LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
 Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
 LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
 Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
 LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Boolean_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Boolean_1_objects_2)
+Fill_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Fill_1 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Fill_1_objects_2)
 model.do()
 model.end()
 
 from GeomAPI import  GeomAPI_Shape
 
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [273])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [546])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [273])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [546])
 
 assert(model.checkPythonDump())
index dd6e4c4e914b3e3de3018130af3d6d047d006d45..9d2144f63b13bb2e6abe54b5593c9372a52c41f9 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -93,11 +95,11 @@ SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552
 SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
 SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")]
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
 Face_3 = model.addFace(Part_1_doc, Face_3_objects)
-Face_4_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")]
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
 Face_4 = model.addFace(Part_1_doc, Face_4_objects)
 Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
@@ -108,15 +110,19 @@ Group_2.result().setName("acier")
 Group_2.result().setColor(170, 85, 0)
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Face_4_1/Edge_6][Face_4_1/Edge_7]"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
 SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
 SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
 SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
 SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
@@ -128,33 +134,33 @@ SketchConstraintLength_3.setName("SketchConstraintLength_1")
 SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
 SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
 model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
 Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
 LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
 Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
 LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
 Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
 LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
 Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
 LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Boolean_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Boolean_1_objects_2)
+Fill_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Fill_1_objects_2)
 model.do()
 model.end()
 
 from GeomAPI import  GeomAPI_Shape
 
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [273])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [546])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [273])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [546])
 
 assert(model.checkPythonDump())
index d23abdd5e3243bbf78d45debdceaa60d0d3fe458..313f436ad36931f2686a77e129bf1ad8a2822ef7 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -26,7 +28,8 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Ellipsoid_1 = model.addEllipsoid(Part_1_doc, 10, 20, 40)
 Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3)
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Ellipsoid_1_1")], model.selection("EDGE", "Ellipsoid_1_1/Face_1"), 10, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Ellipsoid_1_1")], model.selection("EDGE", "[Ellipsoid_1_1/Face_1][weak_name_3]"), 10, 2)
+model.do()
 model.end()
 
 # check that for the linear copy direction the elliptical edge is invalid
index 8154bd4bd411c14afd7496f1e1e61ba6c090076e..f7c74d59097619225d6e024f5ac86d32f83c86c9 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -36,7 +36,7 @@ SketchLine_1 = Sketch_1.addLine(153.5, 27.7, -153.5, 27.7)
 SketchLine_2 = Sketch_1.addLine(-153.5, 27.7, -153.5, 16.19999999999975)
 SketchLine_3 = Sketch_1.addLine(-151.5000000000398, -24.69999999999951, 151.5000000000377, -24.69999999999977)
 SketchLine_4 = Sketch_1.addLine(153.5000000000001, -22.70000000003736, 153.5, -15.80000000000003)
-SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
@@ -44,20 +44,20 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 307)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 11.50000000000025)
 SketchPoint_1 = Sketch_1.addPoint(0, 27.7)
-SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
-SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_5")
 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_5 = SketchProjection_1.createdFeature()
-SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_6")
 SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_1.result(), SketchPoint_1.coordinates())
 SketchPoint_2 = Sketch_1.addPoint(153.5, 0)
-SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result())
-SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7")
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
 SketchLine_6 = SketchProjection_2.createdFeature()
-SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result())
-SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8")
 SketchLine_7 = Sketch_1.addLine(-108.1499999999999, 23.04999999999991, -109.8500000000001, 23.04999999999991)
 SketchLine_8 = Sketch_1.addLine(-109.8500000000001, 19.75000000000008, -108.1499999999999, 19.75000000000008)
 SketchLine_8.setName("SketchLine_9")
@@ -65,15 +65,15 @@ SketchLine_8.result().setName("SketchLine_9")
 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result())
 SketchArc_1 = Sketch_1.addArc(-109.8500000000001, 21.39999999999999, -109.8500000000001, 19.75000000000008, -109.8500000000001, 23.04999999999991, True)
-SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_1.startPoint())
-SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9")
 SketchArc_2 = Sketch_1.addArc(-108.1499999999999, 21.39999999999999, -108.1499999999999, 19.75000000000008, -108.1499999999999, 23.04999999999991, False)
-SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_2.startPoint())
-SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
-SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint())
-SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11")
-SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.endPoint())
-SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12")
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_2.startPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10")
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11")
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_7.result())
 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_2.results()[1])
 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_1.results()[1])
@@ -82,24 +82,24 @@ SketchLine_9 = Sketch_1.addLine(-111.5, 21.39999999999998, -106.5, 21.4000000000
 SketchLine_9.setName("SketchLine_10")
 SketchLine_9.result().setName("SketchLine_10")
 SketchLine_9.setAuxiliary(True)
-SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_1.results()[1])
-SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13")
-SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_2.results()[1])
-SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
-SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_9.result())
-SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
-SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_9.result())
-SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16")
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_2.results()[1])
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14")
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_9.result())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_9.result())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
 SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_9.result(), 5)
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_7.result(), 3.3, True)
 SketchPoint_3 = Sketch_1.addPoint(0, 21.40000000000294)
-SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17")
-SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result())
-SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18")
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_17")
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_18")
 SketchPoint_4 = Sketch_1.addPoint(-109, 21.4)
-SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result())
-SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_19")
 SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_9.result())
 SketchConstraintMiddle_2.setName("SketchConstraintMiddle_3")
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 109)
@@ -122,8 +122,8 @@ SketchArc_4.result().setName("SketchArc_5")
 SketchArc_4.results()[1].setName("SketchArc_5_2")
 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_6.result(), 21.4, True)
 SketchPoint_5 = Sketch_1.addPoint(0, -21)
-SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_20")
 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_6.result(), 21, True)
 SketchMultiTranslation_2_objects = [SketchArc_1.results()[1], SketchLine_7.result(), SketchLine_8.result(), SketchArc_2.results()[1], SketchLine_10.result(), SketchArc_5.results()[1], SketchLine_12.result(), SketchArc_3.results()[1], SketchArc_4.results()[1], SketchLine_13.result(), SketchLine_11.result(), SketchArc_6.results()[1]]
 SketchMultiTranslation_2 = Sketch_1.addTranslation(SketchMultiTranslation_2_objects, SketchPoint_3.coordinates(), SketchPoint_5.coordinates(), 2)
@@ -160,49 +160,49 @@ SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_20.result(), 37)
 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_21.result(), 8)
 SketchArc_13 = Sketch_1.addArc(-146.43, 15.7, -145.43, 15.69999999999999, -146.43, 14.7, False)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_13.results()[1], 1)
-SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_13.startPoint())
-SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_31")
-SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchLine_21.startPoint())
-SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_29")
-SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_20.result())
-SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_30")
-SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_21.result())
-SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_32")
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_13.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_31")
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchLine_21.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_29")
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_20.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_30")
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_21.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_32")
 SketchArc_14 = Sketch_1.addArc(-146.43, 5.699999999999998, -146.43, 6.699999999999998, -145.43, 5.7, False)
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_13.results()[1], SketchArc_14.results()[1])
-SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_14.startPoint(), SketchLine_21.endPoint())
-SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_35")
-SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_22.startPoint())
-SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_34")
-SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_22.result())
-SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_33")
-SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_21.result())
-SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_36")
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_14.startPoint(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_35")
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_22.startPoint())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_34")
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_22.result())
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_33")
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_21.result())
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_36")
 SketchArc_15 = Sketch_1.addArc(-107.43, 15.69999999999999, -107.43, 14.69999999999999, -108.43, 15.69999999999999, False)
 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_15.results()[1], SketchArc_13.results()[1])
-SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchLine_20.startPoint())
-SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_39")
-SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchLine_23.endPoint())
-SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_37")
-SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_20.result())
-SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_38")
-SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_23.result())
-SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_40")
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_39")
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchLine_23.endPoint())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_20.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_38")
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_23.result())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_40")
 SketchArc_16 = Sketch_1.addArc(-107.43, 5.7, -108.43, 5.7, -107.43, 6.7, False)
 SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_15.results()[1], SketchArc_16.results()[1])
-SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_22.endPoint())
-SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_43")
-SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_16.endPoint(), SketchLine_23.startPoint())
-SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_42")
-SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_22.result())
-SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_41")
-SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_23.result())
-SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_22.endPoint())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_43")
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_16.endPoint(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_42")
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_22.result())
+SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_41")
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_23.result())
+SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_44")
 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_15.center(), SketchLine_5.result(), 107.43, True)
 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_16.center(), SketchLine_6.result(), 5.7, True)
 SketchPoint_6 = Sketch_1.addPoint(-95.65000000000001, 15.7)
-SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_20.result())
-SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_45")
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_20.result())
+SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_45")
 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchArc_15.center(), SketchPoint_6.coordinates(), "5.89*2", True)
 SketchMultiTranslation_3_objects = [SketchLine_23.result(), SketchArc_13.results()[1], SketchLine_21.result(), SketchArc_14.results()[1], SketchArc_16.results()[1], SketchLine_22.result(), SketchLine_20.result(), SketchArc_15.results()[1]]
 SketchMultiTranslation_3 = Sketch_1.addTranslation(SketchMultiTranslation_3_objects, SketchArc_13.center(), SketchPoint_6.coordinates(), 6)
@@ -293,8 +293,8 @@ SketchLine_25.result().setName("SketchLine_29")
 SketchLine_24.setName("SketchLine_25")
 SketchLine_24.result().setName("SketchLine_25")
 SketchPoint_7 = Sketch_1.addPoint(-107.43, -5.3)
-SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_23.result())
-SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_46")
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_46")
 SketchConstraintDistance_7 = Sketch_1.setDistance(SketchPoint_7.coordinates(), SketchLine_6.result(), 5.3, True)
 SketchMultiTranslation_4_objects = [SketchLine_20.result(), SketchArc_21.results()[1], SketchLine_22.result(), SketchArc_16.results()[1], SketchLine_41.result(), SketchLine_37.result(), SketchLine_38.result(), SketchArc_33.results()[1], SketchLine_43.result(), SketchLine_24.result(), SketchLine_42.result(), SketchArc_13.results()[1], SketchArc_31.results()[1], SketchLine_36.result(), SketchLine_28.result(), SketchArc_19.results()[1], SketchLine_21.result(), SketchArc_36.results()[1], SketchArc_14.results()[1], SketchArc_24.results()[1], SketchLine_31.result(), SketchArc_32.results()[1], SketchArc_20.results()[1], SketchLine_27.result(), SketchLine_34.result(), SketchArc_30.results()[1], SketchLine_39.result(), SketchArc_25.results()[1], SketchArc_34.results()[1], SketchArc_18.results()[1], SketchLine_40.result(), SketchLine_35.result(), SketchArc_35.results()[1], SketchArc_28.results()[1], SketchLine_32.result(), SketchArc_22.results()[1], SketchArc_26.results()[1], SketchLine_26.result(), SketchLine_30.result(), SketchArc_15.results()[1], SketchLine_33.result(), SketchLine_29.result(), SketchLine_23.result(), SketchLine_25.result(), SketchArc_29.results()[1], SketchArc_23.results()[1], SketchArc_27.results()[1], SketchArc_17.results()[1]]
 SketchMultiTranslation_4 = Sketch_1.addTranslation(SketchMultiTranslation_4_objects, SketchArc_15.center(), SketchPoint_7.coordinates(), 2)
@@ -360,17 +360,17 @@ SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_68.result())
 SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_70.result())
 SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_69.result())
 SketchArc_61 = Sketch_1.addArc(-152.2999999999999, 14.70000000000002, -150.7999999999999, 14.70000000000003, -152.2999999999999, 16.20000000000002, False)
-SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_61.startPoint(), SketchLine_69.startPoint())
-SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_47")
-SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_61.endPoint(), SketchLine_68.endPoint())
-SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_50")
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_61.startPoint(), SketchLine_69.startPoint())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_47")
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_61.endPoint(), SketchLine_68.endPoint())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_50")
 SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_61.results()[1], SketchLine_69.result())
 SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_61.results()[1], SketchLine_68.result())
 SketchArc_62 = Sketch_1.addArc(-152.2999999999999, 9.699999999999999, -152.2999999999999, 8.199999999999999, -150.7999999999999, 9.699999999999999, False)
-SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_62.startPoint(), SketchLine_70.startPoint())
-SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_48")
-SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_62.endPoint(), SketchLine_69.endPoint())
-SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_51")
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_62.startPoint(), SketchLine_70.startPoint())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_62.endPoint(), SketchLine_69.endPoint())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_51")
 SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_62.results()[1], SketchLine_69.result())
 SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_62.results()[1], SketchLine_70.result())
 SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_70.startPoint(), SketchLine_68.result(), 8, True)
@@ -379,8 +379,8 @@ SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_61.results()[1], 1.5)
 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_61.results()[1], SketchArc_62.results()[1])
 SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_70.endPoint(), SketchLine_6.result(), 8.199999999999999, True)
 SketchPoint_8 = Sketch_1.addPoint(-153.5, -7.799999999999999)
-SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_2.result())
-SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_53")
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_2.result())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_53")
 SketchConstraintDistance_11 = Sketch_1.setDistance(SketchPoint_8.coordinates(), SketchLine_6.result(), 7.8, True)
 SketchMultiTranslation_5_objects = [SketchLine_68.result(), SketchArc_61.results()[1], SketchLine_69.result(), SketchArc_62.results()[1], SketchLine_70.result()]
 SketchMultiTranslation_5 = Sketch_1.addTranslation(SketchMultiTranslation_5_objects, SketchLine_68.startPoint(), SketchPoint_8.coordinates(), 2)
@@ -410,23 +410,24 @@ SketchLine_80 = Sketch_1.addLine(-153.4999999999999, 8.199999999999999, -153.5,
 SketchLine_80.setName("SketchLine_81")
 SketchLine_80.result().setName("SketchLine_81")
 SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_80.result())
-SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_70.endPoint(), SketchLine_80.startPoint())
-SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_54")
-SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_68.startPoint(), SketchLine_2.endPoint())
-SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_55")
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_70.endPoint(), SketchLine_80.startPoint())
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_54")
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_68.startPoint(), SketchLine_2.endPoint())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_55")
 SketchLine_81 = Sketch_1.addLine(-153.4999999999999, -15.79999999999969, -153.5, -22.70000000003739)
 SketchLine_81.setName("SketchLine_82")
 SketchLine_81.result().setName("SketchLine_82")
 SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_80.result(), SketchLine_81.result())
-SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_81.startPoint(), SketchLine_73.result())
-SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_49")
-SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_80.endPoint(), SketchPoint_8.result())
-SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_52")
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_81.startPoint(), SketchLine_73.result())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_49")
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_80.endPoint(), SketchPoint_8.result())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_52")
 SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_80.result())
 SketchLine_82 = Sketch_1.addLine(153.5, 16.19999999999975, 153.5, 27.7)
 SketchLine_82.setName("SketchLine_83")
 SketchLine_82.result().setName("SketchLine_83")
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_82.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_82.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_56")
 SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_82.result())
 SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_82.startPoint(), SketchLine_74.result())
 SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_56")
@@ -443,7 +444,7 @@ SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_59")
 SketchLine_84 = Sketch_1.addLine(-153.5, -22.70000000003739, -151.5000000000398, -24.69999999999951)
 SketchLine_84.setName("SketchLine_85")
 SketchLine_84.result().setName("SketchLine_85")
-SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_84.result(), SketchLine_3.result(), 45)
+SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_84.result(), SketchLine_3.result(), 45.0000000000272)
 SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_84.startPoint(), SketchLine_81.endPoint())
 SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_62")
 SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_84.endPoint(), SketchLine_3.startPoint())
@@ -459,14 +460,14 @@ SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_61")
 SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_85.result())
 SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_63")
 model.do()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4e-SketchLine_80e"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_83e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
 SketchPoint_9 = SketchProjection_3.createdFeature()
 SketchArc_69 = Sketch_2.addArc(27.70000001097709, 0.85, 27.7, 0, 28.55000001097708, 0.85, False)
 SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchPoint_9.result(), SketchArc_69.startPoint())
 SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_64")
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_83"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_83"), False)
 SketchLine_86 = SketchProjection_4.createdFeature()
 SketchLine_86.setName("SketchLine_87")
 SketchLine_86.result().setName("SketchLine_87")
@@ -489,13 +490,13 @@ SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_67")
 SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_88.result())
 SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_88.result(), 10)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchArc_69_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_89")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchArc_69_2"), model.selection("EDGE", "Sketch_2/SketchLine_89")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")], model.selection("EDGE", "PartSet/OX"), 0, 307)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3e-SketchLine_86e"))
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3e-SketchLine_86e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
 SketchPoint_10 = SketchProjection_5.createdFeature()
-SketchArc_70 = Sketch_3.addArc(-24.69999999999951, 1.85, -24.69999999999928, -3.648414406296559e-014, -26.54999999999951, 1.85, True)
+SketchArc_70 = Sketch_3.addArc(-24.69999999999951, 1.85, -24.69999999999928, -3.648414406296559e-14, -26.54999999999951, 1.85, True)
 SketchConstraintCoincidence_58 = Sketch_3.setCoincident(SketchPoint_10.result(), SketchArc_70.startPoint())
 SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_68")
 SketchLine_89 = Sketch_3.addLine(-26.54999999999951, 1.85, -24.69999999999951, 1.85)
@@ -525,18 +526,18 @@ SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_91.result())
 SketchConstraintRadius_4 = Sketch_3.setRadius(SketchArc_70.results()[1], "rext_2-ep/2")
 SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_91.result(), 10)
 model.do()
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_92"), model.selection("EDGE", "Sketch_3/Edge-SketchArc_70_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_92"), model.selection("EDGE", "Sketch_3/SketchArc_70_2")])
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2")], model.selection("EDGE", "PartSet/OX"), 0, 299)
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Extrusion_2_2"), model.selection("FACE", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OX"), -2)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_7r-SketchLine_9r-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11r-SketchLine_12r-SketchArc_4_2r-SketchArc_5_2r-SketchLine_13r-SketchLine_14r-SketchArc_6_2r-SketchArc_7_2r-SketchLine_15r-SketchLine_16r-SketchArc_8_2r-SketchLine_17r-SketchArc_9_2r-SketchLine_18r-SketchArc_10_2r-SketchArc_11_2r-SketchLine_19r-SketchLine_20r-SketchArc_12_2r-SketchLine_21r-SketchLine_22r-SketchLine_23r-SketchLine_24r-SketchArc_13_2r-SketchArc_14_2r-SketchArc_15_2r-SketchArc_16_2r-SketchLine_25r-SketchArc_17_2r-SketchLine_26r-SketchArc_18_2r-SketchArc_19_2r-SketchLine_27r-SketchLine_28r-SketchArc_20_2r-SketchLine_29r-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_23_2r-SketchArc_24_2r-SketchLine_33r-SketchLine_34r-SketchLine_35r-SketchLine_36r-SketchArc_25_2r-SketchArc_26_2r-SketchArc_27_2r-SketchArc_28_2r-SketchArc_29_2r-SketchArc_30_2r-SketchArc_31_2r-SketchArc_32_2r-SketchLine_37r-SketchLine_38r-SketchLine_39r-SketchLine_40r-SketchLine_41r-SketchLine_42r-SketchLine_43r-SketchLine_44r-SketchArc_33_2r-SketchArc_34_2r-SketchArc_35_2r-SketchArc_36_2r-SketchLine_45r-SketchArc_37_2r-SketchLine_46r-SketchArc_38_2r-SketchLine_47r-SketchLine_48r-SketchLine_49r-SketchArc_39_2r-SketchLine_50r-SketchLine_51r-SketchLine_52r-SketchArc_40_2r-SketchArc_41_2r-SketchLine_53r-SketchLine_54r-SketchArc_42_2r-SketchLine_55r-SketchArc_43_2r-SketchArc_44_2r-SketchArc_45_2r-SketchLine_56r-SketchArc_46_2r-SketchArc_47_2r-SketchLine_57r-SketchLine_58r-SketchArc_48_2r-SketchLine_59r-SketchArc_49_2r-SketchArc_50_2r-SketchArc_51_2r-SketchLine_60r-SketchLine_61r-SketchArc_52_2r-SketchArc_53_2r-SketchLine_62r-SketchArc_54_2r-SketchArc_55_2r-SketchLine_63r-SketchLine_64r-SketchArc_56_2r-SketchLine_65r-SketchLine_66r-SketchLine_67r-SketchLine_68r-SketchArc_57_2r-SketchArc_58_2r-SketchArc_59_2r-SketchArc_60_2r-SketchLine_69f-SketchLine_70f-SketchLine_71f-SketchArc_61_2r-SketchArc_62_2r-SketchLine_72f-SketchArc_63_2r-SketchLine_73f-SketchArc_64_2r-SketchLine_74f-SketchLine_75r-SketchArc_65_2r-SketchLine_76r-SketchArc_66_2r-SketchLine_77r-SketchLine_78r-SketchArc_67_2r-SketchLine_79r-SketchArc_68_2r-SketchLine_80r-SketchLine_81f-SketchLine_82f-SketchLine_83f-SketchLine_84f-SketchLine_85f-SketchLine_86r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_69f-SketchArc_61_2r-SketchLine_70f-SketchArc_62_2r-SketchLine_71f-SketchLine_81f-SketchLine_72f-SketchArc_63_2r-SketchLine_73f-SketchArc_64_2r-SketchLine_74f-SketchLine_82f-SketchLine_85f-SketchLine_3f-SketchLine_86r-SketchLine_4f-SketchLine_80r-SketchArc_68_2r-SketchLine_79r-SketchArc_67_2r-SketchLine_78r-SketchLine_84f-SketchLine_77r-SketchArc_66_2r-SketchLine_76r-SketchArc_65_2r-SketchLine_75r-SketchLine_83f-SketchLine_15r-SketchArc_8_2r-SketchLine_16r-SketchArc_7_2r-SketchArc_2_2r-SketchLine_9r-SketchArc_1_2r-SketchLine_7r-SketchLine_11r-SketchArc_4_2r-SketchLine_12r-SketchArc_3_2r-SketchArc_32_2r-SketchLine_40r-SketchArc_28_2r-SketchLine_36r-SketchArc_24_2r-SketchLine_44r-SketchArc_36_2r-SketchLine_32r-SketchLine_50r-SketchArc_43_2r-SketchLine_54r-SketchArc_41_2r-SketchLine_49r-SketchArc_55_2r-SketchLine_65r-SketchArc_37_2r-SketchLine_13r-SketchArc_6_2r-SketchLine_14r-SketchArc_5_2r-SketchArc_9_2r-SketchLine_18r-SketchArc_10_2r-SketchLine_17r-SketchLine_20r-SketchArc_12_2r-SketchLine_19r-SketchArc_11_2r-SketchArc_29_2r-SketchLine_37r-SketchArc_25_2r-SketchLine_33r-SketchArc_21_2r-SketchLine_41r-SketchArc_33_2r-SketchLine_29r-SketchArc_30_2r-SketchLine_38r-SketchArc_26_2r-SketchLine_34r-SketchArc_22_2r-SketchLine_42r-SketchArc_34_2r-SketchLine_30r-SketchLine_68r-SketchArc_53_2r-SketchLine_61r-SketchArc_58_2r-SketchLine_64r-SketchArc_51_2r-SketchLine_60r-SketchArc_39_2r-SketchArc_50_2r-SketchLine_63r-SketchArc_57_2r-SketchLine_53r-SketchArc_45_2r-SketchLine_56r-SketchArc_42_2r-SketchLine_47r-SketchArc_49_2r-SketchLine_62r-SketchArc_47_2r-SketchLine_52r-SketchArc_52_2r-SketchLine_57r-SketchArc_48_2r-SketchLine_48r-SketchArc_31_2r-SketchLine_39r-SketchArc_27_2r-SketchLine_35r-SketchArc_23_2r-SketchLine_43r-SketchArc_35_2r-SketchLine_31r-SketchArc_59_2r-SketchLine_58r-SketchArc_54_2r-SketchLine_66r-SketchArc_60_2r-SketchLine_59r-SketchArc_46_2r-SketchLine_51r-SketchArc_19_2r-SketchLine_27r-SketchArc_18_2r-SketchLine_26r-SketchArc_17_2r-SketchLine_28r-SketchArc_20_2r-SketchLine_25r-SketchArc_56_2r-SketchLine_67r-SketchArc_38_2r-SketchLine_46r-SketchArc_44_2r-SketchLine_55r-SketchArc_40_2r-SketchLine_45r-SketchArc_15_2r-SketchLine_24r-SketchArc_16_2r-SketchLine_23r-SketchArc_14_2r-SketchLine_22r-SketchArc_13_2r-SketchLine_21r")])
 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Translation_1_2"))
 SketchCircle_1 = Sketch_4.addCircle(96.50000000003769, 5.5, 1.65)
-SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "Translation_1_2/Translated_Edge_1"), False)
+SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "Translation_1_2/ME:Translated&Extrusion_2_1/To_Edge"), False)
 SketchLine_92 = SketchProjection_6.createdFeature()
 SketchLine_92.setName("SketchLine_93")
 SketchLine_92.result().setName("SketchLine_93")
 SketchConstraintDistance_14 = Sketch_4.setDistance(SketchCircle_1.center(), SketchLine_92.result(), 53, True)
-SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_2/To_Edge_1"), False)
+SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_2/To_Edge"), False)
 SketchLine_93 = SketchProjection_7.createdFeature()
 SketchLine_93.setName("SketchLine_94")
 SketchLine_93.result().setName("SketchLine_94")
@@ -560,11 +561,11 @@ SketchConstraintLength_8 = Sketch_4.setLength(SketchLine_95.result(), 67)
 SketchMultiTranslation_6 = Sketch_4.addTranslation([SketchCircle_1.results()[1]], SketchLine_95.endPoint(), SketchLine_95.startPoint(), 4)
 [SketchCircle_2, SketchCircle_3, SketchCircle_4] = SketchMultiTranslation_6.translated()
 model.do()
-Face_2_objects = [model.selection("EDGE", "Sketch_4/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_4/Edge-SketchCircle_3_2"), model.selection("WIRE", "Sketch_4/Wire-SketchCircle_2_2f"), model.selection("EDGE", "Sketch_4/Edge-SketchCircle_1_2")]
+Face_2_objects = [model.selection("EDGE", "Sketch_4/SketchCircle_4_2"), model.selection("EDGE", "Sketch_4/SketchCircle_3_2"), model.selection("WIRE", "[Sketch_4/SketchCircle_2_2]"), model.selection("EDGE", "Sketch_4/SketchCircle_1_2")]
 Face_2 = model.addFace(Part_1_doc, Face_2_objects)
 Partition_1_objects = [model.selection("FACE", "Extrusion_1_1"), model.selection("FACE", "Extrusion_1_2"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2"), model.selection("FACE", "Face_2_3"), model.selection("FACE", "Face_2_4")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Remove_SubShapes_1_objects_2 = [model.selection("FACE", "Face_2_1/Face_2_1"), model.selection("FACE", "Face_2_2/Face_2_2"), model.selection("FACE", "Face_2_3/Face_2_3"), model.selection("FACE", "Face_2_4/Face_2_4")]
+Remove_SubShapes_1_objects_2 = [model.selection("FACE", "Partition_1_1_5"), model.selection("FACE", "Partition_1_1_6"), model.selection("FACE", "Partition_1_1_7"), model.selection("FACE", "Partition_1_1_8")]
 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
 Remove_SubShapes_1.setSubShapesToRemove(Remove_SubShapes_1_objects_2)
 model.do()
index d8ea46b65b5c9a7376a79740af9dfa756ebb3e02..5d15a25551c00dc2f6cbc318e2195d1117897251 100644 (file)
@@ -88,14 +88,14 @@ SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.result())
 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_17")
 model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_9")]
 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
 Revolution_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5"), model.selection("EDGE", "Edge_1_6"), model.selection("EDGE", "Edge_1_7")]
 Revolution_1 = model.addRevolution(Part_1_doc, Revolution_1_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_9 = SketchProjection_4.createdFeature()
 SketchLine_9.setName("SketchLine_11")
 SketchLine_9.result().setName("SketchLine_11")
@@ -122,197 +122,198 @@ SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_13.endPoint())
 SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_22")
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result())
-SketchPoint_2 = Sketch_2.addPoint(-5.903605550615992e-026, -5)
-SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result())
-SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_24")
+SketchPoint_2 = Sketch_2.addPoint(-5.903605550615992e-26, -5)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24")
 SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_12.result())
-SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
-SketchLine_15 = SketchProjection_6.createdFeature()
-SketchLine_15.setName("SketchLine_16")
-SketchLine_15.result().setName("SketchLine_16")
-SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result())
-SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_25")
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_14 = SketchProjection_5.createdFeature()
+SketchLine_14.setName("SketchLine_16")
+SketchLine_14.result().setName("SketchLine_16")
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25")
 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 2, True)
 SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 3)
 SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchAPI_Line(SketchLine_9).endPoint(), SketchLine_10.result())
 SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_12.result(), 2)
 model.do()
-Edge_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")]
+Edge_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_12"), model.selection("EDGE", "Sketch_2/SketchLine_13"), model.selection("EDGE", "Sketch_2/SketchLine_14"), model.selection("EDGE", "Sketch_2/SketchLine_10")]
 Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
 Extrusion_1_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3"), model.selection("EDGE", "Edge_2_4")]
 Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), 3, 3)
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_6"))
-SketchLine_16 = Sketch_3.addLine(-15, 0, -10, 2.951677693621839e-024)
-SketchLine_16.setName("SketchLine_17")
-SketchLine_16.result().setName("SketchLine_17")
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Revolution_1_6/Generated_Edge_1"), False)
-SketchCircle_1 = SketchProjection_7.createdFeature()
-SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchCircle_1.results()[1])
-SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
-SketchLine_17 = Sketch_3.addLine(-10, 2.951677693621839e-024, -10, -3)
-SketchLine_17.setName("SketchLine_18")
-SketchLine_17.result().setName("SketchLine_18")
+SketchLine_15 = Sketch_3.addLine(-15, 0, -10, 2.951677693621839e-24)
+SketchLine_15.setName("SketchLine_17")
+SketchLine_15.result().setName("SketchLine_17")
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Revolution_1_6/Generated_Edge&Sketch_1/SketchLine_2_StartVertex"), False)
+SketchCircle_1 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26")
+SketchLine_16 = Sketch_3.addLine(-10, 2.951677693621839e-24, -10, -3)
+SketchLine_16.setName("SketchLine_18")
+SketchLine_16.result().setName("SketchLine_18")
+SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_27")
+SketchLine_17 = Sketch_3.addLine(-10, -3, -14.69693845669907, -3)
+SketchLine_17.setName("SketchLine_19")
+SketchLine_17.result().setName("SketchLine_19")
 SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint())
-SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27")
-SketchLine_18 = Sketch_3.addLine(-10, -3, -14.69693845669907, -3)
-SketchLine_18.setName("SketchLine_19")
-SketchLine_18.result().setName("SketchLine_19")
-SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_28")
-SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchCircle_1.results()[1])
-SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_29")
-SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_17.result())
-SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_16.result(), SketchAPI_Circle(SketchCircle_1).center())
-SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_30")
-SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_16.result(), SketchLine_18.result())
-SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_16.result(), 5)
-SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_17.result(), 3)
-SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_16.result(), [SketchLine_17.result(), SketchLine_18.result()])
-[SketchLine_19, SketchLine_20] = SketchConstraintMirror_1.mirrored()
-SketchLine_20.setName("SketchLine_21")
-SketchLine_20.result().setName("SketchLine_21")
-SketchLine_19.setName("SketchLine_20")
-SketchLine_19.result().setName("SketchLine_20")
-SketchLine_21 = Sketch_3.addLine(-1.5, -2, 2, -2)
-SketchLine_21.setName("SketchLine_22")
-SketchLine_21.result().setName("SketchLine_22")
-SketchLine_22 = Sketch_3.addLine(2, -2, 2, 2)
-SketchLine_22.setName("SketchLine_23")
-SketchLine_22.result().setName("SketchLine_23")
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28")
+SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_16.result())
+SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_15.result(), SketchAPI_Circle(SketchCircle_1).center())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30")
+SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_15.result(), SketchLine_17.result())
+SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_15.result(), 5)
+SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_16.result(), 3)
+SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_15.result(), [SketchLine_16.result(), SketchLine_17.result()])
+[SketchLine_18, SketchLine_19] = SketchConstraintMirror_1.mirrored()
+SketchLine_19.setName("SketchLine_21")
+SketchLine_19.result().setName("SketchLine_21")
+SketchLine_18.setName("SketchLine_20")
+SketchLine_18.result().setName("SketchLine_20")
+SketchLine_20 = Sketch_3.addLine(-1.5, -2, 2, -2)
+SketchLine_20.setName("SketchLine_22")
+SketchLine_20.result().setName("SketchLine_22")
+SketchLine_21 = Sketch_3.addLine(2, -2, 2, 2)
+SketchLine_21.setName("SketchLine_23")
+SketchLine_21.result().setName("SketchLine_23")
+SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31")
+SketchLine_22 = Sketch_3.addLine(2, 2, -1.5, 2)
+SketchLine_22.setName("SketchLine_24")
+SketchLine_22.result().setName("SketchLine_24")
 SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
-SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_31")
-SketchLine_23 = Sketch_3.addLine(2, 2, -1.5, 2)
-SketchLine_23.setName("SketchLine_24")
-SketchLine_23.result().setName("SketchLine_24")
-SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_32")
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
-SketchLine_24 = SketchProjection_8.createdFeature()
-SketchLine_24.setName("SketchLine_25")
-SketchLine_24.result().setName("SketchLine_25")
-SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_33")
-SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_23.result())
-SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_21.result())
-SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32")
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_23 = SketchProjection_7.createdFeature()
+SketchLine_23.setName("SketchLine_25")
+SketchLine_23.result().setName("SketchLine_25")
+SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33")
+SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_22.result())
+SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_20.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_21.result())
 SketchArc_2 = Sketch_3.addArc(0, 0, -1.5, -2, -1.5, 2, True)
-SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center())
-SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_34")
-SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_21.startPoint())
-SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_35")
-SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint())
-SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_36")
+SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34")
+SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35")
+SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_22.endPoint())
+SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36")
 SketchPoint_3 = Sketch_3.addPoint(2, 0)
-SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_22.result())
-SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_37")
-SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result())
-SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_38")
-SketchConstraintMiddle_3 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_22.result())
-SketchLine_25 = Sketch_3.addLine(-1.5, -2, -1.5, 2)
-SketchLine_25.setName("SketchLine_26")
-SketchLine_25.result().setName("SketchLine_26")
-SketchLine_25.setAuxiliary(True)
-SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.startPoint())
-SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_39")
-SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.endPoint())
-SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_40")
-SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_12s-SketchLine_10e"), False)
-SketchPoint_4 = SketchProjection_9.createdFeature()
-SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_25.result())
-SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_41")
-SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_25.result(), 4)
-SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_10s-SketchLine_14e"), False)
-SketchPoint_5 = SketchProjection_10.createdFeature()
-SketchConstraintDistance_3 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_22.result(), 0.5, True)
-SketchLine_26 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -7.5, -3)
-SketchLine_26.setName("SketchLine_27")
-SketchLine_26.result().setName("SketchLine_27")
-SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_26.result())
-SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_16.result())
-SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_42")
-SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_18.result())
-SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_43")
-SketchLine_27 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -2.500000000000019, -5.187200122832181e-016)
-SketchLine_27.setName("SketchLine_28")
-SketchLine_27.result().setName("SketchLine_28")
-SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_27.startPoint())
-SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_44")
-SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchArc_2.results()[1])
-SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_45")
-SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_27.result())
-SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 2.5, True)
-SketchLine_28 = Sketch_3.addLine(2, 0, 11, 0)
-SketchLine_28.setName("SketchLine_29")
-SketchLine_28.result().setName("SketchLine_29")
-SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_28.startPoint())
-SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_46")
-SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_47")
-SketchLine_29 = Sketch_3.addLine(15, 0, 14, 0)
-SketchLine_29.setName("SketchLine_30")
-SketchLine_29.result().setName("SketchLine_30")
-SketchProjection_11 = Sketch_3.addProjection(model.selection("VERTEX", "Revolution_1_6/Generated_Edge_1"), False)
-SketchPoint_6 = SketchProjection_11.createdFeature()
-SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchPoint_6.result())
-SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_48")
-SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_49")
-SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_28.endPoint(), SketchLine_29.endPoint(), 3, True)
-SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_29.result(), 1)
-SketchLine_30 = Sketch_3.addLine(11, 0, 11, -2.000000000000004)
-SketchLine_30.setName("SketchLine_31")
-SketchLine_30.result().setName("SketchLine_31")
-SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_30.startPoint())
-SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_50")
-SketchLine_31 = Sketch_3.addLine(9.500000000000002, 2.627360613063856e-019, 9.5, -2.000000000000004)
-SketchLine_31.setName("SketchLine_32")
-SketchLine_31.result().setName("SketchLine_32")
-SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_31.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_51")
-SketchLine_32 = Sketch_3.addLine(8, -1.882265929199326e-020, 8, -2.000000000000004)
-SketchLine_32.setName("SketchLine_33")
-SketchLine_32.result().setName("SketchLine_33")
-SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_52")
-SketchLine_33 = Sketch_3.addLine(5, -3.396138881322731e-022, 5, -2.000000000000004)
-SketchLine_33.setName("SketchLine_34")
-SketchLine_33.result().setName("SketchLine_34")
-SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_33.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_53")
-SketchLine_34 = Sketch_3.addLine(5, -2.000000000000004, 11, -2.000000000000004)
-SketchLine_34.setName("SketchLine_35")
-SketchLine_34.result().setName("SketchLine_35")
-SketchLine_34.setAuxiliary(True)
-SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint())
-SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_54")
-SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_34.endPoint())
-SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_55")
-SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_33.result())
-SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_32.result())
-SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_31.result())
-#SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_30.result())
-SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_34.result())
-SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_34.result())
-SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_56")
-SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_34.result())
-SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_57")
-SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_21.endPoint(), SketchLine_33.result(), 3, True)
-SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_33.endPoint(), SketchLine_32.result(), 3, True)
-SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_32.endPoint(), SketchLine_31.result(), 1.5, True)
-SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_31.endPoint(), SketchLine_30.result(), 1.5, True)
-SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_21.result())
-SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58")
-SketchConstraintMirror_2_objects = [SketchLine_33.result(), SketchLine_32.result(), SketchLine_31.result(), SketchLine_30.result()]
-SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_24.result(), SketchConstraintMirror_2_objects)
-[SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38] = SketchConstraintMirror_2.mirrored()
-SketchLine_38.setName("SketchLine_39")
-SketchLine_38.result().setName("SketchLine_39")
-SketchLine_37.setName("SketchLine_38")
-SketchLine_37.result().setName("SketchLine_38")
-SketchLine_36.setName("SketchLine_37")
-SketchLine_36.result().setName("SketchLine_37")
-SketchLine_35.setName("SketchLine_36")
-SketchLine_35.result().setName("SketchLine_36")
+SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_21.result())
+SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38")
+SketchConstraintMiddle_3 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_21.result())
+SketchLine_24 = Sketch_3.addLine(-1.5, -2, -1.5, 2)
+SketchLine_24.setName("SketchLine_26")
+SketchLine_24.result().setName("SketchLine_26")
+SketchLine_24.setAuxiliary(True)
+SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.startPoint())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39")
+SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.endPoint())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40")
+SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
+SketchPoint_4 = SketchProjection_8.createdFeature()
+SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41")
+SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_24.result(), 4)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_StartVertex"), False)
+SketchPoint_5 = SketchProjection_9.createdFeature()
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_21.result(), 0.5, True)
+SketchLine_25 = Sketch_3.addLine(-7.5, -7.382311001750988e-22, -7.5, -3)
+SketchLine_25.setName("SketchLine_27")
+SketchLine_25.result().setName("SketchLine_27")
+SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_25.result())
+SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_15.result())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42")
+SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_17.result())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43")
+SketchLine_26 = Sketch_3.addLine(-7.5, -7.382311001750988e-22, -2.500000000000019, -5.187200122832181e-16)
+SketchLine_26.setName("SketchLine_28")
+SketchLine_26.result().setName("SketchLine_28")
+SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchArc_2.results()[1])
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45")
+SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_26.result())
+SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_16.startPoint(), SketchLine_25.result(), 2.5, True)
+SketchLine_27 = Sketch_3.addLine(2, 0, 11, 0)
+SketchLine_27.setName("SketchLine_29")
+SketchLine_27.result().setName("SketchLine_29")
+SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46")
+SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47")
+SketchLine_28 = Sketch_3.addLine(15, 0, 14, 0)
+SketchLine_28.setName("SketchLine_30")
+SketchLine_28.result().setName("SketchLine_30")
+SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "[Revolution_1_6/Revolution_1_6&Sketch_1/SketchLine_2]"), False)
+SketchPoint_6 = SketchProjection_10.createdFeature()
+SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_28.startPoint(), SketchPoint_6.result())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49")
+SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_27.endPoint(), SketchLine_28.endPoint(), 3, True)
+SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_28.result(), 1)
+SketchLine_29 = Sketch_3.addLine(11, 0, 11, -2.000000000000004)
+SketchLine_29.setName("SketchLine_31")
+SketchLine_29.result().setName("SketchLine_31")
+SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50")
+SketchLine_30 = Sketch_3.addLine(9.500000000000002, 2.627360613063856e-19, 9.5, -2.000000000000004)
+SketchLine_30.setName("SketchLine_32")
+SketchLine_30.result().setName("SketchLine_32")
+SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51")
+SketchLine_31 = Sketch_3.addLine(8, -1.882265929199326e-20, 8, -2.000000000000004)
+SketchLine_31.setName("SketchLine_33")
+SketchLine_31.result().setName("SketchLine_33")
+SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_31.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52")
+SketchLine_32 = Sketch_3.addLine(5, -3.396138881322731e-22, 5, -2.000000000000004)
+SketchLine_32.setName("SketchLine_34")
+SketchLine_32.result().setName("SketchLine_34")
+SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53")
+SketchLine_33 = Sketch_3.addLine(5, -2.000000000000004, 11, -2.000000000000004)
+SketchLine_33.setName("SketchLine_35")
+SketchLine_33.result().setName("SketchLine_35")
+SketchLine_33.setAuxiliary(True)
+SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
+SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_54")
+SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_55")
+SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_32.result())
+SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_31.result())
+SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_30.result())
+SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_33.result())
+SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_56")
+SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_57")
+SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_20.endPoint(), SketchLine_32.result(), 3, True)
+SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_32.endPoint(), SketchLine_31.result(), 3, True)
+SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_31.endPoint(), SketchLine_30.result(), 1.5, True)
+SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_30.endPoint(), SketchLine_29.result(), 1.5, True)
+SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_20.result())
+SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_58")
+SketchConstraintMirror_2_objects = [SketchLine_32.result(), SketchLine_31.result(), SketchLine_30.result(), SketchLine_29.result()]
+SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_23.result(), SketchConstraintMirror_2_objects)
+[SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37] = SketchConstraintMirror_2.mirrored()
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+model.do()
+model.do()
 model.end()
 
 assert(model.checkPythonDump())
index 206998debee7594ad60020901280267da282c421..d12325da3e070c0c4c1228c23d66eb8181025beb 100644 (file)
@@ -29,7 +29,7 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_1 = Sketch_1.addLine(7.823413936076148e-032, 6, 18, 6)
+SketchLine_1 = Sketch_1.addLine(7.823413936076148e-32, 6, 18, 6)
 SketchLine_2 = Sketch_1.addLine(18, 6, 18, 10)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
 SketchLine_3 = Sketch_1.addLine(18, 10, 63, 10)
@@ -46,11 +46,11 @@ SketchLine_8 = Sketch_1.addLine(70, 18, 70, 6.999999999999999)
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchLine_9 = Sketch_1.addLine(70, 6.999999999999999, 38, 6.999999999999999)
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchLine_10 = Sketch_1.addLine(38, 6.999999999999999, 34, 1.232595164407831e-032)
+SketchLine_10 = Sketch_1.addLine(38, 6.999999999999999, 34, 1.232595164407831e-32)
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchLine_11 = Sketch_1.addLine(34, 1.232595164407831e-032, 7.823413936076148e-032, 1.232595164407831e-032)
+SketchLine_11 = Sketch_1.addLine(34, 1.232595164407831e-32, 7.823413936076148e-32, 1.232595164407831e-32)
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchLine_12 = Sketch_1.addLine(7.823413936076148e-032, 1.232595164407831e-032, 7.823413936076148e-032, 6)
+SketchLine_12 = Sketch_1.addLine(7.823413936076148e-32, 1.232595164407831e-32, 7.823413936076148e-32, 6)
 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.endPoint())
 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_11.result())
@@ -84,7 +84,7 @@ SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.startPoint
 SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_8.result())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "Sketch_1/SketchLine_13"), 360, 0)
 model.do()
 # check that naming of the revolution is correct
 model.testHaveNamingSubshapes(Revolution_1, model, Part_1_doc)
index dcc1b884c2ed1aac1cc46c2a5078329c2744d20b..1400e32c94517391a97db16ebb3841de41bca2e8 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 import math
 
@@ -30,7 +32,7 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchArc_1 = Sketch_1.addArc(-47.73523320343703, -72.31551328948351, 43.26553250145439, -30.85636904935887, -50.76060275488791, 27.63871192924931, False)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
 model.do()
 
 radius = model.measureRadius(Part_1_doc, model.selection("EDGE", "Edge_1_1"))
index b0a4da97f4682e4f7f956fbfbdd9a610ab6aba72..29eed9c909d02dd7747397d7f3f467c08e9ff355 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -33,10 +35,11 @@ SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 2)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_1_2__cc"), True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), True)
 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_1")], model.selection("EDGE", "PartSet/OY"), 5, 3)
 AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-LinearCopy_1")], model.selection("EDGE", "PartSet/OZ"), 45, 8)
+model.do()
 model.end()
 
 from GeomAPI import  GeomAPI_Shape
index d102679c5441fb5521502cf28fd8b3ed04a9513d..ba27bbd566c564a137acb19ab27dbb4921b32de1 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -25,8 +27,9 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), True)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), True)
 Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_1")], model.selection("EDGE", "PartSet/OX"), True)
+model.do()
 model.end()
 
 # check python dump failed before the bug fix: selection in symmetry 2 changed to the whole symmetry 1 compound
index 529861ae1997270c4abb4abb287d7c68b266f31c..c01c2e3c3fd8c1484caa79c16117e47e2587e1df 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,7 +43,7 @@ SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
 Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_1_2")])
 model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/Test2617.py b/src/FeaturesPlugin/Test/Test2617.py
new file mode 100644 (file)
index 0000000..0e50b6d
--- /dev/null
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), 5)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), True)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2"), model.selection("SOLID", "Symmetry_1_1_1")])
+model.do()
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [0])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Common_1, [461.055845803990962394891539589])
+
+assert(model.checkPythonDump())
index a254a07235c6a5d799562704efda0ec804b4b064..f3e679e314ed445af67be54f93db8376d5c1f1f7 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -33,18 +35,18 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(),
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_3 = Sketch_2.addLine(31.90519577166173, 58.11303515552675, 60.012153951459, 58.11303515552675)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_4 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result())
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint())
 SketchLine_5 = Sketch_2.addLine(60.012153951459, 58.11303515552675, 60.012153951459, 33.0446670492211)
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_6 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_5")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")], [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 8d7c256e6eb0d3e2e1a0defbefa5284211dafa3c..53f6606e52c0c39fad2cfa4397ad9e729aebffbb 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -37,7 +39,7 @@ SketchLine_5 = Sketch_2.addLine(64.54729867171925, -32.684941224703, 20.69511709
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint())
 model.do()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_6 = Sketch_3.addLine(18.78449167586506, 11.40320166178118, 18.60732592394469, -15.47067574876233)
 SketchLine_7 = Sketch_3.addLine(18.60732592394469, -15.47067574876233, 57.06415928764967, -9.455161348995592)
@@ -48,7 +50,7 @@ SketchLine_9 = Sketch_3.addLine(56.5687276408287, 11.2362868340608, 18.784491675
 SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint())
 model.do()
-Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_3/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
 model.do()
 model.end()
 
diff --git a/src/FeaturesPlugin/Test/Test2681.py b/src/FeaturesPlugin/Test/Test2681.py
new file mode 100644 (file)
index 0000000..5a74bc0
--- /dev/null
@@ -0,0 +1,52 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30.99434204882063, 26.80840312072785, -30.86519895695055, 26.80840312072785)
+SketchLine_2 = Sketch_1.addLine(-30.86519895695055, 26.80840312072785, -30.86519895695055, -19.3714637805129)
+SketchLine_3 = Sketch_1.addLine(-30.86519895695055, -19.3714637805129, 30.99434204882063, -19.3714637805129)
+SketchLine_4 = Sketch_1.addLine(30.99434204882063, -19.3714637805129, 30.99434204882063, 26.80840312072785)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchArc_1 = Sketch_1.addArc(-7.617093567666898, 26.80840312072785, -19.24336125977736, 26.80840312072785, 4.009174124443563, 26.80840312072785, False)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2686.py b/src/FeaturesPlugin/Test/Test2686.py
new file mode 100644 (file)
index 0000000..5367546
--- /dev/null
@@ -0,0 +1,216 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from GeomAPI import GeomAPI_Pnt
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "angle", "27.5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, 4, 6.2, 4)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(6.2, 4, 6.2, 2.5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(6.2, 2.5, 3.5, 2)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(3.5, 2, 3.5, 0)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_6 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(3.5, 0, 0, 0)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint())
+SketchLine_8 = Sketch_1.addLine(0, 4, 0, 0)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3.5)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 6.2)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(3.1, 0, 2))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", GeomAPI_Pnt(0, 0, 4)))
+SketchCircle_1 = Sketch_2.addCircle(4.027018127601872, 2.325000000002457, 1.1)
+SketchCircle_2 = Sketch_2.addCircle(-4.027018127597639, 2.325000000000002, 1.1)
+SketchCircle_3 = Sketch_2.addCircle(7.188370358619843e-12, -4.650000000090492, 1.1)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", GeomAPI_Pnt(0, 0, 4)), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchCircle_4 = Sketch_2.addCircle(0, 0, 4.65)
+SketchCircle_4.setAuxiliary(True)
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_4.center())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_9 = SketchProjection_4.createdFeature()
+SketchLine_10 = Sketch_2.addLine(0, 0, 4.027018127601872, 2.325000000002457)
+SketchLine_10.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_10.endPoint())
+SketchLine_11 = Sketch_2.addLine(0, 0, -4.027018127597639, 2.325000000000002)
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_11.endPoint())
+SketchLine_12 = Sketch_2.addLine(0, 0, 7.188370358619843e-12, -4.650000000090492)
+SketchLine_12.setAuxiliary(True)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_12.endPoint())
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchCircle_4.results()[1])
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_4.results()[1])
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchCircle_4.results()[1])
+SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_4.results()[1], 4.65)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 1.1)
+SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1])
+SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_13 = SketchProjection_5.createdFeature()
+SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_13.result(), SketchLine_10.result(), 30)
+SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120)
+SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_12.result(), 120)
+SketchCircle_5 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.8)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_5.center())
+SketchCircle_6 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.65)
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center())
+SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_6.results()[1], 0.65)
+SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.8)
+SketchLine_14 = Sketch_2.addLine(0, 0, 4.645574230355638, 0.2028301512488116)
+SketchLine_14.setAuxiliary(True)
+SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_14.endPoint())
+SketchConstraintAngle_4 = Sketch_2.setAngle(SketchLine_14.result(), SketchLine_10.result(), "angle")
+SketchCircle_7 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.65)
+SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_7.center())
+SketchCircle_8 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.8)
+SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_8.center())
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center())
+SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_7.results()[1])
+SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_5.results()[1])
+SketchLine_15 = Sketch_2.addLine(0, 0, 2.498443178812738, 3.921770223029927)
+SketchLine_15.setAuxiliary(True)
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.startPoint())
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_15.endPoint())
+SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_15.result(), "angle")
+SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_8.results()[1], SketchCircle_5.results()[1]], SketchCircle_4.center(), 360, 3, True)
+[SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12] = SketchMultiRotation_1.rotated()
+SketchCircle_12.setName("SketchCircle_13")
+SketchCircle_12.result().setName("SketchCircle_13")
+SketchCircle_12.results()[1].setName("SketchCircle_13_2")
+SketchCircle_11.setName("SketchCircle_12")
+SketchCircle_11.result().setName("SketchCircle_12")
+SketchCircle_11.results()[1].setName("SketchCircle_12_2")
+SketchMultiRotation_2 = Sketch_2.addRotation([SketchCircle_6.results()[1], SketchCircle_7.results()[1]], SketchAPI_Line(SketchLine_9).startPoint(), 120, 2)
+[SketchCircle_13, SketchCircle_14] = SketchMultiRotation_2.rotated()
+SketchCircle_14.setName("SketchCircle_17")
+SketchCircle_14.result().setName("SketchCircle_17")
+SketchCircle_14.results()[1].setName("SketchCircle_17_2")
+SketchCircle_13.setName("SketchCircle_14")
+SketchCircle_13.result().setName("SketchCircle_14")
+SketchCircle_13.results()[1].setName("SketchCircle_14_2")
+SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45)
+SketchCircle_15.setName("SketchCircle_15")
+SketchCircle_15.result().setName("SketchCircle_15")
+SketchCircle_15.results()[1].setName("SketchCircle_15_2")
+SketchLine_16 = Sketch_2.addLine(0, 0, 0, 5)
+SketchLine_16.setAuxiliary(True)
+SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.startPoint())
+SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_16.endPoint())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_16.result(), 5)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_17 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_17.result())
+SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45)
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(-6.2, 7.59281015471359e-16, 4)), False)
+SketchCircle_16 = SketchProjection_7.createdFeature()
+SketchCircle_16.setName("SketchCircle_16")
+SketchCircle_16.result().setName("SketchCircle_16")
+SketchCircle_16.results()[1].setName("SketchCircle_16_2")
+SketchCircle_17 = Sketch_2.addCircle(4.259590630302756, -2.982597469025441, 0.5)
+SketchCircle_17.setName("SketchCircle_18")
+SketchCircle_17.result().setName("SketchCircle_18")
+SketchCircle_17.results()[1].setName("SketchCircle_18_2")
+SketchCircle_18 = Sketch_2.addCircle(3.276608177155966, -2.294305745404186, 0.3)
+SketchCircle_18.setName("SketchCircle_19")
+SketchCircle_18.result().setName("SketchCircle_19")
+SketchCircle_18.results()[1].setName("SketchCircle_19_2")
+SketchLine_18 = Sketch_2.addLine(0, 0, 4.259590630302756, -2.982597469025441)
+SketchLine_18.setAuxiliary(True)
+SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_17.center(), SketchLine_18.endPoint())
+SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_18.center(), SketchLine_18.result())
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_19 = SketchProjection_8.createdFeature()
+SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_19.result(), SketchLine_18.result(), 35)
+SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5)
+SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_18.results()[1], 0.3)
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_4.center(), SketchCircle_18.center(), 4, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_4.center(), SketchLine_18.endPoint(), 5.2, True)
+model.do()
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(2.927018127601872, 2.325000000002457, 4)), model.selection("WIRE", GeomAPI_Pnt(1.848443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.995574230355639, 0.2028301512488117, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-3.148443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(-5.127018127597639, 2.325000000000002, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-5.29557423035565, 0.2028301512488154, 4)), model.selection("FACE", GeomAPI_Pnt(7.188472039842964e-12, -4.650000000090492, 4)), model.selection("FACE", GeomAPI_Pnt(4.259590630302756, -2.982597469025441, 4)), model.selection("FACE", GeomAPI_Pnt(3.276608177155966, -2.294305745404186, 4))]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0, [model.selection("SOLID", GeomAPI_Pnt(-7.561538823095622e-16, 6.008767139946657e-17, 2.62684985301323))])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(-5.44557423035565, 0.2028301512488154, 4)), model.selection("WIRE", GeomAPI_Pnt(-3.298443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(1.698443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.845574230355639, 0.2028301512488117, 4))]
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", GeomAPI_Pnt(0.06663461012735418, 0.05143712897449785, 2.675990079155852))])
+Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", GeomAPI_Pnt(-0.45, 5, 4))], model.selection("EDGE", GeomAPI_Pnt(0, -0.5, -5)), 10, 10, [model.selection("SOLID", GeomAPI_Pnt(0.06614791498027658, 0.06612435067467369, 2.67762623401837))])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 4)), model.selection("FACE", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 4))], model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0)
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
+SketchLine_20 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4)
+SketchLine_21 = Sketch_3.addLine(3.5, 4, 6.2, 4)
+SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_22 = Sketch_3.addLine(6.2, 4, 6.2, 3.008501119175777)
+SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
+SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint())
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_20.result())
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(3.5, 0, 1)), False)
+SketchLine_24 = SketchProjection_9.createdFeature()
+SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.result())
+SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE_3", GeomAPI_Pnt(4.85, 0, 2.25)), False)
+SketchLine_25 = SketchProjection_10.createdFeature()
+SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_23.result(), SketchLine_25.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result())
+SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(6.2, 0, 3.25)), False)
+SketchLine_26 = SketchProjection_11.createdFeature()
+SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_23.startPoint(), SketchLine_26.result())
+SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_21.result())
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_20.startPoint(), SketchLine_25.result(), 0.5, True)
+SketchProjection_12 = Sketch_3.addProjection(model.selection("EDGE_5", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_27 = SketchProjection_12.createdFeature()
+SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_27.result())
+model.do()
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(4.850000000000001, 0, 3.254250559587889))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 2)), model.selection("SOLID", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 2))], [model.selection("SOLID", GeomAPI_Pnt(-1.278142456973851e-15, 2.734224632526547e-16, 3.386836255166113))])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(0.06552679693747457, 0.1115566065149892, 2.681859907222054))], [model.selection("SOLID", GeomAPI_Pnt(-2.134018078943279, -4.099410579753945, 3.358593616213623)), model.selection("SOLID", GeomAPI_Pnt(2.134018071503405, -4.099410583757958, 3.358593616233432))])
+model.do()
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2689.py b/src/FeaturesPlugin/Test/Test2689.py
new file mode 100644 (file)
index 0000000..76986e7
--- /dev/null
@@ -0,0 +1,100 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-14.44396674123619, 36.663, -34.44396674123619, 36.663)
+SketchLine_2 = Sketch_1.addLine(-34.44396674123619, 36.663, -34.44396674123619, 14.29964516129033)
+SketchLine_3 = Sketch_1.addLine(-34.44396674123619, 14.29964516129033, -14.44396674123619, 14.29964516129033)
+SketchLine_4 = Sketch_1.addLine(-14.44396674123619, 14.29964516129033, -14.44396674123619, 36.663)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(34.94274193548387, 39.45841935483872, 18.60029032258063, 39.45841935483872)
+SketchLine_6 = Sketch_1.addLine(18.60029032258063, 39.45841935483872, 18.60029032258063, 13.00945161290323)
+SketchLine_7 = Sketch_1.addLine(18.60029032258063, 13.00945161290323, 34.94274193548387, 13.00945161290323)
+SketchLine_8 = Sketch_1.addLine(34.94274193548387, 13.00945161290323, 34.94274193548387, 39.45841935483872)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
+SketchLine_9 = Sketch_1.addLine(-7.633645161290328, -5.05325806451613, -33.00745161290323, -5.05325806451613)
+SketchLine_10 = Sketch_1.addLine(-33.00745161290323, -5.05325806451613, -33.00745161290323, -31.71725806451613)
+SketchLine_11 = Sketch_1.addLine(-33.00745161290323, -31.71725806451613, -7.633645161290328, -31.71725806451613)
+SketchLine_12 = Sketch_1.addLine(-7.633645161290328, -31.71725806451613, -7.633645161290328, -5.05325806451613)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result())
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_11.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result())
+SketchLine_13 = Sketch_1.addLine(36.44796774193549, -7.848677419354839, 19.46041935483872, -7.848677419354839)
+SketchLine_14 = Sketch_1.addLine(19.46041935483872, -7.848677419354839, 19.46041935483872, -34.29764516129033)
+SketchLine_15 = Sketch_1.addLine(19.46041935483872, -34.29764516129033, 36.44796774193549, -34.29764516129033)
+SketchLine_16 = Sketch_1.addLine(36.44796774193549, -34.29764516129033, 36.44796774193549, -7.848677419354839)
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result())
+SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_15.result())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_16.result())
+SketchCircle_1 = Sketch_1.addCircle(-24.6211935483871, 23.331, 4.515677419354841)
+SketchCircle_2 = Sketch_1.addCircle(27.20158064516131, 20.96564516129033, 4.091267733479863)
+SketchCircle_3 = Sketch_1.addCircle(-16.23493548387097, -18.60029032258065, 7.50151366286372)
+SketchCircle_4 = Sketch_1.addCircle(27.84667741935485, -22.90093548387097, 5.414373911476542)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "hh")
+model.do()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "hh", "15")
+model.addParameter(Part_1_doc, "hh_1", "26")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")], model.selection(), "hh", 0)
+Extrusion_2_objects = [model.selection("WIRE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r_wire"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_2_2r"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f-SketchCircle_4_2r"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchCircle_3_2r")]
+Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, "hh_1")
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_4"), model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 40)
+Fuse_1_objects_1 = [model.selection("SOLID", "Translation_1_2"), model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Extrusion_2_1")]
+Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_3")], model.selection("EDGE", "PartSet/OX"), 30)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Translation_2_1")])
+model.do()
+model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2692.py b/src/FeaturesPlugin/Test/Test2692.py
new file mode 100644 (file)
index 0000000..d7dff2a
--- /dev/null
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3)
+ExtrusionCut_1_objects_2 = [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_1_1_3")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, ExtrusionCut_1_objects_2)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.871972805908816, 24.69028692663239, 2.754280056405151)
+SketchCircle_2 = Sketch_1.addCircle(4.956613458332676, 4.459837610261877, 1.82794741094275)
+SketchCircle_3 = Sketch_1.addCircle(4.842959508111481, 44.32940059836771, 3.136980464700132)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+model.do()
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(ExtrusionCut_1, 1)
+model.testNbSubResults(ExtrusionCut_1, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [21])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(ExtrusionCut_1, [2347.550996571865198347950354218])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2693.py b/src/FeaturesPlugin/Test/Test2693.py
new file mode 100644 (file)
index 0000000..1f96da5
--- /dev/null
@@ -0,0 +1,156 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-17.23654191510748, 16.36770059625795, -4.760492650097712, 19.4251823602345)
+SketchLine_2 = Sketch_1.addLine(20, 2.414080216212369e-15, 20, -31)
+SketchLine_3 = Sketch_1.addLine(2.928932188134523, -38.07106781186548, -8.677669529663685, -26.46446609406726)
+SketchLine_4 = Sketch_1.addLine(-12.21320343559642, -25, -20.00000000000047, -25)
+SketchArc_1 = Sketch_1.addArc(10, -31, 20, -31, 2.928932188134523, -38.07106781186548, True)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1])
+SketchArc_2 = Sketch_1.addArc(-12.21320343559642, -30, -8.677669529663685, -26.46446609406726, -12.21320343559642, -25, False)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4")
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchArc_3 = Sketch_1.addArc(5.671735138196638e-24, 3.298692290329323e-23, -4.760492650097712, 19.4251823602345, 20, 2.414080216212369e-15, True)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_3.startPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
+SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_3.results()[1])
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
+SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_2.result())
+SketchArc_4 = Sketch_1.addArc(-12, -5, -22.35294117647118, -24.41176470588231, -17.23654191510748, 16.36770059625795, True)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_1.result())
+SketchConstraintTangent_7.setName("SketchConstraintTangent_8")
+SketchCircle_1 = Sketch_1.addCircle(-22, -5, 7.5)
+SketchCircle_2 = Sketch_1.addCircle(5.671735138196638e-24, 3.298692290329323e-23, 10)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.center(), SketchCircle_2.center())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
+SketchCircle_3 = Sketch_1.addCircle(7, -25, 7.5)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10)
+SketchConstraintRadius_1.setName("SketchConstraintRadius_2")
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), 134.9999999999999)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 5)
+SketchConstraintRadius_2.setName("SketchConstraintRadius_3")
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 22)
+SketchConstraintRadius_3.setName("SketchConstraintRadius_4")
+SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_3.results()[1], 20)
+SketchConstraintRadius_4.setName("SketchConstraintRadius_5")
+SketchPoint_1 = Sketch_1.addPoint(-20.00000000000047, -25)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
+SketchArc_5 = Sketch_1.addArc(-20.00000000000047, -20, -20.00000000000047, -25, -22.35294117647118, -24.41176470588231, True)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
+SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_5.results()[1])
+SketchConstraintTangent_8.setName("SketchConstraintTangent_9")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_5.endPoint())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13")
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_4.center(), SketchCircle_2.center(), 12)
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchArc_3.center(), 22)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.center(), SketchArc_4.center(), 5)
+SketchLine_5 = Sketch_1.addLine(-22, -5, -12, -5)
+SketchLine_5.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_5.endPoint())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_1.results()[1], 7.5)
+SketchConstraintRadius_5.setName("SketchConstraintRadius_6")
+SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchCircle_2.center(), SketchCircle_3.center(), 7)
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchCircle_2.center(), SketchCircle_3.center(), 25)
+SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchArc_3.center(), SketchArc_1.center(), 31)
+SketchConstraintRadius_6 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7.5)
+SketchConstraintRadius_6.setName("SketchConstraintRadius_7")
+SketchConstraintRadius_7 = Sketch_1.setRadius(SketchCircle_2.results()[1], 10)
+SketchConstraintRadius_7.setName("SketchConstraintRadius_8")
+SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_5.results()[1], 5)
+SketchConstraintRadius_8.setName("SketchConstraintRadius_9")
+SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1])
+SketchConstraintTangent_9.setName("SketchConstraintTangent_10")
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.center(), SketchAPI_Point(SketchPoint_2).coordinates())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16")
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_4.result(), 20, True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_4_2f-SketchArc_5_2f-SketchLine_4r-SketchArc_2_2r-SketchLine_3r-SketchArc_1_2f-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 6.5, 0)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
+SketchLine_6 = Sketch_2.addLine(12.25, 6.5, -12.25, 6.5)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
+SketchLine_7 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17")
+SketchLine_8 = Sketch_2.addLine(-12.25, 6.5, -12.25, 4.5)
+SketchLine_9 = Sketch_2.addLine(-12.25, 4.5, 12.25, 4.5)
+SketchLine_10 = Sketch_2.addLine(12.25, 4.5, 12.25, 6.5)
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18")
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21")
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_10.result())
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_9.result(), 24.5)
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_8.result(), 2)
+SketchPoint_3 = Sketch_2.addPoint(2.442490654175344e-15, 6.499999999999999)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_6.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22")
+SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_6.result())
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2]"), False)
+SketchLine_11 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_11.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23")
+ExtrusionCut_1.setNestedSketch(Sketch_2)
+model.do()
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2698.py b/src/FeaturesPlugin/Test/Test2698.py
new file mode 100644 (file)
index 0000000..44b5dea
--- /dev/null
@@ -0,0 +1,351 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, -3.45, 0, -6.45)
+SketchLine_2 = Sketch_1.addLine(0, -6.45, 7.781999999999999, -6.45)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(7.781999999999999, -6.45, 7.781999999999999, -3.45)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(7.781999999999999, -3.45, 6.537999941088452, -3.45)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(6.537999941088452, -3.45, 6.537999999999999, -2.4)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(6.537999999999999, -2.4, 6.375999999999999, -2.25)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999998, 9.186999999999999)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(6.537999999999998, 9.186999999999999, 6.537999999999998, 10.256)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchLine_10 = Sketch_1.addLine(6.537999999999998, 10.256, 6.187999999999998, 10.256)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchLine_11 = Sketch_1.addLine(6.187999999999998, 10.256, 4.9175, 10.94235984621995)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_12 = SketchProjection_1.createdFeature()
+SketchArc_1 = Sketch_1.addArc(0, 2.425, 0, 12.26, 4.9175, 10.94235984621995, True)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.center())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_1.endPoint())
+SketchLine_13 = Sketch_1.addLine(0, 12.26, 0, 12.096)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_13.startPoint())
+SketchLine_14 = Sketch_1.addLine(0, -3.45, 6.187999958006518, -3.45)
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_14.startPoint())
+SketchLine_15 = Sketch_1.addLine(6.187999958006518, -3.45, 6.188, 9.025)
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchLine_16 = Sketch_1.addLine(6.188, 9.025, 6.082, 9.532)
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_14.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_2.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_10.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_14.result())
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_5.result(), 0.35, True)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_15.result(), 0.188, True)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_17 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_17.result(), 3.45, True)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.result(), 6.188, True)
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_17.result(), 9.025, True)
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_12.result())
+SketchLine_18 = Sketch_1.addLine(6.188, 9.025, 6.375999999999999, 9.025)
+SketchLine_18.setAuxiliary(True)
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_18.endPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_18.result())
+SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_17.result(), 10.256, True)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 0.35)
+SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_8.result(), 45)
+SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_17.result(), 9.186999999999999, True)
+SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_15.result(), 0.106, True)
+SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_17.result(), 9.532, True)
+SketchArc_2 = Sketch_1.addArc(4.793786120242238, 9.263, 6.082, 9.532, 5.676067550792405, 10.23944020672409, False)
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_2.startPoint())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 1.316)
+SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_17.result(), 9.263, True)
+SketchLine_19 = Sketch_1.addLine(4.793786120242238, 9.263, 6.082, 9.532)
+SketchLine_19.setAuxiliary(True)
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_19.startPoint())
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_19.endPoint())
+SketchLine_20 = Sketch_1.addLine(4.793786120242238, 9.263, 5.676067550792405, 10.23944020672409)
+SketchLine_20.setAuxiliary(True)
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_20.endPoint())
+SketchLine_21 = Sketch_1.addLine(4.793786120242238, 9.263, 4.79378612024245, 10.72808112087842)
+SketchLine_21.setAuxiliary(True)
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_21.startPoint())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_21.result())
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 42.09999999999906)
+SketchLine_22 = Sketch_1.addLine(5.676067550792282, 10.23944020672395, 5.404900443923878, 10.43809443685872)
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_1.addLine(5.404900443923878, 10.43809443685872, 5.12663857042824, 10.62933672216996)
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_1.addLine(5.12663857042824, 10.62933672216996, 4.835500000000001, 10.80033167999931)
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint())
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_13.result(), "0.082*2")
+SketchArc_3 = Sketch_1.addArc(0, 2.425, 0, 12.096, 4.835500000000001, 10.80033167999931, True)
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_3.center())
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchArc_3.startPoint())
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchArc_3.endPoint())
+SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_17.result(), 2.425, True)
+SketchLine_25 = Sketch_1.addLine(0, 2.425, 4.9175, 10.94235984621995)
+SketchLine_25.setName("SketchLine_26")
+SketchLine_25.result().setName("SketchLine_26")
+SketchLine_25.setAuxiliary(True)
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_25.startPoint())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_38")
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_25.result())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_39")
+SketchLine_26 = Sketch_1.addLine(0, 2.425, 5.220090907696442, 10.77889172431985)
+SketchLine_26.setName("SketchLine_27")
+SketchLine_26.result().setName("SketchLine_27")
+SketchLine_26.setAuxiliary(True)
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_40")
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_41")
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_42")
+SketchLine_27 = Sketch_1.addLine(0, 2.425, 5.524022094217663, 10.61469954608912)
+SketchLine_27.setName("SketchLine_28")
+SketchLine_27.result().setName("SketchLine_28")
+SketchLine_27.setAuxiliary(True)
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_43")
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_27.result(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_45")
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_46")
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_25.result(), SketchLine_12.result(), 30.00000000000003)
+SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_26.result(), SketchLine_12.result(), 32.00000000000001)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_12.result(), 33.99999999999999)
+SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_23.endPoint(), SketchLine_11.result(), "0.088*2", True)
+SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_11.result(), "0.106*2", True)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001)
+SketchLine_28 = Sketch_1.addLine(7.031999999999999, -4.05, 5.531999999999999, -4.05)
+SketchLine_28.setName("SketchLine_29")
+SketchLine_28.result().setName("SketchLine_29")
+SketchLine_29 = Sketch_1.addLine(5.531999999999999, -4.05, 5.531999999999999, -5.85)
+SketchLine_29.setName("SketchLine_30")
+SketchLine_29.result().setName("SketchLine_30")
+SketchLine_30 = Sketch_1.addLine(5.531999999999999, -5.85, 7.031999999999999, -5.85)
+SketchLine_30.setName("SketchLine_31")
+SketchLine_30.result().setName("SketchLine_31")
+SketchLine_31 = Sketch_1.addLine(7.031999999999999, -5.85, 7.031999999999999, -4.05)
+SketchLine_31.setName("SketchLine_32")
+SketchLine_31.result().setName("SketchLine_32")
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_47")
+SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint())
+SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_49")
+SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
+SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_50")
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_28.result())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_29.result())
+SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_30.result())
+SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_31.result())
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_30.result(), 1.5)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_29.result(), 1.8)
+SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_29.startPoint(), SketchLine_14.result(), 0.6, True)
+SketchLine_32 = Sketch_1.addLine(6.281999999999999, 9.025000000000009, 6.281999999999999, -4.049999999999998)
+SketchLine_32.setName("SketchLine_33")
+SketchLine_32.result().setName("SketchLine_33")
+SketchLine_32.setAuxiliary(True)
+SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_18.result())
+SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_51")
+SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_28.result())
+SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_52")
+SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_32.result())
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_32.endPoint(), SketchLine_28.result())
+SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_32.startPoint(), SketchLine_18.result())
+SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchLine_3.result(), 1.5, True)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.endPoint(), SketchLine_5.endPoint(), 0.15)
+SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_17.result(), 2.25, True)
+SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.result(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_53")
+SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_25.result(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_54")
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchArc_1_2f-SketchLine_13f-SketchArc_3_2r-SketchLine_24r-SketchLine_23r-SketchLine_22r-SketchArc_2_2r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_32r-SketchLine_31r-SketchLine_30r-SketchLine_29r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_33 = Sketch_2.addLine(0, 2.425, 3.282538500974061, 11.74164236673401)
+SketchLine_33.setName("SketchLine_34")
+SketchLine_33.result().setName("SketchLine_34")
+SketchLine_33.setAuxiliary(True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_28_StartVertex"), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_55")
+SketchPoint_2 = Sketch_2.addPoint(3.241, 11.6237460014939)
+SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_33.result())
+SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_56")
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_34 = SketchProjection_4.createdFeature()
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+SketchConstraintDistance_17 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_34.result(), 3.241, True)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_13"), False)
+SketchLine_35 = SketchProjection_5.createdFeature()
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_28"), False)
+SketchLine_36 = SketchProjection_6.createdFeature()
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550194, 10.51060344512932, True)
+SketchArc_4.setAuxiliary(True)
+SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_4.center())
+SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58")
+SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_35.result(), SketchArc_4.startPoint())
+SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_59")
+SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_36.result(), SketchArc_4.endPoint())
+SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_60")
+SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchLine_35.result(), SketchArc_4.startPoint())
+SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1])
+SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_61")
+SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.28253850097406, 11.74164236673401, 4.139817701932777, 11.39365616437401, True)
+SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_5.center())
+SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_62")
+SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_63")
+SketchLine_37 = Sketch_2.addLine(4.139817701932777, 11.39365616437401, 4.459277785066624, 11.1909606795611)
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_37.startPoint())
+SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_64")
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False)
+SketchArc_6 = SketchProjection_7.createdFeature()
+SketchConstraintCoincidence_62 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_6.results()[1])
+SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_65")
+SketchLine_38 = Sketch_2.addLine(4.459277785066624, 11.1909606795611, 4.390495384356073, 11.041947909785)
+SketchLine_38.setName("SketchLine_40")
+SketchLine_38.result().setName("SketchLine_40")
+SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint())
+SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_66")
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False)
+SketchArc_7 = SketchProjection_8.createdFeature()
+SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchArc_7.results()[1])
+SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_67")
+SketchLine_39 = Sketch_2.addLine(4.390495384356073, 11.041947909785, 4.035044020470619, 11.16667053559354)
+SketchLine_39.setName("SketchLine_41")
+SketchLine_39.result().setName("SketchLine_41")
+SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint())
+SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_68")
+SketchArc_8 = Sketch_2.addArc(0, 2.425, 3.199461499025941, 11.5058496362538, 4.035044020470619, 11.16667053559354, True)
+SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_8.center())
+SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_69")
+SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_8.startPoint())
+SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_70")
+SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_39.endPoint())
+SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_71")
+SketchLine_40 = Sketch_2.addLine(0, 2.425, 4.139817701932777, 11.39365616437401)
+SketchLine_40.setName("SketchLine_42")
+SketchLine_40.result().setName("SketchLine_42")
+SketchLine_40.setAuxiliary(True)
+SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_40.startPoint())
+SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_72")
+SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.endPoint())
+SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_73")
+SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_40.result())
+SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_74")
+SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_38.result(), SketchLine_40.result())
+SketchLine_41 = Sketch_2.addLine(0, 2.425, 3.9115060144283, 11.49555702253678)
+SketchLine_41.setName("SketchLine_43")
+SketchLine_41.result().setName("SketchLine_43")
+SketchLine_41.setAuxiliary(True)
+SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_41.startPoint())
+SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_75")
+SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_5.results()[1])
+SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_76")
+SketchPoint_3 = Sketch_2.addPoint(3.812510620258724, 11.26599240868436)
+SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_41.result())
+SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_77")
+SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_8.results()[1])
+SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_78")
+SketchLine_42 = Sketch_2.addLine(3.812510620258724, 11.26599240868436, 3.9115060144283, 11.49555702253678)
+SketchLine_42.setName("SketchLine_44")
+SketchLine_42.result().setName("SketchLine_44")
+SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_42.startPoint())
+SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_79")
+SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.endPoint())
+SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_80")
+SketchPoint_4 = Sketch_2.addPoint(3.862008317343517, 11.38077471561057)
+SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_42.result())
+SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_81")
+SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_42.result())
+SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_4.results()[1])
+SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_82")
+SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_42.endPoint(), SketchLine_40.result(), 0.25, True)
+SketchConstraintDistance_19 = Sketch_2.setDistance(SketchArc_5.endPoint(), SketchLine_38.result(), 0.375, True)
+SketchConstraintDistance_20 = Sketch_2.setDistance(SketchArc_5.startPoint(), SketchLine_42.result(), "1.35/2", True)
+SketchConstraintDistance_21 = Sketch_2.setDistance(SketchArc_8.startPoint(), SketchArc_5.startPoint(), 0.25, True)
+SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_83")
+SketchLine_43 = Sketch_2.addLine(3.199461499025942, 11.5058496362538, 3.28253850097406, 11.74164236673401)
+SketchLine_43.setName("SketchLine_45")
+SketchLine_43.result().setName("SketchLine_45")
+SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchArc_8.startPoint(), SketchLine_43.startPoint())
+SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_84")
+SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchLine_43.endPoint())
+SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_85")
+model.do()
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_45r-SketchArc_8_2r-SketchLine_44f")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0)
+Revolution_2.result().setName("Cut_tool")
+Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_44r-SketchArc_8_2r-SketchLine_41r-SketchLine_40r-SketchLine_39r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0)
+Revolution_3.result().setName("Fuse_tool")
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cut_tool"), model.selection("SOLID", "Fuse_tool")], model.selection("EDGE", "PartSet/OZ"), True)
+Symmetry_1.result().subResult(0).setName("Symmetry_1_1_1")
+Symmetry_1.result().subResult(1).setName("Symmetry_1_1_2")
+Symmetry_1.results()[1].subResult(0).setName("Symmetry_1_2_1")
+Symmetry_1.results()[1].subResult(1).setName("Symmetry_1_2_2")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "Cut_tool")])
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Fuse_tool")], True)
+model.do()
+model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2701.py b/src/FeaturesPlugin/Test/Test2701.py
new file mode 100644 (file)
index 0000000..97de481
--- /dev/null
@@ -0,0 +1,118 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "a", "10")
+model.addParameter(Part_1_doc, "b", "8")
+model.addParameter(Part_1_doc, "c", "2*a")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-48.37423594569039, -43.07420401522882, -48.37423594569039, -8.074204015228814)
+SketchLine_2 = Sketch_1.addLine(-40.38893648559045, -0.07421752185518632, -2.793802518897851e-22, 0)
+SketchLine_3 = Sketch_1.addLine(-2.793802518897851e-22, 0, 37.58770483143633, -13.68080573302675)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchLine_4 = Sketch_1.addLine(37.58770483143633, -13.68080573302675, 19.91003530177265, -31.35847526269043)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchLine_5 = Sketch_1.addLine(-8.374235945690391, -43.07420401522882, -48.37423594569039, -43.07420401522882)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
+SketchArc_1 = Sketch_1.addArc(-40.37423594569039, -8.074204015228817, -40.38893648559045, -0.07421752185518632, -48.37423594569039, -8.074204015228814, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result())
+SketchArc_2 = Sketch_1.addArc(-8.374235945690213, -3.074204015227884, -8.374235945690391, -43.07420401522882, 19.91003530177265, -31.35847526269043, False)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_5.result())
+SketchLine_6 = Sketch_1.addLine(-2.793802518897851e-22, 0, 0, 35)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
+SketchLine_7 = Sketch_1.addLine(30.00000000001173, 65.00000000001097, 42.00000000001173, 65.00000000001097)
+SketchLine_8 = Sketch_1.addLine(65.00000000000007, 42, 65.00000000000007, 30)
+SketchLine_9 = Sketch_1.addLine(35.00000000000009, 0, -2.793802518897851e-22, 0)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_9.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_14")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchArc_3 = Sketch_1.addArc(30.00000000000873, 35.00000000000306, 30.00000000001173, 65.00000000001097, 0, 35, False)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_15")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.endPoint())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_16")
+SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_6.result())
+SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_7.result())
+SketchArc_4 = Sketch_1.addArc(42.00000000000008, 41.99999999999999, 65.00000000000007, 42, 42.00000000001173, 65.00000000001097, False)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.endPoint())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18")
+SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_7.result())
+SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_8.result())
+SketchArc_5 = Sketch_1.addArc(35.00000000000006, 30.00000000000001, 35.00000000000009, 0, 65.00000000000007, 30, False)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_8.endPoint())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20")
+SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_8.result())
+SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_9.result())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_21")
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_4.result(), SketchLine_3.result(), 65.00000000000011)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "2*c")
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 25)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "4*a")
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 35)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 8)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_9.result(), 20.00000000000001)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 40)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_6.result(), 35)
+SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_7.result(), 12)
+SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_8.result(), 12)
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], 30)
+SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_5.results()[1], 30)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2724.py b/src/FeaturesPlugin/Test/Test2724.py
new file mode 100644 (file)
index 0000000..16cd2c3
--- /dev/null
@@ -0,0 +1,67 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "b", "80")
+model.addParameter(partSet, "a", "100")
+model.addParameter(partSet, "c", "b-a")
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-60, -20, -60.00000000000001, 80)
+SketchLine_2 = Sketch_1.addLine(-60.00000000000001, 80, 0, 0)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(0, 0, 0, -100)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(0, -100, -60, -20)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result())
+SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_3.result())
+SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_3.startPoint(), "a", True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.endPoint(), SketchLine_2.endPoint(), 60)
+SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchLine_1.result(), SketchLine_2.result()]
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_3.result(), SketchConstraintMirror_1_objects)
+[SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored()
+SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_4.result(), SketchLine_3.result(), SketchLine_5.result(), SketchLine_6.result()]
+SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_2.endPoint(), SketchLine_4.startPoint(), 4)
+[SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_5, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_6, SketchLine_20, SketchLine_21, SketchLine_22] = SketchMultiTranslation_1.translated()
+model.do()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1_objects = [model.selection("FACE", (-30, -10, 0)), model.selection("FACE", (30, -110, 0)), model.selection("FACE", (-30, -210, 0)), model.selection("FACE", (30, -310, 0))]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), "c", 0)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", (30, -310, -9.999999999999998))], model.selection("EDGE", (-30, -360, 0)), "-c")
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -10, -10))], model.selection("FACE", (5, 10, 5)), model.selection("FACE", (-30, 40, -10)), True, True)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -210, -10)), model.selection("SOLID", (18, -293.9999999999999, -9.999999999999998))])
+model.do()
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK))
+model.end()
diff --git a/src/FeaturesPlugin/Test/Test2729.py b/src/FeaturesPlugin/Test/Test2729.py
new file mode 100644 (file)
index 0000000..2819f18
--- /dev/null
@@ -0,0 +1,254 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "B", "46")
+model.addParameter(Part_1_doc, "B1", "36")
+model.addParameter(Part_1_doc, "B2", "25.5")
+model.addParameter(Part_1_doc, "B3", "10")
+model.addParameter(Part_1_doc, "D", "4.2")
+model.addParameter(Part_1_doc, "D1", "4")
+model.addParameter(Part_1_doc, "D2", "0")
+model.addParameter(Part_1_doc, "H", "95")
+model.addParameter(Part_1_doc, "H1", "86")
+model.addParameter(Part_1_doc, "H2", "4.7")
+model.addParameter(Part_1_doc, "H4", "86")
+model.addParameter(Part_1_doc, "H5", "71")
+model.addParameter(Part_1_doc, "H6", "40")
+model.addParameter(Part_1_doc, "H7", "26.75")
+model.addParameter(Part_1_doc, "H8", "51.5")
+model.addParameter(Part_1_doc, "H9", "15")
+model.addParameter(Part_1_doc, "H10", "1.5")
+model.addParameter(Part_1_doc, "L1", "23")
+model.addParameter(Part_1_doc, "L2", "30")
+model.addParameter(Part_1_doc, "L3", "4")
+model.addParameter(Part_1_doc, "L4", "2.3")
+model.addParameter(Part_1_doc, "L5", "6.5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(29.99999999999995, 0, -16.00000000000005, 0)
+SketchLine_2 = Sketch_1.addLine(-16.00000000000005, 0, -16.00000000000005, 4.7)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-16.00000000000005, 4.7, 1.946471204593173e-17, 4.7)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(1.946471204593173e-17, 4.7, 4.235164736271502e-22, 95)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(4.235164736271502e-22, 95, 7, 95)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(7, 95, 7, 80)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(7, 80, 9, 80)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(9, 80, 9, 8.999999999999996)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(9, 8.999999999999996, 17, 9.000000000000002)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchLine_10 = Sketch_1.addLine(17, 9.000000000000002, 17, 4.7)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchLine_11 = Sketch_1.addLine(17, 4.7, 30, 4.7)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchLine_12 = Sketch_1.addLine(30, 4.7, 29.99999999999995, 0)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.endPoint())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_13 = SketchProjection_1.createdFeature()
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_13.result(), SketchLine_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_14 = SketchProjection_2.createdFeature()
+SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_14.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_12.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_11.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "H2")
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), "B")
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchLine_1.startPoint(), "L2")
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_11.endPoint(), "L1")
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 2)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.startPoint(), SketchLine_1.startPoint(), "H")
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_8.startPoint(), SketchLine_9.endPoint(), "H5")
+SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_6.startPoint(), SketchLine_9.endPoint(), "H1")
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_12.result(), "H2")
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_11.result(), "L5*2")
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "B/2", "B/2")
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, "L5", [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
+SketchLine_15 = Sketch_2.addLine(-8.985867605559861e-16, 8.999999999999996, 1.535230276239474e-15, 80)
+SketchLine_15.setAuxiliary(True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
+SketchLine_16 = SketchProjection_3.createdFeature()
+SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_16.result(), SketchLine_15.endPoint())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"), False)
+SketchLine_17 = SketchProjection_4.createdFeature()
+SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_15.startPoint(), SketchLine_17.result())
+SketchLine_18 = Sketch_2.addLine(-4.999999999999998, 13.00000000000012, -4.999999999999999, 94.99999999999999)
+SketchLine_19 = Sketch_2.addLine(-4.999999999999999, 94.99999999999999, -13.00000000000988, 95.00000000000222)
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
+SketchLine_20 = Sketch_2.addLine(-13.00000000000988, 95.00000000000222, -13, 78.5)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
+SketchLine_21 = Sketch_2.addLine(-13, 78.5, -23.00000000000001, 78.5)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_22 = Sketch_2.addLine(-23.00000000000001, 78.5, -23.00000000000001, 72.5)
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_2.addLine(-23.00000000000001, 72.5, -15, 72.5)
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_2.addLine(-13, 70.5, -13, 23)
+SketchLine_25 = Sketch_2.addLine(-15, 21, -22.99999999999999, 21)
+SketchLine_26 = Sketch_2.addLine(-22.99999999999999, 21, -22.99999999999999, 15)
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchLine_27 = Sketch_2.addLine(-22.99999999999999, 15, -13, 15)
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21")
+SketchLine_28 = Sketch_2.addLine(-13, 15, -13.00000000000024, 13.00000000000012)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22")
+SketchArc_1 = Sketch_2.addArc(-9.000000000000117, 13.00000000000012, -4.999999999999998, 13.00000000000012, -13.00000000000024, 13.00000000000012, True)
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23")
+SketchConstraintTangent_1 = Sketch_2.setTangent(SketchLine_18.result(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_28.endPoint(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24")
+SketchConstraintTangent_2 = Sketch_2.setTangent(SketchLine_28.result(), SketchArc_1.results()[1])
+SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_18.result())
+SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_28.result())
+SketchConstraintCollinear_3 = Sketch_2.setCollinear(SketchLine_28.result(), SketchLine_24.result())
+SketchConstraintCollinear_4 = Sketch_2.setCollinear(SketchLine_20.result(), SketchLine_24.result())
+SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_27.result())
+SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_25.result())
+SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_23.result())
+SketchConstraintHorizontal_9 = Sketch_2.setHorizontal(SketchLine_21.result())
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), False)
+SketchLine_29 = SketchProjection_5.createdFeature()
+SketchConstraintCollinear_5 = Sketch_2.setCollinear(SketchLine_22.result(), SketchLine_29.result())
+SketchConstraintCollinear_5.setName("SketchConstraintCollinear_7")
+SketchConstraintCollinear_6 = Sketch_2.setCollinear(SketchLine_26.result(), SketchLine_29.result())
+SketchConstraintCollinear_6.setName("SketchConstraintCollinear_8")
+SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_1.results()[1], SketchLine_17.result())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_22.result(), 6)
+SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_26.result(), 6)
+SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_18.endPoint(), SketchLine_15.endPoint(), "B3/2")
+SketchConstraintLength_8 = Sketch_2.setLength(SketchLine_19.result(), 8)
+SketchConstraintLength_8.setName("SketchConstraintLength_9")
+SketchArc_2 = Sketch_2.addArc(-15, 70.5, -13, 70.5, -15, 72.5, False)
+SketchPoint_1 = Sketch_2.addPoint(-13, 72.5)
+SketchPoint_1.setAuxiliary(True)
+SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25")
+SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26")
+SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_24.startPoint())
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27")
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28")
+SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_23.result())
+SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_24.result())
+SketchArc_3 = Sketch_2.addArc(-15, 23, -15, 21, -13, 23, False)
+SketchPoint_2 = Sketch_2.addPoint(-13, 21)
+SketchPoint_2.setAuxiliary(True)
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchPoint_2.coordinates(), "H8", False)
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_25.result())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29")
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30")
+SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_25.startPoint())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31")
+SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_24.endPoint())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32")
+SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_25.result())
+SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_24.result())
+SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_3.results()[1], 2)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], 2)
+SketchLine_30 = Sketch_2.addLine(13.00000000000001, 78.49999999999866, 23, 78.49999999999866)
+SketchLine_30.setName("SketchLine_32")
+SketchLine_30.result().setName("SketchLine_32")
+SketchLine_31 = Sketch_2.addLine(23, 78.49999999999866, 23, 72.49999999999866)
+SketchLine_31.setName("SketchLine_33")
+SketchLine_31.result().setName("SketchLine_33")
+SketchLine_32 = Sketch_2.addLine(23, 72.49999999999866, 14.99999999999993, 72.5)
+SketchLine_32.setName("SketchLine_34")
+SketchLine_32.result().setName("SketchLine_34")
+SketchArc_4 = Sketch_2.addArc(14.99999999999997, 70.5, 12.99999999999997, 70.50000000000004, 14.99999999999993, 72.5, True)
+SketchLine_33 = Sketch_2.addLine(12.99999999999997, 70.50000000000004, 12.99999999999995, 22.99999999999997)
+SketchLine_33.setName("SketchLine_35")
+SketchLine_33.result().setName("SketchLine_35")
+SketchArc_5 = Sketch_2.addArc(14.99999999999996, 23.00000000000001, 14.99999999999992, 21, 12.99999999999995, 22.99999999999997, True)
+SketchLine_34 = Sketch_2.addLine(14.99999999999992, 21, 23, 20.99999999999866)
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+SketchLine_35 = Sketch_2.addLine(23, 20.99999999999866, 23, 14.99999999999866)
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchLine_36 = Sketch_2.addLine(23, 14.99999999999866, 13.00000000000001, 14.99999999999866)
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchLine_37 = Sketch_2.addLine(13.00000000000001, 14.99999999999866, 13.00000000000024, 13.00000000000011)
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchArc_6 = Sketch_2.addArc(9.000000000000117, 13.00000000000012, 4.999999999999996, 13.00000000000012, 13.00000000000024, 13.00000000000011, False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"), True)
+SketchLine_38 = SketchProjection_6.createdFeature()
+SketchLine_38.setName("SketchLine_41")
+SketchLine_38.result().setName("SketchLine_41")
+SketchConstraintCollinear_7 = Sketch_2.setCollinear(SketchLine_19.result(), SketchLine_38.result())
+SketchConstraintCollinear_7.setName("SketchConstraintCollinear_9")
+SketchConstraintDistanceVertical_4 = Sketch_2.setVerticalDistance(SketchAPI_Line(SketchLine_29).startPoint(), SketchLine_22.startPoint(), "H10")
+SketchConstraintMirror_1_objects = [SketchLine_18.result(), SketchLine_20.result(), SketchLine_19.result()]
+SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_15.result(), SketchConstraintMirror_1_objects)
+[SketchLine_39, SketchLine_40, SketchLine_41] = SketchConstraintMirror_1.mirrored()
+SketchLine_41.setName("SketchLine_43")
+SketchLine_41.result().setName("SketchLine_43")
+SketchLine_40.setName("SketchLine_42")
+SketchLine_40.result().setName("SketchLine_42")
+SketchLine_39.setName("SketchLine_40")
+SketchLine_39.result().setName("SketchLine_40")
+ExtrusionCut_1.setNestedSketch(Sketch_2)
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_8&weak_name_1"))
+SketchCircle_1 = Sketch_3.addCircle(-19.86097902097902, 65.28094405594405, 2.5)
+SketchCircle_2 = Sketch_3.addCircle(-18.51902097902098, 27.57192307692308, 2)
+SketchCircle_3 = Sketch_3.addCircle(-19.0558041958042, 85.54451048951049, 3)
+SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_2.results()[1], 2)
+SketchConstraintRadius_4 = Sketch_3.setRadius(SketchCircle_1.results()[1], 2.5)
+SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_3.results()[1], 3)
+ExtrusionCut_2.setNestedSketch(Sketch_3)
+model.end()
+
+# check that radius constraint is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(SketchConstraintRadius_3.feature()))
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/Test2751.py b/src/FeaturesPlugin/Test/Test2751.py
new file mode 100644 (file)
index 0000000..ef00edc
--- /dev/null
@@ -0,0 +1,93 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "r", "20")
+model.addParameter(Part_1_doc, "l", "40")
+model.addParameter(Part_1_doc, "r2", "3")
+model.addParameter(Part_1_doc, "a", "10")
+model.addParameter(Part_1_doc, "h", "5")
+model.addParameter(Part_1_doc, "n", "2")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_2.createdFeature()
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_3.createdFeature()
+SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
+SketchArc_2 = Sketch_1.addArc(0, 0, 60, 0, 0, 60, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.center())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint())
+SketchLine_3 = Sketch_1.addLine(0, 20, 0, 60)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.endPoint())
+SketchLine_4 = Sketch_1.addLine(20, 0, 60, 0)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_4.endPoint())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "l")
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "r")
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", (30, 30, 0))])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE_2", (30, 30, 0)))
+SketchCircle_1 = Sketch_2.addCircle(24.6201938253052, 4.341204441673258, 3)
+SketchLine_5 = Sketch_2.addLine(24.6201938253052, 4.341204441673258, 54.16442641567144, 9.550649771681169)
+SketchLine_5.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], "r2")
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_6 = SketchProjection_4.createdFeature()
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", (20, 0, 0)), False)
+SketchPoint_2 = SketchProjection_5.createdFeature()
+SketchMultiTranslation_1 = Sketch_2.addTranslation([SketchCircle_1.results()[1]], SketchCircle_1.center(), SketchLine_5.endPoint(), "n")
+[SketchCircle_2] = SketchMultiTranslation_1.translated()
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_5.result(), "(l-2*h)/(n-1)")
+SketchLine_7 = Sketch_2.addLine(0, 0, 24.6201938253052, 4.341204441673258)
+SketchLine_7.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_7.endPoint())
+SketchConstraintCollinear_1 = Sketch_2.setCollinear(SketchLine_5.result(), SketchLine_7.result())
+SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_6.result(), SketchLine_7.result(), "a")
+SketchPoint_3 = Sketch_2.addPoint(19.69615506024416, 3.472963553338606)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_7.result())
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", (14.14213562373095, 14.14213562373095, 0)), False)
+SketchArc_3 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_3.results()[1])
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_7.endPoint(), "h", True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 10, 0)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("EDGE", "PartSet/OZ"), "(90-2*a)/(n-1)", "n")
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", (30, 30, 0))], [model.selection("COMPOUND", (29.25281542867235, 29.25281542867235, 5))])
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBoolean.py b/src/FeaturesPlugin/Test/TestBoolean.py
deleted file mode 100644 (file)
index 84c893e..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-##
-
-"""
-      TestBoolean.py
-      Unit test of FeaturesPlugin_Boolean class
-
-      class FeaturesPlugin_Boolean
-        static const std::string MY_ID("Boolean");
-        static const std::string MY_OBJECT_ID("main_object");
-        static const std::string MY_TOOL_ID("tool_object");
-        static const std::string MY_TYPE_ID("bool_type");
-
-        data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::typeId());
-        data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::typeId());
-        data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
-"""
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-from ModelAPI import *
-from GeomDataAPI import *
-from GeomAlgoAPI import *
-from GeomAPI import *
-
-__updated__ = "2014-12-16"
-
-aSession = ModelAPI_Session.get()
-# Create a part for extrusions & boolean
-aSession.startOperation()
-aPartFeature = aSession.moduleDocument().addFeature("Part")
-aSession.finishOperation()
-aPart = aSession.activeDocument()
-#=========================================================================
-# Create a sketch with circle to extrude
-#=========================================================================
-aSession.startOperation()
-aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
-anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
-aCircleRadius = aSketchCircle.real("circle_radius")
-anCircleCentr.setValue(10., 10.)
-aCircleRadius.setValue(50.)
-aSession.finishOperation()
-#=========================================================================
-# Create a sketch with triangle to extrude
-#=========================================================================
-aSession.startOperation()
-aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
-aSketchLineB = aTriangleSketchFeature.addFeature("SketchLine")
-aSketchLineC = aTriangleSketchFeature.addFeature("SketchLine")
-aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
-aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
-aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
-aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint"))
-aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint"))
-aLineAStartPoint.setValue(25., 25.)
-aLineAEndPoint.setValue(100., 25.)
-aLineBStartPoint.setValue(100., 25.)
-aLineBEndPoint.setValue(60., 75.)
-aLineCStartPoint.setValue(60., 75.)
-aLineCEndPoint.setValue(25., 25.)
-aSession.finishOperation()
-#=========================================================================
-# Make extrusion on circle (cylinder) and triangle (prism)
-#=========================================================================
-# Build shape from sketcher results
-aSession.startOperation()
-extrudedObjects = []
-for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
-    # Build sketch faces
-    aSketchResult = eachSketchFeature.firstResult()
-    aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-    origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
-    dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
-    norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
-    aSketchFaces = ShapeList()
-    GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, norm, aSketchEdges, aSketchFaces)
-    # Create extrusion on them
-    anExtrusionFt = aPart.addFeature("Extrusion")
-    anExtrusionFt.selectionList("base").append(
-        aSketchResult, aSketchFaces[0])
-    anExtrusionFt.string("CreationMethod").setValue("BySizes")
-    anExtrusionFt.real("from_size").setValue(0)
-    anExtrusionFt.real("to_size").setValue(50)
-    anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
-    anExtrusionFt.execute()
-    extrudedObjects.append(modelAPI_ResultBody(anExtrusionFt.firstResult()))
-aSession.finishOperation()
-#=========================================================================
-# Create a pacman as boolean cut of the prism from the cylinder
-#=========================================================================
-aSession.startOperation()
-aBooleanFt = aPart.addFeature("Cut")
-aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
-aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-aBooleanFt.execute()
-aSession.finishOperation()
-
-assert (len(aBooleanFt.results()) > 0)
-aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult())
-assert (aBooleanResult is not None)
-#=========================================================================
-# End of test
-#=========================================================================
-
-from salome.shaper import model
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
-model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
-model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
-model.end()
-assert(len(Boolean_1.results()) > 0)
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
-model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
-model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
-model.end()
-assert(len(Boolean_1.results()) > 0)
-
-assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBoolean1.py b/src/FeaturesPlugin/Test/TestBoolean1.py
new file mode 100644 (file)
index 0000000..371c30b
--- /dev/null
@@ -0,0 +1,134 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+      TestBoolean.py
+      Unit test of FeaturesPlugin_Boolean class
+
+      class FeaturesPlugin_Boolean
+        static const std::string MY_ID("Boolean");
+        static const std::string MY_OBJECT_ID("main_object");
+        static const std::string MY_TOOL_ID("tool_object");
+        static const std::string MY_TYPE_ID("bool_type");
+
+        data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+        data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::typeId());
+        data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
+"""
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+# Create a part for extrusions & boolean
+aSession.startOperation()
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+#=========================================================================
+# Create a sketch with circle to extrude
+#=========================================================================
+aSession.startOperation()
+aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
+anCircleCentr.setValue(10., 10.)
+aCircleRadius.setValue(50.)
+aSession.finishOperation()
+#=========================================================================
+# Create a sketch with triangle to extrude
+#=========================================================================
+aSession.startOperation()
+aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
+aSketchLineB = aTriangleSketchFeature.addFeature("SketchLine")
+aSketchLineC = aTriangleSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
+aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
+aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
+aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint"))
+aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint"))
+aLineAStartPoint.setValue(25., 25.)
+aLineAEndPoint.setValue(100., 25.)
+aLineBStartPoint.setValue(100., 25.)
+aLineBEndPoint.setValue(60., 75.)
+aLineCStartPoint.setValue(60., 75.)
+aLineCEndPoint.setValue(25., 25.)
+aSession.finishOperation()
+#=========================================================================
+# Make extrusion on circle (cylinder) and triangle (prism)
+#=========================================================================
+# Build shape from sketcher results
+aSession.startOperation()
+extrudedObjects = []
+for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
+    # Build sketch faces
+    aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
+    # Create extrusion on them
+    anExtrusionFt = aPart.addFeature("Extrusion")
+    anExtrusionFt.selectionList("base").append(
+        aSketchResult, aSketchResult.face(0))
+    anExtrusionFt.string("CreationMethod").setValue("BySizes")
+    anExtrusionFt.real("from_size").setValue(0)
+    anExtrusionFt.real("to_size").setValue(50)
+    anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+    anExtrusionFt.execute()
+    extrudedObjects.append(modelAPI_ResultBody(anExtrusionFt.firstResult()))
+aSession.finishOperation()
+#=========================================================================
+# Create a pacman as boolean cut of the prism from the cylinder
+#=========================================================================
+aSession.startOperation()
+aBooleanFt = aPart.addFeature("Cut")
+aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
+aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
+aBooleanFt.execute()
+aSession.finishOperation()
+
+assert (len(aBooleanFt.results()) > 0)
+aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult())
+assert (aBooleanResult is not None)
+#=========================================================================
+# End of test
+#=========================================================================
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBoolean2.py b/src/FeaturesPlugin/Test/TestBoolean2.py
new file mode 100644 (file)
index 0000000..dc68688
--- /dev/null
@@ -0,0 +1,41 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert(len(Common_1.results()) > 0)
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBoolean3.py b/src/FeaturesPlugin/Test/TestBoolean3.py
new file mode 100644 (file)
index 0000000..9c027bb
--- /dev/null
@@ -0,0 +1,41 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert(len(Smash_1.results()) > 0)
+
+assert(model.checkPythonDump())
index c74354f89f5bb3ad8a518833d84ccbcc164af6ce..11a62f6457297b32485b92c0f65bd52c5ba4c0a2 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index 4ed9772d10344bbeef59e8114a4fce5b2314a75e..7fa5c0af2b4a546fc03eef1bb46b6e24370f4540 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -71,7 +73,7 @@ SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result())
 SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
index 474ee4f0d83d1b87391b1422c9439e58a76e562a..fba6de97f14370588bd0e1074c563bcfe4393b5f 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -75,7 +77,7 @@ SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_15.endPoint()
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_13f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_15r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_15f-SketchLine_13f-SketchLine_14f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_13f-SketchLine_15r")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index 30e2a876b8cdf5f351074703d7ed269f1db6d982..a6ac0b27804a5dc9bc6916ca0d6b95c28c218da0 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index 8799458b1dd61c93916acde7ce324c3e3ce73f84..317b8b9ac886c2e9eb9e2f30af765d380c7aa19b 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -56,7 +58,7 @@ SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index f43929d82564b294f377ce89a5c77f52b440d54f..f2d4c518d9293dcabf89ec47681df3a7c0e5f736 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -42,9 +44,9 @@ SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint()
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_6 = Sketch_2.addLine(26.29086071781277, 6.827405438264643, 9.220324256871813, 6.827405438264643)
-SketchLine_7 = Sketch_2.addLine(9.220324256871813, 6.827405438264643, 9.220324256871813, -3.640935176083419)
-SketchLine_8 = Sketch_2.addLine(9.220324256871813, -3.640935176083419, 26.29086071781277, -3.640935176083419)
+SketchLine_6 = Sketch_2.addLine(26.29086071781277, 6.827405438264643, 9.220324256871812, 6.827405438264643)
+SketchLine_7 = Sketch_2.addLine(9.220324256871812, 6.827405438264643, 9.220324256871812, -3.640935176083419)
+SketchLine_8 = Sketch_2.addLine(9.220324256871812, -3.640935176083419, 26.29086071781277, -3.640935176083419)
 SketchLine_9 = Sketch_2.addLine(26.29086071781277, -3.640935176083419, 26.29086071781277, 6.827405438264643)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint())
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
@@ -59,7 +61,7 @@ SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_10r"), model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_10r"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_10f-SketchLine_8f-SketchLine_9f")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index ad29cd18de332fd19cca99098e09f944cc9f6d2e..ac4c913fd0ebdb3fa58c6fa7bb6e867d5b690e59 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -34,8 +36,8 @@ SketchLine_4 = Sketch_1.addLine(31.27467463593981, 24.52070441885453, 55.1316738
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_2_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_2_1")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
index 69b8e39f81d1399205edd9411bc6fcf00297ebb4..edee7c4f8cd10c4624a9e33daf64ad29e4db8749 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,7 @@ SketchLine_2 = Sketch_1.addLine(-81.47249047471176, -8.020952206935315, 40.54932
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.endPoint())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py
new file mode 100644 (file)
index 0000000..1c1143f
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1")])
+assert(Common_1.feature().error() != "")
+Part_1_doc.removeFeature(Common_1.feature())
+
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [])
+assert(Common_1.feature().error() != "")
+Part_1_doc.removeFeature(Common_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Common_1 = Part_1_doc.addFeature("Common")
+Common_1.execute()
+assert(Common_1.error() != "")
+aSession.finishOperation()
index 23195447d2848cf50a456160257b8df7fddb864c..f0dd9175f4dca59bbd6d2a2ab55c96fb6f9ef049 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -76,8 +78,8 @@ SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_14.result())
 SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_15.result())
 SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
index 0c2edd99de6c58df3d840e5301d7921671803cea..9a6edb525df71d590434284aad04451867b7a6cb 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -52,7 +54,7 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py
new file mode 100644 (file)
index 0000000..6b86e5d
--- /dev/null
@@ -0,0 +1,51 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(32.87583448774056, -21.97399556638079, -28.86536213173501, -21.97399556638079)
+SketchLine_2 = Sketch_1.addLine(-28.86536213173501, -21.97399556638079, -28.86536213173501, 32.11012709159006)
+SketchLine_3 = Sketch_1.addLine(-28.86536213173501, 32.11012709159006, 32.87583448774056, 32.11012709159006)
+SketchLine_4 = Sketch_1.addLine(32.87583448774056, 32.11012709159006, 32.87583448774056, -21.97399556638079)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 0, False)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_1")])
+model.do()
+model.end()
+
+from GeomAPI import  GeomAPI_Shape
+
+model.testNbResults(Common_1, 0)
+
+assert(model.checkPythonDump())
index 8cb5b9078dfe24dea5bdfae20877faa027dba5c6..6e6060d4ca4261955403277b7c83297c86eba8a0 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -88,9 +90,9 @@ SketchLine_20 = Sketch_2.addLine(62.43123950606181, 3.491482965931855, 86.073169
 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchLine_17.result())
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_19.result())
 model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_9f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_10f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_10r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_9f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_10f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_10r-SketchLine_7f-SketchLine_8f")]
 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
-Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_19f-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_17f-SketchLine_18f-SketchLine_19f-SketchLine_20r")]
+Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_15f-SketchLine_14f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_20f-SketchLine_19f"), model.selection("FACE", "Sketch_2/Face-SketchLine_17f-SketchLine_18f-SketchLine_19f-SketchLine_20r")]
 Shell_2 = model.addShell(Part_1_doc, Shell_2_objects)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_2_2")])
index 5930b955ed324a51a121b7f2073a7c9b04d0c8fd..e552c0000cbe750bd2e131705f54d5fd9685b318 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -58,8 +60,8 @@ SketchLine_10 = Sketch_2.addLine(-61.96570844393754, -12.80210420841683, -27.699
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result())
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result())
 model.do()
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
-Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_9r-SketchLine_10r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")])
+Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_10f-SketchLine_9r-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10r-SketchLine_7r-SketchLine_6r")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index 29b3e910984cba64a5e73751ff914628529a2445..38b7a13cb76f4e7b8449852a04a0b5efc0736488 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -65,8 +67,8 @@ SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result())
 SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result())
 SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f")])
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index 7435166fdabd5c431ded43efd5351d0357175761..6335dcd9d193326b18f6736a4e1f3d40f56fcd3a 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -68,7 +70,7 @@ SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint()
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_15.endPoint())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10r-SketchLine_14r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_15r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_15f-SketchLine_10r-SketchLine_9r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15r-SketchLine_13r-SketchLine_12r-SketchLine_11r")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
index 37bf47049d74489d81d29decf760b37215157cb3..eb65219ecd21dfba5c6edb174bba0b8cec16120f 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index 36cee473df69de1eec2a0edd66042539c65b2fdd..ce3da4b77a8e6caa04efbc618c7dbe273203c86d 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,7 +29,7 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_1.addCircle(-19.01903137581643, 2.528314065029049, 44.55011038017909)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
 Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
 Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Sphere_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
index c9364c2bc541d291c44f4847103afc93b7769af5..b5ca6b4fb7e4cd43e2509f1acc89167b68ffdb5c 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,7 +43,7 @@ SketchLine_5 = Sketch_1.addLine(4.250501002003999, 22.87174348697394, 4.25050100
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
 model.do()
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")])
 Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Sphere_1_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
index cd4fd2adeb6569ba9ae6c56231ec08bde17b0a7a..9cda92d25b78842e942393381a0f0baa6aa52936 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py
new file mode 100644 (file)
index 0000000..69d7416
--- /dev/null
@@ -0,0 +1,52 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(3.367708126821666, -16.14093028927689, 18.51144913400999)
+SketchCircle_2 = Sketch_1.addCircle(37.37680688568888, 37.3768068856889, 21.5270932014419)
+SketchCircle_3 = Sketch_1.addCircle(-3.554756249974806, 10.65828989222541, 8.503732568675463)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1"), model.selection("SOLID", "Compound_1_1_3")], [model.selection("SOLID", "Box_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [14])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [48])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [96])
+model.testResultsVolumes(Common_1, [15007.623169576811051229014992714])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py
new file mode 100644 (file)
index 0000000..42be468
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Partition_1_1_2")], [model.selection("SOLID", "Translation_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [2])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [13])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [56])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [112])
+model.testResultsVolumes(Common_1, [745])
+
+assert(model.checkPythonDump())
index e3389a1178f4980ed55b665ccb16c44bd0a16e20..99b823f5c2f0a8548e5378d569b12e75528f2a30 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -29,8 +31,8 @@ SketchPoint_1 = Sketch_1.addPoint(-28.13426853707415, 23.27655310621242)
 SketchPoint_2 = Sketch_1.addPoint(10.32264529058116, 23.27655310621242)
 SketchPoint_3 = Sketch_1.addPoint(47.56513026052106, 23.27655310621242)
 model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_2_2")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
index c89dda3f3c9fb52759bde8886d311d7d2cae3c90..8e18283a22bb2abcdae84575fe8a44a738705e84 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,16 +30,16 @@ Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchPoint_1 = Sketch_1.addPoint(15.05904629113425, 12.50050543761873)
 SketchPoint_2 = Sketch_1.addPoint(47.25352258215165, 31.63008715695855)
 model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchPoint_3 = Sketch_2.addPoint(15.05904629113425, 12.50050543761873)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_1"), False)
 SketchPoint_4 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchPoint_4.result())
 model.do()
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_3-SketchProjection_1-SketchPoint_4")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_3")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
 Common_2 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_3_1")])
 model.testHaveNamingSubshapes(Common_2, model, Part_1_doc)
 model.do()
index 5d06579a22497b0194fbe1e5c10ea31da8d49ee9..ed878934a11171277f738ecb2f9f9b0e8d071cc8 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -36,30 +38,30 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(),
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_5 = Sketch_2.addLine(-75.23467769579756, 14.76574658950986, -60.62456998069012, -7.998839850308684)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_6 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_6.result())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_5.endPoint())
 SketchLine_7 = Sketch_2.addLine(-60.62456998069012, -7.998839850308684, -47.51524103341781, 13.8500417284785)
 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_8 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result())
 SketchLine_9 = Sketch_2.addLine(35.74952364371219, 12.81217486039606, 47.60078384600371, -9.954719738742909)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
 SketchLine_10 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_10.result())
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_9.endPoint())
 SketchLine_11 = Sketch_2.addLine(47.60078384600371, -9.954719738742909, 64.13719888777418, 18.68151118724985)
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_11.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_12 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_11")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_7")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchLine_11")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
index 0e802ce833f9d46ea53b5b9bab7de9d8086d5f31..3ead1bf4803109b880d07e3e675140306ecadd08 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -33,18 +35,18 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(),
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_3 = Sketch_2.addLine(-15.313984501828, -1.226571041729713, -1.296213364851965, -18.43019925529121)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_4 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result())
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint())
 SketchLine_5 = Sketch_2.addLine(-1.296213364851965, -18.43019925529121, 20.70651786493702, 7.831125115747244)
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_6 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_5")])
 Common_1 = model.addCommon(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
 model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
 model.do()
index 638f279557ec244a12aa07c93a6be96bb12095aa..1ab01779aee108a3031fe4613a44434a7f9f53dc 100644 (file)
@@ -93,14 +93,7 @@ aSession.startOperation()
 extrudedObjects = []
 for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
     # Build sketch faces
-    aSketchResult = eachSketchFeature.firstResult()
-    aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-    origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
-    dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
-    norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
-    aSketchFaces = ShapeList()
-    GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, norm, aSketchEdges, aSketchFaces)
+    aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
     # Create extrusion on them
     anExtrusionFt = aPart.addFeature("Extrusion")
     anExtrusionFt.selectionList("base").append(
index 3df97a6129be61790d7cfa16dfa596645a61c95b..82f6ceff0caba5a211fc42cb4871a75b0cde1d12 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -47,7 +49,7 @@ model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 20)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "Extrusion_2_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_2"), model.selection("COMPSOLID", "Extrusion_2_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 5d20e521f90954557bf81823bbe2ab708ea8ec07..5328ea5bd439b803c1017ad0ae4c100c08b44417 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -32,7 +34,7 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(),
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_2 = Sketch_2.addCircle(32.08143103297851, 1.286314091165838, 40.2404383217231)
-SketchLine_2 = Sketch_2.addLine(-8.153954725266397, 0.6486549270159857, 72.23884334545456, 3.869938036363647)
+SketchLine_2 = Sketch_2.addLine(-8.153954725266397, 0.6486549270159857, 72.23884334545455, 3.869938036363647)
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1])
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1])
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py
new file mode 100644 (file)
index 0000000..6e85899
--- /dev/null
@@ -0,0 +1,45 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 20)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")])
+Box_3 = model.addBox(Part_1_doc, 20, 6, 20)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], -5, 2, -5)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1")], [model.selection("SOLID", "Translation_2_1")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Cut_1, [1400])
index 45674c70092084e9532a8f5a60c192ae6dc3beba..1e361757bbb1deed7c42d53d66a4fdc5c2591602 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,8 +32,8 @@ SketchLine_2 = Sketch_1.addLine(-13.21145377197118, 31.16583469441819, 14.897138
 SketchLine_3 = Sketch_1.addLine(-5.074756009927738, 49.65832960815328, -4.828189411077946, 26.48106931627197)
 SketchLine_4 = Sketch_1.addLine(7.993273729111718, 49.41176300930348, 8.23984032796152, 26.48106931627197)
 model.do()
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 9d51ddc1cd1e0aeb9ee7fecb2ec8009e8d0f738e..0ae1a159fc3dd71829179df5aba424cbe41a70db 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,7 +30,7 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(-28.62948623265935, 53.77363153293705, 40.23707952134417, 53.11775947813702)
 SketchLine_2 = Sketch_1.addLine(-26.66187006825925, 26.22700523133564, 40.89295157614425, 26.22700523133564)
 model.do()
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 10)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_3 = Sketch_2.addLine(14.6580693841429, 60.98822413573743, -10.2650686982584, 60.98822413573743)
index ccd2c2c307d53dc7a049d5159aa531ca6000cbea..b7d16f2e6eb8593795afcd66fffe805f0c23ca04 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,7 +30,7 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(-25.12006861063466, 20.61578044596912, 27.54545454545454, 58.72898799313897)
 SketchLine_2 = Sketch_1.addLine(-19.22984562607204, 56.30360205831907, 22.69468267581474, 22.00171526586621)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_1_2")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 5e8d25fe15cc5986326ad224c0b721f080c93435..91d9df2a4913c347fe72159d9bba598766713202 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,8 +43,8 @@ SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_3.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f_wire")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py
new file mode 100644 (file)
index 0000000..2549803
--- /dev/null
@@ -0,0 +1,36 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Cut_1 = aPart.addFeature("Cut")
+Cut_1.execute()
+assert(Cut_1.error() != "")
+aSession.finishOperation()
index d3c727e67532f17652215063ae17407b4f094f30..daf6e38d3e9f4ed898277692659bd3fbf1004655 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -32,8 +34,8 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_3 = Sketch_2.addCircle(-15.35052744425385, 1.145561749571189, 23.35148318113706)
 SketchCircle_4 = Sketch_2.addCircle(82.70955831903943, -3.436685248713552, 26.06650182177207)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
index f314c44d58f97772a12d5b94523bc7bf3f450580..6cdfcddc7b061ec032d12397f00e918083039ef9 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -25,9 +27,9 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-6.063464837049752, 0.8662092624356818, 32.2304349637617)
+SketchCircle_1 = Sketch_1.addCircle(-6.063464837049752, 0.8662092624356817, 32.2304349637617)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
index bd0752f91b101abb32d68756fd3f8ff824e389fd..07c2e15c7543df14a264bd7d3d8d1dd842ea658c 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,7 +29,7 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_1.addCircle(-8.850181926352695, 1.062021831162306, 46.73432400996293)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_1 = Sketch_2.addLine(64.95207814695526, 55.29739830292169, -8.272875875352462, 55.29739830292169)
 SketchLine_2 = Sketch_2.addLine(-8.272875875352462, 55.29739830292169, -8.272875875352462, -5.036618941767999)
@@ -42,11 +44,11 @@ SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-Group_1_objects = [model.selection("VERTEX", "Cut_1_1/Modified_Edge_divided_2_v_2_1"), model.selection("FACE", "Cut_1_1"), model.selection("FACE", "Cut_1_1"), model.selection("VERTEX", "Cut_1_1/Modified_Face_divided_4_v_3_1")]
+Group_1_objects = [model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Sketch_2/SketchLine_3&Face_1_1/Edge_1"), model.selection("FACE", "Cut_1_1"), model.selection("FACE", "Cut_1_1"), model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Face_1_1/Face_1_1")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-Group_2_objects = [model.selection("FACE", "Cut_1_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_divided_3_e_2_1"), model.selection("VERTEX", "Cut_1_1/Modified_Face_divided_4_v_3_1"), model.selection("FACE", "Cut_1_1")]
+Group_2_objects = [model.selection("FACE", "Cut_1_1"), model.selection("EDGE", "Cut_1_1/Generated_Edge&Sketch_2/SketchLine_3&Face_1_1/Face_1_1"), model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Face_1_1/Face_1_1"), model.selection("FACE", "Cut_1_1")]
 Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
 Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Cut_1_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
index 9bed1636b1d15510bdf09603d14effb736e1b6c6..d7ecbef44ece80cfd7ceebfe5f1571af50968228 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -44,9 +46,9 @@ SketchLine_4 = Sketch_2.addLine(207.6267015097382, 3.521847530670962, 440.264781
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_4.results()[1])
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_4.results()[1])
 model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2f")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_2f")]
 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
-Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_3f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_3r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4r")]
+Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r-SketchLine_3f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r-SketchCircle_3_2r-SketchLine_3r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchCircle_4_2f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4r")]
 Shell_2 = model.addShell(Part_1_doc, Shell_2_objects)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_2_2")])
index 0757d3a9b3515cd85e5d08e16c9ac5d76e6137fd..e09a7619383553322f8ec9fecac1795826714466 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -36,7 +38,7 @@ SketchLine_2 = Sketch_2.addLine(112.0898160449407, 1.460291967886176, -7.7048053
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1])
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1])
 model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f-SketchLine_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1f")]
+Shell_1_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r-SketchCircle_2_2r-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r-SketchLine_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1f")]
 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "Shell_1_2")], [model.selection("SHELL", "Shell_1_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
index 987532453d0d32bcf3a0bb93ad5382f750c7de34..f8803c16bb065254c3e6d24b613c980174864683 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -34,8 +36,8 @@ SketchCircle_4 = Sketch_2.addCircle(78.03127953954764, -3.93858425080257, 22.765
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 602d704bf38384ed0f1b48cf1029bf2e3ce2b44e..36fc87b1af9f225f3d7d554b910f28c1e89cc4e6 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index 681a33893af0a4fee9fdd4a9cdff56f06bd754d2..4cfcc864cd86e00350c6bb3b8dd3a64e0424f448 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,7 @@ SketchPoint_2 = Sketch_1.addPoint(-27.26436963979418, 34.59596483704974)
 SketchPoint_3 = Sketch_1.addPoint(25.43147084048027, 34.59596483704974)
 SketchPoint_4 = Sketch_1.addPoint(54.29962692967411, 33.67951543739281)
 model.do()
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4")]
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_4")]
 Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_2.addLine(42.11715050385933, 45.75316349699826, -43.32915483490565, 45.75316349699826)
@@ -46,7 +48,7 @@ SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 702fa1e9c5669f2ef2e10d75945ace6837197f64..314fb4efaadd1e16c250b033667b7b6f861d7c68 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,9 +32,9 @@ SketchPoint_2 = Sketch_1.addPoint(-27.26436963979418, 34.59596483704974)
 SketchPoint_3 = Sketch_1.addPoint(25.43147084048027, 34.59596483704974)
 SketchPoint_4 = Sketch_1.addPoint(54.29962692967411, 33.67951543739281)
 model.do()
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4")]
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_4")]
 Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index cc53f7725b05b789ef23dd1d55e5274c267ce6aa..5015061a474652e93a7d3acd8f0e3e62577b5b50 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,13 +30,12 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchPoint_1 = Sketch_1.addPoint(0, 50)
 SketchPoint_2 = Sketch_1.addPoint(0, 25)
 model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], [model.selection("VERTEX", "Vertex_2_1")])
 Cut_2 = model.addCut(Part_1_doc, [model.selection("VERTEX", "Vertex_3_1")], [model.selection("VERTEX", "Vertex_4_1")])
-model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.testHaveNamingSubshapes(Cut_2, model, Part_1_doc)
 model.do()
 model.end()
index baf9bc9211db7bfa2e9a7aad13109b0c46a3e78b..8b37dcefceeada48212826160a017c57aad4a25e 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -33,17 +35,17 @@ SketchLine_4 = Sketch_1.addLine(33.43567753001715, 55.95711835334479, 50.7598627
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_5 = Sketch_2.addLine(-67.39108061749573, 66.6981132075472, -42.44425385934821, 35.51457975986279)
-SketchLine_6 = Sketch_2.addLine(-42.44425385934821, 35.51457975986279, -16.1114922813036, 69.1234991423671)
+SketchLine_5 = Sketch_2.addLine(-67.39108061749573, 66.69811320754719, -42.44425385934821, 35.51457975986279)
+SketchLine_6 = Sketch_2.addLine(-42.44425385934821, 35.51457975986279, -16.1114922813036, 69.12349914236709)
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchLine_7 = Sketch_2.addLine(12.64665523156088, 66.6981132075472, 35.16809605488852, 36.5540308747856)
+SketchLine_7 = Sketch_2.addLine(12.64665523156088, 66.69811320754719, 35.16809605488852, 36.5540308747856)
 SketchLine_8 = Sketch_2.addLine(35.16809605488852, 36.5540308747856, 52.49228130360206, 66.35162950257292)
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
index 9739b75fa074b6765c33ac66f7f492d7f592590f..6a9f8d678f30a4497db9ff67d5679c915ceace22 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -34,9 +36,9 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_2.addCircle(3.984562607204112, 58.72898799313897, 38.16357190022508)
 model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 0944b7ea5cb942175ca64deb190e552166a535e6..3b608b1a87094d51d4cc8a5f5cb42b9e5a4117c1 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -34,9 +36,9 @@ SketchLine_4 = Sketch_1.addLine(-58.79960075346089, 25.5711331765356, 3.50824445
 SketchLine_5 = Sketch_1.addLine(3.508244452542322, 60.3323520809374, 63.1926014393454, 22.94764495733547)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
 model.do()
index 449508b034dfe25afd308d53386aacc3a791b734..c181b37443318f5a35ee7f2c2b9970f3a6d0d9dd 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
-"""
-Test case for Boolean Fill feature. Written on High API.
-"""
-from ModelAPI import *
-from GeomAPI import *
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
-# Get session
-aSession = ModelAPI_Session.get()
-
-# Create a part
-aDocument = aSession.activeDocument()
-aSession.startOperation()
-model.addPart(aDocument)
-aDocument = aSession.activeDocument()
-aSession.finishOperation()
-
-# Create a sketch with circle to extrude
-aSession.startOperation()
-anOrigin = GeomAPI_Pnt(0, 0, 0)
-aDirX = GeomAPI_Dir(1, 0, 0)
-aNorm = GeomAPI_Dir(0, 0, 1)
-aCircleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aCircleSketch.addCircle(0, 0, 50)
-aSession.finishOperation()
-
-# Create a sketch with triangle to extrude
-aSession.startOperation()
-aTriangleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aTriangleSketch.addLine(25, 25, 100, 25)
-aTriangleSketch.addLine(100, 25, 60, 75)
-aTriangleSketch.addLine(60, 75, 25, 25)
-aSession.finishOperation()
-
-# Make extrusion on circle (cylinder) and triangle (prism)
-aSession.startOperation()
-anExtrusion = model.addExtrusion(aDocument, aCircleSketch.results() + aTriangleSketch.results(), 100)
-aSession.finishOperation()
-
-# Fill prism with cylinder
-aSession.startOperation()
-aBoolean = model.addFill(aDocument, [anExtrusion.results()[0]], [anExtrusion.results()[1]])
-assert (len(aBoolean.results()) > 0)
-aSession.finishOperation()
-
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 50)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_2.addLine(25, 25, 100, 25)
+SketchLine_2 = Sketch_2.addLine(100, 25, 60, 75)
+SketchLine_3 = Sketch_2.addLine(60, 75, 25, 25)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert (len(Fill_1.results()) > 0)
 assert(model.checkPythonDump())
index eeb22406402956a5b299d6f40175f0e17548a016..ed575a9b7a595a4633231bdfb3b2e2abfcdce56e 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
+from GeomAPI import GeomAPI_Pnt
+
 from salome.shaper import model
 
 model.begin()
@@ -50,22 +54,20 @@ SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/YOZ")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(17.35551764280096, -11.01190794150899, 0))], model.selection(), 100, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-0.3180832609141306, -28.0220443670531, 50.00000000000001))], [model.selection("FACE", "PartSet/YOZ")])
 model.do()
-
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
-
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 model.end()
 
 from GeomAPI import  GeomAPI_Shape
 
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [4])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [4])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [30])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [132])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [264])
-model.testResultsVolumes(Boolean_1, [11003613.329450136050581932067871094])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [4])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [30])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [132])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [264])
+model.testResultsVolumes(Fill_1, [11003613.329450136050581932067871094])
 
 assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py
new file mode 100644 (file)
index 0000000..612fdf4
--- /dev/null
@@ -0,0 +1,36 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Fill_1 = aPart.addFeature("Fill")
+Fill_1.execute()
+assert(Fill_1.error() != "")
+aSession.finishOperation()
index ca8aae00d59c1a1176a1f9e92fca7a11983d007f..5267db93afb906e800b20df4c81b2976cfe2ad8b 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -74,8 +76,8 @@ SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint()
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 50, -20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "Extrusion_2_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_2"), model.selection("COMPSOLID", "Extrusion_1_1")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_2"), model.selection("COMPSOLID", "Extrusion_2_1")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")], True)
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
index a5d5577e062e6a6b3911284400fbdd758acc6eb8..5140319a575af2e9a07f8bfd10f093abd5f9d753 100644 (file)
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py
new file mode 100644 (file)
index 0000000..90d0037
--- /dev/null
@@ -0,0 +1,66 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(52.27216563767099, 0, 18.66006927176168)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(79.68333887668101, 0, 24.16077154338278)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
+SketchLine_2 = Sketch_2.addLine(73.13136007081269, -14.25937060400964, 2.118687665902372, -14.25937060400964)
+SketchLine_3 = Sketch_2.addLine(2.118687665902372, -14.25937060400964, 2.118687665902372, 26.70061277610758)
+SketchLine_4 = Sketch_2.addLine(2.118687665902372, 26.70061277610758, 73.13136007081269, 26.70061277610758)
+SketchLine_5 = Sketch_2.addLine(73.13136007081269, 26.70061277610758, 73.13136007081269, -14.25937060400964)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_2.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_3.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")])
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
+
+model.testNbResults(Fuse_1, 1)
+model.testNbSubResults(Fuse_1, [2])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32])
+model.testResultsVolumes(Fuse_1, [785.398163397447774514148477465])
+
+Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("FACE", "Fuse_1_1_1")])
+assert(Fuse_2.feature().error() != "")
+
+model.end()
index 14a1cb14020efb99c13be5bff30261d55c4e9447..904b8dd3495627e91bbcd50a07e99f61216c8e25 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -32,7 +34,7 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_3 = Sketch_2.addLine(-70.53968253968257, 29.92592592592593, -31.52910052910054, -5.343915343915344)
 SketchLine_4 = Sketch_2.addLine(14.96296296296294, 26.18518518518519, 50.23280423280426, -8.015873015873021)
 model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4")])
index 3a3a78be3a06928a9434df3f5275ab133aeb6a6c..faecb17e3963c5cdfc835e7ba4d4b9e58b0b7706 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,7 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_2 = Sketch_2.addLine(-24.04761904761907, 40.07936507936508, 39.54497354497357, -14.96296296296296)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_2/SketchLine_2")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_1")])
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py
new file mode 100644 (file)
index 0000000..1801cab
--- /dev/null
@@ -0,0 +1,52 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "PartSet/XOZ")])
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [model.selection("SOLID", "Partition_1_1_2")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Fuse_1 = Part_1_doc.addFeature("Fuse")
+Fuse_1.execute()
+assert(Fuse_1.error() != "")
+aSession.finishOperation()
index d9cebddfda8e2d8b43e6f1cbd7032ed7fedb9dcd..33a3ff96fe1e0f932f1eeb856b1f7e60484c8169 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -32,9 +34,9 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_3 = Sketch_2.addCircle(-36.12101408450705, -7.148950704225357, 25.24032590912034)
 SketchCircle_4 = Sketch_2.addCircle(51.92395774647893, -12.41659859154929, 31.3630728131964)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
 Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r")])
 Face_4 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
index a7f012ab28f7540d79473f817dc9aedafe20ed85..c9b803e505ef62b1757aad0f187a6f693b13ee61 100644 (file)
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -31,8 +32,8 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_2 = Sketch_2.addCircle(22.86792452830187, 26.50600343053173, 30.90704565816075)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], True)
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
index 6065be8052ccf087b060ece5a64f4173a27c7f35..b1ab2c6ae992050c1f4e13c58d226e809b93d550 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index df924e429125c32bf839796acd4af9c28af0ddc5..79d4d308df9932a6c3afbcc5c774daba75f29b81 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -72,7 +74,7 @@ SketchLine_20 = Sketch_2.addLine(31.63598289786226, 11.9441976247031, 52.2962166
 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint())
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint())
 model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16r-SketchLine_17r-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_5r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_10r-SketchLine_6r"), model.selection("FACE", "Sketch_1/Face-SketchLine_10f-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15f-SketchLine_12r-SketchLine_11r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15r-SketchLine_14r-SketchLine_13r"), model.selection("FACE", "Sketch_2/Face-SketchLine_20f-SketchLine_17r-SketchLine_16r"), model.selection("FACE", "Sketch_2/Face-SketchLine_20r-SketchLine_19r-SketchLine_18r")]
 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_3"), model.selection("SHELL", "Shell_1_4")])
index 49575672344c269228314f494e49db782cafc762..b612327c6e6af917e10f263a7a1e0b61c8cd10ec 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -50,7 +52,7 @@ SketchLine_10 = Sketch_2.addLine(-84.57783182897859, 11.29856532066509, -60.6894
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint())
 model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9r-SketchLine_10r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_5r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchLine_10f-SketchLine_7r-SketchLine_6r"), model.selection("FACE", "Sketch_2/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r")]
 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")], True)
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
index e985d287609861d47fb35f6b8edf1a84d9403bda..7f7dba73e04b66d71c8e9d3bb8c2bc5b2807a582 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
index 3cd98f2ef0ae29d1b054f6402d22b3d0ec851437..c5fdfc25a5f072bde0487e37b3aabaedeb708b12 100644 (file)
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -79,7 +80,7 @@ SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_15.result())
 SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result())
 model.do()
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 40, -20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
index 809ff19f6d320b684da721bbb7820cf33da292d8..51f95d5694b2aaf4af09f16e85744c18933d8cc1 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -38,7 +40,7 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_5 = Sketch_2.addLine(-38.01624011480907, 11.11021000825241, -18.03083750064881, 11.11021000825241)
 SketchLine_6 = Sketch_2.addLine(-18.03083750064881, 11.11021000825241, -18.03083750064881, 22.05701811772883)
@@ -53,7 +55,7 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, -20)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire")], model.selection(), 30, -20)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
index 3a497f317e1c71081223c6cc5eaac070362b685a..23e9bf54c5ba630287e0c95243181205faf7a7e2 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,7 @@ SketchPoint_2 = Sketch_1.addPoint(18.16931216931219, 17.1005291005291)
 SketchPoint_3 = Sketch_1.addPoint(-19.77248677248678, -16.03174603174603)
 SketchPoint_4 = Sketch_1.addPoint(21.37566137566138, -16.03174603174603)
 model.do()
-Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")]
+Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_4"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")]
 Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects)
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4")])
index 70ce3aad8eaa6218ec7de2287f71696807b528fc..c246d7f395b2573f873670dc94a266209a4dbba2 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,7 +30,7 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchPoint_1 = Sketch_1.addPoint(-6.078627161807992, -0.4501231771005025)
 SketchPoint_2 = Sketch_1.addPoint(7.482208269631659, 3.929326826374309)
 model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
index b7473f690e96961f63ae4335add40a43b7ee0fa2..3a27c8a0c3b9ad175cbdffe757e419635dce1ac6 100644 (file)
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -41,10 +42,10 @@ SketchLine_7 = Sketch_2.addLine(13.49417304964538, 51.08508368794326, 35.9844614
 SketchLine_8 = Sketch_2.addLine(35.98446146572105, 27.95221560283687, 53.3341125295508, 47.87218534278959)
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")])
 Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
 Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
index 0cb778f8e526cdb850f8aa13304bb305308b1cbe..c4261102f961724e12cc56d5a2b67a86c02af0d8 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -34,8 +36,8 @@ SketchLine_3 = Sketch_2.addLine(-23.92129524945932, 7.630068312327553, -4.124361
 SketchLine_4 = Sketch_2.addLine(-4.124361249906777, 34.02598031173091, 14.43526437467373, 6.392759937355498)
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")])
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
 model.do()
index 4be9090f0e551b493dc458e67340fb9c5939cab5..7cce18735a5e67f984c4b9fbe945623937316514 100644 (file)
@@ -84,18 +84,11 @@ aSession.startOperation()
 extrudedObjects = []
 for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
     # Build sketch faces
-    aSketchResult = eachSketchFeature.firstResult()
-    aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-    origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
-    dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
-    norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
-    aSketchFaces = ShapeList()
-    GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, norm, aSketchEdges, aSketchFaces)
+    aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
     # Create extrusion on them
     anExtrusionFt = aPart.addFeature("Extrusion")
     anExtrusionFt.selectionList("base").append(
-        aSketchResult, aSketchFaces[0])
+        aSketchResult, aSketchResult.face(0))
     anExtrusionFt.string("CreationMethod").setValue("BySizes")
     anExtrusionFt.real("from_size").setValue(0)
     anExtrusionFt.real("to_size").setValue(50)
diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py
new file mode 100644 (file)
index 0000000..4819afe
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-0.820365148699405, 7.40718257641344, 6.028904154999336)
+SketchCircle_2 = Sketch_1.addCircle(10.62009910116713, 13.94078752172051, 10.99163472554975)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Box_1_1")])
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Smash_1, 1)
+model.testNbSubResults(Smash_1, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [28])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [120])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [240])
+model.testResultsVolumes(Smash_1, [4980.404017506245509139262139797])
diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py
new file mode 100644 (file)
index 0000000..519b542
--- /dev/null
@@ -0,0 +1,71 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")], [model.selection("SOLID", "Cylinder_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")])
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Cylinder_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(5, -6, 7)
+SketchCircle_2 = Sketch_1.addCircle(14, 0, 8)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("SOLID", "Extrusion_1_1_2")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face")])
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_2_1")], [model.selection("FACE", "Face_2_2")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Smash_1 = Part_1_doc.addFeature("Smash")
+Smash_1.execute()
+assert(Smash_1.error() != "")
+aSession.finishOperation()
index 06198375b931082a2f44d06e9b4fd903b0bbe182..56c4b9a9f6a8df5400828c51d21de49d712f2b02 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,7 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_2 = Sketch_2.addCircle(12.30017152658664, 14.37907375643225, 29.61574408620473)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")])
 Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_1_2")])
 model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
 model.do()
diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py
new file mode 100644 (file)
index 0000000..9f2ee79
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Partition_1_1_2")], [model.selection("SOLID", "Translation_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Smash_1, 1)
+model.testNbSubResults(Smash_1, [3])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [28])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [130])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [260])
+model.testResultsVolumes(Smash_1, [1657])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py
new file mode 100644 (file)
index 0000000..17c34da
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/YOZ"), model.selection("SOLID", "Cylinder_1_1")])
+
+Cut_1 = model.addCut(Part_1_doc, [], [])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [model.selection("SOLID", "Partition_1_1_2")])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+model.end()
index 47caabb1d0e461c8a09d5a53afdb49a66462d149..1df2653bc57df55ad02a6fa25f2a8c56a3540986 100644 (file)
@@ -64,16 +64,8 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
index 5e44cac127913e038df1dc283cb72ffa9e22fb89..158c60feb60d3c4be002b64078e0667badf93872 100644 (file)
@@ -85,24 +85,16 @@ aSession.finishOperation()
 #=========================================================================
 # Make extrusion on circle
 #=========================================================================
-# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+# Build face from sketcher results
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -147,8 +139,7 @@ aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 anExtrusionFt.real("to_size").setValue(0) #TODO: remove
 anExtrusionFt.real("from_size").setValue(0) #TODO: remove
@@ -213,20 +204,13 @@ aLineEEndPoint.setValue(0., -50.)
 aSession.finishOperation()
 
 # Extrude clamp
-aClampSketchResult = aClampSketchFeature.firstResult()
-aClampSketchEdges = modelAPI_ResultConstruction(aClampSketchResult).shape()
-origin = geomDataAPI_Point(aClampSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aClampSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aClampSketchFeature.attribute("Norm")).dir()
-aClampSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aClampSketchEdges, aClampSketchFaces)
+aClampSketchResult = modelAPI_ResultConstruction(aClampSketchFeature.firstResult())
 aSession.startOperation()
 aClampExtrusionFt = aPart.addFeature("Extrusion")
 assert (aClampExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 aClampExtrusionFt.selectionList("base").append(
-    aClampSketchResult, aClampSketchFaces[0])
+    aClampSketchResult, aClampSketchResult.face(0))
 aClampExtrusionFt.string("CreationMethod").setValue("BySizes")
 aClampExtrusionFt.real("to_size").setValue(70)
 aClampExtrusionFt.real("from_size").setValue(0)
@@ -245,14 +229,13 @@ aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 anExtrusionFt.real("to_size").setValue(0) #TODO: remove
 anExtrusionFt.real("from_size").setValue(0) #TODO: remove
-anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_3")
+anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/Generated_Face&Sketch_2/SketchLine_3")
 anExtrusionFt.real("to_offset").setValue(0)
-anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_4")
+anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face&Sketch_2/SketchLine_4")
 anExtrusionFt.real("from_offset").setValue(0)
 anExtrusionFt.execute()
 aSession.finishOperation()
index af4c4917953c97baa9f766964d878b932b5692e8..05a81bef328bdddfb9e95fd582518838a37ee69d 100644 (file)
@@ -62,23 +62,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -108,7 +100,7 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
 aSession.startOperation()
 aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
 anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
index a8c6cb8c398e61fb49590c41462175a4386fb53a..0ad73b99b3eca578645799e40ade96acbf9ebee8 100644 (file)
@@ -62,23 +62,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -108,7 +100,7 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
 aSession.startOperation()
 aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
 anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py b/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py
new file mode 100644 (file)
index 0000000..00819d0
--- /dev/null
@@ -0,0 +1,53 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 0, 0, 0)
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection(), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(20, 20, 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection("EDGE", "PartSet/OX"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchArc_1 = Sketch_2.addArc(25, 10, 40, 10, 25, 25, False)
+model.do()
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+model.end()
diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ZeroOffsetError.py b/src/FeaturesPlugin/Test/TestExtrusion_ZeroOffsetError.py
new file mode 100644 (file)
index 0000000..858f147
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(9.631110499908317, -35.9437937189679, 36.19447160731126)
+model.do()
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, -10)
+assert(Extrusion_1.feature().error() != "")
+
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(114.4867836253828, -21.50233830122853, 11.10986684682035)
+SketchCircle_3 = Sketch_2.addCircle(113.4180342136906, 1.426992627069481, 10.29495051811322)
+model.do()
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")])
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 10, False)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
+SketchCircle_4 = Sketch_3.addCircle(91.42492988686666, -20.30106607931821, 6.749165188215104)
+SketchCircle_5 = Sketch_3.addCircle(88.32466240656791, 2.196618803039243, 8.273170230715275)
+model.do()
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")])
+
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), model.selection("COMPOUND", "Compound_1_1"), 0, model.selection("COMPOUND", "Compound_2_1"), 0)
+assert(Extrusion_2.feature().error() == "")
+
+model.end()
index 832475bb2a59621c3e704aaae1a977ce094139f7..e53cbae5687cbfd5e28a9696e9b404b3f85b8890 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -50,13 +51,13 @@ SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
-model.checkResult(Boolean_2, model, 1, [6], [0], [6], [22], [44])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [6], [0], [6], [22], [44])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
 
 model.end()
 
diff --git a/src/FeaturesPlugin/Test/TestFillCompsolidPlane.py b/src/FeaturesPlugin/Test/TestFillCompsolidPlane.py
new file mode 100644 (file)
index 0000000..5558109
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(11.92861402549826, 0, 16.05621803603458)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(37.8779560884558, 0, 17.74637067763095)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/XOZ")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [25])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(Fill_1, [16831.622023411000554915517568588])
index 0c92a1422f1af360d886783fb88797f582027ee6..452a91aa1fb0058044b445ea619b564ab3a948d8 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -30,18 +31,18 @@ SketchLine_1 = Sketch_1.addLine(-43.24383164005806, 13.92597968069667, 63.179970
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_2 = Sketch_2.addLine(-21.12944291883177, 24.09981691608177, 39.13933236574746, 51.82677414066782)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_3 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_3.result())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[3],[0],[0],[3],[6])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[3],[0],[0],[3],[6])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 5b5ee1cc4e9c9e4a43153aaee08e8b0d839fda0e..9e4c8dca72893f606a1279a9b3c1b3333ef0648a 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -31,13 +32,13 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchLine_2 = Sketch_2.addLine(-42.46271611030479, 53.71965718432511, 14.83075791001449, -51.73354862119014)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[2],[0],[0],[2],[4])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[0],[2],[4])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 49a082413e58f87626cf1042dea8daff7a2f9969..fda6db633661a2466cb4c0cadf7fe90c512defa1 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -35,16 +36,17 @@ SketchLine_4 = Sketch_1.addLine(13.30716777939044, -81.12733381712628, -65.15998
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchLine_5 = Sketch_2.addLine(-53.77011318694006, -47.84888937635935, 60.89888292381829, 36.13719175945)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index cd7be482d1baed8df930268df2bdfe1be4f89cf3..c0b99730abfe32264eb823ee5fe24a80f0e31131 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -40,19 +41,19 @@ SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.770542089
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_3 = Sketch_2.addLine(-64.49168769733997, 17.16789081864163, 146.7677170722727, 22.9901626941168)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SHELL", "Shell_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 943d4e5a797599e3c818f200ead43ba6c059171b..9cc4c12e7e4cd333352ca6b0234d20291ea2400b 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -28,19 +29,19 @@ Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
 SketchLine_1 = Sketch_1.addLine(4, 10, 7, 0)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), False)
 SketchLine_2 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), False)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), False)
 SketchLine_3 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Box_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [1], [2])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [1], [2])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 5756635e1669a9139546d6429922397518def96c..630317d66a8357c8d931b025e321f446b2bc4201 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -36,12 +37,12 @@ SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Cone_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Cone_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 33ba672dca3785d134b3295848202036ba596e2b..ce2e768f05246b761255a93d8502efd678b0c7a1 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -27,7 +28,7 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-Point_1 = model.addPoint(Part_1_doc, 10, 10, 0)
+Point_2 = model.addPoint(Part_1_doc, 10, 10, 0)
 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(-27.61369370623992, 41.69872643310781, 64.30052615729069, -35.76145957046036)
@@ -35,12 +36,11 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Point_1")
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchAPI_Point(SketchPoint_1).coordinates())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
 model.do()
-
-model.checkResult(Boolean_1,model,1,[2],[0],[0],[2],[4])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[0],[2],[4])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index ead4aeb8880ad2e4f42f5651e6f10cb7cd40462a..d4ee8813f9a7f4cd614cda098033f214fdf3a91c 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -38,13 +39,14 @@ SketchLine_5 = Sketch_2.addLine(55.26415094339622, -34.15529753265602, -40.60522
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("WIRE", "Wire_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 5bcc0602a345edd7505954f4c2e5f48c2364cf68..a16030c88fbc30926c98ce85a3b8d771de6a13f4 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -35,16 +36,17 @@ SketchLine_4 = Sketch_1.addLine(13.30716777939044, -81.12733381712628, -65.15998
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchLine_5 = Sketch_2.addLine(-53.77011318694006, -47.84888937635935, 60.89888292381829, 36.13719175945)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[2],[0],[2],[8],[16])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[2],[8],[16])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 44bd6384aef149cdd56713b5b6a0d0f0a4714d35..e28c492c66384e29d57ed76fd006ee1563dab53d 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -35,19 +36,20 @@ SketchLine_3 = Sketch_1.addLine(-34.74165457184325, -28.87808417997097, -49.4005
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint())
 model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1r-SketchLine_2r-SketchLine_3r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchLine_4 = Sketch_2.addLine(-17.59187701681758, -17.53169787967194, -23.97073271029336, 4.338664497959301)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
 SketchLine_5 = SketchProjection_1.createdFeature()
 SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_4.result(), SketchLine_5.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[5],[10])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[5],[10])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 2d5182fd204a13322b131377ea119d999bf35bea..e088a9137605cc23e39f154b542a8dbe8f8bac9e 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -42,13 +43,14 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_7 = Sketch_2.addLine(24.33758278426026, -52.48127186534471, 29.40566289183227, 59.45054433956496)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[6],[13])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[6],[13])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index d7ce14972ca30eae6ab0e599af24917134607212..ac67d760073e6b4e78047c1c53d0e2a5f14c3dc7 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,9 +18,9 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
-from SketchAPI import *
 
 model.begin()
 partSet = model.moduleDocument()
@@ -42,26 +42,26 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_4 = Sketch_2.addLine(31.79164821526215, 49.99496405877289, 8.200436015051352, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
 SketchPoint_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
 SketchLine_5 = Sketch_2.addLine(8.200436015051352, 0, 27.24680168984479, -49.85269382803262)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-021, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
+SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-21, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_2.center())
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "R")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchArc_2_2f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_2_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchArc_2_2f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_2_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [2], [0], [2], [6], [12])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [2], [0], [2], [6], [12])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 068e4aebee22145353def0256914e2a868d6c4ec..da44bcf24b1b846389f25d6d20d8030b603b6da6 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -97,15 +98,15 @@ SketchLine_15.result().setName("SketchLine_16")
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint())
 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_3_1")], [model.selection("SHELL", "Shell_1_1")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_3_1")], [model.selection("SHELL", "Shell_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [3], [0], [3], [14], [28])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [3], [14], [28])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index a99fa556f2ce0c71ca7e790abe6ec5218fd50e97..f7e144562fb3db0eb1ed20514b6c39ff7f63394f 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -49,12 +50,12 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), 5)
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Box_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [4], [0], [4], [15], [30])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [4], [0], [4], [15], [30])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 21b11a3d13adeb305ba61a639a055a110c303f74..23a1a71db165101243370039329c45bb41959e02 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -40,13 +41,14 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[4],[9])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[4],[9])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index b38a7a3dee3b41877efcc9c9745b43d644013aed..6daa0c42ebe7d6f800aab081c0682cda421adec1 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -45,19 +46,19 @@ SketchLine_5 = Sketch_2.addLine(-18.23994072168525, 7.835320880296757, 13.893416
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchLine_6 = Sketch_2.addLine(13.89341696052619, 27.33089138697832, 39.39985877388298, 9.747860956493145)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchLine_7 = Sketch_2.addLine(39.39985877388298, 9.747860956493145, 38.20105433548567, 71.93732104572752)
+SketchLine_7 = Sketch_2.addLine(39.39985877388298, 9.747860956493145, 38.20105433548567, 71.93732104572751)
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
-SketchLine_8 = Sketch_2.addLine(38.20105433548567, 71.93732104572752, -42.38833891077762, 73.71572760627062)
+SketchLine_8 = Sketch_2.addLine(38.20105433548567, 71.93732104572751, -42.38833891077762, 73.71572760627062)
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_8.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("WIRE", "Wire_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [5], [0], [5], [21], [42])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [5], [0], [5], [21], [42])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index a0bd627ba39a29984d4a83cbfddad0db769d1425..a1e1043fdd3966d6fc234e462b68959f30fb8a52 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -40,14 +41,14 @@ SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.770542089
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "PartSet/XOZ")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "PartSet/XOZ")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[3],[12],[24])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[3],[12],[24])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 20f0ed60fbafcdbe245697ba83fea5a2942947df..a81a80960ed5aaa36ba23bbb1c2e5b7bfd8b5a7c 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -40,19 +41,19 @@ SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.770542089
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_3 = Sketch_2.addLine(-64.49168769733997, 17.16789081864163, 146.7677170722727, 22.9901626941168)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[2],[8],[18])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[2],[8],[18])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 0a7242dfc0b53b26d2c7fdf8db68c765a66818e9..6e1cd569d7036d1e2268fc8f589349a90c62e219 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -73,7 +74,9 @@ SketchLine_10 = Sketch_2.addLine(64.99999999999999, 12.18920647716607, 50, 12.18
 SketchLine_10.setName("SketchLine_12")
 SketchLine_10.result().setName("SketchLine_12")
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
 SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L", True)
 SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_9.endPoint(), SketchLine_7.result(), "L/2", True)
 SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_10.result())
@@ -86,20 +89,22 @@ SketchLine_12.setName("SketchLine_14")
 SketchLine_12.result().setName("SketchLine_14")
 SketchLine_11.setName("SketchLine_13")
 SketchLine_11.result().setName("SketchLine_13")
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12")
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [4], [13], [26])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [4], [13], [26])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 1363f2e95dd67a7db495bcf3a09b8012cec048f5..e5a81e896f79eb2aee0dea5b5dbaece9633853d3 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -33,10 +34,10 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(-10, 32.04672553984553, 15.61552812808831, 47.66225366793383)
 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_2 = SketchProjection_1.createdFeature()
-SketchLine_3 = Sketch_1.addLine(15.61552812808831, 47.66225366793383, -4.988916520257207e-021, 73.27778179602213)
+SketchLine_3 = Sketch_1.addLine(15.61552812808831, 47.66225366793383, -4.988916520257207e-21, 73.27778179602213)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result())
-SketchLine_4 = Sketch_1.addLine(-4.988916520257207e-021, 73.27778179602213, -25.61552812810082, 57.66225366792627)
+SketchLine_4 = Sketch_1.addLine(-4.988916520257207e-21, 73.27778179602213, -25.61552812810082, 57.66225366792627)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 SketchLine_5 = Sketch_1.addLine(-25.61552812810082, 57.66225366792627, -10, 32.04672553984553)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
@@ -64,7 +65,7 @@ SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(),
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint())
 SketchLine_11 = Sketch_2.addLine(50, 15.56025031353752, 73.27778179602213, 0)
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
 SketchLine_12 = Sketch_2.addLine(73.27778179602213, 0, 50, -15.54016280334104)
@@ -73,17 +74,17 @@ SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.endPoint(),
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_7.result(), "D", True)
 SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7r-SketchLine_8r-SketchLine_10r")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7f-SketchLine_11r-SketchLine_12r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_10r-SketchLine_8r-SketchLine_7r_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_12r-SketchLine_11r_wire")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
 Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SHELL", "Shell_2_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SHELL", "Shell_2_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [4], [15], [30])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [4], [15], [30])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 1b78fe4c15b0d9a8f0d3cd94d6ad1a7609907cc4..15deb078a6b1a529724663df297672205c6a52bb 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -50,14 +51,14 @@ SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
-model.checkResult(Boolean_2, model, 1, [0], [0], [6], [22], [44])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [0], [0], [6], [22], [44])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
 
 model.end()
 
index 2fb840f5c256e78aa076aba293e28461d9c210c6..0303d771e5bdb5623e707e8ae3562d16c43901e9 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -36,16 +37,16 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
 Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
 Point_2 = model.addPoint(Part_1_doc, 0, 0, 10)
 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[2],[9],[18])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[2],[9],[18])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 1dc51bd3de8b8951f3fce7b0df03f58f51bbf2c8..9c3362ba50eaf741352d4adbfd3b10c23d2446da 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -71,15 +72,16 @@ SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/O
 SketchPoint_1 = SketchProjection_2.createdFeature()
 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), "L", True)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchLine_10")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [8], [30], [60])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [8], [30], [60])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 981f18b9b1c43bb331b4b89f481d7007448f4462..18507904da27a28d4200269e6d0483b3a77a717d 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -26,11 +27,11 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[4],[4],[20],[72],[144])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[4],[4],[20],[72],[144])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index d486e1856193f198a81becb987c7a165d80a537b..cbc2df7646bf1aa024da4b70b8b5eaf487367bcd 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -34,14 +35,14 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"),
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
@@ -50,13 +51,13 @@ SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
 model.do()
 
-model.checkResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [2], [2], [14], [60], [120])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
 
 model.end()
 
index d6de9e4cf79ec6565d2d1c4668824f979e1b7f4f..ed2dc543f79d4c62befa4d942cdf46735693d817 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -34,14 +35,14 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"),
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
@@ -50,15 +51,15 @@ SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
 model.do()
 
-model.checkResult(Boolean_2, model, 1, [4], [4], [30], [132], [264])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [4], [4], [30], [132], [264])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
 
 model.end()
 
index 25190b5fd62fe2b784659745fa101ad32296432a..813b114f87da7969a3a16d962f9f2acff4665fbb 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -28,19 +29,19 @@ Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
 SketchLine_1 = Sketch_1.addLine(4, 10, 7, 0)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), False)
 SketchLine_2 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), False)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), False)
 SketchLine_3 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [1], [7], [30], [60])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [1], [7], [30], [60])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 54e07fa92f6bd637f638092a7b8d2b9601408cc5..b6ac81d72c94a75232415e534072875c50d6c5c6 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -34,14 +35,14 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"),
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
@@ -49,12 +50,12 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "Shift/3")
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Face_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [2], [2], [12], [48], [96])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [2], [2], [12], [48], [96])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 174e8db41fd3787b6a99c8a97968d8d05bf7bd6e..283100fc9adc09c7044cc2446e5f97e0bf98e2be 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -34,14 +35,14 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"),
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
@@ -50,14 +51,14 @@ SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
 model.do()
 
-model.checkResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [2], [2], [14], [60], [120])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
 
 model.end()
 
index eeda3945e1ad2ad934f1791a0a876520d9d6603d..4305d7df35f4bc9d47d6162a7cc65b3199974e5d 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -38,13 +39,14 @@ SketchLine_5 = Sketch_2.addLine(55.26415094339622, -34.15529753265602, -40.60522
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("EDGE", "Edge_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[0],[6],[12])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[0],[6],[12])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index e63cac9f591ae9750df04c90c19b24ebcdcef0d3..2a4ee39fa616fec64420e294db8f1e7947df910b 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -41,7 +42,7 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_4 = Sketch_2.addLine(29.74624907439609, 30.07487215963349, 31.08202242513997, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
 SketchPoint_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
 SketchLine_5 = Sketch_2.addLine(31.08202242513997, 0, 45.45797599933665, 0)
@@ -57,13 +58,13 @@ SketchLine_9 = Sketch_2.addLine(70.40999925541598, 30.039147749218, 29.746249074
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_9f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [6], [12])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [6], [12])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index d5b99ecdc9fdb3de691803e32339fe4f9a505610..840818c89dd0c3133c5a9440245aa8cf7701f3b4 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -97,15 +98,15 @@ SketchLine_15.result().setName("SketchLine_16")
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint())
 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SHELL", "Shell_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [10], [20])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [10], [20])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index d0fd12e4e69890edc0eda5bb63ed19c0fe265c55..35dd3401a86e1a6250ab7b5c749ba114a5739324 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -49,12 +50,12 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), 5)
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SOLID", "Box_1_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [9], [18])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [9], [18])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index 01c3c349a917ea8dc05c560c00e346570698675e..677cd5b94fc6aa86cfd2d020ed80708fd33de1ec 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from SketchAPI import *
 
@@ -40,12 +41,13 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(),
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
 model.do()
 
-model.checkResult(Boolean_1,model,1,[0],[0],[0],[4],[8])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[0],[4],[8])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
 
 model.end()
 
index 9540742cff0f7b42a8f7eebe7a28093ee06f7488..b7e49aa20bc8f4bee19b0834dedec9ac74a55b2e 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -41,26 +42,26 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_4 = Sketch_2.addLine(31.79164821526215, 49.99496405877289, 8.200436015051352, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
 SketchPoint_1 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
 SketchLine_5 = Sketch_2.addLine(8.200436015051352, 0, 27.24680168984479, -49.85269382803262)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-021, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
+SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-21, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_2.center())
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "R")
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchArc_2_2f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchArc_2_2f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
 model.do()
 
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [4], [8])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [4], [8])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
 
 model.end()
 
index a641328bf4764a8f7f8b937b673cd251c4e3702a..05d41e7c54a675ed57fa7093034eebcf07dbfbfd 100644 (file)
@@ -52,7 +52,7 @@ aSession.finishOperation()
 aSession.startOperation()
 aPoint = aPart.addFeature("Point")
 aPoint.string("creation_method").setValue("by_xyz")
-geomDataAPI_Point(aFeature.attribute("point3d")).setValue(20, 5, 0)
+geomDataAPI_Point(aPoint.attribute("point3d")).setValue(20, 5, 0)
 aSession.finishOperation()
 
 aSession.startOperation()
@@ -71,7 +71,7 @@ aSession.startOperation()
 aFillet1 = aPart.addFeature("Fillet")
 aFillet1.string("creation_method").setValue("fixed_radius")
 anObjects = aFillet1.selectionList("main_objects")
-anObjects.append("Box_1_1/Left&Box_1_1/Top", "edge")
+anObjects.append("[Box_1_1/Left][Box_1_1/Top]", "edge")
 aFillet1.real("radius1").setValue(3)
 aSession.finishOperation()
 assert(aFillet1.error() == ""), "FAILED: Fillet reports error \"{}\"".format(aFillet1.error())
@@ -94,7 +94,7 @@ aFillet2 = aPart.addFeature("Fillet")
 aFillet2.string("creation_method").setValue("fixed_radius")
 anObjects = aFillet2.selectionList("main_objects")
 anObjects.append("Cylinder_1_1/Face_2", "face")
-anObjects.append("_Box_1_1/Right", "face")
+anObjects.append("Box_1_1/Right", "face")
 aFillet2.real("radius1").setValue(2)
 aSession.finishOperation()
 assert(aFillet2.error() != ""), "FAILED: Fillet does not report error"
diff --git a/src/FeaturesPlugin/Test/TestFillet1.py b/src/FeaturesPlugin/Test/TestFillet1.py
new file mode 100644 (file)
index 0000000..9c5bf93
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Box_1")], 2)
+assert(Fillet_1.feature().error() == "")
+
+model.testNbResults(Fillet_1, 1)
+model.testNbSubResults(Fillet_1, [0])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [26])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [104])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [208])
+model.testResultsVolumes(Fillet_1, [907.704992710141368661425076425])
+
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(20, -15, 5)
+SketchCircle_2 = Sketch_1.addCircle(30, 10, 3)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Extrusion_1")], 2)
+assert(Fillet_2.feature().error() != "")
+
+model.end()
diff --git a/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py b/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py
new file mode 100644 (file)
index 0000000..92dfacd
--- /dev/null
@@ -0,0 +1,52 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-30, 5, 15)
+SketchLine_1 = Sketch_1.addLine(60, -30, 15, -30)
+SketchLine_2 = Sketch_1.addLine(15, -30, 15, 15)
+SketchLine_3 = Sketch_1.addLine(15, 15, 60, 15)
+SketchLine_4 = Sketch_1.addLine(60, 15, 60, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")], 2)
+assert(Fillet_1.feature().error() != "")
+Part_1_doc.removeFeature(Fillet_1.feature())
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_2/To_Face")], 2)
+assert(Fillet_1.feature().error() != "")
+Part_1_doc.removeFeature(Fillet_1.feature())
+
+model.end()
index 810d548dbd7149384efd1924c50c4bdaf06e582f..84c6a3c4533c2a1f88a2056cdab5827962c02ede 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 # Create document
@@ -33,7 +35,7 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 10)
 
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Translation_1_1/Translated_Face_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Top")])
 model.do()
 
 model.checkResult(Shell_1, model, 1, [0], [0], [2], [8], [16])
index ea47ba331366afb14fc08647e9e4c750ba191993..df49fea3003e66c90661f4281ad2882e8001aa9d 100644 (file)
@@ -62,23 +62,15 @@ aSession.finishOperation()
 # Make extrusion on circle 1
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -116,23 +108,15 @@ aSession.finishOperation()
 # Make extrusion on circle 2
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
diff --git a/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py b/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py
new file mode 100644 (file)
index 0000000..74b8b25
--- /dev/null
@@ -0,0 +1,35 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(10, -20, 15)
+model.do()
+
+Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+assert(Intersection_1.feature().error() != "")
+Part_1_doc.removeFeature(Intersection_1.feature())
+
+model.end()
index bec25e1c22ec4a1e544afc74a0a15edb51fb6a5c..ec0b9d44498c66f85e8a3441e1fa82e65e1f3905 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -28,9 +30,9 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-ParamR = model.addParameter(Part_1_doc, "R", "50")
-ParamL = model.addParameter(Part_1_doc, "L", "40")
-ParamH = model.addParameter(Part_1_doc, "H", "20")
+model.addParameter(Part_1_doc, "R", "50")
+model.addParameter(Part_1_doc, "L", "40")
+model.addParameter(Part_1_doc, "H", "20")
 Point_2 = model.addPoint(Part_1_doc, 0, 100, 100)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
@@ -59,8 +61,8 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), "H")
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 SketchLine_7 = Sketch_2.addLine(119.1454520140253, 130.0744845530344, 10, 0)
 SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
 SketchLine_8 = SketchProjection_3.createdFeature()
@@ -72,14 +74,14 @@ model.do()
 TOLERANCE = 1.e-6
 
 # reference data
-REF_DATA = [("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchLine_6", [90]),
-            ("Extrusion_1_1/Generated_Face_5", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [45]),
-            ("Sketch_1/Edge-SketchCircle_1_2", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [0]),
-            ("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchCircle_1_2", []),
-            ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", []),
-            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_4", [130]),
-            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_1", [40]),
-            ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [121.21205374, 84.80231126])
+REF_DATA = [("Sketch_1/SketchLine_3", "Sketch_1/SketchLine_6", [90]),
+            ("([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [45]),
+            ("Sketch_1/SketchCircle_1_2", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [0]),
+            ("Sketch_1/SketchLine_3", "Sketch_1/SketchCircle_1_2", []),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", []),
+            ("Sketch_2/SketchLine_7", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", [130]),
+            ("Sketch_2/SketchLine_7", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", [40]),
+            ("Sketch_2/SketchLine_7", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [121.21205374, 84.80231126])
            ]
 
 for ref in REF_DATA:
@@ -89,7 +91,7 @@ for ref in REF_DATA:
         assert(math.fabs(a - r) < TOLERANCE), "Angle {} differs from expected value {}".format(a, r)
 
 # select incorrect data
-angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"))
+angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("EDGE", "Sketch_2/SketchLine_7"))
 assert(angle.size() == 0)
 
 model.end()
index c3f7fcc8e9aa553cf4a48b7985e03e3113ad4118..1e4fc4034961a96356638cb7321412da8ac59525 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -55,43 +57,43 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 100, 0)
 model.do()
 
 TOLERANCE = 1.e-6
 
 # reference data
-REF_DATA = [("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
+REF_DATA = [("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
              120),
-            ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
              120),
-            ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
              60),
-            ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1",
-             "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
              120),
-            ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
              104.9068234),
-            ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
              90),
-            ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
-             "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
              52.91916441),
-            ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
-             "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
-             "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+             "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
              0)
            ]
 
@@ -100,7 +102,7 @@ for ref in REF_DATA:
     assert(math.fabs(angle - ref[3]) < TOLERANCE), "Angle {} differs from expected value {}".format(angle, ref[3])
 
 # select incorrect data
-angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"))
+angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"))
 assert(angle == -1.0)
 
 angle = model.measureAngle(Part_1_doc, model.selection("VERTEX", ""), model.selection("VERTEX", ""), model.selection("VERTEX", ""))
index c2b7d0a6a6f28425edfc8914e2e35668af114318..a5a4444aad26b52edb0bb3b1c52d02c2e4063fb5 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 import math
@@ -26,9 +28,9 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-ParamR = model.addParameter(Part_1_doc, "R", "50")
-ParamL = model.addParameter(Part_1_doc, "L", "40")
-ParamH = model.addParameter(Part_1_doc, "H", "20")
+model.addParameter(Part_1_doc, "R", "50")
+model.addParameter(Part_1_doc, "L", "40")
+model.addParameter(Part_1_doc, "H", "20")
 Point_2 = model.addPoint(Part_1_doc, 0, 100, 100)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
@@ -57,7 +59,7 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), "H")
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchArc_1 = Sketch_2.addArc(100, 48.41229182762603, 87.5, 0, 87.5, 96.82458365525073, False)
 SketchArc_2 = Sketch_2.addArc(0, 48.41229182762603, 87.5, 0, 87.5, 96.82458365525073, False)
@@ -87,34 +89,34 @@ TOLERANCE = 1.e-6
 
 # reference data
 REF_DATA = [(model.selection("VERTEX", "PartSet/Origin"),
-             model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"),
+             model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"),
              122.4744871),
-            (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"),
-             model.selection("VERTEX", "Sketch_2/Vertex-SketchArc_1-SketchLine_7e"),
+            (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"),
+             model.selection("VERTEX", "Sketch_2/SketchArc_1"),
              36.94403089),
-            (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
-             model.selection("EDGE", "Extrusion_1_1/Generated_Face_5"),
+            (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+             model.selection("EDGE", "([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])"),
              0),
-            (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
-             model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"),
+            (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+             model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2][Extrusion_2_1/To_Face]"),
              16.00781059),
-            (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
-             model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+            (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+             model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2"),
              8.412291828),
-            (model.selection("VERTEX", "Sketch_1/Vertex-SketchCircle_1"),
+            (model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"),
              model.selection("FACE", "Plane_1"),
              35.35533906),
-            (model.selection("FACE", "Extrusion_2_2/From_Face_1"),
-             model.selection("FACE", "Extrusion_2_2/To_Face_1"),
+            (model.selection("FACE", "Extrusion_2_2/From_Face"),
+             model.selection("FACE", "Extrusion_2_2/To_Face"),
              100),
-            (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"),
-             model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+            (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"),
+             model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2"),
              0),
-            (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"),
-             model.selection("FACE", "Extrusion_1_1/Generated_Face_2"),
+            (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"),
+             model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"),
              27.63932023),
             (model.selection("SOLID", "Extrusion_1_1"),
-             model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+             model.selection("FACE", "Extrusion_2_1/To_Face"),
              12.5),
             (model.selection("SOLID", "Extrusion_1_1"),
              model.selection("SOLID", "Extrusion_2_1"),
index f557f8fde98eda4ba75723e1a709062c4b95a739..c85fb4a2ba549af46bb8fcc6b748d878daefaabd 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 import math
@@ -57,20 +59,20 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), "H")
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
 model.do()
 
 TOLERANCE = 1.e-6
 
 # reference data
-REF_DATA = [("Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_1", ParamH.value()),
-            ("Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_4", ParamL.value()),
-            ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1", ParamR.value() * 2.0 * math.pi),
-            ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", 381.981436664),
-            ("Extrusion_1_1/Generated_Face_5", 60),
-            ("Sketch_1/Edge-SketchLine_3", ParamL.value()),
-            ("Sketch_1/Edge-SketchLine_4", ParamH.value()),
-            ("Sketch_1/Edge-SketchCircle_1_2", ParamR.value() * 2.0 * math.pi)
+REF_DATA = [("[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", ParamH.value()),
+            ("[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", ParamL.value()),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", ParamR.value() * 2.0 * math.pi),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", 381.981436664),
+            ("([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])", 60),
+            ("Sketch_1/SketchLine_3", ParamL.value()),
+            ("Sketch_1/SketchLine_4", ParamH.value()),
+            ("Sketch_1/SketchCircle_1_2", ParamR.value() * 2.0 * math.pi)
            ]
 
 for ref in REF_DATA:
@@ -78,7 +80,7 @@ for ref in REF_DATA:
     assert(math.fabs(length - ref[1]) < TOLERANCE), "Length {} differs from expected value {}".format(length, ref[1])
 
 # select incorrect data
-length = model.measureLength(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_5"))
+length = model.measureLength(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"))
 assert(length == -1)
 
 model.end()
diff --git a/src/FeaturesPlugin/Test/TestMeasurementPresentation.py b/src/FeaturesPlugin/Test/TestMeasurementPresentation.py
new file mode 100644 (file)
index 0000000..97d2f80
--- /dev/null
@@ -0,0 +1,98 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16")
+Config_PropManager().registerProp("Visualization", "dimension_arrow_size", "Dimension arrow size", Config_Prop.IntSpin, "16")
+Config_PropManager().registerProp("Visualization", "dimension_font", "Dimension font", Config_Prop.String, "Times-bold")
+Config_PropManager().registerProp("Visualization", "sketch_dimension_color", "Dimension color", Config_Prop.Color, "64,128,225")
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-15.79157881408318, 17.46869043106789, -28.20135254460625, -14.21916935022164)
+SketchLine_2 = Sketch_1.addLine(-28.20135254460625, -14.21916935022164, 5.332188506333114, -12.56026625936245)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchArc_1 = Sketch_1.addArc(-8.886980843888518, -0.1184930779185158, 5.332188506333114, -12.56026625936245, -15.79157881408318, 17.46869043106789, False)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint())
+model.do()
+model.end()
+
+from ModelAPI import *
+
+aSession = ModelAPI_Session.get()
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Length")
+aMeasurement.selection("edge_for_length").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Distance")
+aMeasurement.selection("distance_from").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
+aMeasurement.selection("distance_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Radius")
+aMeasurement.selection("circular").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Angle")
+aMeasurement.selection("angle_from").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
+aMeasurement.selection("angle_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("AngleBy3Points")
+aMeasurement.selection("angle_point_1").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
+aMeasurement.selection("angle_point_2").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_EndVertex")
+aMeasurement.selection("angle_point_3").selectSubShape("VERTEX", "Sketch_1/SketchLine_2_EndVertex")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
index a39927d460e1282450693f3a93fb80355684e0ab..c000dde790786ae99c503bd950e5c2c654d57a3b 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 import math
@@ -57,15 +59,15 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), "H")
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
 model.do()
 
 TOLERANCE = 1.e-6
 
 # reference data
-REF_DATA = [(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), ParamR.value()),
-            (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"), ParamR.value()),
-            (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), ParamR.value())
+REF_DATA = [(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), ParamR.value()),
+            (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"), ParamR.value()),
+            (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"), ParamR.value())
            ]
 
 for ref in REF_DATA:
@@ -73,7 +75,7 @@ for ref in REF_DATA:
     assert(math.fabs(radius - ref[1]) < TOLERANCE), "Radius {} differs from expected value {}".format(radius, ref[1])
 
 # select incorrect data
-radius = model.measureRadius(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+radius = model.measureRadius(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 assert(radius == -1)
 
 model.end()
index c65d2c4bc550af394621c01be1fc587b0b4bfb47..1471c32d6c40c9d5a278558d7c5df7d41b8ad9b6 100644 (file)
@@ -96,30 +96,17 @@ aSession.startOperation()
 
 anExtrusions = []
 for i in range(0, N * N):
-    aSketchResult = aSketchFeatures[i].firstResult()
-    aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-    origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
-    dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
-    norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
-    aSketchFaces = ShapeList()
-    GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+    aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
     anExtrusionFt = aPart.addFeature("Extrusion")
     assert (anExtrusionFt.getKind() == "Extrusion")
 
     anExtrusionFt.selectionList("base").append(
-        aSketchResult, aSketchFaces[0])
+        aSketchResult, aSketchResult.face(0))
     anExtrusionFt.string("CreationMethod").setValue("BySizes")
     anExtrusionFt.real("from_size").setValue(0)
     anExtrusionFt.real("to_size").setValue(10)
     anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
     anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
-    # v1.0.2 from master
-    # anExtrusionFt.selection("extrusion_face").setValue(
-    #    aSketchResult, aSketchFaces[0])
-    # anExtrusionFt.real("extrusion_size").setValue(10)
-    # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
     anExtrusions.append(anExtrusionFt)
 
 aSession.finishOperation()
@@ -162,28 +149,16 @@ aSession.startOperation()
 #=========================================================================
 # Build a big box extrusion
 #=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
 # Create extrusion on them
 aBox = aPart.addFeature("Extrusion")
 aBox.selectionList("base").append(
-    aSketchResult, aSketchFaces[0])
+    aSketchResult, aSketchResult.face(0))
 aBox.string("CreationMethod").setValue("BySizes")
 aBox.real("from_size").setValue(0)
 aBox.real("to_size").setValue(10)
 aBox.real("to_offset").setValue(0) #TODO: remove
 aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-#     aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
 
 aSession.finishOperation()
 
diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py
new file mode 100644 (file)
index 0000000..4675f04
--- /dev/null
@@ -0,0 +1,72 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+anAngularCopy1 = aPart.addFeature("AngularCopy")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("COMPOUND", "Compound_1_1")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("EDGE", "PartSet/OX")
+anAngularCopy1.integer("nb_angular").setValue(0)
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_Part.py b/src/FeaturesPlugin/Test/TestMultiRotation_Part.py
new file mode 100644 (file)
index 0000000..11938ae
--- /dev/null
@@ -0,0 +1,40 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+AngularCopy_1 = model.addMultiRotation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 2)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(AngularCopy_1, 2)
+model.testNbSubResults(AngularCopy_1, [0, 0])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(AngularCopy_1, [1000, 1000])
diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py
new file mode 100644 (file)
index 0000000..f5bbd13
--- /dev/null
@@ -0,0 +1,114 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy1 = aPart.addFeature("LinearCopy")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy1.integer("nb_first_dir").setValue(2)
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy2 = aPart.addFeature("LinearCopy")
+aLinearCopy2.string("use_second_dir").setValue("true")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy2.selection("axis_second_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_second_dir").selectSubShape("EDGE", "PartSet/OY")
+aLinearCopy2.integer("nb_first_dir").setValue(0)
+aLinearCopy2.integer("nb_second_dir").setValue(0)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.integer("nb_first_dir").setValue(2)
+aLinearCopy2.integer("nb_second_dir").setValue(2)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py b/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py
new file mode 100644 (file)
index 0000000..634aa47
--- /dev/null
@@ -0,0 +1,49 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+LinearCopy_1 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 20, 2)
+LinearCopy_2 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "LinearCopy_1/")], model.selection("EDGE", "OX"), 20, 2, model.selection("EDGE", "OY"), 20, 2)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(LinearCopy_1, 2)
+model.testNbSubResults(LinearCopy_1, [0, 0])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(LinearCopy_1, [1000, 1000])
+
+model.testNbResults(LinearCopy_2, 4)
+model.testNbSubResults(LinearCopy_2, [0, 0, 0, 0])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.SOLID, [1, 1, 1, 1])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.FACE, [6, 6, 6, 6])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.EDGE, [24, 24, 24, 24])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.VERTEX, [48, 48, 48, 48])
+model.testResultsVolumes(LinearCopy_2, [1000, 1000, 1000, 1000])
index 6380b00947ee10d65d37165cd4772de5cac0dfb9..9e38122376eb45ede0707bdba0eb455a0866139c 100644 (file)
@@ -64,23 +64,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
index dc64bef78f08cd4bda28470b5b29a13697fc2ba5..ceee550fd294a3617a4d0be9d5d3cee8520bab89 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -42,8 +43,9 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_2.addCircle(64.38749999999999, 45.44999999999999, 41.86298795836804)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
 model.do()
 
index fac8630ee577a4c4e671002b35c903b578081f0c..d86d22d287d387b4afc15a1ca85d3b986b7a6d7e 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
-from GeomAPI import GeomAPI_Shape
 
 model.begin()
-#Create part
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-#Create Sketch_1 - closed polyline from 5 segments
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_1 = Sketch_1.addLine(-43.90694444444443, 28.05555555555554, 19.21805555555554, 72.66388888888889)
 SketchLine_2 = Sketch_1.addLine(19.21805555555554, 72.66388888888889, 82.06249999999999, -36.19166666666666)
@@ -40,10 +38,8 @@ SketchLine_5 = Sketch_1.addLine(-45.87083333333333, -45.44999999999999, -43.9069
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
 model.do()
-#Create Extrusion_1 on Sketch_1
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r")], model.selection(), 100, 0)
-#Create Sketch_2 from 5 segments
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
 SketchLine_6 = Sketch_2.addLine(74.07000206783135, -18.10965884648514, 62.37497281453477, -31.70853007124862)
 SketchLine_7 = Sketch_2.addLine(62.37497281453477, -31.70853007124862, 37.35304976096997, -31.43655264675337)
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
@@ -55,9 +51,7 @@ SketchLine_10 = Sketch_2.addLine(69.44638585141178, 6.640286782584385, 74.070002
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.endPoint())
 model.do()
-#Create Extrusion_2 on Sketch_2
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r")], model.selection(), 10, 160)
-#Create Partition on objects Extrusion_1 and Extrusion_2
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 10, 160)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
 model.do()
 
index 01eb2c1e52b06080c84cc5acd86f6f41c679f6e1..6de248887bcd76ff0233890be7f159e9acba8719 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -49,8 +50,10 @@ SketchLine_9 = Sketch_2.addLine(30.30743587791019, -67.62202818906478, 1.8947624
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_1_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Wire_2_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6")]
+Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_1_1")])
 model.do()
 
index 7e2313a7fcc92bdaf6ca145ecaed4b9107d80f1e..a733842c56c2cf17cf46b3f951d4d957624607fd 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -30,7 +31,8 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 100
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), 100, False)
 Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 100, False)
 Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 50, False)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 model.checkResult(Partition_1,model,1,[8],[8],[48],[192],[384])
index c12eec4b3a9acb2347925ad1c3da06c9481ae741..26886c988ee4c5d96777ac4af8b2e910de67f007 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -26,12 +27,12 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
-Point_1 = model.addPoint(Part_1_doc, 4, 5, 11)
+Point_2 = model.addPoint(Part_1_doc, 4, 5, 11)
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_1 = Sketch_1.addLine(1.156555510724249, 12.03812858614785, 0.5812800089239156, -4.87167684997945)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("EDGE", "Edge_1_1")])
 model.do()
 
index 7750c01486c80b1f33beb715d402972ad48e9ded..b1c837f27b80aec7e5cce79a2fac0b6e0c11365f 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
-from salome.shaper import model
 from SketchAPI import *
 
+from salome.shaper import model
+
 model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
@@ -48,8 +50,7 @@ SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_1.result(), SketchConst
 [SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8] = SketchConstraintMirror_2.mirrored()
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 12, 12)
-
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 SketchLine_3 = Sketch_2.addLine(7.498934040825037, 4.111344571723496, -7.530337532973568, 4.111344571723496)
 SketchLine_4 = Sketch_2.addLine(-7.530337532973568, 4.111344571723496, -7.530337532973568, -4.489390918751097)
 SketchLine_5 = Sketch_2.addLine(-7.530337532973568, -4.489390918751097, 7.498934040825037, -4.489390918751097)
@@ -64,8 +65,7 @@ SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
 SketchCircle_1 = Sketch_2.addCircle(-0.133117930244568, 0.08984026389066591, 1.099112071963378)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchCircle_1_2r")], model.selection(), model.selection(), 5, model.selection(), 10)
-
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchCircle_1_2r")], model.selection(), model.selection(), 5, model.selection(), 10)
 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_7 = Sketch_3.addLine(21.55890075100801, 30.21822825485694, -17.43219636481839, 31.63011070278906)
 SketchLine_8 = Sketch_3.addLine(-17.43219636481839, 31.63011070278906, -12.33809712604348, -45.93749869468675)
@@ -76,9 +76,10 @@ SketchLine_10 = Sketch_3.addLine(30.10255255530162, -25.9120009302625, 21.558900
 SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_10")])
-
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_1")])
+Face_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_7"), model.selection("EDGE", "Sketch_3/SketchLine_8"), model.selection("EDGE", "Sketch_3/SketchLine_9"), model.selection("EDGE", "Sketch_3/SketchLine_10")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 model.checkResult(Partition_1,model,1,[2],[4],[42],[198],[396])
index 3a6a56b86d244047c92c372e8f3651bed65af667..29ec0085a21fd5740afe4157b32291361481bf2b 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -52,8 +53,10 @@ SketchLine_9 = Sketch_2.addLine(-36.0335881148175, -7.328477046301525, -31.39978
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_9.endPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_2_2"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("WIRE", "Wire_1_1")])
 model.do()
 
index c7113bbc2ad8bc7eef66f606dde033620156650d..25fba0007b5328534e6948aad6b119371557b7ad 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -30,7 +31,7 @@ SketchCircle_1 = Sketch_1.addCircle(-18.11540697674418, -21.53002906976744, 69.9
 SketchCircle_2 = Sketch_1.addCircle(-18.11540697674418, -21.53002906976744, 31.60961705559024)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2r")], model.selection(), 100, 0)
 Point_2 = model.addPoint(Part_1_doc, 100, 40, 80)
 Point_3 = model.addPoint(Part_1_doc, 100, -40, 80)
 Point_4 = model.addPoint(Part_1_doc, 20, 40, -80)
@@ -45,7 +46,8 @@ SketchLine_4 = Sketch_2.addLine(-102.5665996005733, 115.6113578178721, 98.506500
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_4"), model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
 model.do()
 
index 689fdb07eb284e49420f4f1f463d62b019824c05..73cb83f8194f1d27b6ee02f78e2b1b1cdf3bf595 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
index 48e09d554587d348fb38f36f912ec3ca427b6e70..02afc6c25cc6a49e21878466fb3ac06943d52c81 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,7 +42,8 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), mo
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front"))
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_3")])
+Partition_2_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_3")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
 model.do()
 
 # check partition
index c6673117d30384dfc7b02def66722b2bddbeabca..6508e2171b4005a8227d9c6da0b4a58e5f08ad7a 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,7 +42,8 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), mo
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front"))
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Partition_1_1_3")])
+Partition_2_objects = [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_3")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
 model.do()
 
 # check partition
index 086680d49109aeb9ab2588e6ecee30295657932b..9ba9d1360e56cebb179a2311211e791b3a39e24b 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,8 +42,8 @@ SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1")])
 model.do()
 
index 3ed42aa9c47802fa663db5cc0490e407c954ab0a..4fdfc8e39eb3af267c50e0d1d2f50ab69b435b99 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,8 +42,8 @@ SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1")])
 model.do()
 
index 93b708ca6805ea76c1692afff6a5aa065abf5b16..1a3a6c59ce534e91f73bfd33aa6a8e23ef5cb564 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,8 +42,8 @@ SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")])
 model.do()
 
index c2e0b80452a910e182cc0727ac9b23741d563ede..a11e6bba595ce7d3f79f2eb1af1cdb4908abde92 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,9 +42,10 @@ SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index d1bc8fa050fa72be7445f80f8211062c26d167ed..8bacb70a9382c16227ede4158b92bf0dc166165a 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -40,9 +42,10 @@ SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index 3e12bd028ac2e5be0fb050c6cb7fa7566ea6c97b..68efb93250c71c65a1ec6ffcc433fecf4d8e0969 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
index f64b01b7e6f17c1da62604361dcc730b03f84e0f..0d8668bd13b1945ae804aa1d75bc2ee54b64bb2a 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
index befdd88030929d931139432c19d4d508e6b05601..c44f1b6dd501fb4ddb0188bbc1e64ea0794a12ea 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
index a4e738ff397d58897299b83d71aa8fd9ece366b8..e403909daabe2a5b6dabbc7bfe69a092a157926a 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -34,7 +36,8 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index 11f2e34c6b47871c19e6701d9815d5ffc2d761af..e2f6f34d2cc406a508bbfad9bf7441db2c69ee07 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -34,7 +36,8 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index 02f6690539dc44f1daf9cd020df410052c9d0c08..c7adbf2c94b31dc726e438e088a8a5af69705cf3 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
index d132dd3683804642fef544f1a75c200a2c0c8732..5097340fef61f6116b16b3fa23bcc83c65310406 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -36,7 +38,8 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index 736e688e0e0303b6d6a2937b5065a2fcdd603ce0..670121b5142de36a8ca1580651598b947c9be2d7 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -36,7 +38,8 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index fef86e870c0ac607802c76f70552b5fe0398b762..718d720372226b064bd3744fb7280aead1a14ac2 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -36,7 +38,8 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index df68837afabd3e7b0e450a0e8a4bdc776a2f6e06..61627dbed985f757003c32264362f00e2bdfdae3 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -36,7 +38,8 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 # check partition
index 9573c9cc764b04af144ee17d4f76da2bde46ad5d..1c3cb457664fdd4ff3f6048f0784114285b023bd 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -37,7 +38,8 @@ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(),
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 SketchCircle_1 = Sketch_1.addCircle(14.49765103937751, 9.678507230150521, 3.831444106492329)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchLine_5 = Sketch_2.addLine(-15.11211565655763, 11.99814589971457, -14.79635576556081, -11.77064279967296)
 SketchLine_6 = Sketch_2.addLine(-14.79635576556081, -11.77064279967296, -3.043616368139293, -11.46189011940212)
@@ -48,8 +50,10 @@ SketchLine_8 = Sketch_2.addLine(-3.922197168000547, 15.83568871823551, -15.11211
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint())
 model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Torus_1_1"), model.selection("WIRE", "Wire_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Torus_1_1"), model.selection("WIRE", "Wire_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
 model.checkResult(Partition_1,model,1,[3],[1],[4],[22],[46])
diff --git a/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py
new file mode 100644 (file)
index 0000000..9addcbe
--- /dev/null
@@ -0,0 +1,58 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(60, -30, 15, -30)
+SketchLine_2 = Sketch_1.addLine(15, -30, 15, 15)
+SketchLine_3 = Sketch_1.addLine(15, 15, 60, 15)
+SketchLine_4 = Sketch_1.addLine(60, 15, 60, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(Partition_1.feature().error() != "")
+Part_1_doc.removeFeature(Partition_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Partition_1 = Part_1_doc.addFeature("Partition")
+Partition_1.execute()
+assert(Partition_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestPipe_Compound.py b/src/FeaturesPlugin/Test/TestPipe_Compound.py
new file mode 100644 (file)
index 0000000..192c400
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(50, 15, 100, 20)
+SketchLine_2 = Sketch_1.addLine(30, 10, 50, 0)
+SketchArc_1 = Sketch_1.addArc(30, 40, 60, 40, 30, 70, False)
+model.do()
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+model.do()
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "Sketch_1/SketchArc_1_2"))
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [2])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [16])
diff --git a/src/FeaturesPlugin/Test/TestPipe_Edge.py b/src/FeaturesPlugin/Test/TestPipe_Edge.py
new file mode 100644 (file)
index 0000000..9e17782
--- /dev/null
@@ -0,0 +1,54 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchArc_1 = Sketch_1.addArc(23.47558064206828, 28.1849874113521, 68.07028657666974, 20.97621888383109, 20.24058919303746, 73.24260576165612, False)
+SketchLine_1 = Sketch_1.addLine(67.41776169413798, 4.173199186912264, 102.8479480835664, 10.72004206910377)
+model.do()
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "Sketch_1/SketchArc_1_2"))
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_2_1")], model.selection("EDGE", "PartSet/OY"), model.selection("EDGE", "PartSet/OZ"))
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Pipe_1, [3693.366575752712378744035959244])
+
+model.testNbResults(Pipe_2, 1)
+model.testNbSubResults(Pipe_2, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Pipe_2, [3543.018638942841789685189723969])
diff --git a/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py
new file mode 100644 (file)
index 0000000..ea10665
--- /dev/null
@@ -0,0 +1,89 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+# Get document
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create a sketch with circle for pipe profile
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+
+# Create circle
+aSketchCircleFeature = aSketchFeature.addFeature("SketchCircle")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircleFeature.attribute("circle_center"))
+aCircleRadius = aSketchCircleFeature.real("circle_radius")
+anCircleCentr.setValue(0, 0)
+aCircleRadius.setValue(10)
+aSession.finishOperation()
+
+aSketchResult = aSketchFeature.firstResult()
+aSketchShape = aSketchResult.shape()
+
+aSession.startOperation()
+aPipeFeature = aPart.addFeature("Pipe")
+aPipeFeature.string("creation_method").setValue("WrongCreationMethod")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = aPipeFeature.selectionList("base_objects")
+aBaseObjectsList.append(aSketchResult, None)
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPathObjectSelection = aPipeFeature.selection("path_object")
+aPathObjectSelection.selectSubShape("EDGE", "PartSet/OZ")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPipeFeature.string("creation_method").setValue("binormal")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPipeFeature.string("creation_method").setValue("locations")
+aBaseObjectsList = aPipeFeature.selectionList("locations_objects")
+aBaseObjectsList.append(None, None)
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestPipe_Wire.py b/src/FeaturesPlugin/Test/TestPipe_Wire.py
new file mode 100644 (file)
index 0000000..34786b0
--- /dev/null
@@ -0,0 +1,69 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(25, -20, -20, -20)
+SketchLine_2 = Sketch_1.addLine(-20, -20, -20, 15)
+SketchLine_3 = Sketch_1.addLine(-20, 15, 25, 15)
+SketchLine_4 = Sketch_1.addLine(25, 15, 25, -20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(75, 25, 95, 25)
+SketchLine_6 = Sketch_1.addLine(95, 25, 95, 45)
+SketchLine_7 = Sketch_1.addLine(95, 45, 75, 45)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+model.do()
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "PartSet/OZ"))
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), [])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Pipe_1, [157500])
+
+model.testNbResults(Pipe_2, 1)
+model.testNbSubResults(Pipe_2, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [12])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [24])
+model.testResultsVolumes(Pipe_2, [6000])
diff --git a/src/FeaturesPlugin/Test/TestPlacement.py b/src/FeaturesPlugin/Test/TestPlacement.py
deleted file mode 100644 (file)
index 0ad0b90..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-##
-
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-from ModelAPI import *
-from GeomDataAPI import *
-from GeomAlgoAPI import *
-from GeomAPI import *
-import math
-
-__updated__ = "2014-12-16"
-
-aSession = ModelAPI_Session.get()
-aDocument = aSession.moduleDocument()
-
-aSession.startOperation()
-aPartFeature = aDocument.addFeature("Part")
-aSession.finishOperation()
-assert (len(aPartFeature.results()) == 1)
-aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
-aPart = aPartResult.partDoc()
-
-#=========================================================================
-# Create a sketch to extrude
-#=========================================================================
-aSession.startOperation()
-aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aLineA1 = aSketchFeature.addFeature("SketchLine")
-aLineB1 = aSketchFeature.addFeature("SketchLine")
-aLineC1 = aSketchFeature.addFeature("SketchLine")
-aLineD1 = aSketchFeature.addFeature("SketchLine")
-aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
-aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
-aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
-aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
-aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
-aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
-aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
-aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
-aLineA1StartPoint.setValue(-100, 0)
-aLineA1EndPoint.setValue(-50, 0)
-aLineB1StartPoint.setValue(-50, 0)
-aLineB1EndPoint.setValue(-50, 50)
-aLineC1StartPoint.setValue(-50, 50)
-aLineC1EndPoint.setValue(-100, 50)
-aLineD1StartPoint.setValue(-100, 50)
-aLineD1EndPoint.setValue(-100, 0)
-aLineA2 = aSketchFeature.addFeature("SketchLine")
-aLineB2 = aSketchFeature.addFeature("SketchLine")
-aLineC2 = aSketchFeature.addFeature("SketchLine")
-aLineD2 = aSketchFeature.addFeature("SketchLine")
-aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
-aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
-aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
-aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
-aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
-aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
-aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
-aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
-aLineA2StartPoint.setValue(100, 0)
-aLineA2EndPoint.setValue(50, 0)
-aLineB2StartPoint.setValue(50, 0)
-aLineB2EndPoint.setValue(50, 50)
-aLineC2StartPoint.setValue(50, 50)
-aLineC2EndPoint.setValue(100, 50)
-aLineD2StartPoint.setValue(100, 50)
-aLineD2EndPoint.setValue(100, 0)
-aSession.finishOperation()
-
-#=========================================================================
-# Make extrusion
-#=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
-assert (len(aSketchFaces) > 0)
-assert (aSketchFaces[0] is not None)
-assert (aSketchFaces[1] is not None)
-
-aSession.startOperation()
-anExtrusionFt = aPart.addFeature("Extrusion")
-assert (anExtrusionFt.getKind() == "Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[1])
-anExtrusionFt.string("CreationMethod").setValue("BySizes")
-anExtrusionFt.real("to_size").setValue(50)
-anExtrusionFt.real("from_size").setValue(0)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
-anExtrusionFt.execute()
-aSession.finishOperation()
-assert (anExtrusionFt.real("to_size").value() == 50.0)
-
-# Check extrusion results
-assert (len(anExtrusionFt.results()) > 0)
-anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
-assert (anExtrusionResult is not None)
-
-#=========================================================================
-# Test placement by face - face
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("face", "Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by face - edge
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by face - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by edge - edge
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by edge - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by vertex - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-
-from salome.shaper import model
-assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py b/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py
new file mode 100644 (file)
index 0000000..dc3e58c
--- /dev/null
@@ -0,0 +1,38 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.do()
+
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
+model.do()
+
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("COMPOUND", "all-in-Part_1"), model.selection("FACE", "Part_2/Box_1_1/Top"), False, False)
+assert(Placement_1.feature().error() != "")
+Part_1_doc.removeFeature(Placement_1.feature())
+
+model.end()
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py b/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py
new file mode 100644 (file)
index 0000000..ac1cb73
--- /dev/null
@@ -0,0 +1,140 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by edge - edge
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py
new file mode 100644 (file)
index 0000000..40502f8
--- /dev/null
@@ -0,0 +1,140 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by edge - vertex
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py
new file mode 100644 (file)
index 0000000..4a37077
--- /dev/null
@@ -0,0 +1,88 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-16.57843122838298, -30.87163595652513, 16.88033171559421)
+SketchCircle_2 = Sketch_1.addCircle(29.74848722752363, 33.32178840955915, 9.026354269133289)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aShapeToMove = Extrusion_1.feature().results()[1]
+
+# Verify Placement errors on low-level
+aSession.startOperation()
+aPlacementFt = featureToCompositeFeature(Part_1.feature()).addFeature("Placement")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selectionList("placement_objects_list").append(aShapeToMove, aShapeToMove.shape())
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_2/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+# Create correct Placement
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() == "")
+
+
+model.begin()
+Placement_2 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Placement_1_1")], model.selection("COMPOUND", "Sketch_1"), model.selection("FACE", "Extrusion_1_1/To_Face"), False, False)
+assert(Placement_2.feature().error() != "")
+Part_1_doc.removeFeature(Placement_2.feature())
+model.end()
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py b/src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py
new file mode 100644 (file)
index 0000000..b723c3c
--- /dev/null
@@ -0,0 +1,140 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - edge
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py b/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py
new file mode 100644 (file)
index 0000000..ffb334e
--- /dev/null
@@ -0,0 +1,140 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - face
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("face", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py
new file mode 100644 (file)
index 0000000..2eed9a2
--- /dev/null
@@ -0,0 +1,140 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - vertex
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py b/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py
new file mode 100644 (file)
index 0000000..6f6d28f
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Cylinder_1 = model.addCylinder(Part_2_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+model.do()
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Cylinder_1_1/Face_2"), model.selection("FACE", "Part_1/Box_1_1/Front"), False, True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Placement_1, 1)
+model.testNbSubResults(Placement_1, [0])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Placement_1, [785.398163397448342948337085545])
diff --git a/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py
new file mode 100644 (file)
index 0000000..568564a
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-100, 0, -50, 0)
+SketchLine_2 = Sketch_1.addLine(-50, 0, -50, 50)
+SketchLine_3 = Sketch_1.addLine(-50, 50, -100, 50)
+SketchLine_4 = Sketch_1.addLine(-100, 50, -100, 0)
+SketchLine_5 = Sketch_1.addLine(100, 0, 50, 0)
+SketchLine_6 = Sketch_1.addLine(50, 0, 50, 50)
+SketchLine_7 = Sketch_1.addLine(50, 50, 100, 50)
+SketchLine_8 = Sketch_1.addLine(100, 50, 100, 0)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 50, 0)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]"), False, True)
+model.do()
+model.end()
index 1adcbd13e30df69ed0f45b9d1042d05d31598811..40085922c0f446a12522ef5531f77a0ab97d23bb 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -54,7 +56,7 @@ SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(),
 SketchLine_11 = Sketch_1.addLine(-70, 0, -90, 0)
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_9.result())
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70, False)
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_10.result())
 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_4.result())
@@ -66,10 +68,10 @@ SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4")
 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
 SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_5")
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80)
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90)
-SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85)
-SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80, False)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90, False)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85, False)
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90, False)
 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_2.startPoint())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_10.result(), 190)
 SketchConstraintLength_1.setName("SketchConstraintLength_3")
@@ -92,40 +94,44 @@ SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_8")
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_13.result(), SketchLine_4.endPoint())
 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17")
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 180, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face_1"), 120, True)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 180, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face"), 120, True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_14 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"))
+SketchLine_14.setName("SketchLine_14")
+SketchLine_14.result().setName("SketchLine_14")
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
 SketchLine_15 = SketchProjection_2.createdFeature()
-SketchLine_16 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 14.99999932366307, 44.20204102886705)
+SketchLine_15.setName("SketchLine_15")
+SketchLine_15.result().setName("SketchLine_15")
+SketchLine_16 = Sketch_2.addLine(-15, 44.202041028867, 15, 44.20204102886701)
 SketchLine_16.setName("SketchLine_24")
 SketchLine_16.result().setName("SketchLine_24")
-SketchLine_17 = Sketch_2.addLine(-25, 88.20203643108667, -25, 54.20202402898175)
+SketchLine_17 = Sketch_2.addLine(-25, 88.20204102886699, -25, 54.202041028867)
 SketchLine_17.setName("SketchLine_28")
 SketchLine_17.result().setName("SketchLine_28")
-SketchLine_18 = Sketch_2.addLine(25, 54.2020551101737, 25, 88.20204066628929)
+SketchLine_18 = Sketch_2.addLine(25, 54.20204102886701, 25, 88.202041028867)
 SketchLine_18.setName("SketchLine_26")
 SketchLine_18.result().setName("SketchLine_26")
-SketchLine_19 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -15.00002220451297, 98.20204102886706)
+SketchLine_19 = Sketch_2.addLine(15, 98.202041028867, -15.00000000000001, 98.20204102886699)
 SketchLine_19.setName("SketchLine_27")
 SketchLine_19.result().setName("SketchLine_27")
-SketchLine_21 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706)
-SketchLine_21.setName("SketchLine_15")
-SketchLine_21.result().setName("SketchLine_15")
-SketchLine_21.setAuxiliary(True)
-SketchLine_20 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706)
-SketchLine_20.setName("SketchLine_18")
-SketchLine_20.result().setName("SketchLine_18")
+SketchLine_20 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706)
+SketchLine_20.setName("SketchLine_15")
+SketchLine_20.result().setName("SketchLine_15")
 SketchLine_20.setAuxiliary(True)
-SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_21 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706)
+SketchLine_21.setName("SketchLine_18")
+SketchLine_21.result().setName("SketchLine_18")
+SketchLine_21.setAuxiliary(True)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_20.startPoint())
 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_13")
 SketchLine_22 = Sketch_2.addLine(-25, 98.20204102886706, -25, 44.20204102886705)
 SketchLine_22.setName("SketchLine_16")
 SketchLine_22.result().setName("SketchLine_16")
 SketchLine_22.setAuxiliary(True)
-SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_22.startPoint())
 SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_14")
 SketchLine_23 = Sketch_2.addLine(-25, 44.20204102886705, 25, 44.20204102886705)
 SketchLine_23.setName("SketchLine_17")
@@ -133,27 +139,31 @@ SketchLine_23.result().setName("SketchLine_17")
 SketchLine_23.setAuxiliary(True)
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_15")
-SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_21.startPoint())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_16")
-SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_21.result())
+SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_20.result())
+SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_6")
 SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_22.result())
 SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_23.result())
-SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_20.result())
-SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_21.result(), "l_percage")
+SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_7")
+SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_20.result(), "l_percage")
 SketchConstraintLength_6.setName("SketchConstraintLength_8")
-SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_20.result(), 54)
+SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_21.result(), 54)
 SketchConstraintLength_7.setName("SketchConstraintLength_9")
-SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2")
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_19"))
+SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2", False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_19"), False)
 SketchLine_24 = SketchProjection_3.createdFeature()
-SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_21.startPoint(), 20)
-SketchArc_1 = Sketch_2.addArc(-15, 54.20204102886705, -25, 54.20202402898175, -15.00002401644285, 44.20204102886705, False)
-SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.20202402898175)
+SketchLine_24.setName("SketchLine_25")
+SketchLine_24.result().setName("SketchLine_25")
+SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_20.startPoint(), 20, False)
+SketchArc_1 = Sketch_2.addArc(-15, 54.202041028867, -25, 54.202041028867, -15, 44.202041028867, False)
+SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.202041028867)
 SketchLine_25.setName("SketchLine_22")
 SketchLine_25.result().setName("SketchLine_22")
 SketchLine_25.setAuxiliary(True)
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_25.endPoint())
-SketchLine_26 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 25, 44.20204102886705)
+SketchLine_26 = Sketch_2.addLine(-15, 44.202041028867, 25, 44.20204102886705)
 SketchLine_26.setName("SketchLine_21")
 SketchLine_26.result().setName("SketchLine_21")
 SketchLine_26.setAuxiliary(True)
@@ -164,33 +174,33 @@ SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_23.endPoint()
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_22.startPoint(), SketchLine_25.startPoint())
 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_23.result())
 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_22.result())
-SketchArc_2 = Sketch_2.addArc(15, 54.20204102886705, 14.99999932366307, 44.20204102886705, 25, 54.2020551101737, False)
+SketchArc_2 = Sketch_2.addArc(15, 54.20204102886701, 15, 44.20204102886701, 25, 54.20204102886701, False)
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_16.endPoint())
-SketchLine_27 = Sketch_2.addLine(25, 54.2020551101737, 25, 98.20204102886706)
+SketchLine_27 = Sketch_2.addLine(25, 54.20204102886701, 25, 98.20204102886706)
 SketchLine_27.setName("SketchLine_23")
 SketchLine_27.result().setName("SketchLine_23")
 SketchLine_27.setAuxiliary(True)
 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_27.startPoint())
 SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_27.result())
 SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_16.result())
-SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_27.endPoint())
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_27.endPoint())
 SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_16.startPoint())
-SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_20.result())
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_21.result())
 SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_26.result())
-SketchArc_3 = Sketch_2.addArc(15, 88.20204102886704, 25, 88.20204066628929, 14.99999814471567, 98.20204102886706, False)
+SketchArc_3 = Sketch_2.addArc(15, 88.202041028867, 25, 88.202041028867, 15, 98.202041028867, False)
 SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_18.endPoint())
-SketchLine_28 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -25, 98.20204102886706)
+SketchLine_28 = Sketch_2.addLine(15, 98.202041028867, -25, 98.20204102886706)
 SketchLine_28.setName("SketchLine_25")
 SketchLine_28.result().setName("SketchLine_25")
 SketchLine_28.setAuxiliary(True)
 SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_28.startPoint())
 SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_28.result())
 SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_18.result())
-SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_28.endPoint())
+SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_28.endPoint())
 SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_20.result())
 SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_27.result())
-SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886706, -15.00002220451297, 98.20204102886706, -25, 88.20203643108667, False)
+SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886699, -15.00000000000001, 98.20204102886699, -25, 88.20204102886699, False)
 SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchArc_4.startPoint(), SketchLine_19.endPoint())
 SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_17.startPoint())
 SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_19.result())
@@ -204,9 +214,9 @@ SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_4.results()[1], 10)
 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_2.results()[1], 10)
 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_1.results()[1], 10)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchLine_28f-SketchLine_26f-SketchLine_27f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face_1"), -30, model.selection(), 0)
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_8"), "inclinaison")
-Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchArc_2_2f-SketchLine_26f-SketchArc_3_2f-SketchLine_27f-SketchArc_4_2f-SketchLine_28f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face"), -30, model.selection(), 0)
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_24][Extrusion_1_1/From_Face]"), "inclinaison")
+Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1")
 Recover_1 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()])
 Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle2")
 Rotation_3.setName("Rotation_4")
@@ -219,8 +229,10 @@ Recover_3 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()])
 Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1")], model.selection("EDGE", "PartSet/OZ"), "-angle1")
 Rotation_5.setName("Rotation_6")
 Rotation_5.result().setName("Rotation_6_1")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")])
+Cut_1_objects_2 = [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Rotation_2_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")]
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], Cut_1_objects_2)
+model.do()
 model.end()
 
-assert(Boolean_1.result().shapeType() == 'SOLID')
+assert(Cut_1.result().shapeType() == 'SOLID')
 assert(Part_1_doc.size("Bodies") == 1)
index c7f7d638404c19c2e5e0f4202a73871ae65a3b40..a7531b72b810f6e6789cce07d26e2a55e35e6d99 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -36,7 +38,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Face_1_1")])
 
 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("SHELL", "Shell_1_1"))
-Remove_SubShapes_1.setSubShapesToRemove([model.selection("FACE", "Shell_1_1/Modified_Face_2")])
+Remove_SubShapes_1.setSubShapesToRemove([model.selection("FACE", "Shell_1_1/Modified_Face&Face_2_1/Face_2_1")])
 model.do()
 
 model.checkResult(Remove_SubShapes_1, model, 1, [0], [0], [1], [4], [8])
index e594d3371ca98eb5ad1de18a4aa98d0e7e3f1c8d..5d203c268aa0790c04c359e88d90e671d765ebe4 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 from GeomAPI import *
@@ -47,7 +49,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
index ff3c8d8047b4ec10dfdc4f4ee7ec0158256c50f5..8d24febe21935edea578d595ce6f0c06a86e5906 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 from GeomAPI import *
@@ -47,7 +49,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
index ff61445e55733a9f75c1c0fbe84ecf3b3f6f0b96..806869411ee5458864121f99b56600491f6f3083 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 from GeomAPI import *
@@ -47,7 +49,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
index bfe1a37bb07dfcc23af7ae242f113e8e1658497d..dfd45ccb4cede06496d0520da131dd4ea2916cee 100644 (file)
@@ -86,16 +86,8 @@ aCircleRadius.setValue(30.)
 aSession.finishOperation()
 
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 
 #=========================================================================
 # Create a sketch line to revol
@@ -130,7 +122,7 @@ aRevolFt = aPart.addFeature("Revolution")
 assert (aRevolFt.getKind() == "Revolution")
 # selection type FACE=4
 aRevolFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
 aRevolFt.string("CreationMethod").setValue("ByAngles")
 aRevolFt.real("from_angle").setValue(10)
@@ -184,7 +176,7 @@ aRevolFt = aPart.addFeature("Revolution")
 assert (aRevolFt.getKind() == "Revolution")
 # selection type FACE=4
 aRevolFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
 aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 aRevolFt.real("from_angle").setValue(0) #TODO: remove
@@ -210,7 +202,7 @@ aRevolFt = aPart.addFeature("Revolution")
 assert (aRevolFt.getKind() == "Revolution")
 # selection type FACE=4
 aRevolFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
 aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 aRevolFt.real("from_angle").setValue(0) #TODO: remove
index 21bb4644b29395f2db8cd11c5c240d1e29f44cc6..03a3ade72e91d06ba2513b14869fef4be971651a 100644 (file)
@@ -62,23 +62,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -104,7 +96,7 @@ dirx = geomDataAPI_Dir(aLineSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aLineSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace")
 
 aSketchLine = aLineSketchFeature.addFeature("SketchLine")
 aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
@@ -134,7 +126,7 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
 aSession.startOperation()
 aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
 anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
index 659cde9b85c87ece2acb93bbbee586e4c734c230..ee8e77c2f69573374e62d7db3bca8d8911c8a7fc 100644 (file)
@@ -90,23 +90,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -132,7 +124,7 @@ dirx = geomDataAPI_Dir(aLineSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aLineSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace")
 
 aSketchLine = aLineSketchFeature.addFeature("SketchLine")
 aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
@@ -162,7 +154,7 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
 norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
 aSession.startOperation()
 aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
 anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
index 5e192e24ab5d0daf5d469626f9c8f6834b932842..62229e65434850cb6bdf7220d49dbca182785cc8 100644 (file)
@@ -75,23 +75,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
diff --git a/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py
new file mode 100644 (file)
index 0000000..0e903e5
--- /dev/null
@@ -0,0 +1,80 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 =model.addBox(Part_1_doc, 10, 10, 10)
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aShapeToMove = Box_1.feature().lastResult()
+
+# Verify Rotation errors on low-level
+aSession.startOperation()
+aRotation = featureToCompositeFeature(Part_1.feature()).addFeature("Rotation")
+aRotation.string("CreationMethod").setValue("ByAxisAndAngle")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape())
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(None, None)
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.string("CreationMethod").setValue("ByThreePoints")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").removeLast()
+aRotation.selectionList("main_objects").removeLast()
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape())
+aRotation.string("CreationMethod").setValue("ByAxisAndAngle")
+aRotation.selection("axis_object").selectSubShape("FACE", "Box_1_1/Back")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selection("axis_object").selectSubShape("COMPOUND", "Box_1_1/Back")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
index ddbde47932709ce72866ee278c80d81c4653e610..2012454bcbdc01f188585c4b2986e612ba053823 100644 (file)
@@ -96,30 +96,17 @@ aSession.startOperation()
 
 anExtrusions = []
 for i in range(0, N * N):
-    aSketchResult = aSketchFeatures[i].firstResult()
-    aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-    origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
-    dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
-    norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
-    aSketchFaces = ShapeList()
-    GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+    aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
     anExtrusionFt = aPart.addFeature("Extrusion")
     assert (anExtrusionFt.getKind() == "Extrusion")
 
     anExtrusionFt.selectionList("base").append(
-        aSketchResult, aSketchFaces[0])
+        aSketchResult, aSketchResult.face(0))
     anExtrusionFt.string("CreationMethod").setValue("BySizes")
     anExtrusionFt.real("from_size").setValue(0)
     anExtrusionFt.real("to_size").setValue(10)
     anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
     anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
-    # v1.0.2 from master
-    # anExtrusionFt.selection("extrusion_face").setValue(
-    #    aSketchResult, aSketchFaces[0])
-    # anExtrusionFt.real("extrusion_size").setValue(10)
-    # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
     anExtrusions.append(anExtrusionFt)
 
 aSession.finishOperation()
@@ -162,28 +149,16 @@ aSession.startOperation()
 #=========================================================================
 # Build a big box extrusion
 #=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
 # Create extrusion on them
 aBox = aPart.addFeature("Extrusion")
 aBox.selectionList("base").append(
-    aSketchResult, aSketchFaces[0])
+    aSketchResult, aSketchResult.face(0))
 aBox.string("CreationMethod").setValue("BySizes")
 aBox.real("from_size").setValue(0)
 aBox.real("to_size").setValue(10)
 aBox.real("to_offset").setValue(0) #TODO: remove
 aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-#     aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
 
 aSession.finishOperation()
 
diff --git a/src/FeaturesPlugin/Test/TestSymmetry_Part.py b/src/FeaturesPlugin/Test/TestSymmetry_Part.py
new file mode 100644 (file)
index 0000000..c0db1e3
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Symmetry_1 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("VERTEX", "Part_1/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), False)
+Symmetry_2 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_1/")], model.selection("EDGE", "Symmetry_1/[Box_1_1/Back][Box_1_1/Left]"), False)
+Symmetry_3 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_2/")], model.selection("FACE", "Symmetry_2/Box_1_1/Bottom"), True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Symmetry_3, 2)
+model.testNbSubResults(Symmetry_3, [0, 0])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(Symmetry_3, [-1000, 1000])
index 0ebe4e3009740fc8ccb04b5c54a977cdeae2c09e..3309d0ddf5163537f532ed16b20bb8cb7aa78c26 100644 (file)
@@ -75,23 +75,15 @@ aSession.finishOperation()
 # Make extrusion on circle
 #=========================================================================
 # Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
diff --git a/src/FeaturesPlugin/Test/TestTranslation_Part.py b/src/FeaturesPlugin/Test/TestTranslation_Part.py
new file mode 100644 (file)
index 0000000..f50e575
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OX"), 10)
+Translation_2 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_1/")], 0, 10, 0)
+Translation_3 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_2/")], model.selection("VERTEX", "Translation_2/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "Translation_2/[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"))
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_1, [1000])
index 80665ef414248d64f15038498781890870d42905..aff0c7b969a85eb7508f6c244d46e7671e4b0c16 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -36,7 +37,7 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(),
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 200, 0)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "Revolution_1_1")])
 Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")])
index 2519dd469b9f186b555d37c29965d70c653753b8..52d67d3401ee2cb4a365c5c4d967ec94e38d5cfc 100644 (file)
@@ -1,3 +1,8 @@
+## Copyright (C) 2014-2017  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,
@@ -13,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,10 +37,12 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(),
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 360, 0)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")])
-Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")])
+Partition_1_objects = [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
+Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
 model.testHaveNamingSubshapes(Union_1,model,Part_1_doc)
 model.do()
 model.end()
index f5adc70c80fe862d1e9e69c817d200661187e833..87b1617a81102c2f3d568a48fea724b7d7223e5d 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2017  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -37,9 +38,9 @@ SketchLine_5 = Sketch_1.addLine(31.85610465116278, -38.16860465116279, -44.48110
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint())
 model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchLine_6 = Sketch_2.addLine(31.85610465116278, -38.16860465116279, -40.43276493886778, -56.03425756438362)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchPoint_1.result())
 SketchLine_7 = Sketch_2.addLine(-40.43276493886778, -56.03425756438362, -115.5003601973775, -26.06900348999911)
@@ -48,14 +49,18 @@ SketchLine_8 = Sketch_2.addLine(-115.5003601973775, -26.06900348999911, -106.232
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchLine_9 = Sketch_2.addLine(-106.2327558444751, 34.47934494896344, -44.48110465116279, 12.33139534883721)
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_2.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ")])
-Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Face_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")]
+Face_2 = model.addFace(Part_1_doc, Face_2_objects)
+Partition_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
+Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
 model.do()
 
 model.checkResult(Union_1,model,1,[2],[0],[2],[13],[26])
index ae80df8af0baa083a10f08ee3b63e8e9f71684c7..886da1df451ea22e0628f8a78e2ead87940d6e53 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,8 +29,9 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_1.addCircle(-5.197255574614073, 0.1732418524871273, 67.586529314451)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")])
 model.do()
 model.end()
index a681118ea7c813fb7d0e98a8e769680a7979cc2d..ba8e4c1773c63bdddf884e0a043369a6c84b3afe 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -30,7 +32,8 @@ Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5
 Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("SOLID", "Box_1_1")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")])
-Union_2 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Partition_1_1_4/Partition_1_1_4"), model.selection("SOLID", "Partition_1_1_2/Partition_1_1_2")])
+Union_2 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Union_1_1_2"), model.selection("SOLID", "Union_1_1_1")])
+model.do()
 model.end()
 
 from GeomAPI import GeomAPI_Shape
diff --git a/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py b/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py
new file mode 100644 (file)
index 0000000..5f5710a
--- /dev/null
@@ -0,0 +1,37 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, -30, 15)
+SketchCircle_2 = Sketch_1.addCircle(10, -25, 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("COMPOUND", "Sketch_1")])
+assert(Union_1.feature().error() != "")
+Part_1_doc.removeFeature(Union_1.feature())
+
+model.end()
index 910a623e3bd48907dbbc846d0641782fc820b6d6..6e14b846e106534fd604b8f35e67afde4f6f94bb 100644 (file)
@@ -41,6 +41,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Direction"
                   tooltip="Select an edge for direction"
                   shape_types="edge"
+                  geometrical_selection="true"
                   default="&lt;base normal&gt;">
     <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
   </shape_selector>
@@ -74,6 +75,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
+                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
@@ -90,6 +92,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
+                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
index b176ddc1812e8050c855c02a8569abd097c22aca..c8bc95a8e47c36bdfcff7de3c851da29b5a83a9e 100755 (executable)
@@ -43,6 +43,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Direction"
                     tooltip="Select an edge for direction"
                     shape_types="edge"
+                    geometrical_selection="true"
                     default="&lt;base normal&gt;">
       <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
     </shape_selector>
@@ -76,6 +77,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -91,6 +93,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index e65b6b4af990bcdcb52914206dae5522a2fd9ade..0891b558926a5566ae69f1c874a217e3fb110935 100644 (file)
@@ -43,6 +43,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Direction"
                     tooltip="Select an edge for direction"
                     shape_types="edge"
+                    geometrical_selection="true"
                     default="&lt;base normal&gt;">
       <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
     </shape_selector>
@@ -76,6 +77,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -91,6 +93,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index e0357b1f45e78746e70eac77c094442febf8bc73..78cba48ea502b8638979a1f436932ee502ea0bb5 100644 (file)
@@ -15,7 +15,8 @@
                     label="Axis"
                     tooltip="Select an edge for the axis of rotation"
                     shape_types="edge"
-                    default="">
+                    default=""
+                    geometrical_selection="true">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <optionalbox id="use_step_angular" title="Angular step">
index b6137c34ec3a8c3522ea408efb45ddf957312259..4eed46173cf3984ddb6be053b99c82d0c661cddb 100644 (file)
@@ -34,7 +34,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for the first direction"
                     shape_types="edge"
-                    default="">
+                    default=""
+                    geometrical_selection="true">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <doublevalue id="step_first_dir"
@@ -58,7 +59,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for the second direction"
                     shape_types="edge"
-                    default="">
+                    default=""
+                    geometrical_selection="true">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <doublevalue id="step_second_dir"
index 42a493390a912e2c7ce45ee764252c21bfc0e315..684e8f394c41038ce08ef6b12f56c02f258399d6 100644 (file)
@@ -32,14 +32,16 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     label="Select an object"
     icon="icons/Features/placement_from.png"
     tooltip="Select a start face, edge or vertex"
-    shape_types="face edge vertex">
+    shape_types="face edge vertex"
+    geometrical_selection="true">
     <validator id="GeomValidators_BodyShapes"/>
   </shape_selector>
   <shape_selector id="placement_end_shape"
     label="Select an object"
     icon="icons/Features/placement_to.png"
     tooltip="Select an end face, edge or vertex"
-    shape_types="face edge vertex">
+    shape_types="face edge vertex"
+    geometrical_selection="true">
     <validator id="PartSet_DifferentObjects"/>
     <validator id="GeomValidators_BodyShapes"/>
   </shape_selector>
index 3d71c3d844b90a41682dbd5bfe7227b35f8abf25..3bc2c6683a86de26e96ab4e084abf0ae7efe60af 100644 (file)
@@ -41,6 +41,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Axis"
                   tooltip="Select an edge for axis"
                   shape_types="edge"
+                  geometrical_selection="true"
                   default="">
     <validator id="GeomValidators_ShapeType" parameters="line"/>
   </shape_selector>
@@ -74,6 +75,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
+                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
@@ -90,6 +92,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
+                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
index 12f2f247f45e509048e9dd951573275a38668bfa..297fc706fd950f69ed4f2ebf63aeee680980fbf2 100644 (file)
@@ -43,6 +43,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for axis"
                     shape_types="edge"
+                    geometrical_selection="true"
                     default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
@@ -76,6 +77,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -91,6 +93,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index 6d1bb83945ef55b9e1a08688f8ea6173cb2ae147..5e358ee66b311e70648c61231b8b3b8fa1fa4a90 100644 (file)
@@ -43,6 +43,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for axis"
                     shape_types="edge"
+                    geometrical_selection="true"
                     default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
@@ -76,6 +77,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -91,6 +93,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
+                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index c07bd8ba850eb192b91dabb611b572295cc4b740..41899821036b83b4031a8b91628884d4b48f32f9 100755 (executable)
@@ -37,7 +37,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Axis"
                   tooltip="Select an edge for axis"
                   shape_types="edge"
-                  default="">
+                  default=""
+                  geometrical_selection="true">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
       <doublevalue id="angle"
index 9923217faaed1415bab958bc097afdd7ceed7a27..6d73285bbb99a2604e26300ac9a9f49c19a7c3b3 100644 (file)
@@ -53,7 +53,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Axis"
                       tooltip="Select an axis"
                       shape_types="edge"
-                      default="">
+                      default=""
+                      geometrical_selection="true">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
     </box>
index 28bb25115ef0ba4363f26de0757ae7442001644f..3e5ef8260ce4c12cb05e8263d131e5476514fd42 100644 (file)
@@ -37,7 +37,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Axis"
                       tooltip="Select an edge for axis"
                       shape_types="edge"
-                      default="">
+                      default=""
+                      geometrical_selection="true">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
       <doublevalue id="distance"
index 2429edd78744ceb42dfd34179252e312340cc992..13bc106c5bd6c95c09b88f5a55e0486fab53a361 100644 (file)
@@ -94,13 +94,13 @@ void GDMLPlugin_ConeSegment::loadNamingDS(
   theConeSegmentAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theConeSegmentAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultConeSegment->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultConeSegment->generated((*it).second, (*it).first);
   }
 }
 
index 55e2d14454f6f688a69b55f5634bd632b2dbdddd..c7b4c5aeb9c57c355d231d85e9fe08f3baa46104 100644 (file)
@@ -113,23 +113,26 @@ void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Ellipsoid> t
 
   // Insert to faces
   // Naming for faces and edges
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theEllipsoidAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultEllipsoid->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it!=listOfFaces.end();
+       ++it)
+  {
+    theResultEllipsoid->generated((*it).second, (*it).first);
   }
 
   // Naming vertices
   GeomAPI_DataMapOfShapeShape aVertices;
-  GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
-  for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
+       aVertExp.more();
+       aVertExp.next())
+  {
     if (!aVertices.isBound(aVertExp.current())) {
       std::ostringstream aStream;
       aStream<<"Vertex_"<<anIndex++;
-      theResultEllipsoid->generated(aVertExp.current(), aStream.str(), num++);
+      theResultEllipsoid->generated(aVertExp.current(), aStream.str());
       aVertices.bind(aVertExp.current(), aVertExp.current());
     }
   }
index a375b100ee5586f887442cad012059c43c5a3c93..e2851f71b0c08f0390b0c42de2528aa415a7e4e0 100644 (file)
@@ -123,7 +123,7 @@ public:
   virtual std::shared_ptr<GeomAPI_Pnt> middlePoint() const;
 };
 
-//! Pointer on attribute object
+//! Pointer on object
 typedef std::shared_ptr<GeomAPI_Edge> GeomEdgePtr;
 
 #endif
index fa4686de7e8797971b1d0ffc20520d9fdad9c978..dbc6e498a943ce533a23e5010d39558a3fcd3a19 100644 (file)
@@ -122,6 +122,8 @@ bool GeomAPI_PlanarEdges::isEqual(const std::shared_ptr<GeomAPI_Shape> theShape)
     return false;
   TopoDS_Shape& aMyShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
   TopoDS_Shape aTheShape = theShape->impl<TopoDS_Shape>();
+  if (aMyShape.ShapeType() != aTheShape.ShapeType()) // to don't confuse by the face of same edges
+    return false;
   TopExp_Explorer aMyExp(aMyShape, TopAbs_EDGE);
   TopExp_Explorer aTheExp(aTheShape, TopAbs_EDGE);
   for (; aMyExp.More() && aTheExp.More(); aMyExp.Next(), aTheExp.Next()) {
index ef1cea8beeef1be375c07277592466338e6d956a..0fc2a9f0aeaea2029b3122a2a4888cd0ec335b42 100644 (file)
@@ -35,7 +35,7 @@
  * \ingroup DataModel
  * \brief Interface to the set of edges located in one plane
  *
- * Normally this interface corresponds to theedges of the sketch
+ * Normally this interface corresponds to the edges of the sketch
  */
 class GeomAPI_PlanarEdges : public GeomAPI_Shape
 {
index 60e417c7c5df4d79f6c29ab2f9ecb2c8533f2c86..9ccd1a9508fad214b29e838c3e91efb227fc1a7e 100644 (file)
@@ -120,6 +120,13 @@ double GeomAPI_Pln::distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const
   return aMyPln.Distance(anOtherPln);
 }
 
+double GeomAPI_Pln::distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const
+{
+  const gp_Pln& aMyPln = impl<gp_Pln>();
+  const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
+  return aMyPln.Distance(aPnt);
+}
+
 void GeomAPI_Pln::translate(const std::shared_ptr<GeomAPI_Dir> theDir, double theDist)
 {
   gp_Vec aVec(theDir->impl<gp_Dir>());
index 863a72f617edfe1329eacf23220c0222a08bb000..af1d1fe7cf9a4c4b3fbf661083b6268ff3061593 100644 (file)
@@ -82,6 +82,10 @@ class GeomAPI_Pln : public GeomAPI_Interface
   GEOMAPI_EXPORT
   double distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
 
+  /// \return distance from a point to this plane.
+  GEOMAPI_EXPORT
+  double distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const;
+
   /// Translates the plane along direction theDir on distance theDist
   GEOMAPI_EXPORT
   void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theDist);
index 0825957681036ae6d31270139c4cd882d46b6512..c15700df1cbc68621f0320f5efe17ae32116bc34 100644 (file)
@@ -28,6 +28,9 @@
 //==================================================================================================
 GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr& theShape)
 {
+  if (!theShape.get())
+    return GeomShapePtr();
+
   GeomShapePtr aTypedShape = theShape;
 
   GeomAPI_Shape::ShapeType aType = theShape->shapeType();
index 020d819c158bec3cda7c594d700b1817865add05..bcedbf74d5bffd04967a7433d8809906ed92d367 100644 (file)
@@ -81,5 +81,8 @@ class GeomAPI_XYZ : public GeomAPI_Interface
   GEOMAPI_EXPORT double squareModulus() const;
 };
 
+//! Pointer on object
+typedef std::shared_ptr<GeomAPI_XYZ> GeomXYZPtr;
+
 #endif
 
index d1c6fae9c48911a24c6e558d5d09f7aa05f8e011..2af1a04a930b85c87da0102f9bb10151e8925c49 100644 (file)
@@ -77,8 +77,8 @@ SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), Sketc
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1])
 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7")])
 
 from GeomAPI import *
 
index a8412a4cdcc5c830339e7d035372d3599e84378a..32948b25aea675a807d613f9e1d8b5fd4fc1d9e7 100644 (file)
@@ -91,7 +91,7 @@ ParamHeight = model.addParameter(Part_1_doc, "Height", "25")
 ParamAngle = model.addParameter(Part_1_doc, "Angle", "30")
 Box_1 = model.addBox(Part_1_doc, "BoxSize", "BoxSize", "BoxSize")
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchLine_1 = Sketch_1.addLine(30, 10, 10, 10)
 SketchLine_2 = Sketch_1.addLine(10, 10, 10, 20)
@@ -109,7 +109,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Width")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Depth")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Height", 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Height", 0)
 model.do()
 
 # Test 1. Check boxes
@@ -119,13 +119,13 @@ aCornerPara = GeomAPI.GeomAPI_Pnt(ParamSize.value(), ParamSize.value(), ParamSiz
 checkBox(Extrusion_1, aCornerPara, ParamWidth.value(), ParamDepth.value(), ParamHeight.value())
 
 # Test 2. Rotate box to keep it still axes-aligned
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"), 90)
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), 90)
 aCornerPara.setX(aCornerPara.x() + ParamWidth.value() - ParamDepth.value())
 aCornerPara.setY(aCornerPara.y() - ParamWidth.value())
 checkBox(Rotation_1, aCornerPara, ParamDepth.value(), ParamWidth.value(), ParamHeight.value())
 
 # Test 3. Rotate boxes
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"))
 Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), "Angle")
 Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "Axis_1"), "Angle")
 
@@ -155,11 +155,11 @@ aCornerPara1 = GeomAPI.GeomAPI_Pnt(aCornerPara1.x() * (aCosAngle + (1 - aCosAngl
 checkRotatedBox(Rotation_3, aCornerPara, aCornerPara1)
 
 # Test 4. Compose a non-closed shell of the box faces and check it is not a box
-Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4"]
+Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2"]
 checkShellNotBox(Part_1_doc, Shell_objects)
 
 # Test 5. Compose a shell of all box faces
-Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4", "Rotation_3_1/Rotated_Face_5", "Rotation_3_1/Rotated_Face_6"]
+Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_3", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_4"]
 checkShellRotatedBox(Part_1_doc, Shell_objects, aCornerPara, aCornerPara1)
 
 model.end()
index 2c74a1955475694876e75442314f8093f87a5b5b..7c92fb34d8376e0adbcee53e223c693595c9eaa2 100644 (file)
@@ -153,10 +153,10 @@ anApex = GeomAPI.GeomAPI_Pnt(0, 0, ParamR1.value() / math.tan(aSemiAngle))
 anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1)
 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR2.value(), ParamR1.value(), ParamH.value())
 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
 checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
 
 # Test 2. Update cone radii
 ParamR1.setValue(0)
@@ -165,8 +165,8 @@ aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value())
 anApex.setZ(0)
 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
 checkVertex(Part_1_doc, "Cone_1_1/Vertex_2", GeomAPI.GeomAPI_Pnt(0, 0, 0))
 
 ParamR2.setValue(50)
@@ -176,20 +176,20 @@ aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value())
 anApex.setZ(-ParamR1.value() / math.tan(aSemiAngle))
 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
 checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
 
 # Test 3. Translate cone
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift")
 anApex.setX(anApex.x() + ParamShift.value())
-checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
-checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
-checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Translation_1_1/Translated_Face_3", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value()))
+checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
+checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
+checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value()))
 
 # Test 4. Rotate cone
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle")
@@ -198,24 +198,24 @@ anAxis = GeomAPI.GeomAPI_Dir(math.sin(anAngle), 0, math.cos(anAngle))
 x, z = anApex.x(), anApex.z()
 anApex.setX(x * math.cos(anAngle) + z * math.sin(anAngle))
 anApex.setZ(-x * math.sin(anAngle) + z * math.cos(anAngle))
-checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
 aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle) + ParamH.value() * math.sin(anAngle), 0, -ParamShift.value() * math.sin(anAngle) + ParamH.value() * math.cos(anAngle))
-checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value())
-checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value())
+checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2", aCenter, ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]", aCenter, ParamR2.value())
 aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle), 0, -ParamShift.value() * math.sin(anAngle))
-checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value())
-checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value())
+checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", aCenter, ParamR1.value())
+checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_3]", aCenter, ParamR1.value())
 
 # Test 5. Split cone by plane and check conical shell and elliptic face
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 20, False)
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "Plane_1")])
-checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face_2_2", "Partition_1_1_2/Modified_Face_2_2"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
 
 aFirstFocus = GeomAPI.GeomAPI_Pnt(20, 0, 31.062397266842858)
 aSecondFocus = GeomAPI.GeomAPI_Pnt(20, 0, -1.0935246846933797)
 aMajorRadius = 27.91915871311068
 aMinorRadius = 22.824955511666207
-checkEllipseFace(Part_1_doc, "Partition_1_1_2/Modified_Face_2_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
-checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Modified_Face_1_divided_1_e_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
+checkEllipseFace(Part_1_doc, "_weak_name_1_Partition_1_1_2", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
+checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Generated_Edge&Cone_1_1/Face_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
 
 model.end()
index 726b837fa0a9f47b0569dab4cf55fbfd44e8c39d..c423f72e133bd359bc429581e15fe2624bde80f8 100644 (file)
@@ -76,7 +76,7 @@ ParamR = model.addParameter(Part_1_doc, "R", "10")
 ParamAngle = model.addParameter(Part_1_doc, "Angle", "30")
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "2*R", "H")
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2__cc"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]__cc"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchCircle_1 = Sketch_1.addCircle(0, 0, 10)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
@@ -98,14 +98,14 @@ SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), "R/2")
 SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_2.result(), "H")
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), False)
 [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.result())
 SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
 SketchLine_5 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.result())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 270, 0)
 model.do()
 
 # Test 1. Check cylinders
@@ -114,10 +114,10 @@ aLoc2 = GeomAPI.GeomAPI_Pnt(0, 0, 2 * ParamH.value())
 aLoc3 = GeomAPI.GeomAPI_Pnt(0, 0, 3 * ParamH.value())
 anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1)
 checkCylinderAll(Part_1_doc, Cylinder_1, "Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
-checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face_1", aLoc2, anAxis, ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value())
 checkNonCylinder(Revolution_1)
-checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
-checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
 
 # Test 2. Rotate cylinders
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle")
@@ -131,11 +131,11 @@ anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle,
 aLoc1 = GeomAPI.GeomAPI_Pnt(0, aLoc1.y() * aCosAngle - aLoc1.z() * aSinAngle, aLoc1.y() * aSinAngle + aLoc1.z() * aCosAngle)
 aLoc2 = GeomAPI.GeomAPI_Pnt(0, aLoc2.y() * aCosAngle - aLoc2.z() * aSinAngle, aLoc2.y() * aSinAngle + aLoc2.z() * aCosAngle)
 aLoc3 = GeomAPI.GeomAPI_Pnt(0, aLoc3.y() * aCosAngle - aLoc3.z() * aSinAngle, aLoc3.y() * aSinAngle + aLoc3.z() * aCosAngle)
-checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
-checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/Rotated_Face_3", aLoc2, anAxis, ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/MF:Rotated&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value())
 checkNonCylinder(Rotation_3)
-checkCylinderShell(Part_1_doc, ["Rotation_3_1/Rotated_Face_5"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
-checkCylinderFace(Part_1_doc, "Rotation_3_1/Rotated_Face_5", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderShell(Part_1_doc, ["Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderFace(Part_1_doc, "Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
 
 # Test 3. Split cylinder and compose a shell
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2.2*H", False)
@@ -143,7 +143,9 @@ Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), "H"
 Partition_1_objects = [model.selection("SOLID", "Rotation_3_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 
-Shell_1_objects = ["Partition_1_1_1/Modified_Face_3_5", "Partition_1_1_4/Modified_Face_3_3", "Partition_1_1_2/Modified_Face_1_divided_2_1"]
+Shell_1_objects = ["Partition_1_1_1/Modified_Face&Sketch_2/SketchLine_4",
+                   "Partition_1_1_4/Modified_Face&Sketch_2/SketchLine_4",
+                   "(Partition_1_1_2/Modified_Face&Revolution_1_1/To_Face)(Partition_1_1_2/Modified_Face&Sketch_2/SketchLine_1)"]
 checkCylinderShell(Part_1_doc, Shell_1_objects, aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
 
 model.end()
index c05c3886451d4c6dcf39d24825730fa4e8c5fe5a..7f66006261d1e183ea18fe1cd0e4d5b4ff39d9d5 100644 (file)
@@ -88,15 +88,15 @@ model.do()
 
 # Test 1. Check face/wire of box is a rectangle
 checkRectangleFace(Part_1_doc, "Box_1_1/Top")
-Wire_edges = ["Box_1_1/Left&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top"]
+Wire_edges = ["[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]"]
 checkRectangleWire(Part_1_doc, Wire_edges)
 
 # Test 2. Build a polygon from edges
-Wire_edges = ["Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left", "Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top"]
+Wire_edges = ["[Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left]", "[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]"]
 checkPolygonWire(Part_1_doc, Wire_edges)
 
 # Test 3. Build a polygon from vertices
-Poly_vertices = ["Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"]
+Poly_vertices = ["[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"]
 checkPolyline(Part_1_doc, Poly_vertices)
 
 model.end()
index 961ed55e14b4e9d5bd151f61a55ba126828223ee..1990fbc20cab131c4c66648d5830c6d3228053fb 100644 (file)
@@ -68,7 +68,9 @@ def checkSphereAll(theDocument, theFeature, theFaceName, theCenter, theRadius):
 
     checkSphereShell(theDocument, theFaceName, theCenter, theRadius)
     checkSphereFace(theDocument, theFaceName, theCenter, theRadius)
-    checkArc(theDocument, theFaceName, theCenter, theRadius)
+
+    anArcName = "[" + theFaceName + "][weak_name_3]"
+    checkArc(theDocument, anArcName, theCenter, theRadius)
 
 
 model.begin()
@@ -93,32 +95,32 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 model.do()
 
 # Test 1. Compose sphere
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), "Aperture", 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), "Aperture", 0)
 aCenter = GeomAPI.GeomAPI_Pnt(0, 0, 0)
-checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face_2", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
 
 # Test 2. Translate sphere
 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift")
 aCenter.setX(aCenter.x() + ParamShift.value())
-checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
 
 # Test 3. Rotate sphere
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle")
 anAngle = ParamAngle.value() * math.pi / 180.0
 aCenter.setX(ParamShift.value() * math.cos(anAngle))
 aCenter.setZ(-ParamShift.value() * math.sin(anAngle))
-checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
 
 # Test 4. Check result by changing parameters
 ParamR.setValue(100)
 model.do()
-checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
 
 ParamAperture.setValue(270)
 model.do()
-checkSphereFace(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value())
-checkSphereShell(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value())
-checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
-checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR.value())
+checkSphereFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
+checkSphereShell(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
+checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/From_Face]", aCenter, ParamR.value())
+checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/To_Face]", aCenter, ParamR.value())
 
 model.end()
index 25c7f3edc6d059a2855b56c30f32317cffe33133..a710df35b6d9e08bfb8cc1d836b2b627fd3d873d 100644 (file)
@@ -84,12 +84,15 @@ aCosAngle = math.cos(anAngle)
 aSinAngle = math.sin(anAngle)
 aCenter = GeomAPI.GeomAPI_Pnt(0, aCenter.y() * aCosAngle - aCenter.z() * aSinAngle, aCenter.y() * aSinAngle + aCenter.z() * aCosAngle)
 anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, anAxis.y() * aSinAngle + anAxis.z() * aCosAngle)
-checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
+checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Torus_1_1/Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
 
 # Test 3. Split torus and compose a shell
 Partition_1_objects = [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Shell_1_objects = ["Partition_1_1_6/Modified_Face_4_4", "Partition_1_1_7/Modified_Face_4_3", "Partition_1_1_7/Modified_Face_1_divided_2_1", "Partition_1_1_5/Modified_Face_4_4"]
+Shell_1_objects = ["Partition_1_1_6/Modified_Face&Torus_1_1/Face_1",
+                   "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_2",
+                   "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_1",
+                   "Partition_1_1_5/Modified_Face&Torus_1_1/Face_1"]
 checkTorusShell(Part_1_doc, Shell_1_objects, aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
 
 model.end()
index 5793dbf0bd49a6e4bbd8330cf0276551403e7f40..49b7fe423b9988aafb251eda3b613db08d53869d 100644 (file)
 
 //==================================================================================================
 GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects)
+  : myFiller(0)
 {
   build(theObjects);
 }
 
+GeomAlgoAPI_Intersection::~GeomAlgoAPI_Intersection() {
+  if (myFiller)
+    delete (BOPAlgo_PaveFiller*)myFiller;
+}
 //==================================================================================================
 void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
 {
@@ -53,21 +58,22 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
     }
   }
 
-  BOPAlgo_PaveFiller aDSFiller;
-  aDSFiller.SetArguments(anObjects);
+  BOPAlgo_PaveFiller* aDSFiller = new BOPAlgo_PaveFiller;
+  myFiller = aDSFiller;
+  aDSFiller->SetArguments(anObjects);
 
-  aDSFiller.SetRunParallel(false);
-  aDSFiller.SetNonDestructive(false);
-  aDSFiller.SetGlue(BOPAlgo_GlueOff);
+  aDSFiller->SetRunParallel(false);
+  aDSFiller->SetNonDestructive(false);
+  aDSFiller->SetGlue(BOPAlgo_GlueOff);
 
   // optimization for the issue #2399
   BOPAlgo_SectionAttribute theSecAttr(Standard_True,
                                       Standard_True,
                                       Standard_True);
-  aDSFiller.SetSectionAttribute(theSecAttr);
+  aDSFiller->SetSectionAttribute(theSecAttr);
 
-  aDSFiller.Perform();
-  if (aDSFiller.HasErrors()) {
+  aDSFiller->Perform();
+  if (aDSFiller->HasErrors()) {
     return;
   }
 
@@ -75,7 +81,7 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
   anOperation->SetRunParallel(false);
   anOperation->SetCheckInverted(true);
 
-  anOperation->PerformWithFiller(aDSFiller);
+  anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler
   if(anOperation->HasErrors()) {
     return;
   }
index 2ea3e0c14d2bce03b2f614d1eac6ac0640730cb3..bd05117696eed9252aa5a06480027f9c236a62e6 100644 (file)
 /// \brief Performs the intersection operations.
 class GeomAlgoAPI_Intersection : public GeomAlgoAPI_MakeShape
 {
+  void* myFiller; ///< store filler to avoid memory leaks
 public:
   /// \brief Constructor.
   /// \param[in] theObjects list of objects.
   /// \param[in] theTools list of tools.
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Intersection(const ListOfShape& theObjects);
 
+  /// Destructor to erase the filler
+  GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection();
+
 private:
   /// Builds resulting shape.
   void build(const ListOfShape& theObjects);
+
 };
 
 #endif
index 6ed3adf8e21d25821bbb702c697d84204216a1f6..ded490e1f1656d4c0edc3f6a032ed2023a99b6a8 100644 (file)
@@ -21,6 +21,7 @@
 #include "GeomAlgoAPI_MakeShape.h"
 
 #include <BOPAlgo_Builder.hxx>
+#include <BRep_Tool.hxx>
 #include <BRepBuilderAPI_MakeShape.hxx>
 #include <BRepCheck_Analyzer.hxx>
 #include <BRepGProp.hxx>
@@ -31,7 +32,9 @@
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
+#include <TopoDS.hxx>
 #include <TopoDS_Builder.hxx>
+#include <TopoDS_Edge.hxx>
 
 // new shape -> old shapes -> index in the old shape
 typedef NCollection_DataMap<TopoDS_Shape,
@@ -41,7 +44,7 @@ typedef
   NCollection_DataMap<int, NCollection_DataMap<TopoDS_Shape, MapNewToOld, TopTools_ShapeMapHasher> >
   HistoryMap;
 
-//=================================================================================================
+//==================================================================================================
 GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape()
 : myBuilderType(Unknown),
   myDone(false)
@@ -49,32 +52,34 @@ GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape()
   myHist = 0;
 }
 
-GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape() {
+//==================================================================================================
+GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape()
+{
   if (myHist) {
     delete (HistoryMap*)myHist;
   }
 }
 
-//=================================================================================================
+//==================================================================================================
 bool GeomAlgoAPI_MakeShape::isDone() const
 {
   return myDone;
 }
 
-//=================================================================================================
-const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
+//==================================================================================================
+const GeomShapePtr GeomAlgoAPI_MakeShape::shape() const
 {
   return myShape;
 }
 
-//=================================================================================================
+//==================================================================================================
 bool GeomAlgoAPI_MakeShape::isValid() const
 {
   BRepCheck_Analyzer aChecker(myShape->impl<TopoDS_Shape>());
   return (aChecker.IsValid() == Standard_True);
 }
 
-//=================================================================================================
+//==================================================================================================
 bool GeomAlgoAPI_MakeShape::hasVolume() const
 {
   bool hasVolume = false;
@@ -88,88 +93,86 @@ bool GeomAlgoAPI_MakeShape::hasVolume() const
   return hasVolume;
 }
 
-//=================================================================================================
+//==================================================================================================
 std::shared_ptr<GeomAPI_DataMapOfShapeShape> GeomAlgoAPI_MakeShape::mapOfSubShapes() const
 {
   return myMap;
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                      ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::generated(const GeomShapePtr theOldShape,
+                                      ListOfShape& theNewShapes)
 {
   TopTools_ListOfShape aList;
   if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
     BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
-    aList = aMakeShape->Generated(theShape->impl<TopoDS_Shape>());
+    aList = aMakeShape->Generated(theOldShape->impl<TopoDS_Shape>());
   } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
     BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
-    aList = aBOPBuilder->Generated(theShape->impl<TopoDS_Shape>());
+    aList = aBOPBuilder->Generated(theOldShape->impl<TopoDS_Shape>());
   }
   for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) {
-    if(anIt.Value().IsNull()) {
-      continue;
-    }
-    std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+    GeomShapePtr aShape(new GeomAPI_Shape());
     aShape->setImpl(new TopoDS_Shape(anIt.Value()));
-    theHistory.push_back(aShape);
+    if (!isValidForHistory(aShape)) continue;
+    fixOrientation(aShape);
+    theNewShapes.push_back(aShape);
   }
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                     ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::modified(const GeomShapePtr theOldShape,
+                                     ListOfShape& theNewShapes)
 {
   TopTools_ListOfShape aList;
   if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
     BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
     try {
-      aList = aMakeShape->Modified(theShape->impl<TopoDS_Shape>());
+      aList = aMakeShape->Modified(theOldShape->impl<TopoDS_Shape>());
     } catch(Standard_NoSuchObject) {
     }
   } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
     BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
-    aList = aBOPBuilder->Modified(theShape->impl<TopoDS_Shape>());
+    aList = aBOPBuilder->Modified(theOldShape->impl<TopoDS_Shape>());
   }
   for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) {
-    if(anIt.Value().IsNull()) {
-      continue;
-    }
-    std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+    GeomShapePtr aShape(new GeomAPI_Shape());
     aShape->setImpl(new TopoDS_Shape(anIt.Value()));
-    theHistory.push_back(aShape);
+    if (!isValidForHistory(aShape)) continue;
+    fixOrientation(aShape);
+    theNewShapes.push_back(aShape);
   }
 }
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isDeleted(const GeomShapePtr theOldShape)
 {
   bool isDeleted = false;
   if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
     BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
-    isDeleted = aMakeShape->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
+    isDeleted = aMakeShape->IsDeleted(theOldShape->impl<TopoDS_Shape>()) == Standard_True;
   } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
     BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
-    isDeleted = aBOPBuilder->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
+    isDeleted = aBOPBuilder->IsDeleted(theOldShape->impl<TopoDS_Shape>()) == Standard_True;
   }
 
   return isDeleted;
 }
 
-//=================================================================================================
+//==================================================================================================
 void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType)
 {
   myBuilderType = theBuilderType;
 }
 
-//=================================================================================================
+//==================================================================================================
 void GeomAlgoAPI_MakeShape::setDone(const bool theFlag)
 {
   myDone = theFlag;
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::setShape(const GeomShapePtr theShape)
 {
   if(myShape.get() && myShape->isEqual(theShape)) {
     return;
@@ -187,17 +190,17 @@ void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr<GeomAPI_Shape> theSha
 
     const TopoDS_Shape& aTopoDSShape = myShape->impl<TopoDS_Shape>();
     for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_VERTEX); anExp.More(); anExp.Next()) {
-      std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+      GeomShapePtr aCurrentShape(new GeomAPI_Shape());
       aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
       myMap->bind(aCurrentShape, aCurrentShape);
     }
     for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_EDGE); anExp.More(); anExp.Next()) {
-      std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+      GeomShapePtr aCurrentShape(new GeomAPI_Shape());
       aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
       myMap->bind(aCurrentShape, aCurrentShape);
     }
     for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) {
-      std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+      GeomShapePtr aCurrentShape(new GeomAPI_Shape());
       aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
       myMap->bind(aCurrentShape, aCurrentShape);
     }
@@ -208,8 +211,30 @@ void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr<GeomAPI_Shape> theSha
   }
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::initialize() {
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isValidForHistory(const GeomShapePtr theShape)
+{
+  if (!theShape.get()) return false;
+
+  const TopoDS_Shape& aShape_ = theShape->impl<TopoDS_Shape>();
+  if (aShape_.IsNull()) return false;
+
+  if (aShape_.ShapeType() == TopAbs_EDGE) {
+    TopoDS_Edge anEdge_ = TopoDS::Edge(aShape_);
+    if (BRep_Tool::Degenerated(anEdge_)) return false;
+  }
+
+  return true;
+}
+
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::fixOrientation(GeomShapePtr& theShape) {
+  if (myMap->isBound(theShape)) theShape = myMap->find(theShape);
+}
+
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::initialize()
+{
   switch (myBuilderType) {
     case OCCT_BRepBuilderAPI_MakeShape: {
       myDone = implPtr<BRepBuilderAPI_MakeShape>()->IsDone() == Standard_True;
@@ -233,7 +258,7 @@ void GeomAlgoAPI_MakeShape::initialize() {
 
   const TopoDS_Shape& aTopoDSShape = myShape->impl<TopoDS_Shape>();
   for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) {
-    std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+    GeomShapePtr aCurrentShape(new GeomAPI_Shape());
     aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
     myMap->bind(aCurrentShape, aCurrentShape);
   }
@@ -241,21 +266,21 @@ void GeomAlgoAPI_MakeShape::initialize() {
 }
 
 
-//=================================================================================================
+//==================================================================================================
 void GeomAlgoAPI_MakeShape::prepareNamingFaces()
 {
   long long index = 1;
   GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE);
   for(GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE); anExp.more(); anExp.next()) {
-    std::shared_ptr<GeomAPI_Shape> aFace = anExp.current();
+    GeomShapePtr aFace = anExp.current();
     myCreatedFaces["Face_" + std::to_string(index++)] = aFace;
   }
 }
 
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage){
-
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage)
+{
   // isValid() is called from this method
   if (!isValid()) {
     myError = theMessage + " :: resulting shape is not valid.";
@@ -278,8 +303,9 @@ bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage){
   return true ;
 }
 
-bool GeomAlgoAPI_MakeShape::newShapesCollected(
-  std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isNewShapesCollected(GeomShapePtr theWholeOld,
+                                                 const int theShapeType)
 {
   if (!myHist)
     return false;
@@ -290,7 +316,7 @@ bool GeomAlgoAPI_MakeShape::newShapesCollected(
 }
 
 void GeomAlgoAPI_MakeShape::collectNewShapes(
-  std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType)
+  GeomShapePtr theWholeOld, const int theShapeType)
 {
   if (!myHist)
     myHist = new HistoryMap;
@@ -339,9 +365,10 @@ static void addAllSubs(const TopoDS_Shape& theNewShape,
   }
 }
 
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::oldShapesForNew(
-  std::shared_ptr<GeomAPI_Shape> theWholeOld,
-  std::shared_ptr<GeomAPI_Shape> theNewShape, const int theShapeType)
+//==================================================================================================
+GeomShapePtr GeomAlgoAPI_MakeShape::oldShapesForNew(GeomShapePtr theWholeOld,
+                                                    GeomShapePtr theNewShape,
+                                                    const int theShapeType)
 {
   GeomShapePtr aResult(new GeomAPI_Shape);
   TopoDS_Compound aResComp;
index eb2396c96736daaa37e0b95fa6fa5f49085228b2..c5c586855ac586e2f41616c65c91d13b38fcf2d8 100644 (file)
@@ -52,7 +52,8 @@ public:
   /// \brief Constructor by builder and builder type.
   /// \param[in] theBuilder pointer to the builder.
   /// \param[in] theBuilderType builder type.
-  template<class T> explicit GeomAlgoAPI_MakeShape(T* theBuilder,
+  template<class T> explicit GeomAlgoAPI_MakeShape(
+    T* theBuilder,
     const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
   : GeomAPI_Interface(theBuilder),
     myBuilderType(theBuilderType)
@@ -63,7 +64,8 @@ public:
   /// \brief Initializes internals.
   /// \param[in] theBuilder pointer to the builder.
   /// \param[in] theBuilderType builder type.
-  template<class T> void initialize(T* theBuilder,
+  template<class T> void initialize(
+    T* theBuilder,
     const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
   {
     setImpl(theBuilder);
@@ -75,7 +77,7 @@ public:
   GEOMALGOAPI_EXPORT bool isDone() const;
 
   /// \return a shape built by the shape construction algorithm.
-  GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
+  GEOMALGOAPI_EXPORT virtual const GeomShapePtr shape() const;
 
   /// \return true if resulting shape is valid.
   GEOMALGOAPI_EXPORT bool isValid() const;
@@ -87,34 +89,35 @@ public:
   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfSubShapes() const;
 
   /// \return the list of shapes generated from the shape \a theShape.
-  /// \param[in] theShape base shape.
-  /// \param[out] theHistory generated shapes.
-  GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                            ListOfShape& theHistory);
+  /// \param[in] theOldShape base shape.
+  /// \param[out] theNewShapes shapes generated from \a theShape. Does not cleared!
+  GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape,
+                                            ListOfShape& theNewShapes);
 
   /// \return the list of shapes modified from the shape \a theShape.
-  /// \param[in] theShape base shape.
-  /// \param[out] theHistory modified shapes. Does not cleared!
-  GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                           ListOfShape& theHistory);
+  /// \param[in] theOldShape base shape.
+  /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared!
+  GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
+                                           ListOfShape& theNewShapes);
 
   /// \return true if theShape was deleted.
-  /// \param[in] theShape base shape.
-  GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+  /// \param[in] theOldShape base shape.
+  GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theOldShape);
 
   /// \return true if the data were correct.
   GEOMALGOAPI_EXPORT virtual bool check() { return true; };
 
+  /// \brief Prepare the naming of faces.
+  GEOMALGOAPI_EXPORT virtual void prepareNamingFaces();
+
   ///  \return the list of created faces.
-  GEOMALGOAPI_EXPORT std::map< std::string, std::shared_ptr<GeomAPI_Shape> > getCreatedFaces()
-  {return myCreatedFaces;}
+  GEOMALGOAPI_EXPORT std::map< std::string, GeomShapePtr > getCreatedFaces() {
+    return myCreatedFaces;
+  }
 
   /// \return the error.
   GEOMALGOAPI_EXPORT std::string getError() { return myError; }
 
-  /// \brief Prepare the naming of faces.
-  GEOMALGOAPI_EXPORT virtual void prepareNamingFaces();
-
   /// \brief Check the validity of the produced shape.
   GEOMALGOAPI_EXPORT bool checkValid(std::string theMessage);
 
@@ -122,24 +125,27 @@ public:
   /// \param theWholeOld the whole old shape
   /// \param theShapeType type of the sub-shapes that is used for optimization
   /// \returns true if optimization containers are already filled
-  GEOMALGOAPI_EXPORT bool newShapesCollected(
-    std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType);
+  GEOMALGOAPI_EXPORT bool isNewShapesCollected(GeomShapePtr theWholeOld,
+                                               const int theShapeType);
 
   /// Optimization of access the new shapes by old shapes for the limited set of needed new shapes.
   /// \param theWholeOld the whole old shape
   /// \param theShapeType type of the sub-shapes that is used for optimization
   /// \returns true if optimization containers are already filled
-  GEOMALGOAPI_EXPORT void collectNewShapes(
-    std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType);
+  GEOMALGOAPI_EXPORT void collectNewShapes(GeomShapePtr theWholeOld,
+                                           const int theShapeType);
 
   /// Optimization of access the new shapes by old shapes for the limited set of needed new shapes.
   /// \param theWholeOld the whole old shape
   /// \param theNewShape the whole new shape
   /// \param theShapeType type of the old sub-shapes
   /// \returns compound of all old shapes that were used for creation of the given new
-  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> oldShapesForNew(
-    std::shared_ptr<GeomAPI_Shape> theWholeOld,
-    std::shared_ptr<GeomAPI_Shape> theNewShape, const int theShapeType);
+  GEOMALGOAPI_EXPORT GeomShapePtr oldShapesForNew(GeomShapePtr theWholeOld,
+                                                  GeomShapePtr theNewShape,
+                                                  const int theShapeType);
+
+  /// Replaces \a theShape with shape from \a myMap.
+  GEOMALGOAPI_EXPORT void fixOrientation(GeomShapePtr& theShape);
 
 protected:
   /// \brief Sets builder type.
@@ -152,7 +158,10 @@ protected:
 
   /// \brief Sets result shape.
   /// \param[in] theShape new shape.
-  void setShape(const std::shared_ptr<GeomAPI_Shape> theShape);
+  void setShape(const GeomShapePtr theShape);
+
+  /// \return true if passed shape is valid for history.
+  bool isValidForHistory(const GeomShapePtr theShape);
 
 protected:
    /// Data map to keep correct orientation of sub-shapes.
@@ -160,7 +169,7 @@ protected:
   /// Error occurred during the execution of an algorithm.
   std::string myError;
   /// Map of created faces with their name for naming.
-  std::map< std::string, std::shared_ptr<GeomAPI_Shape> > myCreatedFaces;
+  std::map< std::string, GeomShapePtr > myCreatedFaces;
 
 private:
   /// \brief Initializes internals.
@@ -169,13 +178,14 @@ private:
 private:
   GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder.
   bool myDone; ///< Builder status.
-  std::shared_ptr<GeomAPI_Shape> myShape; ///< Resulting shape.
+  GeomShapePtr myShape; ///< Resulting shape.
 
   /// map that is used to keep the optimization structure for access to the history
   /// kind of sub-shapes -> whole old shape -> new shape -> list of old shapes that create this new
   void* myHist;
 };
 
-typedef std::list<std::shared_ptr<GeomAlgoAPI_MakeShape> > ListOfMakeShape;
+typedef std::shared_ptr<GeomAlgoAPI_MakeShape> GeomMakeShapePtr;
+typedef std::list<GeomMakeShapePtr> ListOfMakeShape;
 
 #endif
index 01bf7a88a8af2c82ca0b94f1f90dabe9cfe212d4..01bf7c8653306f0952625f5725ff0a5e3aca9812 100644 (file)
 
 #include <GeomAlgoAPI_MakeShapeCustom.h>
 
-//=================================================================================================
+//==================================================================================================
 GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom()
-{}
+{
+}
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::setResult(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape)
 {
   setShape(theShape);
 }
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addModified(const std::shared_ptr<GeomAPI_Shape> theBase,
-                                              const std::shared_ptr<GeomAPI_Shape> theResult)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addModified(const GeomShapePtr theOldShape,
+                                              const GeomShapePtr theNewShape)
 {
-  return myModified.add(theBase, theResult);
+  if (!isValidForHistory(theNewShape)) return false;
+  GeomShapePtr aNewShape = theNewShape;
+  return myModified.add(theOldShape, aNewShape);
 }
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const std::shared_ptr<GeomAPI_Shape> theBase,
-                                               const std::shared_ptr<GeomAPI_Shape> theResult)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const GeomShapePtr theOldShape,
+                                               const GeomShapePtr theNewShape)
 {
-  return myGenerated.add(theBase, theResult);
+  if (!isValidForHistory(theNewShape)) return false;
+  GeomShapePtr aNewShape = theNewShape;
+  return myGenerated.add(theOldShape, aNewShape);
 }
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const GeomShapePtr theOldShape)
 {
-  return myDeleted.bind(theShape, theShape);
+  return myDeleted.bind(theOldShape, theOldShape);
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                            ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::generated(const GeomShapePtr theOldShape,
+                                            ListOfShape& theNewShapes)
 {
   ListOfShape aGenerated;
-  if(myGenerated.find(theShape, aGenerated)) {
-    theHistory.insert(theHistory.end(), aGenerated.begin(), aGenerated.end());
+  if(myGenerated.find(theOldShape, aGenerated)) {
+    theNewShapes.insert(theNewShapes.end(), aGenerated.begin(), aGenerated.end());
   }
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                           ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::modified(const GeomShapePtr theOldShape,
+                                           ListOfShape& theNewShapes)
 {
   ListOfShape aModified;
-  if(myModified.find(theShape, aModified)) {
-    theHistory.insert(theHistory.end(), aModified.begin(), aModified.end());
+  if(myModified.find(theOldShape, aModified)) {
+    theNewShapes.insert(theNewShapes.end(), aModified.begin(), aModified.end());
   }
 }
 
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const GeomShapePtr theOldShape)
 {
-  return myDeleted.isBound(theShape);
-}
\ No newline at end of file
+  return myDeleted.isBound(theOldShape);
+}
index 77bfac0e231e924f22a962e86c53b4da807bb304..6fca968ea9c7fad8d0151a2f8449b349744e7a29 100644 (file)
@@ -37,29 +37,29 @@ public:
   GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeCustom();
 
   /// Sets result shape.
-  GEOMALGOAPI_EXPORT void setResult(const std::shared_ptr<GeomAPI_Shape> theShape);
+  GEOMALGOAPI_EXPORT void setResult(const GeomShapePtr theShape);
 
   /// Adds modified shape.
-  GEOMALGOAPI_EXPORT bool addModified(const std::shared_ptr<GeomAPI_Shape> theBase,
-                                      const std::shared_ptr<GeomAPI_Shape> theResult);
+  GEOMALGOAPI_EXPORT bool addModified(const GeomShapePtr theOldShape,
+                                      const GeomShapePtr theNewShape);
 
   /// Adds generated shape.
-  GEOMALGOAPI_EXPORT bool addGenerated(const std::shared_ptr<GeomAPI_Shape> theBase,
-                                       const std::shared_ptr<GeomAPI_Shape> theResult);
+  GEOMALGOAPI_EXPORT bool addGenerated(const GeomShapePtr theOldShape,
+                                       const GeomShapePtr theNewShape);
 
   /// Adds deleted shape.
-  GEOMALGOAPI_EXPORT bool addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+  GEOMALGOAPI_EXPORT bool addDeleted(const GeomShapePtr theOldShape);
 
   /// \return the list of shapes generated from the shape theShape
-  GEOMALGOAPI_EXPORT void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                            ListOfShape& theHistory);
+  GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape,
+                                    ListOfShape& theNewShapes);
 
   /// \return the list of shapes modified from the shape theShape
-  GEOMALGOAPI_EXPORT void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                           ListOfShape& theHistory);
+  GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape,
+                                   ListOfShape& theNewShapes);
 
   /// \return whether the shape is deleted
-  GEOMALGOAPI_EXPORT bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+  GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theOldShape);
 
 private:
   GeomAPI_DataMapOfShapeMapOfShapes myGenerated;
index 1c615ced3505a04201f1ab6bfe933ba95f5e71c9..646894a1f75387e8301f40b6e87481a43630b06b 100644 (file)
 #include <NCollection_Map.hxx>
 #include <TopoDS_Shape.hxx>
 
-//=================================================================================================
+//==================================================================================================
 GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList()
 : GeomAlgoAPI_MakeShape()
 {}
 
-//=================================================================================================
+//==================================================================================================
 GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList(const ListOfMakeShape& theMakeShapeList)
 : GeomAlgoAPI_MakeShape()
 {
   init(theMakeShapeList);
 }
 
-//=================================================================================================
+//==================================================================================================
 void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList)
 {
   if(myMap.get()) {
@@ -54,9 +54,15 @@ void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList)
   }
 }
 
-//=================================================================================================
+const ListOfMakeShape& GeomAlgoAPI_MakeShapeList::list() const
+{
+  return myListOfMakeShape;
+}
+
+
+//==================================================================================================
 void GeomAlgoAPI_MakeShapeList::appendAlgo(
-  const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+  const GeomMakeShapePtr theMakeShape)
 {
   myListOfMakeShape.push_back(theMakeShape);
   if(!myMap.get()) {
@@ -65,38 +71,41 @@ void GeomAlgoAPI_MakeShapeList::appendAlgo(
   myMap->merge(theMakeShape->mapOfSubShapes());
 }
 
-//=================================================================================================
-const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShapeList::shape() const
+//==================================================================================================
+const GeomShapePtr GeomAlgoAPI_MakeShapeList::shape() const
 {
-  std::shared_ptr<GeomAPI_Shape> aShape = GeomAlgoAPI_MakeShape::shape();
+  GeomShapePtr aShape = GeomAlgoAPI_MakeShape::shape();
   if(aShape.get() && !aShape->impl<TopoDS_Shape>().IsNull()) {
     return aShape;
   } else if(!myListOfMakeShape.empty()) {
     return myListOfMakeShape.back()->shape();
   }
-  return std::shared_ptr<GeomAPI_Shape>();
+  return GeomShapePtr();
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeList::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                          ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::generated(const GeomShapePtr theOldShape,
+                                          ListOfShape& theNewShapes)
 {
-  result(theShape,  GeomAlgoAPI_MakeShapeList::Generated, theHistory);
+  result(theOldShape,  GeomAlgoAPI_MakeShapeList::Generated, theNewShapes);
 }
 
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeList::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
-                                         ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::modified(const GeomShapePtr theOldShape,
+                                         ListOfShape& theNewShapes)
 {
-  result(theShape, GeomAlgoAPI_MakeShapeList::Modified, theHistory);
+  result(theOldShape, GeomAlgoAPI_MakeShapeList::Modified, theNewShapes);
 }
 
-bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape)
 {
-  for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
-      aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
-    std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
-    if(aMakeShape->isDeleted(theShape)) {
+  for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
+       aBuilderIt != myListOfMakeShape.end();
+       ++aBuilderIt)
+  {
+    GeomMakeShapePtr aMakeShape = *aBuilderIt;
+    if(aMakeShape->isDeleted(theOldShape)) {
       return true;
     }
   }
@@ -104,9 +113,10 @@ bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr<GeomAPI_Shape> t
   return false;
 }
 
-void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theShape,
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape,
                                        OperationType theOperationType,
-                                       ListOfShape& theHistory)
+                                       ListOfShape& theNewShapes)
 {
   if(myListOfMakeShape.empty()) {
     return;
@@ -115,24 +125,30 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theS
   NCollection_Map<TopoDS_Shape> anAlgoShapes;
   NCollection_Map<TopoDS_Shape> aResultShapesMap;
   NCollection_List<TopoDS_Shape> aResultShapesList;
-  anAlgoShapes.Add(theShape->impl<TopoDS_Shape>());
-  aResultShapesMap.Add(theShape->impl<TopoDS_Shape>());
-  aResultShapesList.Append(theShape->impl<TopoDS_Shape>());
+  anAlgoShapes.Add(theOldShape->impl<TopoDS_Shape>());
+  aResultShapesMap.Add(theOldShape->impl<TopoDS_Shape>());
+  aResultShapesList.Append(theOldShape->impl<TopoDS_Shape>());
 
   for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
-      aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
-    std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
+      aBuilderIt != myListOfMakeShape.end();
+      ++aBuilderIt)
+  {
+    GeomMakeShapePtr aMakeShape = *aBuilderIt;
     NCollection_Map<TopoDS_Shape> aTempShapes;
-    for(NCollection_Map<TopoDS_Shape>::Iterator
-        aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) {
+    for (NCollection_Map<TopoDS_Shape>::Iterator aShapeIt(anAlgoShapes);
+         aShapeIt.More();
+         aShapeIt.Next())
+    {
       bool hasResults = false;
       bool anArgumentIsInResult = false;
-      std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+      GeomShapePtr aShape(new GeomAPI_Shape);
       aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
       ListOfShape aGeneratedShapes;
       aMakeShape->generated(aShape, aGeneratedShapes);
-      for (ListOfShape::const_iterator
-        anIt = aGeneratedShapes.cbegin(); anIt != aGeneratedShapes.cend(); anIt++) {
+      for (ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin();
+           anIt != aGeneratedShapes.cend();
+           ++anIt)
+      {
         const TopoDS_Shape& anItShape = (*anIt)->impl<TopoDS_Shape>();
         if (anItShape.IsSame(aShapeIt.Value())) {
           anArgumentIsInResult = true;
@@ -146,8 +162,10 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theS
       }
       ListOfShape aModifiedShapes;
       aMakeShape->modified(aShape, aModifiedShapes);
-      for(ListOfShape::const_iterator
-          anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) {
+      for (ListOfShape::const_iterator anIt = aModifiedShapes.cbegin();
+           anIt != aModifiedShapes.cend();
+           ++anIt)
+      {
         const TopoDS_Shape& anItShape = (*anIt)->impl<TopoDS_Shape>();
         if (anItShape.IsSame(aShapeIt.Value())) {
           anArgumentIsInResult = true;
@@ -175,10 +193,14 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theS
     anAlgoShapes.Unite(aTempShapes);
   }
 
-  for(NCollection_List<TopoDS_Shape>::Iterator
-      aShapeIt(aResultShapesList); aShapeIt.More(); aShapeIt.Next()) {
-    std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+  for (NCollection_List<TopoDS_Shape>::Iterator aShapeIt(aResultShapesList);
+       aShapeIt.More();
+       aShapeIt.Next())
+  {
+    GeomShapePtr aShape(new GeomAPI_Shape());
     aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
-    theHistory.push_back(aShape);
+    if (!isValidForHistory(aShape)) continue;
+    fixOrientation(aShape);
+    theNewShapes.push_back(aShape);
   }
 }
index e79826e89f86c2c4eaf2866ea8d422183abc2c66..b41712e142f54f485dc0146d9e561cc6f3602dda 100644 (file)
@@ -49,26 +49,29 @@ public:
   /// \param[in] theMakeShapeList list of algorithms.
   GEOMALGOAPI_EXPORT void init(const ListOfMakeShape& theMakeShapeList);
 
+  /// \return the list reference
+  GEOMALGOAPI_EXPORT const ListOfMakeShape& list() const;
+
   /// \brief Adds algo to the end of list.
   /// \param[in] theMakeShape algo to be added.
-  GEOMALGOAPI_EXPORT void appendAlgo(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
+  GEOMALGOAPI_EXPORT void appendAlgo(const GeomMakeShapePtr theMakeShape);
 
   /// \return a shape built by the shape construction algorithms
-  GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
+  GEOMALGOAPI_EXPORT virtual const GeomShapePtr shape() const;
 
   /// \return the list of shapes generated from the shape \a theShape
-  GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+  GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape,
                                             ListOfShape& theHistory);
 
   /// \return the list of shapes modified from the shape \a theShape
-  GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
+  GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape,
                                            ListOfShape& theHistory);
 
   /// \return whether the shape is deleted
-  GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+  GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theShape);
 
 private:
-  void result(const std::shared_ptr<GeomAPI_Shape> theShape,
+  void result(const GeomShapePtr theShape,
               OperationType theOperationType,
               ListOfShape& theHistory);
 
index 419854e011d8aa31abcf2b0053210497f04047e2..210a8c4b04957695652e32c7cd64d9c7944e115f 100644 (file)
@@ -323,6 +323,8 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes,
   GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
   aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
   aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
+  fixOrientation(aFromShape);
+  fixOrientation(aToShape);
   this->addFromShape(aFromShape);
   this->addToShape(aToShape);
 
index 3e3ed5d4edfaa4fd84df68c8243bb6ddcc082986..c07cda2db43205b1c52ac3070ba255f2370e973e 100644 (file)
@@ -21,6 +21,7 @@
 #include "GeomAlgoAPI_Placement.h"
 
 #include <GeomAlgoAPI_DFLoader.h>
+#include <GeomAlgoAPI_ShapeTools.h>
 
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
@@ -28,6 +29,7 @@
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_XYZ.h>
 
@@ -70,29 +72,48 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr<GeomAPI_Shape>& theSourc
 
   GProp_GProps aProps;
   static const double aPropEps = 1.e-4;
+  GeomShapePtr aShape;
+  bool isCompound = false;
   for (int i = 0; i < aNbObjects; i++) {
-    if (aShapes[i]->isFace()) {
-      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
+    aShape = aShapes[i];
+    isCompound = false;
+    if (aShapes[i]->isCompound()) {
+      isCompound = true;
+      GeomAPI_ShapeIterator anIt(aShapes[i]);
+      aShape = anIt.current();
+
+      GeomPointPtr aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShapes[i]);
+      aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
+    }
+
+    if (aShape->isFace()) {
+      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
       std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
       std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
       aSrcDstNormals[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
 
-      BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
-      gp_Pnt aLoc = aProps.CentreOfMass();
-      aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
+      if (!isCompound) {
+        BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
+        gp_Pnt aLoc = aProps.CentreOfMass();
+        aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
+      }
     }
-    else if (aShapes[i]->isEdge()) {
-      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
+    else if (aShape->isEdge()) {
+      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
       std::shared_ptr<GeomAPI_Lin> aLine = anEdge->line();
       std::shared_ptr<GeomAPI_Dir> aDir = aLine->direction();
-      std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
-      std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
-      std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())->multiplied(0.5);
-      aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
       aSrcDstDirections[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
+
+      if (!isCompound) {
+        std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
+        std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
+        std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())
+                                                            ->multiplied(0.5);
+        aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
+      }
     }
-    else if (aShapes[i]->isVertex()) {
-      std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShapes[i]));
+    else if (aShape->isVertex()) {
+      std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShape));
       std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
       aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
     } else // something goes wrong
index 2576423e74ceb37811b60bbd5cd556b347a1cf96..3a0e7eee8256d368e8e33a5c3eec058a61befffb 100644 (file)
@@ -411,6 +411,7 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr&                theBaseShape,
       for(TopTools_ListIteratorOfListOfShape anIt(aToShapes); anIt.More(); anIt.Next()) {
         GeomShapePtr aGeomSh(new GeomAPI_Shape());
         aGeomSh->setImpl(new TopoDS_Shape(anIt.Value()));
+        fixOrientation(aGeomSh);
         this->addToShape(aGeomSh);
       }
     }
@@ -436,6 +437,7 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr&                theBaseShape,
       for(TopTools_ListIteratorOfListOfShape anIt(aFromShapes); anIt.More(); anIt.Next()) {
         GeomShapePtr aGeomSh(new GeomAPI_Shape());
         aGeomSh->setImpl(new TopoDS_Shape(anIt.Value()));
+        fixOrientation(aGeomSh);
         this->addFromShape(aGeomSh);
       }
     }
@@ -483,6 +485,8 @@ void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo,
     GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
     aFromShape->setImpl(new TopoDS_Shape(thePrismBuilder->FirstShape(aShape)));
     aToShape->setImpl(new TopoDS_Shape(thePrismBuilder->LastShape(aShape)));
+    thePrismAlgo->fixOrientation(aFromShape);
+    thePrismAlgo->fixOrientation(aToShape);
     thePrismAlgo->addFromShape(aFromShape);
     thePrismAlgo->addToShape(aToShape);
   }
@@ -504,11 +508,13 @@ void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo,
       if(anIntTools.IsValidPointForFace(aPnt,
           theToFace, Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        thePrismAlgo->fixOrientation(aGeomSh);
         thePrismAlgo->addToShape(aGeomSh);
       }
       if(anIntTools.IsValidPointForFace(aPnt,
           theFromFace, Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        thePrismAlgo->fixOrientation(aGeomSh);
         thePrismAlgo->addFromShape(aGeomSh);
       }
     } else if(theType == TopAbs_EDGE) {
@@ -517,12 +523,14 @@ void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo,
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        thePrismAlgo->fixOrientation(aGeomSh);
         thePrismAlgo->addToShape(aGeomSh);
       }
       anEdgeCheck.Init(anEdge, theFromFace);
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        thePrismAlgo->fixOrientation(aGeomSh);
         thePrismAlgo->addFromShape(aGeomSh);
       }
     } else {
index 770580963c188d6fc2eb511777f421aa2729628e..8c2f624485e3cb4bb698c160925516c2f1429663 100644 (file)
@@ -418,6 +418,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr&                 theBaseSh
       for(TopTools_ListIteratorOfListOfShape anIt(aBndShapes); anIt.More(); anIt.Next()) {
         GeomShapePtr aShape(new GeomAPI_Shape());
         aShape->setImpl(new TopoDS_Shape(anIt.Value()));
+        fixOrientation(aShape);
         isFromFaceSet ? this->addFromShape(aShape) : this->addToShape(aShape);
       }
     }
@@ -482,6 +483,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr&                 theBaseSh
           for(TopTools_ListIteratorOfListOfShape anIt(aBsShapes); anIt.More(); anIt.Next()) {
             GeomShapePtr aShape(new GeomAPI_Shape());
             aShape->setImpl(new TopoDS_Shape(anIt.Value()));
+            fixOrientation(aShape);
             isFromFaceSet ? this->addToShape(aShape) : this->addFromShape(aShape);
           }
         }
@@ -612,6 +614,8 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
     GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
     aFromShape->setImpl(new TopoDS_Shape(theRevolBuilder->FirstShape(aShape)));
     aToShape->setImpl(new TopoDS_Shape(theRevolBuilder->LastShape(aShape)));
+    theRevolutionAlgo->fixOrientation(aFromShape);
+    theRevolutionAlgo->fixOrientation(aToShape);
     theRevolutionAlgo->addFromShape(aFromShape);
     theRevolutionAlgo->addToShape(aToShape);
   }
@@ -633,11 +637,13 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace),
           Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addToShape(aGeomSh);
       }
       if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace),
           Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addFromShape(aGeomSh);
       }
     } else if(theType == TopAbs_EDGE) {
@@ -646,12 +652,14 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addToShape(aGeomSh);
       }
       anEdgeCheck.Init(anEdge, TopoDS::Face(theFromFace));
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addFromShape(aGeomSh);
       }
     } else {
@@ -660,10 +668,12 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(theToFace));
       if(aFaceSurface == aFromSurface) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addFromShape(aGeomSh);
       }
       if(aFaceSurface == aToSurface) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theRevolutionAlgo->addToShape(aGeomSh);
       }
     }
@@ -686,12 +696,14 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace),
           Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
                            theRevolutionAlgo->addToShape(aGeomSh);
       }
       if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape),
          Precision::Confusion()) == Standard_True) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
                            theRevolutionAlgo->addFromShape(aGeomSh);
       }
@@ -701,6 +713,7 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
                            theRevolutionAlgo->addToShape(aGeomSh);
       }
@@ -708,6 +721,7 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       anEdgeCheck.Perform();
       if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
                            theRevolutionAlgo->addFromShape(aGeomSh);
       }
@@ -718,11 +732,13 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo,
       Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape));
       if(aFaceSurface == aBoundingSurface) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
                            theRevolutionAlgo->addToShape(aGeomSh);
       }
       if(aFaceSurface == aBaseSurface) {
         aGeomSh->setImpl(new TopoDS_Shape(aShape));
+        theRevolutionAlgo->fixOrientation(aGeomSh);
         theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
                            theRevolutionAlgo->addFromShape(aGeomSh);
       }
index a47c77c7f28d1fa298a72a1613b71a5eabdd06ff..a9390272b8aa6e6fd0fffac277a3a75432185e10 100644 (file)
@@ -234,14 +234,14 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeTools::combineShapes(
     }
   }
 
-  // Map subshapes and shapes.
+  // Map sub-shapes and shapes.
   TopTools_IndexedDataMapOfShapeListOfShape aMapSA;
   TopExp::MapShapesAndAncestors(aShapesComp, aTS, aTA, aMapSA);
   if(aMapSA.IsEmpty()) {
     return aResult;
   }
 
-  // Get all shapes with common subshapes and free shapes.
+  // Get all shapes with common sub-shapes and free shapes.
   NCollection_Map<TopoDS_Shape> aFreeShapes;
   NCollection_Vector<NCollection_Map<TopoDS_Shape>> aShapesWithCommonSubshapes;
   for(TopTools_IndexedDataMapOfShapeListOfShape::Iterator
@@ -299,7 +299,7 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeTools::combineShapes(
     }
   }
 
-  // Combine shapes with common subshapes.
+  // Combine shapes with common sub-shapes.
   for(NCollection_Vector<NCollection_Map<TopoDS_Shape>>::Iterator
       anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) {
     TopoDS_Shell aShell;
@@ -444,7 +444,7 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeTools::groupSharedTopology(
         aKeysIt.Next()) {
         const TopTools_ListOfShape& anOtherConnected = aVertexShapesMap(aKeysIt.Value());
         if (!anOtherConnected.Contains(aConnected)) {
-          // Other connected group does not containt shape from our connected group
+          // Other connected group does not contain shape from our connected group
           continue;
         }
         // Other is connected to our, so add them to our connected
index 5a893f50b218d813a3530f39685d26f19ce924ed..e642cc59f65fe7385ee73c179bcea2dad2e032bb 100644 (file)
@@ -19,6 +19,7 @@
 //
 
 #include "GeomAlgoAPI_Tools.h"
+#include "GeomAlgoAPI_MakeShape.h"
 
 #include <clocale>
 
@@ -58,3 +59,32 @@ std::string File_Tools::name(const std::string& theFileName)
   OSD_Path aPath(aFileName);
   return aPath.Name().ToCString();
 }
+
+bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr& theAlgorithm,
+                                  const std::string& theFeature,
+                                  std::string& theError)
+{
+  theError.clear();
+  if (!theAlgorithm->isDone()) {
+    theError = "Error: " + (theFeature.empty() ? "The" : theFeature) + " algorithm failed.";
+    std::string anAlgoError = theAlgorithm->getError();
+    if (!anAlgoError.empty())
+      theError += " " + anAlgoError;
+    return true;
+  }
+  if (!theAlgorithm->shape() || theAlgorithm->shape()->isNull()) {
+    theError = "Error: Resulting shape";
+    if (!theFeature.empty())
+      theError += "of " + theFeature;
+    theError += " is Null.";
+    return true;
+  }
+  if (!theAlgorithm->isValid()) {
+    theError = "Error: Resulting shape";
+    if (!theFeature.empty())
+      theError += "of " + theFeature;
+    theError += " is not valid.";
+    return true;
+  }
+  return false;
+}
index f17efdc3b735b1040812bb1872adab95d602ebb2..bb0c28f2b3faf961a3b6ab1a97826f7a46b9e385 100644 (file)
 
 #include <GeomAlgoAPI.h>
 
+#include <memory>
 #include <string>
 
+class GeomAlgoAPI_MakeShape;
+
 namespace GeomAlgoAPI_Tools {
 
 /** \class Localizer
@@ -56,6 +59,24 @@ public:
   GEOMALGOAPI_EXPORT static std::string name(const std::string& theFileName);
 };
 
+/** \class AlgoError
+ *  \ingroup DataAlgo
+ *  \brief Verify error in MakeShape algorithm.
+ */
+class AlgoError {
+public:
+  /** \brief Verify MakeShape algorithm for failures
+   *  \param[in]  theAlgorithm object to verify the failure
+   *  \param[in]  theFeature   kind of the feature, the algorithm belongs to
+   *  \param[out] theError     error string (empty if the feature succeed)
+   *  \return \c true if succeed
+   */
+  GEOMALGOAPI_EXPORT static bool isAlgorithmFailed(
+      const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm,
+      const std::string& theFeature,
+      std::string& theError);
+};
+
 } // GeomAlgoAPI_Tools
 
 #endif /* GEOMALGOAPI_TOOLS_H_ */
index 85527474ee0c0ee69d3903a1a19228be3331a348..fcca1b51c9f189b99085e5ed2c52f0008b82c5c0 100644 (file)
@@ -28,7 +28,6 @@ SET(PROJECT_HEADERS
     GeomValidators_Face.h
     GeomValidators_FeatureKind.h
     GeomValidators_Finite.h
-    GeomValidators_PartitionArguments.h
     GeomValidators_Plugin.h
     GeomValidators_Positive.h
     GeomValidators_ShapeType.h
@@ -48,7 +47,6 @@ SET(PROJECT_SOURCES
     GeomValidators_Face.cpp
     GeomValidators_FeatureKind.cpp
     GeomValidators_Finite.cpp
-    GeomValidators_PartitionArguments.cpp
     GeomValidators_Plugin.cpp
     GeomValidators_Positive.cpp
     GeomValidators_ShapeType.cpp
index 69a981be699f7741b1e34a6091e1d5dc344c0afb..e030c284e0cef28e6185e55d682a1fbb5c85a610 100644 (file)
@@ -171,5 +171,7 @@ bool GeomValidators_DifferentShapes::isAttrShapesEqual(const AttributePtr& theAt
   }
   GeomShapePtr aOtherTypedShape = GeomAPI_Tools::getTypedShape(anOtherShape);
 
+  if (!aTypedShape.get())
+    return !aTypedShape.get() && !aOtherTypedShape.get();
   return aTypedShape->isEqual(aOtherTypedShape);
-}
\ No newline at end of file
+}
index 945f9bc34d306c14beda27425213d5b0cadb4100..18cc1b1e684bec26c7f2f4360973ba5857fb35b2 100644 (file)
@@ -24,6 +24,7 @@
 #include "ModelAPI_AttributeSelection.h"
 
 #include <GeomAPI_Face.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAbs_SurfaceType.hxx>
 
@@ -46,6 +47,40 @@ GeomAbs_SurfaceType faceType(const std::string& theType)
   return GeomAbs_Plane;
 }
 
+bool isValidFace(const GeomShapePtr theShape,
+                 const GeomAbs_SurfaceType theFaceType,
+                 Events_InfoMessage& theError)
+{
+  GeomFacePtr aGeomFace = theShape->face();
+
+  if (!aGeomFace.get()) {
+    theError = "The shape is not a face.";
+      return false;
+  }
+
+  bool aValid = true;
+
+  switch (theFaceType) {
+    case GeomAbs_Plane: {
+      aValid = aGeomFace->isPlanar();
+      if (!aValid) theError = "The shape is not a plane.";
+      break;
+    }
+    case GeomAbs_Cylinder: {
+      aValid = aGeomFace->isCylindrical();
+      if (!aValid) theError = "The shape is not a cylinder.";
+      break;
+    }
+    default: {
+      aValid = false;
+      theError = "The shape is not an available face.";
+      break;
+    }
+  }
+
+  return aValid;
+}
+
 bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
                                   const std::list<std::string>& theArguments,
                                   Events_InfoMessage& theError) const
@@ -73,42 +108,21 @@ bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
     // it is necessary to check whether the shape is face in order to set in selection a value
     // with any type and check the type in this validator
     // It is realized to select any object in OB and filter it in this validator (sketch plane)
-    if (!aGeomShape->isFace()) {
-      aValid = false;
-      theError = "The shape is not a face.";
+    GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
+    if (theArguments.size() == 1)
+      aFaceType = faceType(theArguments.front());
+    if (aGeomShape->isFace()) {
+      aValid = isValidFace(aGeomShape, aFaceType, theError);
     }
-    else {
-      std::shared_ptr<GeomAPI_Face> aGeomFace(new GeomAPI_Face(aGeomShape));
-      if (!aGeomFace.get()) {
-        aValid = false;
-        theError = "The shape is not a face.";
-      }
-      else {
-        GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
-        if (theArguments.size() == 1)
-          aFaceType = faceType(theArguments.front());
-
-        switch (aFaceType) {
-          case GeomAbs_Plane: {
-            aValid = aGeomFace->isPlanar();
-            if (!aValid)
-              theError = "The shape is not a plane.";
-          }
-          break;
-          case GeomAbs_Cylinder:{
-            aValid = aGeomFace->isCylindrical();
-            if (!aValid)
-              theError = "The shape is not a cylinder.";
-          }
-          break;
-          default: {
-            aValid = false;
-            theError = "The shape is not an available face.";
-            break;
-          }
-        }
+    else if (aSelectionAttr->isGeometricalSelection() && aGeomShape->isCompound()) {
+      for (GeomAPI_ShapeIterator anIt(aGeomShape); anIt.more() && aValid; anIt.next()) {
+        aValid = isValidFace(anIt.current(), aFaceType, theError);
       }
     }
+    else {
+      aValid = false;
+      theError = "The shape is not a face.";
+    }
   }
   return aValid;
 }
diff --git a/src/GeomValidators/GeomValidators_PartitionArguments.cpp b/src/GeomValidators/GeomValidators_PartitionArguments.cpp
deleted file mode 100644 (file)
index 0231eda..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_PartitionArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeSelectionList.h>
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                              const std::list<std::string>& theArguments,
-                                              Events_InfoMessage& theError) const
-{
-  if(theArguments.size() != 3) {
-    theError = "Wrong number of arguments (expected 3).";
-    return false;
-  }
-
-  int anObjectsNb = 0, aToolsNb = 0;
-  bool isCombine = true;
-
-  std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
-  std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    anObjectsNb = anAttrSelList->size();
-  }
-  anIt++;
-
-  anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    aToolsNb = anAttrSelList->size();
-  }
-  anIt++;
-
-  std::shared_ptr<ModelAPI_AttributeBoolean> anAttrBool = theFeature->boolean(*anIt);
-  if(anAttrBool) {
-    isCombine = anAttrBool->value();
-  }
-
-  if((anObjectsNb > 0 && aToolsNb > 0) ||
-     (isCombine && anObjectsNb != 0 && (anObjectsNb + aToolsNb > 1))) {
-    return true;
-  }
-
-  theError = "Not enough arguments";
-  return false;
-}
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
-                                                        std::string theAttribute)
-{
-  if(theAttribute == "tool_objects") {
-    return true;
-  }
-
-  return false;
-}
diff --git a/src/GeomValidators/GeomValidators_PartitionArguments.h b/src/GeomValidators/GeomValidators_PartitionArguments.h
deleted file mode 100644 (file)
index 8a8f072..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_PartitionArguments_H
-#define GeomValidators_PartitionArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_PartitionArguments
- *  \ingroup Validators
- *  \brief Validates that partition operation have enough arguments.
- */
-class GeomValidators_PartitionArguments : public ModelAPI_FeatureValidator
-{
-public:
-  /** \brief Returns true if feature and/or attributes are valid.
-   *  \param[in] theFeature the validated feature.
-   *  \param[in] theArguments the arguments in the configuration file for this validator.
-   *  \param[out] theError error message.
-   *  \returns true if feature is valid.
-   */
-  GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                             const std::list<std::string>& theArguments,
-                                             Events_InfoMessage& theError) const;
-
-  /// \return true if the attribute in feature is not obligatory for the feature execution.
-  GEOMVALIDATORS_EXPORT virtual
-    bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
index 733fc17bf384b193aec4fecd1c625be21f950a84..6f8129df5ac32b9e92fa489e9b2584f699f0f22c 100644 (file)
@@ -26,7 +26,6 @@
 #include <GeomValidators_DifferentShapes.h>
 #include <GeomValidators_Face.h>
 #include <GeomValidators_Finite.h>
-#include <GeomValidators_PartitionArguments.h>
 #include <GeomValidators_ShapeType.h>
 #include <GeomValidators_ZeroOffset.h>
 #include <GeomValidators_FeatureKind.h>
@@ -54,8 +53,6 @@ GeomValidators_Plugin::GeomValidators_Plugin()
                               new GeomValidators_DifferentShapes);
   aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
   aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
-  aFactory->registerValidator("GeomValidators_PartitionArguments",
-                              new GeomValidators_PartitionArguments);
   aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
   aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset);
   aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind);
index afb7dd0c93eb2c6a5bb6eefa2965bd750a5b698b..a7638e7be7ad0e30441d7577daaf2a8b0ab9109a 100755 (executable)
@@ -22,6 +22,7 @@
 #include "GeomValidators_Tools.h"
 
 #include <GeomAPI_Curve.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomDataAPI_Point2D.h>
 
 #include <ModelAPI_Result.h>
@@ -130,18 +131,27 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
     GeomShapePtr aShape = anAttr->value();
     if (aShape.get())
-      aValid = isValidShape(aShape, theShapeType, theError);
+      aValid = isValidShape(aShape, theShapeType, anAttr->isGeometricalSelection(), theError);
     else {
       if (anAttr->context().get())
-        aValid = isValidObject(anAttr->context(), theShapeType, theError);
+        aValid = isValidObject(anAttr->context(),
+                               theShapeType,
+                               anAttr->isGeometricalSelection(),
+                               theError);
       else
-        aValid = isValidObject(anAttr->contextFeature(), theShapeType, theError);
+        aValid = isValidObject(anAttr->contextFeature(),
+                               theShapeType,
+                               anAttr->isGeometricalSelection(),
+                               theError);
     }
   }
   else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
     AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
     if (anAttr->isObject()) {
-      aValid = isValidObject(anAttr->object(), theShapeType, theError);
+      aValid = isValidObject(anAttr->object(),
+                             theShapeType,
+                             false,
+                             theError);
     }
     else if (theShapeType == Vertex) {
       AttributePtr aRefAttr = anAttr->attr();
@@ -162,7 +172,7 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
   else if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
     AttributeReferencePtr anAttr =
                               std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
-    aValid = isValidObject(anAttr->value(), theShapeType, theError);
+    aValid = isValidObject(anAttr->value(), theShapeType, false, theError);
   }
   else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
     AttributeSelectionListPtr aListAttr =
@@ -190,6 +200,7 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
 
 bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
                                              const TypeOfShape theShapeType,
+                                             const bool theIsGeometricalSelection,
                                              Events_InfoMessage& theError) const
 {
   bool aValid = true;
@@ -214,7 +225,7 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
         aValid = false;
         theError = "The result is empty";
       } else {
-        aValid = isValidShape(aResult->shape(), theShapeType, theError);
+        aValid = isValidShape(aResult->shape(), theShapeType, theIsGeometricalSelection, theError);
       }
     } else {
       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
@@ -231,6 +242,7 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
 
 bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
                                             const TypeOfShape theShapeType,
+                                            const bool theIsGeometricalSelection,
                                             Events_InfoMessage& theError) const
 {
   bool aValid = true;
@@ -247,9 +259,21 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
     case Edge:
       aValid = theShape->isEdge();
       break;
-    case Line:
-      aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
+    case Line: {
+      if (theIsGeometricalSelection && theShape->isCompound()) {
+        aValid = true;
+        for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
+          if (!anIt.current()->isEdge() || !GeomAPI_Curve(anIt.current()).isLine()) {
+            aValid = false;
+            break;
+          }
+        }
+      }
+      else {
+        aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
+      }
       break;
+    }
     case Circle:
       aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
       break;
index daf9fda38d230c7d73c38e318c4a809baea31e59..0606cd411235d36e110dfb60a8b10399b0f42694 100644 (file)
@@ -83,6 +83,7 @@ protected:
   /// \param[out] theError error message.
   bool isValidObject(const ObjectPtr& theObject,
                      const TypeOfShape theShapeType,
+                     const bool theIsGeometricalSelection,
                      Events_InfoMessage& theError) const;
 
   /// Returns true if the attibute's object type satisfies the argument value
@@ -91,6 +92,7 @@ protected:
   /// \param[out] theError error message.
   bool isValidShape(const GeomShapePtr theShape,
                     const TypeOfShape theShapeType,
+                    const bool theIsGeometricalSelection,
                     Events_InfoMessage& theError) const;
 
 };
index 4a919d0c4b6afe96dc4c0fe774509a0478fb1863..d6181783f4931cb7a9e647070e3c60d28dd5abfc 100644 (file)
@@ -31,6 +31,7 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Pnt.h>
 
@@ -131,6 +132,10 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
     if(aToShape.get() == NULL && anAttrSel->context().get() != NULL) {
       aToShape =  anAttrSel->context()->shape();
     }
+    if (aToShape->isCompound()) {
+      GeomAPI_ShapeIterator anIt(aToShape);
+      aToShape = anIt.current();
+    }
   }
   anIt++;
 
@@ -146,6 +151,10 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
     if(aFromShape.get() == NULL && anAttrSel->context().get() != NULL) {
       aFromShape = anAttrSel->context()->shape();
     }
+    if (aFromShape->isCompound()) {
+      GeomAPI_ShapeIterator anIt(aFromShape);
+      aFromShape = anIt.current();
+    }
   }
   anIt++;
 
index 33ec73c00da0d180a8b3d58b10c09f869ab09ae8..a5138d2fa25b72f3bc6fbae5c484277bc0b92ff3 100644 (file)
@@ -55,7 +55,6 @@ SET(PROJECT_HEADERS
     Model_ResultParameter.h
     Model_FeatureValidator.h
     Model_AttributeValidator.h
-    Model_SelectionNaming.h
 )
 
 SET(PROJECT_SOURCES
@@ -92,13 +91,13 @@ SET(PROJECT_SOURCES
     Model_ResultParameter.cpp
     Model_FeatureValidator.cpp
     Model_AttributeValidator.cpp
-    Model_SelectionNaming.cpp
 )
 
 SET(PROJECT_LIBRARIES
     ModelAPI
     Events
     Config
+    Selector
     GeomData
     GeomAPI
     GeomAlgoAPI
@@ -109,6 +108,7 @@ SET(PROJECT_INCLUDES
   ../ModelAPI
   ../Events
   ../Config
+  ../Selector
   ../GeomData
   ../GeomDataAPI
   ../GeomAlgoAPI
index 4d77a91f7f2e68663c1be1a7d18c866ab7d1a0a7..e6564b60a7a2d12dc5ef11e4781758e4bbc30aa7 100644 (file)
@@ -44,6 +44,12 @@ void Model_AttributeRefList::append(ObjectPtr theObject)
     myExtDocRef->Append(anEntry);
   } else return; // something is wrong
 
+  if (myHashUsed) {
+    myHashObjects.insert(theObject);
+    myHashIndex[myRef->Extent() - 1] = theObject;
+    myHashIndexNoEmpty[int(myHashIndexNoEmpty.size())] = theObject;
+  }
+
   // do it before the transaction finish to make just created/removed objects know dependencies
   // and reference from composite feature is removed automatically
   ADD_BACK_REF(theObject);
@@ -52,6 +58,7 @@ void Model_AttributeRefList::append(ObjectPtr theObject)
 
 void Model_AttributeRefList::remove(ObjectPtr theObject)
 {
+  eraseHash();
   if (theObject.get() != NULL) {
     if (owner()->document() == theObject->document()) {
       std::shared_ptr<Model_Data> aData;
@@ -79,7 +86,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject)
           if (anExtIter.Value() == anIdString.str().c_str()) {
             TDataStd_ListIteratorOfListOfExtendedString anExtIter2 = anExtIter;
             anExtIter2.Next();
-            if (anExtIter2.Value() == anEntry) { // fully maches, so, remove(don't copy)
+            if (anExtIter2.Value() == anEntry) { // fully matches, so, remove(don't copy)
               aFound = true;
               continue;
             }
@@ -124,6 +131,7 @@ void Model_AttributeRefList::clear()
     REMOVE_BACK_REF((*anOldIter));
   }
   myExtDocRef->Clear();
+  eraseHash();
   owner()->data()->sendAttributeUpdated(this);
 }
 
@@ -131,6 +139,10 @@ int Model_AttributeRefList::size(const bool theWithEmpty) const
 {
   if (theWithEmpty)
     return myRef->Extent();
+
+  if (myHashUsed)
+    return int(myHashIndexNoEmpty.size());
+
   int aResult = 0;
   const TDF_LabelList& aList = myRef->List();
   for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
@@ -177,15 +189,11 @@ ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& th
 
 std::list<ObjectPtr> Model_AttributeRefList::list()
 {
+  createHash();
   std::list<ObjectPtr> aResult;
-  std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
-      owner()->document());
-  if (aDoc) {
-    const TDF_LabelList& aList = myRef->List();
-    TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
-    for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
-      aResult.push_back(iteratedObject(aLIter, anExtIter, aDoc));
-    }
+  std::map<int, ObjectPtr>::iterator aHashIter = myHashIndex.begin();
+  for(; aHashIter != myHashIndex.end(); aHashIter++) {
+    aResult.push_back(aHashIter->second);
   }
   return aResult;
 }
@@ -195,65 +203,24 @@ bool Model_AttributeRefList::isInList(const ObjectPtr& theObj)
   if(!theObj.get()) {
     return false;
   }
-  if (theObj->document() == owner()->document()) { // this document object
-    std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
-        owner()->document());
-    if (aDoc) {
-      std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObj->data());
-      if (aData.get() && aData->isValid()) {
-        TDF_Label anObjLab = aData->label().Father();
-        const TDF_LabelList& aList = myRef->List();
-        for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
-          if (aLIter.Value().IsEqual(anObjLab)) {
-            return true;
-          }
-        }
-      }
-    }
-  } else { // external document object
-    // create new lists because for the current moment remove one of the duplicated elements
-    // from the list is buggy
-    std::ostringstream anIdString; // string with document Id
-    anIdString<<theObj->document()->id();
-    std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObj->data());
-    TCollection_AsciiString anEntry;
-    TDF_Tool::Entry(aData->label().Father(), anEntry);
-    bool aFound = false;
-    TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
-    for (; anExtIter.More(); anExtIter.Next()) {
-      if (anExtIter.Value() == anIdString.str().c_str()) {
-        anExtIter.Next();
-        if (anExtIter.Value() == anEntry) { // fully maches
-          return true;
-        }
-      } else {
-        anExtIter.Next();
-      }
-    }
-  }
-  return false;
+  createHash();
+  return myHashObjects.count(theObj) != 0;
 }
 
-ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty) const
+ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty)
 {
-  std::shared_ptr<Model_Document> aDoc =
-    std::dynamic_pointer_cast<Model_Document>(owner()->document());
-  if (aDoc) {
-    int anIndex = -1;
-    TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
-    for (TDF_ListIteratorOfLabelList aLIter(myRef->List()); aLIter.More(); aLIter.Next()) {
-      if (theWithEmpty || (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()))
-        anIndex++;
-      if (anIndex == theIndex) {
-        return iteratedObject(aLIter, anExtIter, aDoc);
-      }
-      if (aLIter.Value() == myRef->Label()) {
-        anExtIter.Next();
-        anExtIter.Next();
-      }
-    }
+  createHash();
+  std::map<int, ObjectPtr>::iterator aFind;
+  if (theWithEmpty) {
+    aFind = myHashIndex.find(theIndex);
+    if (aFind == myHashIndex.end())
+      return ObjectPtr();
+  } else {
+    aFind = myHashIndexNoEmpty.find(theIndex);
+    if (aFind == myHashIndexNoEmpty.end())
+      return ObjectPtr();
   }
-  return ObjectPtr();
+  return aFind->second;
 }
 
 void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew)
@@ -273,6 +240,7 @@ void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const Objec
         aNewLab = aCurrentLab.Root(); // root means null object
       }
       // do the substitution
+      eraseHash();
       ADD_BACK_REF(theNew);
       if (myRef->InsertAfter(aNewLab, aCurrentLab)) {
         myRef->Remove(aCurrentLab);
@@ -295,6 +263,7 @@ void Model_AttributeRefList::exchange(const ObjectPtr& theObject1, const ObjectP
         std::shared_ptr<Model_Data> aData2 =
           std::dynamic_pointer_cast<Model_Data>(theObject2->data());
         if (aData2.get() && aData2->isValid()) {
+          eraseHash();
           TDF_Label aLab2 = aData2->label().Father();
           // do the substitution: use the temporary label, as usually in exchange
           TDF_Label aTmpLab = aLab1.Root();
@@ -321,6 +290,7 @@ void Model_AttributeRefList::removeLast()
   if (aDoc && !myRef->IsEmpty()) {
     ObjectPtr anObj = aDoc->objects()->object(myRef->Last());
     if (anObj.get()) {
+      eraseHash();
       myRef->Remove(myRef->Last());
       REMOVE_BACK_REF(anObj);
       owner()->data()->sendAttributeUpdated(this);
@@ -333,7 +303,7 @@ void Model_AttributeRefList::remove(const std::set<int>& theIndices)
   std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
       owner()->document());
   if (aDoc && !myRef->IsEmpty()) {
-    // collet labels that will be removed
+    // collect labels that will be removed
     TDF_LabelList aLabelsToRemove;
     TDF_ListIteratorOfLabelList aLabIter(myRef->List());
     for(int aCurrent = 0; aLabIter.More(); aLabIter.Next(), aCurrent++) {
@@ -349,6 +319,7 @@ void Model_AttributeRefList::remove(const std::set<int>& theIndices)
       }
     }
     if (!aLabelsToRemove.IsEmpty()) {
+      eraseHash();
       owner()->data()->sendAttributeUpdated(this);
     }
   }
@@ -369,4 +340,37 @@ void Model_AttributeRefList::reinit()
   if (!myLab.FindAttribute(TDataStd_ExtStringList::GetID(), myExtDocRef)) {
     myExtDocRef = TDataStd_ExtStringList::Set(myLab);
   }
+  eraseHash();
+}
+
+void Model_AttributeRefList::createHash()
+{
+  if (myHashUsed)
+    return;
+  eraseHash();
+  std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
+    owner()->document());
+  if (aDoc) {
+    const TDF_LabelList& aList = myRef->List();
+    TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
+    for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
+      ObjectPtr anObj = iteratedObject(aLIter, anExtIter, aDoc);
+      myHashIndex[int(myHashIndex.size())] = anObj;
+      if (anObj.get()) {
+        myHashIndexNoEmpty[int(myHashIndexNoEmpty.size())] = anObj;
+        myHashObjects.insert(anObj);
+      }
+    }
+    if (!myHashObjects.empty()) // on open document with multi-rotation referenced have no results
+      myHashUsed = true;
+  }
+}
+
+
+void Model_AttributeRefList::eraseHash()
+{
+  myHashObjects.clear();
+  myHashIndex.clear();
+  myHashIndexNoEmpty.clear();
+  myHashUsed = false;
 }
index 1964c7d58d26b945bae3dfbd6a80a6a744b202b7..da674ff49f2b4a9d0c76693518ba9241574d2112 100644 (file)
 class Model_AttributeRefList : public ModelAPI_AttributeRefList
 {
   TDF_Label myLab; ///< the main label of this attribute
+
   Handle_TDataStd_ReferenceList myRef;  ///< references to the features labels
   /// pairs of doc ID and entries if reference is to external object, appends some in this list if
   /// something in myRef is empty
   Handle_TDataStd_ExtStringList myExtDocRef;
- public:
+  bool myHashUsed; ///< true if the hash stored is valid
+  std::set<ObjectPtr> myHashObjects; ///< hashed information: objects existing in the list
+  std::map<int, ObjectPtr> myHashIndex; ///< index to object in the list
+  std::map<int, ObjectPtr> myHashIndexNoEmpty; ///< index to not empty object in the list
+public:
   /// Appends the feature to the end of a list
   MODEL_EXPORT virtual void append(ObjectPtr theObject);
 
@@ -64,7 +69,7 @@ class Model_AttributeRefList : public ModelAPI_AttributeRefList
   /// Returns the list of features
   ///\param theIndex zero-based index in the list
   ///\param theWithEmpty if it is false, counts the not-empty referenced objects only
-  MODEL_EXPORT virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) const;
+  MODEL_EXPORT virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true);
 
   /// Substitutes the feature by another one. Does nothing if such object is not found.
   /// Does not support the external documents objects yet.
@@ -94,6 +99,10 @@ class Model_AttributeRefList : public ModelAPI_AttributeRefList
   ObjectPtr iteratedObject(TDF_ListIteratorOfLabelList& theLIter,
     TDataStd_ListIteratorOfListOfExtendedString& theExtIter,
     std::shared_ptr<Model_Document> theDoc) const;
+  /// Creates the hash-objects containers (does nothing if hash is already correct)
+  void createHash();
+  /// Erases the hashed objects caused by complicated modifications in the list
+  void eraseHash();
 
   friend class Model_Data;
 };
index 7b1259db39ecaa7c013a37deb329fdf113d7fa38..1db965d233bc30a35d1ed1269207245c9ce2be69 100644 (file)
@@ -23,7 +23,6 @@
 #include "Model_Events.h"
 #include "Model_Data.h"
 #include "Model_Document.h"
-#include "Model_SelectionNaming.h"
 #include <Model_Objects.h>
 #include <Model_AttributeSelectionList.h>
 #include <Model_ResultConstruction.h>
 #include <Events_InfoMessage.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Pnt.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
+#include <GeomAPI_ShapeExplorer.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_NExplode.h>
+#include <Selector_Selector.h>
 
-#include <TNaming_Selector.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Tool.hxx>
 #include <TNaming_Builder.hxx>
 #include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_UAttribute.hxx>
@@ -59,6 +61,7 @@
 #include <TopExp_Explorer.hxx>
 #include <BRep_Tool.hxx>
 #include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
 #include <TopExp.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDF_ChildIDIterator.hxx>
@@ -88,10 +91,6 @@ Standard_GUID kCIRCLE_CENTER("d0d0e0f1-217a-4b95-8fbb-0c4132f23718");
 Standard_GUID kELLIPSE_CENTER1("f70df04c-3168-4dc9-87a4-f1f840c1275d");
 // identifier of the selection of the second focus point of ellipse on edge
 Standard_GUID kELLIPSE_CENTER2("1395ae73-8e02-4cf8-b204-06ff35873a32");
-// identifier of the weak naming index
-Standard_GUID kWEAK_NAMING("9dcdd9be-a3a9-46eb-9b16-1c957ab20142");
-// identifier of the weak naming sub-shape type
-Standard_GUID kWEAK_NAMING_SHAPETYPE("6b9cc709-e320-4a1f-9c42-df5622369ea7");
 
 // prefix for the whole feature context identification
 const static std::string kWHOLE_FEATURE = "all-in-";
@@ -131,15 +130,13 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext,
     myRef.setValue(theContext);
   }
 
-  // do noth use naming if selected shape is result shape itself, but not sub-shape
+  // do not use naming if selected shape is result shape itself, but not sub-shape
   TDF_Label aSelLab = selectionLabel();
   aSelLab.ForgetAttribute(kSIMPLE_REF_ID);
   aSelLab.ForgetAttribute(kINVALID_SELECTION);
   aSelLab.ForgetAttribute(kCIRCLE_CENTER);
   aSelLab.ForgetAttribute(kELLIPSE_CENTER1);
   aSelLab.ForgetAttribute(kELLIPSE_CENTER2);
-  aSelLab.ForgetAttribute(kWEAK_NAMING);
-  aSelLab.ForgetAttribute(kWEAK_NAMING_SHAPETYPE);
 
   bool isDegeneratedEdge = false;
   // do not use the degenerated edge as a shape, a null context and shape is used in the case
@@ -157,34 +154,30 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext,
       owner()->data()->blockSendAttributeUpdated(false);
     return false;
   }
-  if (theContext->groupName() == ModelAPI_ResultBody::group()) {
-    ResultBodyPtr aContextBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theContext);
+  bool isSelectBody = theContext->groupName() == ModelAPI_ResultBody::group();
+  if (!isSelectBody) {
+    ResultConstructionPtr aContextConstruction =
+      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
+    isSelectBody = aContextConstruction.get() && !aContextConstruction->isInfinite();
+  }
+  if (isSelectBody) {
+    ResultPtr aContextResult = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
+    GeomShapePtr aContextShape = aContextResult->shape();
     // do not select the whole shape for body:it is already must be in the data framework
     // equal and null selected objects mean the same: object is equal to context,
-    if (aContextBody->shape().get() &&
-        (aContextBody->shape()->isEqual(theSubShape) || !theSubShape.get())) {
+    if (aContextShape.get() && (aContextShape->isEqual(theSubShape) || !theSubShape.get())) {
       aSelLab.ForgetAllAttributes(true);
       TDataStd_UAttribute::Set(aSelLab, kSIMPLE_REF_ID);
     } else {
-      selectBody(aContextBody, theSubShape);
+      selectBody(aContextResult, theSubShape);
     }
   } else if (theContext->groupName() == ModelAPI_ResultConstruction::group()) {
-    ResultConstructionPtr aContextConstruction =
-      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
     aSelLab.ForgetAllAttributes(true); // to remove old selection data
     std::shared_ptr<Model_ResultConstruction> aConstruction =
       std::dynamic_pointer_cast<Model_ResultConstruction>(theContext);
     std::shared_ptr<GeomAPI_Shape> aSubShape;
-    if (theSubShape.get() && !aContextConstruction->shape()->isEqual(theSubShape))
+    if (theSubShape.get() && !aConstruction->shape()->isEqual(theSubShape))
       aSubShape = theSubShape; // the whole context
-    if (aConstruction->isInfinite()) {
-      // For correct naming selection, put the shape into the naming structure.
-      // It seems sub-shapes are not needed: only this shape is (and can be ) selected.
-      TNaming_Builder aBuilder(aSelLab);
-      aBuilder.Generated(aContextConstruction->shape()->impl<TopoDS_Shape>());
-    }
-    int anIndex = aConstruction->select(theSubShape, owner()->document());
-    TDataStd_Integer::Set(aSelLab, anIndex);
   } else if (theContext->groupName() == ModelAPI_ResultPart::group()) {
     aSelLab.ForgetAllAttributes(true);
     TDataStd_UAttribute::Set(aSelLab, kPART_REF_ID);
@@ -339,8 +332,8 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::internalValue(CenterTyp
   if (myRef.isInitialized()) {
     if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape
       ResultPtr aContext = context();
-      if (!aContext.get())
-        return aResult; // empty result
+      if (!aContext.get() || aContext->groupName() == ModelAPI_ResultConstruction::group())
+        return aResult; // empty result, for whole construction selection also
       return aContext->shape();
     }
     if (aSelLab.IsAttribute(kPART_REF_ID)) {
@@ -389,30 +382,10 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::internalValue(CenterTyp
         }
         return GeomAlgoAPI_CompoundBuilder::compound(allShapes);
       }
-    }
-
-    if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used
-      Handle(TDataStd_Integer) aWeakId;
-      aSelLab.FindAttribute(kWEAK_NAMING, aWeakId);
-      // get the context shape
-      GeomShapePtr aContextShape;
-      ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(context());
-      if (aBody.get()) {
-        aContextShape = aBody->shape();
-      } else {
-        ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
-        if (aResult) {
-          aContextShape = aResult->shape();
-        }
+    } else {
+      if (contextFeature().get()) {
+        return aResult; // for the whole sketch feature selected return null => all faces
       }
-      if (!aContextShape.get())
-        return GeomShapePtr();
-      Handle(TDataStd_Integer) aWeakShapeType;
-      aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType);
-      GeomAlgoAPI_NExplode aNExplode(
-        aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get()));
-      GeomShapePtr aValue = aNExplode.shape(aWeakId->Get());
-      return aValue;
     }
 
     Handle(TNaming_NamedShape) aSelection;
@@ -421,12 +394,7 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::internalValue(CenterTyp
       aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
       aResult->setImpl(new TopoDS_Shape(aSelShape));
     } else if (aConstr) { // simple construction element: just shape of this construction element
-      Handle(TDataStd_Integer) anIndex;
-      if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
-        if (anIndex->Get() == 0) // it is just reference to construction, nothing is in value
-          return aResult;
-        return aConstr->shape(anIndex->Get(), owner()->document());
-      }
+      aResult = aConstr->shape();
     }
   }
   return aResult;
@@ -454,11 +422,7 @@ bool Model_AttributeSelection::isInitialized()
         std::shared_ptr<Model_ResultConstruction> aConstr =
           std::dynamic_pointer_cast<Model_ResultConstruction>(context());
         if (aConstr.get()) {
-          Handle(TDataStd_Integer) anIndex;
-          if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
-            // for the whole shape it may return null, so, if index exists, returns true
             return true;
-          }
         }
         // for the whole feature, a feature object
         FeaturePtr aFeat = contextFeature();
@@ -471,7 +435,8 @@ bool Model_AttributeSelection::isInitialized()
 }
 
 Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel)
-  : myRef(theLabel)
+: myRef(theLabel),
+  myIsGeometricalSelection(false)
 {
   myIsInitialized = myRef.isInitialized();
   myParent = NULL;
@@ -481,6 +446,13 @@ void Model_AttributeSelection::setID(const std::string theID)
 {
   myRef.setID(theID);
   ModelAPI_AttributeSelection::setID(theID);
+  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
+  if (myParent) {
+    myIsGeometricalSelection = true;//myParent->isGeometricalSelection();
+  } else {
+    myIsGeometricalSelection =
+      ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+  }
 }
 
 ResultPtr Model_AttributeSelection::context()
@@ -502,7 +474,7 @@ ResultPtr Model_AttributeSelection::context()
         if(aPart.get() && aPart->data() == aResult->data()) {
           ResultPtr aPartResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPart);
           FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-          // check that this result is not this-feature result (it is forbidden t oselect itself)
+          // check that this result is not this-feature result (it is forbidden tselect itself)
           if(anOwnerFeature.get() && anOwnerFeature->firstResult() != aPartResult) {
             return aPartResult;
           }
@@ -538,69 +510,6 @@ void Model_AttributeSelection::setObject(const std::shared_ptr<ModelAPI_Object>&
   myRef.setObject(theObject);
 }
 
-TDF_LabelMap& Model_AttributeSelection::scope()
-{
-  if (myScope.IsEmpty()) { // create a new scope if not yet done
-    // gets all features with named shapes that are before this feature label (before in history)
-    DocumentPtr aMyDoc = owner()->document();
-    std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures = aMyDoc->allFeatures();
-    std::list<std::shared_ptr<ModelAPI_Feature> >::iterator aFIter = allFeatures.begin();
-    bool aMePassed = false;
-    CompositeFeaturePtr aComposite =
-      std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(owner());
-    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-    CompositeFeaturePtr aCompositeOwner, aCompositeOwnerOwner;
-    if (aFeature.get()) {
-      aCompositeOwner = ModelAPI_Tools::compositeOwner(aFeature);
-      if (aCompositeOwner.get()) {
-         aCompositeOwnerOwner = ModelAPI_Tools::compositeOwner(aCompositeOwner);
-      }
-    }
-    // for group Scope is not limitet: this is always up to date objects
-    // this causes problem in galeries.py
-    //bool isGroup = aFeature.get() && aFeature->getKind() == "Group";
-    for(; aFIter != allFeatures.end(); aFIter++) {
-      if (*aFIter == owner()) {  // the left features are created later (except subs of composite)
-        aMePassed = true;
-        continue;
-      }
-      //if (isGroup) aMePassed = false;
-      bool isInScope = !aMePassed;
-      if (!isInScope && aComposite.get()) {
-        // try to add sub-elements of composite if this is composite
-        if (aComposite->isSub(*aFIter))
-          isInScope = true;
-      }
-      // remove the composite-owner of this feature (sketch in extrusion-cut)
-      if (isInScope && (aCompositeOwner == *aFIter || aCompositeOwnerOwner == *aFIter))
-        isInScope = false;
-
-      if (isInScope && aFIter->get() && (*aFIter)->data()->isValid()) {
-        TDF_Label aFeatureLab = std::dynamic_pointer_cast<Model_Data>(
-          (*aFIter)->data())->label().Father();
-        TDF_ChildIDIterator aNSIter(aFeatureLab, TNaming_NamedShape::GetID(), true);
-        for(; aNSIter.More(); aNSIter.Next()) {
-          Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
-          if (!aNS.IsNull() && aNS->Evolution() != TNaming_SELECTED) {
-            myScope.Add(aNS->Label());
-          }
-        }
-      }
-    }
-    // also add all naming labels created for external constructions
-    std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(aMyDoc);
-    TDF_Label anExtDocLab = aDoc->extConstructionsLabel();
-    TDF_ChildIDIterator aNSIter(anExtDocLab, TNaming_NamedShape::GetID(), true);
-    for(; aNSIter.More(); aNSIter.Next()) {
-      Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
-      if (!aNS.IsNull() && aNS->Evolution() != TNaming_SELECTED) {
-        myScope.Add(aNS->Label());
-      }
-    }
-  }
-  return myScope;
-}
-
 /// Sets the invalid flag if flag is false, or removes it if "true"
 /// Returns theFlag
 static bool setInvalidIfFalse(TDF_Label& theLab, const bool theFlag) {
@@ -642,6 +551,7 @@ bool Model_AttributeSelection::update()
 {
   FeaturePtr aContextFeature = contextFeature();
   if (aContextFeature.get()) {
+    owner()->data()->sendAttributeUpdated(this);  // send updated if "update" called in any way
     return true;
   }
   TDF_Label aSelLab = selectionLabel();
@@ -663,46 +573,25 @@ bool Model_AttributeSelection::update()
   }
 
   if (aContext->groupName() == ModelAPI_ResultBody::group()) {
-    if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used
-      Handle(TDataStd_Integer) aWeakId;
-      aSelLab.FindAttribute(kWEAK_NAMING, aWeakId);
-      // get the context shape
-      GeomShapePtr aContextShape;
-      ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContext);
-      if (aBody.get()) {
-        aContextShape = aBody->shape();
-      } else {
-        ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
-        if (aResult) {
-          aContextShape = aResult->shape();
-        }
-      }
-      if (!setInvalidIfFalse(aSelLab, aContextShape.get() != NULL)) // context shape not found
-        return false;
-      Handle(TDataStd_Integer) aWeakShapeType;
-      aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType);
-      GeomAlgoAPI_NExplode aNExplode(
-        aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get()));
-      GeomShapePtr aValue = aNExplode.shape(aWeakId->Get());
-      return setInvalidIfFalse(aSelLab, aValue.get() != NULL);
-    }
-    // body: just a named shape, use selection mechanism from OCCT
-    TNaming_Selector aSelector(aSelLab);
+    // body: just a named shape, use topological selection mechanism
+    bool aResult = false;
     TopoDS_Shape anOldShape;
-    if (!aSelector.NamedShape().IsNull()) {
-      anOldShape = aSelector.NamedShape()->Get();
-    }
-    bool aResult = aSelector.Solve(scope()) == Standard_True;
-    // must be before sending of updated attribute (1556)
-    aResult = setInvalidIfFalse(aSelLab, aResult);
+    Handle(TNaming_NamedShape) aNS;
+    if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+      anOldShape = aNS->Get();
+
+    TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+    Selector_Selector aSelector(aSelLab, baseDocumentLab());
+    aResult = aSelector.restore(aContextShape);
+    setInvalidIfFalse(aSelLab, aResult);
+
     TopoDS_Shape aNewShape;
-    if (!aSelector.NamedShape().IsNull()) {
-      aNewShape = aSelector.NamedShape()->Get();
-    }
-    if (anOldShape.IsNull() || aNewShape.IsNull() ||
-        !anOldShape.IsEqual(aSelector.NamedShape()->Get())) {
-      // shape type shoud not not changed: if shape becomes compound of such shapes, then split
-      if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() &&
+    if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+      aNewShape = aNS->Get();
+
+    if (anOldShape.IsNull() || aNewShape.IsNull() || !anOldShape.IsEqual(aNewShape)) {
+      // shape type should not be changed: if shape becomes compound of such shapes, then split
+      if (!myIsGeometricalSelection && myParent && !anOldShape.IsNull() && !aNewShape.IsNull() &&
           anOldShape.ShapeType() != aNewShape.ShapeType() &&
           (aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID))
       {
@@ -714,22 +603,21 @@ bool Model_AttributeSelection::update()
   }
 
   if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
-    Handle(TDataStd_Integer) anIndex;
-    if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
-      std::shared_ptr<Model_ResultConstruction> aConstructionContext =
-        std::dynamic_pointer_cast<Model_ResultConstruction>(aContext);
-      bool aModified = true;
-      bool aValid = aConstructionContext->update(anIndex->Get(), owner()->document(), aModified);
-      setInvalidIfFalse(aSelLab, aValid);
-      if (aConstructionContext->isInfinite()) {
-        // Update the selected shape.
-        TNaming_Builder aBuilder(aSelLab);
-        aBuilder.Generated(aConstructionContext->shape()->impl<TopoDS_Shape>());
-      }
-      if (aModified)
-        owner()->data()->sendAttributeUpdated(this);
-      return aValid;
+    bool aResult = true;
+    std::shared_ptr<Model_ResultConstruction> aConstructionContext =
+      std::dynamic_pointer_cast<Model_ResultConstruction>(aContext);
+    if (!aConstructionContext->isInfinite()) {
+      TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+      Selector_Selector aSelector(aSelLab, baseDocumentLab());
+      TopoDS_Shape anOldShape = aSelector.value();
+      aResult = aSelector.restore(aContextShape);
+      setInvalidIfFalse(aSelLab, aResult);
+      if (aResult && !anOldShape.IsEqual(aSelector.value()))
+        owner()->data()->sendAttributeUpdated(this);  // send updated if shape is changed
+    } else {
+      owner()->data()->sendAttributeUpdated(this);  // send updated if "update" called in any way
     }
+    return aResult;
   }
   return setInvalidIfFalse(aSelLab, false); // unknown case
 }
@@ -738,10 +626,9 @@ void Model_AttributeSelection::selectBody(
   const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
 {
   // perform the selection
-  TNaming_Selector aSel(selectionLabel());
   TopoDS_Shape aContext;
 
-  ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theContext);//myRef.value()
+  ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
   if (aBody) {
     aContext = aBody->shape()->impl<TopoDS_Shape>();
   } else {
@@ -755,116 +642,25 @@ void Model_AttributeSelection::selectBody(
     }
   }
 
-  // with "recover" feature the selected context may be not up to date (issue 1710)
-  Handle(TNaming_NamedShape) aResult;
-  TDF_Label aSelLab = selectionLabel();
-  TopoDS_Shape aNewContext = aContext;
-  bool isUpdated = true;
-  while(!aNewContext.IsNull() && isUpdated) {
-    // searching for the very last shape that was produced from this one
-    isUpdated = false;
-    if (!TNaming_Tool::HasLabel(aSelLab, aNewContext))
-      // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists
-      break;
-    for(TNaming_SameShapeIterator anIter(aNewContext, aSelLab); anIter.More(); anIter.Next()) {
-      TDF_Label aNSLab = anIter.Label();
-      if (!scope().Contains(aNSLab))
-        continue;
-      Handle(TNaming_NamedShape) aNS;
-      if (aNSLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-        for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) {
-          if (aShapesIter.Evolution() == TNaming_SELECTED)
-            continue; // don't use the selection evolution
-          if (!aShapesIter.OldShape().IsNull() && aShapesIter.OldShape().IsSame(aNewContext)) {
-             // found the original shape
-            aNewContext = aShapesIter.NewShape(); // go to the newer shape
-            isUpdated = true;
-            break;
-          }
-        }
-      }
-    }
-  }
-  if (aNewContext.IsNull()) { // a context is already deleted
-    setInvalidIfFalse(aSelLab, false);
-    Events_InfoMessage("Model_AttributeSelection", "Failed to select shape already deleted").send();
-    return;
-  }
-
-  TopoDS_Shape aNewSub = theSubShape ? theSubShape->impl<TopoDS_Shape>() : aContext;
-  if (!aNewSub.IsEqual(aContext)) { // searching for subshape in the new context
-    bool isFound = false;
-    TopExp_Explorer anExp(aNewContext, aNewSub.ShapeType());
-    for(; anExp.More(); anExp.Next()) {
-      if (anExp.Current().IsSame(aNewSub)) {
-        isFound = true;
-        break;
-      }
-    }
-    if (!isFound) { // sub-shape is not found in the up-to-date instance of the context shape
-      // if context is sub-result of compound/compsolid, selection of sub-shape better propagate to
-      // the main result (which is may be modified); the case is in 1799
-      ResultBodyPtr aMain = ModelAPI_Tools::bodyOwner(theContext);
-      while(ModelAPI_Tools::bodyOwner(aMain).get())
-        aMain = ModelAPI_Tools::bodyOwner(theContext);
-      if (aMain.get()) {
-        selectBody(aMain, theSubShape);
-        return;
-      }
-      setInvalidIfFalse(aSelLab, false);
-      Events_InfoMessage("Model_AttributeSelection",
-        "Failed to select sub-shape already modified").send();
-      return;
-    }
-  }
-
-  /// fix for issue 411: result modified shapes must not participate in this selection mechanism
   if (!aContext.IsNull()) {
-    FeaturePtr aFeatureOwner = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-    bool aEraseResults = false;
-    if (aFeatureOwner.get()) {
-      aEraseResults = !aFeatureOwner->results().empty();
-      if (aEraseResults) // erase results without flash deleted and redisplay: do it after Select
-        aFeatureOwner->removeResults(0, false, false);
-    }
+    TDF_Label aSelLab = selectionLabel();
+    TopoDS_Shape aNewSub = theSubShape->impl<TopoDS_Shape>();
+
     bool aSelectorOk = true;
+    Selector_Selector aSelector(aSelLab, baseDocumentLab());
     try {
-      aSel.Select(aNewSub, aNewContext);
+      aSelectorOk = aSelector.select(aContext, aNewSub, myIsGeometricalSelection);
+      if (aSelectorOk) {
+        aSelectorOk = aSelector.store(aContext);
+      }
     } catch(...) {
       aSelectorOk = false;
     }
-    // face may become divided after the model update, so, new labels may be added to the scope
-    myScope.Clear();
-
-    // check that selection is correct, otherwise use weak naming solution
-    TDF_Label aSelLab = selectionLabel();
-    aSelLab.ForgetAttribute(kWEAK_NAMING);
-    Handle(TNaming_NamedShape) aSelectorShape;
-    if (aSelectorOk && aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aSelectorShape))
-    {
-      TopoDS_Shape aShape = aSelectorShape->Get();
-      if (aShape.IsNull() || aShape.ShapeType() != aNewSub.ShapeType())
-        aSelectorOk = false;
-    }
-    if (!aSelectorOk) { // weak naming identifier instead
-      GeomShapePtr aContextShape(new GeomAPI_Shape);
-      aContextShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewContext));
-      GeomShapePtr aValueShape(new GeomAPI_Shape);
-      aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewSub));
-
-      GeomAlgoAPI_NExplode aNExplode(aContextShape, aValueShape->shapeType());
-      int anId = aNExplode.index(aValueShape);
-      if (anId) {
-        TDataStd_Integer::Set(aSelLab, kWEAK_NAMING, anId);
-        TDataStd_Integer::Set(aSelLab, kWEAK_NAMING_SHAPETYPE, int(aValueShape->shapeType()));
-      }
-    }
-
-    if (aEraseResults) { // flash after Select : in Groups it makes selection with shift working
-      static Events_Loop* aLoop = Events_Loop::loop();
-      static const Events_ID kDeletedEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
-      aLoop->flush(kDeletedEvent);
+    if (aSelectorOk) {
+      TopoDS_Shape aShape = aSelector.value();
+      aSelectorOk = !aShape.IsNull() && aShape.ShapeType() == aNewSub.ShapeType();
     }
+    setInvalidIfFalse(aSelLab, aSelectorOk);
   }
 }
 
@@ -947,16 +743,34 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
   }
 
   TDF_Label aSelLab = selectionLabel();
-  Handle(TDataStd_Integer) aWeakId;
-  if (aSelLab.FindAttribute(kWEAK_NAMING, aWeakId)) { // a weak naming is used
-    std::ostringstream aNameStream;
-    aNameStream<<aCont->data()->name()<<"/weak_name_"<<aWeakId->Get();
-    return aNameStream.str();
+  if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // whole context, no value
+    return contextName(aCont);
+  }
+
+  // if it is in result of another part
+  if (aCont->groupName() == ModelAPI_ResultPart::group()) {
+    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aCont);
+    int anIndex;
+    GeomShapePtr aValue = value();
+    if (aValue.get())
+      return aPart->data()->name() + "/" + aPart->nameInPart(aValue, anIndex);
+    else
+      return aPart->data()->name();
+  }
+
+
+  // whole infinitive construction
+  if (aCont->groupName() == ModelAPI_ResultConstruction::group()) {
+    ResultConstructionPtr aConstr = std::dynamic_pointer_cast<Model_ResultConstruction>(aCont);
+    if (aConstr->isInfinite()) {
+      return contextName(aCont);
+    }
   }
 
-  Model_SelectionNaming aSelNaming(aSelLab);
-  std::string aResult = aSelNaming.namingName(
-    aCont, aSubSh, theDefaultName, owner()->document() != aCont->document());
+  Selector_Selector aSelector(aSelLab, baseDocumentLab());
+  std::string aResult;
+  if (aCont->shape().get() && aSelector.restore(aCont->shape()->impl<TopoDS_Shape>()))
+    aResult = aSelector.name(this);
   if (aCenterType != NOT_CENTER) {
     aResult += centersMap()[aCenterType];
   }
@@ -989,172 +803,116 @@ void Model_AttributeSelection::selectSubShape(
   CenterType aCenterType = theType[0] == 'v' || theType[0] == 'V' ? // only for vertex-type
     centerTypeByName(aSubShapeName) : NOT_CENTER;
   std::string aType = aCenterType == NOT_CENTER ? theType : "EDGE"; // search for edge now
+  static const GeomShapePtr anEmptyShape;
 
   // first iteration is selection by name without center prefix, second - in case of problem,
   // try with initial name
-  for(int aUseCenter = 1; aUseCenter >= 0; aUseCenter--) {
+  for(int aUseCenter = 1; aUseCenter >= 0; aUseCenter--)  {
     if (aUseCenter == 0 && aCenterType != NOT_CENTER) {
       aSubShapeName = theSubShapeName;
       aCenterType = NOT_CENTER;
       aType = theType;
     } else if (aUseCenter != 1) continue;
+    TopAbs_ShapeEnum aShapeType =  TopAbs_ShapeEnum(GeomAPI_Shape::shapeTypeByStr(aType));
 
+    std::shared_ptr<Model_Document> aDoc =
+      std::dynamic_pointer_cast<Model_Document>(owner()->document());
     // check this is Part-name: 2 delimiters in the name
     std::size_t aPartEnd = aSubShapeName.find('/');
-    if (aPartEnd != std::string::npos && aPartEnd != aSubShapeName.rfind('/')) {
+    if (aPartEnd != std::string::npos) {
       std::string aPartName = aSubShapeName.substr(0, aPartEnd);
-      ObjectPtr aFound = owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
-      if (aFound.get()) { // found such part, so asking it for the name
-        ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFound);
-        std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
-        int anIndex;
-        std::shared_ptr<GeomAPI_Shape> aSelected = aPart->shapeInPart(aNameInPart, aType, anIndex);
-        if (aSelected.get()) {
-          if (aCenterType != NOT_CENTER) {
-            if (!aSelected->isEdge())
-              continue;
-            std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aSelected));
-            setValueCenter(aPart, aSelectedEdge, aCenterType);
-          } else
-            setValue(aPart, aSelected);
-          TDataStd_Integer::Set(selectionLabel(), anIndex);
-          return;
+      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+      if (aPartName == aRootDoc->kind()) {
+        aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
+        aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
+      } else {
+        ObjectPtr aFound =
+          owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
+        if (aFound.get()) { // found such part, so asking it for the name
+          ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFound);
+          std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
+          if (aNameInPart.empty()) { // whole part
+            setValue(aPart, anEmptyShape);
+            return;
+          }
+          int anIndex;
+          std::shared_ptr<GeomAPI_Shape> aSelected =
+            aPart->shapeInPart(aNameInPart, aType, anIndex);
+          if (aSelected.get()) {
+            if (aCenterType != NOT_CENTER) {
+              if (!aSelected->isEdge())
+                continue;
+              std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aSelected));
+              setValueCenter(aPart, aSelectedEdge, aCenterType);
+            } else
+              setValue(aPart, aSelected);
+            TDataStd_Integer::Set(selectionLabel(), anIndex);
+            return;
+          }
         }
       }
     }
 
-    std::shared_ptr<Model_Document> aDoc =
-      std::dynamic_pointer_cast<Model_Document>(owner()->document());
     // check this is a whole feature context
     if (aSubShapeName.size() > kWHOLE_FEATURE.size() &&
       aSubShapeName.substr(0, kWHOLE_FEATURE.size()) == kWHOLE_FEATURE) {
       std::string aFeatureName = aSubShapeName.substr(kWHOLE_FEATURE.size());
       ObjectPtr anObj = aDoc->objectByName(ModelAPI_Feature::group(), aFeatureName);
       if (anObj.get()) {
-        static const GeomShapePtr anEmptyShape;
         setValue(anObj, anEmptyShape);
         return;
       }
     }
 
-    Model_SelectionNaming aSelNaming(selectionLabel());
-    std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected;
-    ResultPtr aCont;
-    if (aSelNaming.selectSubShape(aType, aSubShapeName, aDoc, aShapeToBeSelected, aCont)) {
-      // try to find the last context to find the up to date shape
-      if (aCont->shape().get() && !aCont->shape()->isNull() &&
-        aCont->groupName() == ModelAPI_ResultBody::group() && aDoc == owner()->document()) {
-        const TopoDS_Shape aConShape = aCont->shape()->impl<TopoDS_Shape>();
-        if (!aConShape.IsNull()) {
-          Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
-          if (!aNS.IsNull()) {
-            aNS = TNaming_Tool::CurrentNamedShape(aNS);
-            if (!aNS.IsNull() && scope().Contains(aNS->Label())) { // scope check is for 2228
-              TDF_Label aLab = aNS->Label();
-              if (aLab.Depth() % 2 == 0)
-                aLab = aLab.Father();
-              ObjectPtr anObj = aDoc->objects()->object(aLab);
-              while(!anObj.get() && aLab.Depth() > 5) {
-                aLab = aLab.Father().Father();
-                anObj = aDoc->objects()->object(aLab);
-              }
-
-              if (anObj.get()) {
-                ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
-                if (aRes)
-                  aCont = aRes;
-              }
-            }
-          }
-        }
-      }
-      // if compsolid is context, try to take sub-solid as context: like in GUI and scripts
-      if (aCont.get() && aShapeToBeSelected.get()) {
-        ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aCont);
-        if (aComp && aComp->numberOfSubs()) {
-          std::list<ResultPtr> allSubs;
-          ModelAPI_Tools::allSubs(aComp, allSubs);
-          std::list<ResultPtr>::iterator aS = allSubs.begin();
-          for(; aS != allSubs.end(); aS++) {
-            ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aS);
-            if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() &&
-                aSub->shape()->isSubShape(aShapeToBeSelected)) {
-              aCont = aSub;
-              break;
-            }
-          }
-        }
+    // the whole result selection check
+    if (aSubShapeName.find('/') == std::string::npos) {
+      ObjectPtr aRes = aDoc->objectByName(ModelAPI_ResultConstruction::group(), aSubShapeName);
+      if (!aRes.get())
+        aRes = aDoc->objectByName(ModelAPI_ResultBody::group(), aSubShapeName);
+      if (aRes.get()) {
+        setValue(aRes, anEmptyShape);
+        return;
       }
-      // try to find the latest active result that must be used instead of the selected
-      // to set the active context (like in GUI selection), not concealed one
-      bool aFindNewContext = true;
-      while(aFindNewContext && aCont.get()) {
-        aFindNewContext = false;
-        // take references to all results: root one, any sub
-        ResultBodyPtr aCompContext = ModelAPI_Tools::bodyOwner(aCont, true);
-        std::list<ResultPtr> allRes;
-        if (aCompContext.get()) {
-          ModelAPI_Tools::allSubs(aCompContext, allRes);
-          allRes.push_back(aCompContext);
-        } else {
-          allRes.push_back(aCont);
-        }
-        for(std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
-          ResultPtr aResCont = *aSub;
-          ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
-          // only lower and higher level subs are counted
-          if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext)
-            continue;
-          const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
-          std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
-          for(; !aFindNewContext && aRef != aRefs.end(); aRef++) {
-            if (!aRef->get() || !(*aRef)->owner().get())
-              continue;
-            // concealed attribute only
-            FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
-            if (!ModelAPI_Session::get()->validators()->isConcealed(
-              aRefFeat->getKind(), (*aRef)->id()))
+    }
+
+    Selector_Selector aSelector(selectionLabel(), baseDocumentLab());
+    myRestoreDocument = aDoc;
+    TDF_Label aContextLabel = aSelector.restoreByName(
+      aSubShapeName, aShapeType, this, myIsGeometricalSelection);
+    myRestoreDocument.reset();
+    if (!aContextLabel.IsNull()) {
+      ResultPtr aContext = aDoc->resultByLab(aContextLabel); // any label for document access
+      if (aContext.get() && aContext->shape().get()) {
+        TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+        if (aSelector.solve(aContextShape)) {
+          TopoDS_Shape aSelectorShape = aSelector.value();
+          GeomShapePtr aShapeToBeSelected(new GeomAPI_Shape);
+          aShapeToBeSelected->setImpl<TopoDS_Shape>(new TopoDS_Shape(aSelectorShape));
+          // make the context result the latest existing
+          aContext = newestContext(aContext, aShapeToBeSelected);
+          if (myIsGeometricalSelection || aCenterType == NOT_CENTER) {
+            // store the currently generated name
+            selectionLabel().ForgetAllAttributes(true);
+            bool aToUnblock = false;
+            aToUnblock = !owner()->data()->blockSendAttributeUpdated(true);
+            myRef.setValue(aContext);
+            aSelector.store(aContextShape);
+            owner()->data()->sendAttributeUpdated(this);
+            if (aToUnblock)
+              owner()->data()->blockSendAttributeUpdated(false);
+            return;
+          } else { // re-select center of circle/arc by context and value
+            if (!aShapeToBeSelected->isEdge())
               continue;
-            // search the feature result that contains sub-shape selected
-            std::list<std::shared_ptr<ModelAPI_Result> > aResults;
-
-            // take all sub-results or one result
-            std::list<ResultPtr> aRefFeatResults;
-            ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults);
-            std::list<ResultPtr>::iterator aRefResIter = aRefFeatResults.begin();
-            for(; aRefResIter != aRefFeatResults.end(); aRefResIter++) {
-              ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefResIter);
-              if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs
-                aResults.push_back(aBody);
-            }
-            std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = aResults.begin();
-            for(; aResIter != aResults.end(); aResIter++) {
-              if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
-                continue;
-              GeomShapePtr aShape = (*aResIter)->shape();
-              GeomShapePtr aSelectedShape =
-                aShapeToBeSelected.get() ? aShapeToBeSelected : aCont->shape();
-              if (aShape.get() && aShape->isSubShape(aSelectedShape, false)) {
-                aCont = *aResIter; // found new context (produced from this) with same subshape
-                aFindNewContext = true; // continue searching futher
-                break;
-              }
-            }
+            std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected));
+            setValueCenter(aContext, aSelectedEdge, aCenterType);
           }
+          return;
         }
       }
-
-      if (aCenterType != NOT_CENTER) {
-        if (!aShapeToBeSelected->isEdge())
-          continue;
-        std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected));
-        setValueCenter(aCont, aSelectedEdge, aCenterType);
-      } else
-        setValue(aCont, aShapeToBeSelected);
-      return;
     }
   }
-
+  // invalid
   TDF_Label aSelLab = selectionLabel();
   setInvalidIfFalse(aSelLab, false);
   reset();
@@ -1249,24 +1007,15 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType,
   const std::string& theContextName, const int theIndex)
 {
   // selection of context by name
-  //std::string aNamingContextName = theContextName + "/";
-  //selectSubShape(theType, aNamingContextName);
-  std::shared_ptr<Model_Document> aDoc =
-    std::dynamic_pointer_cast<Model_Document>(owner()->document());
-  if (aDoc.get()) {
-    bool aUnique = true;
-    std::string aContextName = theContextName;
-    std::string anEmptySub = "";
-    ResultPtr aContext = aDoc->findByName(aContextName, anEmptySub, aUnique);
-    //ResultPtr aContext = context();
-    if (aContext.get()) {
-      GeomShapePtr aContShape = aContext->shape();
-      if (aContShape.get()) {
-        GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType));
-        GeomShapePtr aValue = aNExp.shape(theIndex);
-        if (aValue.get())
-          setValue(aContext, aValue);
-      }
+  selectSubShape(theType, theContextName);
+  ResultPtr aContext = context();
+  if (aContext.get()) {
+    GeomShapePtr aContShape = aContext->shape();
+    if (aContShape.get()) {
+      GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType));
+      GeomShapePtr aValue = aNExp.shape(theIndex);
+      if (aValue.get())
+        setValue(aContext, aValue);
     }
   }
 }
@@ -1365,16 +1114,9 @@ void Model_AttributeSelection::computeValues(
 {
   bool aWasWholeContext = theValShape.IsNull();
   if (aWasWholeContext) {
-    //theShapes.Append(theValShape);
-    //return;
     theValShape = theOldContext->shape()->impl<TopoDS_Shape>();
   }
-  //TopoDS_Shape anOldContShape = theOldContext->shape()->impl<TopoDS_Shape>();
   TopoDS_Shape aNewContShape = theNewContext->shape()->impl<TopoDS_Shape>();
-  //if (anOldContShape.IsSame(theValShape)) { // full context shape substituted by new full context
-    //theShapes.Append(aNewContShape);
-    //return;
-  //}
   // if a new value is unchanged in the new context, do nothing: value is correct
   TopExp_Explorer aSubExp(aNewContShape, theValShape.ShapeType());
   for(; aSubExp.More(); aSubExp.Next()) {
@@ -1408,9 +1150,9 @@ void Model_AttributeSelection::computeValues(
     for(; aNewContIter != aNewToIterate.end(); aNewContIter++) {
       std::shared_ptr<Model_Data> aNewData =
         std::dynamic_pointer_cast<Model_Data>((*aNewContIter)->data());
-      TDF_Label aNewLab = aNewData->label();
+      TDF_Label aNewLab = aNewData->shapeLab();
       // searching for produced sub-shape fully on some label
-      TDF_ChildIDIterator aNSIter(aNewLab, TNaming_NamedShape::GetID(), Standard_True);
+      TDF_ChildIDIterator aNSIter(aNewLab, TNaming_NamedShape::GetID());
       for(; aNSIter.More(); aNSIter.Next()) {
         Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
         for(TNaming_Iterator aPairIter(aNS); aPairIter.More(); aPairIter.Next()) {
@@ -1441,7 +1183,7 @@ void Model_AttributeSelection::computeValues(
     }
   }
   if (aToFindPart == 2 && !aNewToOld.IsEmpty()) {
-    // map of sub-shapes -> number of occurences of these shapes in containers
+    // map of sub-shapes -> number of occurrences of these shapes in containers
     NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> aSubs;
     TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld);
     for(; aContIter.More(); aContIter.Next()) {
@@ -1502,33 +1244,31 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr<Model_Document>
       if (!aModifierFeat.get())
         continue;
       FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-      if (aModifierFeat == aThisFeature || theDoc->objects()->isLater(aModifierFeat, aThisFeature))
+      if (aModifierFeat == aThisFeature || !theDoc->isLaterByDep(aThisFeature, aModifierFeat))
         continue; // the modifier feature is later than this, so, should not be used
       FeaturePtr aCurrentModifierFeat = theDoc->feature(theContext);
       if (aCurrentModifierFeat == aModifierFeat ||
-        theDoc->objects()->isLater(aCurrentModifierFeat, aModifierFeat))
+        !theDoc->isLaterByDep(aModifierFeat, aCurrentModifierFeat))
         continue; // the current modifier is later than the found, so, useless
       Handle(TNaming_NamedShape) aNewNS;
       aModifIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNewNS);
       if (aNewNS->Evolution() == TNaming_MODIFY || aNewNS->Evolution() == TNaming_GENERATED) {
         aResults.insert(aModifierObj);
-        //TNaming_Iterator aPairIter(aNewNS);
-        //aResContShapes.Append(aPairIter.NewShape());
         aResContShapes.Append(aModifierObj->shape()->impl<TopoDS_Shape>());
       } else if (aNewNS->Evolution() == TNaming_DELETE) { // a shape was deleted => result is empty
         aResults.insert(ResultPtr());
-      } else { // not-precessed modification => don't support it
+      } else { // not-processed modification => don't support it
         continue;
       }
     }
   }
   if (aResults.empty())
     return false; // no modifications found, must stay the same
-  // iterate all results to find futher modifications
+  // iterate all results to find further modifications
   std::set<ResultPtr>::iterator aResIter = aResults.begin();
   for(; aResIter != aResults.end(); aResIter++) {
     if (aResIter->get() != NULL) {
-      // compute new values by two contextes: the old and the new
+      // compute new values by two contexts: the old and the new
       TopTools_ListOfShape aValShapes;
       computeValues(theContext, *aResIter, theValShape, aValShapes);
 
@@ -1543,7 +1283,7 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr<Model_Document>
         if (searchNewContext(theDoc, aNewContShape, *aResIter, aNewValSh,
                              theAccessLabel, aNewRes, aNewUpdatedVal))
         {
-          // appeand new results instead of the current ones
+          // append new results instead of the current ones
           std::list<ResultPtr>::iterator aNewIter = aNewRes.begin();
           TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal);
           for(; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) {
@@ -1572,7 +1312,7 @@ void Model_AttributeSelection::updateInHistory()
   std::shared_ptr<Model_Data> aContData = std::dynamic_pointer_cast<Model_Data>(aContext->data());
   if (!aContData.get() || !aContData->isValid())
     return;
-  TDF_Label aContLab = aContData->label(); // named shape where the selected context is located
+  TDF_Label aContLab = aContData->shapeLab(); // named shape where the selected context is located
   Handle(TNaming_NamedShape) aContNS;
   if (!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS)) {
     bool aFoundNewContext = true;
@@ -1589,13 +1329,14 @@ void Model_AttributeSelection::updateInHistory()
             // to avoid detection of part changes by local selection only
             AttributeSelectionPtr aSel =
               std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRef);
-            if (aSel.get() && !aSel->value()->isSame(aSel->context()->shape()))
+            if (aSel.get() && aSel->value().get() &&
+                !aSel->value()->isSame(aSel->context()->shape()))
               continue;
 
             FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
             if (aRefFeat.get() && aRefFeat != owner()) {
               FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-              if (aDoc->objects()->isLater(aThisFeature, aRefFeat)) { // found better feature
+              if (!aDoc->isLaterByDep(aRefFeat, aThisFeature)) { // found better feature
                 aFoundNewContext = true;
                 aNewContext = aRefFeat->firstResult();
               }
@@ -1632,63 +1373,436 @@ void Model_AttributeSelection::updateInHistory()
   TopTools_ListOfShape aValShapes;
   if (searchNewContext(aDoc, aNewCShape, aContext, aValShape, aContLab, aNewContexts, aValShapes))
   {
-    // update scope to reset to a new one
-    myScope.Clear();
+    GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE;
+    if (myParent) {
+      if (myParent->selectionType() == "VERTEX") aListShapeType = GeomAPI_Shape::VERTEX;
+      else if (myParent->selectionType() == "EDGE") aListShapeType = GeomAPI_Shape::EDGE;
+      else if (myParent->selectionType() == "FACE") aListShapeType = GeomAPI_Shape::FACE;
+    }
 
     std::list<ResultPtr>::iterator aNewCont = aNewContexts.begin();
     TopTools_ListIteratorOfListOfShape aNewValues(aValShapes);
-    if (aNewCont == aNewContexts.end()) { // all results were deleted
+    bool aFirst = true; // first is set to this, next are appended to parent
+    for(; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) {
+
+      GeomShapePtr aValueShape;
+      if (!aNewValues.Value().IsNull()) {
+        aValueShape = std::make_shared<GeomAPI_Shape>();
+        aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+      }
+      // Check that list has the same type of shape selection before adding.
+      GeomAPI_Shape::ShapeType aShapeShapeType = GeomAPI_Shape::SHAPE;
+      if (aValueShape.get()) {
+        aShapeShapeType = aValueShape->shapeType();
+      } else {
+        aShapeShapeType = (*aNewCont)->shape()->shapeType();
+      }
+      if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) {
+        continue;
+      }
+      if (aFirst) {
+        setValue(*aNewCont, aValueShape);
+        aFirst = false;
+      } else if (myParent) {
+        myParent->append(*aNewCont, aValueShape);
+      }
+    }
+    if (aFirst) { // nothing was added, all results were deleted
       ResultPtr anEmptyContext;
       std::shared_ptr<GeomAPI_Shape> anEmptyShape;
       setValue(anEmptyContext, anEmptyShape); // nullify the selection
       return;
     }
+  }
+}
+
+void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent)
+{
+  myParent = theParent;
+}
 
-    GeomShapePtr aValueShape;
-    if (!aNewValues.Value().IsNull()) {
-      aValueShape = std::make_shared<GeomAPI_Shape>();
-      aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+std::string Model_AttributeSelection::contextName(const TDF_Label theSelectionLab)
+{
+  std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+    std::dynamic_pointer_cast<Model_Document>(owner()->document());
+  FeaturePtr aFeatureOwner = aDoc->featureByLab(theSelectionLab);
+  bool aBaseDocumnetUsed = false;
+  if (!aFeatureOwner.get()) { // use module document
+    aDoc = std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument());
+    aFeatureOwner = aDoc->featureByLab(theSelectionLab);
+    aBaseDocumnetUsed = true;
+  }
+  if (aFeatureOwner.get()) {
+    // if it is sub-element of the sketch, the context name is the name of the sketch
+    // searching also for result - real context
+    ResultPtr aResult;
+    FeaturePtr aComposite = ModelAPI_Tools::compositeOwner(aFeatureOwner);
+    if (aComposite.get() && aComposite->results().size() == 1 &&
+        aComposite->firstResult()->groupName() == ModelAPI_ResultConstruction::group()) {
+      aFeatureOwner = aComposite;
+      aResult = aFeatureOwner->firstResult();
+    } else {
+      aResult = aDoc->resultByLab(theSelectionLab);
     }
-    setValue(*aNewCont, aValueShape);
-    // if there are more than one result, put them by "append" into "parent" list
-    if (myParent) {
-      for(aNewCont++, aNewValues.Next(); aNewCont != aNewContexts.end();
-          aNewCont++, aNewValues.Next()) {
-        GeomShapePtr aValueShape;
-        if (!aNewValues.Value().IsNull()) {
-          aValueShape = std::make_shared<GeomAPI_Shape>();
-          aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+    if (aResult.get()) {
+      // this is to avoid duplicated names of results problem
+      std::string aContextName = aResult->data()->name();
+      // myLab corresponds to the current time
+      TDF_Label aCurrentLab = selectionLabel();
+      while(aCurrentLab.Depth() > 3)
+        aCurrentLab = aCurrentLab.Father();
+
+      int aNumInHistoryNames =
+        aDoc->numberOfNameInHistory(aResult, aCurrentLab);
+      while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times
+        aContextName = "_" + aContextName;
+        aNumInHistoryNames--;
+      }
+      if (aBaseDocumnetUsed)
+        aContextName = aDoc->kind() + "/" + aContextName;
+      return aContextName;
+    }
+  }
+  return ""; // invalid case
+}
+
+/// This method restores by the context and value name the context label and
+/// sub-label where the value is. Returns true if it is valid.
+bool Model_AttributeSelection::restoreContext(std::string theName,
+  TDF_Label& theContext, TDF_Label& theValue)
+{
+  static const GeomShapePtr anEmptyShape; // to store context only
+  std::string aName = theName;
+  std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+    std::dynamic_pointer_cast<Model_Document>(owner()->document());
+
+  // remove the sub-value part if exists
+  std::string aSubShapeName = aName;
+  std::string::size_type n = aName.find('/');
+  if (n != std::string::npos) {
+    aName = aName.substr(0, n);
+  }
+
+  if (aName.empty()) return false;
+  bool anUniqueContext = false;
+  ResultPtr aCont = aDoc->findByName(aName, aSubShapeName, anUniqueContext);
+  if (!aCont.get() || !aCont->shape().get() || aCont->shape()->isNull()) {
+    // name in PartSet?
+    aDoc = std::dynamic_pointer_cast<Model_Document>(
+      ModelAPI_Session::get()->moduleDocument());
+    if (theName.find(aDoc->kind()) == 0) { // remove the document identifier from name if exists
+      aSubShapeName = theName.substr(aDoc->kind().size() + 1);
+      aName = aSubShapeName;
+      std::string::size_type n = aName.find('/');
+      if (n != std::string::npos) {
+        aName = aName.substr(0, n);
+      }
+    }
+    aCont = aDoc->findByName(aName, aSubShapeName, anUniqueContext);
+    if (!aCont.get() || !aCont->shape().get() || aCont->shape()->isNull())
+      return false;
+  }
+
+  // searching the sub-shape
+  static const ResultPtr anEmpty;
+  theValue = aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
+
+  // sketch sub-component shape and name is located in separated feature label, try the sub-name
+  if (theValue.IsNull() && aCont->groupName() == ModelAPI_ResultConstruction::group()) {
+    std::string::size_type aSlash = aSubShapeName.rfind('/');
+    if (aSlash != std::string::npos) {
+      std::string aCompName = aSubShapeName.substr(aSlash + 1);
+      CompositeFeaturePtr aComposite =
+        std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aCont));
+      if (aComposite.get() && aComposite->numberOfSubs()) {
+        const int aSubNum = aComposite->numberOfSubs();
+        for (int a = 0; a < aSubNum && theValue.IsNull(); a++) {
+          FeaturePtr aSub = aComposite->subFeature(a);
+          const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+          std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
+          for (; aRes != aResults.cend() && theValue.IsNull(); aRes++) {
+            if ((*aRes)->data()->name() == aCompName) {
+              theValue = std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->shapeLab();
+              break;
+            } else { // any sub-label because the sketch line may be renamed, but not sub-vertices
+              TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->shapeLab();
+              TDF_ChildIDIterator aSubNames(aLab, TDataStd_Name::GetID());
+              for(; aSubNames.More(); aSubNames.Next()) {
+                if (Handle(TDataStd_Name)::DownCast(aSubNames.Value())->Get().
+                  IsEqual(aCompName.c_str())) {
+                  theValue = aSubNames.Value()->Label();
+                  break;
+                }
+              }
+            }
+          }
         }
+      }
+    }
+  }
+
+  if (aCont.get()) {
+    theContext = std::dynamic_pointer_cast<Model_Data>(aCont->data())->label();
+  }
+  return true;
+}
+
+TDF_Label Model_AttributeSelection::newestContext(const TDF_Label theCurrentContext) {
+  std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+    std::dynamic_pointer_cast<Model_Document>(owner()->document());
+  ResultPtr aContext = aDoc->resultByLab(theCurrentContext);
+  if (aContext.get()) {
+    aContext = newestContext(aContext, GeomShapePtr(), true);
+    if (aContext.get())
+      return std::dynamic_pointer_cast<Model_Data>(aContext->data())->label();
+  }
+  return theCurrentContext; // nothing is changed
+}
+
+bool Model_AttributeSelection::isLater(
+  const TDF_Label theResult1, const TDF_Label theResult2) const
+{
+  std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+    std::dynamic_pointer_cast<Model_Document>(owner()->document());
+  FeaturePtr aFeat1 = aDoc->featureByLab(theResult1);
+  if (!aFeat1.get())
+    return false;
+  FeaturePtr aFeat2 = aDoc->featureByLab(theResult2);
+  if (!aFeat2.get())
+    return false;
+  return aDoc->isLaterByDep(aFeat1, aFeat2);
+}
 
-        // Check that list has the same type of shape selection before adding.
-        GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE;
-        if (myParent->selectionType() == "VERTEX") aListShapeType = GeomAPI_Shape::VERTEX;
-        else if (myParent->selectionType() == "EDGE") aListShapeType = GeomAPI_Shape::EDGE;
-        else if (myParent->selectionType() == "FACE") aListShapeType = GeomAPI_Shape::FACE;
-
-        GeomAPI_Shape::ShapeType aShapeShapeType = GeomAPI_Shape::SHAPE;
-        if (aValueShape.get()) {
-          aShapeShapeType = aValueShape->shapeType();
-        } else {
-          (*aNewCont)->shape()->shapeType();
+ResultPtr Model_AttributeSelection::newestContext(
+  const ResultPtr theCurrent, const GeomShapePtr theValue, const bool theAnyValue)
+{
+  ResultPtr aResult = theCurrent;
+  GeomShapePtr aSelectedShape = theValue.get() ? theValue : theCurrent->shape();
+  std::shared_ptr<Model_Document> aDoc =
+    std::dynamic_pointer_cast<Model_Document>(owner()->document());
+  bool aFindNewContext = true;
+  while (aFindNewContext && aResult.get()) {
+    aFindNewContext = false;
+    // try to find the last context to find the up to date shape
+    TopoDS_Shape aConShape = aResult->shape()->impl<TopoDS_Shape>();
+    if (TNaming_Tool::HasLabel(selectionLabel(), aConShape)) {
+      Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
+      if (!aNS.IsNull()) {
+        aNS = TNaming_Tool::CurrentNamedShape(aNS);
+        if (!aNS.IsNull()
+            && isLater(selectionLabel(), aNS->Label())
+            && isLater(aNS->Label(),
+                       std::dynamic_pointer_cast<Model_Data>(aResult->data())->label()))
+        {
+          TDF_Label aLab = aNS->Label();
+          ResultPtr aRes = aDoc->resultByLab(aLab);
+          if (aRes.get()) {
+            if (theAnyValue || aRes->shape()->isSubShape(aSelectedShape)) {
+              aResult = aRes;
+              aFindNewContext = true;
+              continue;
+            }
+          }
         }
+      }
+    }
+    if (theAnyValue) { // only for neighbors for now
+      // try to find modification of sub-shapes: the best number of matches
+      std::map<ResultPtr, int> aMatches; // result -> number of matches of shapes to find the best
+      TDF_Label aResLab = std::dynamic_pointer_cast<Model_Data>(aResult->data())->shapeLab();
+      TDF_ChildIDIterator aModifIter(aResLab, TNaming_NamedShape::GetID());
+      for(; aModifIter.More(); aModifIter.Next()) {
+        Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aModifIter.Value());
+        if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED) {
+          for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+            TNaming_NewShapeIterator aNewIter(aNSIter.NewShape(), aNS->Label());
+            for(; aNewIter.More(); aNewIter.Next()) {
+              TDF_Label aLab = aNewIter.Label();
+              if (isLater(aLab, aNS->Label()) && isLater(selectionLabel(), aLab)) {
+                ResultPtr aRes = aDoc->resultByLab(aLab);
+                if (aRes.get()) {
+                  if (aMatches.find(aRes) == aMatches.end())
+                    aMatches[aRes] = 0;
+                  aMatches[aRes]++; // found result, add matches
+                }
+              }
+            }
+          }
+        }
+      }
+      // searching for the best result-candidate
+      int aBest = 0;
+      ResultPtr aBestResult;
+      std::map<ResultPtr, int>::iterator aMatchIter = aMatches.begin();
+      for(; aMatchIter != aMatches.end(); aMatchIter++) {
+        if (aMatchIter->second > aBest) {
+          aBest = aMatchIter->second;
+          aBestResult = aMatchIter->first;
+        }
+      }
+      if (aBestResult.get()) {
+        aResult = aBestResult;
+        aFindNewContext = true;
+        continue;
+      }
+    }
+
 
-        if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) {
+    // TestFillWireVertex.py - sketch constructions for wire may participate too
+    //if (aResult->groupName() == ModelAPI_ResultBody::group()) {
+      // try to search newer context by the concealment references
+      // take references to all results: root one, any sub
+    std::list<ResultPtr> allRes;
+    ResultPtr aCompContext;
+    ResultBodyPtr aCompBody = ModelAPI_Tools::bodyOwner(aResult, true);
+    if (aCompBody.get()) {
+      ModelAPI_Tools::allSubs(aCompBody, allRes);
+      allRes.push_back(aCompBody);
+      aCompContext = aCompBody;
+    }
+    if (allRes.empty())
+      allRes.push_back(aResult);
+
+    for (std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
+      ResultPtr aResCont = *aSub;
+      ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
+      if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext)
+        continue; // only lower and higher level subs are counted
+      const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
+      std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
+      for (; !aFindNewContext && aRef != aRefs.end(); aRef++) {
+        if (!aRef->get() || !(*aRef)->owner().get())
+          continue;
+        // concealed attribute only
+        FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
+        if (!ModelAPI_Session::get()->validators()->isConcealed(
+          aRefFeat->getKind(), (*aRef)->id()))
           continue;
+        // search the feature result that contains sub-shape selected
+        std::list<std::shared_ptr<ModelAPI_Result> > aResults;
+
+        // take all sub-results or one result
+        std::list<ResultPtr> aRefFeatResults;
+        ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults);
+        std::list<ResultPtr>::iterator aRefResIter = aRefFeatResults.begin();
+        for (; aRefResIter != aRefFeatResults.end(); aRefResIter++) {
+          ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefResIter);
+          if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs
+            aResults.push_back(aBody);
         }
+        std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = aResults.begin();
 
-        myParent->append(*aNewCont, aValueShape);
+        if (theAnyValue) { // searching the best sub-result by maximum number of references to orig
+          int aReferencesCount = 0;
+          ResultPtr aBestResult;
+          for (; aResIter != aResults.end(); aResIter++) {
+            if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
+              continue;
+            TDF_Label aCandidateLab =
+              std::dynamic_pointer_cast<Model_Data>((*aResIter)->data())->shapeLab();
+            Handle(TDF_Reference) aRef;
+            if (aCandidateLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
+              TDF_Label aRefLab = aRef->Get();
+              ResultPtr aRefRes = aDoc->resultByLab(aRefLab);
+              if (aRefRes.get() && aRefRes->shape().get() &&
+                  aRefRes->shape()->isEqual(aResult->shape())) {// it directly references to result
+                aResult = *aResIter; // found new context (produced from this) with same subshape
+                aFindNewContext = true; // continue searching further
+                break;
+              }
+            } else {
+              if (!aBestResult.get())
+                aBestResult = *aResIter;
+            }
+          }
+          if (aBestResult.get() && !aFindNewContext) { // the first good result for now
+            aResult = aBestResult; // found new context
+            aFindNewContext = true;
+          }
+        } else { // searching by sub-shape
+          for (; aResIter != aResults.end(); aResIter++) {
+            if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
+              continue;
+            GeomShapePtr aShape = (*aResIter)->shape();
+            if (aShape.get() && (theAnyValue || aShape->isSubShape(aSelectedShape, false))) {
+              aResult = *aResIter; // found new context (produced from this) with same subshape
+              aFindNewContext = true; // continue searching further
+              break;
+            }
+          }
+        }
+      }
+    }
+  }
+  // if compsolid is context, try to take sub-solid as context: like in GUI and scripts
+  ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
+  if (aComp && aComp->numberOfSubs()) {
+    std::list<ResultPtr> allSubs;
+    ModelAPI_Tools::allSubs(aComp, allSubs);
+    std::list<ResultPtr>::iterator aS = allSubs.begin();
+    for (; aS != allSubs.end(); aS++) {
+      ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aS);
+      if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() &&
+        (theAnyValue || aSub->shape()->isSubShape(aSelectedShape))) {
+        aResult = aSub;
+        break;
       }
     }
   }
+  // in case sketch line was selected for wire, but wire was concealed and not such line anymore,
+  // so, actually, the sketch element was selected (which is never concealed)
+  if (aResult != theCurrent && aResult->isConcealed())
+    aResult = theCurrent;
+  return aResult;
 }
 
-void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent)
+void Model_AttributeSelection::combineGeometrical()
 {
-  myParent = theParent;
+  if (myTmpContext.get() || myTmpSubShape.get())
+    return;
+  TDF_Label aSelLab = selectionLabel();
+  if (aSelLab.IsAttribute(kINVALID_SELECTION) || !myRef.isInitialized())
+    return;
+
+  if (aSelLab.IsAttribute(kCIRCLE_CENTER) || aSelLab.IsAttribute(kELLIPSE_CENTER1) ||
+      aSelLab.IsAttribute(kELLIPSE_CENTER2) || aSelLab.IsAttribute(kSIMPLE_REF_ID))
+    return;
+
+  if (aSelLab.IsAttribute(kPART_REF_ID)) {
+    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(context());
+    if (!aPart.get() || !aPart->isActivated())
+      return; // postponed naming needed
+    Handle(TDataStd_Integer) anIndex;
+    if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
+      if (anIndex->Get()) { // special selection attribute was created, use it
+        std::string aNewName;
+        aPart->combineGeometrical(anIndex->Get(), aNewName);
+        TDataStd_Name::Set(aSelLab, aNewName.c_str());
+      }
+    }
+    return;
+  }
+
+  std::shared_ptr<Model_ResultConstruction> aConstr =
+    std::dynamic_pointer_cast<Model_ResultConstruction>(context());
+  if (aConstr.get())
+    return;
+  FeaturePtr aFeature = contextFeature();
+  if (aFeature.get())
+    return;
+
+  Selector_Selector aSelector(aSelLab, baseDocumentLab());
+  TopoDS_Shape aContextShape = context()->shape()->impl<TopoDS_Shape>();
+  if (aSelector.restore(aContextShape)) {
+    aSelector.combineGeometrical(aContextShape);
+  }
 }
 
-bool Model_AttributeSelection::isWeakNaming()
+TDF_Label Model_AttributeSelection::baseDocumentLab()
 {
-  return selectionLabel().IsAttribute(kWEAK_NAMING);
+  if (ModelAPI_Session::get()->moduleDocument() != owner()->document())
+    return std::dynamic_pointer_cast<Model_Document>
+      (ModelAPI_Session::get()->moduleDocument())->extConstructionsLabel();
+  static TDF_Label anEmpty;
+  return anEmpty;
 }
index 66f628ebb295069df51d7d450f77351b8b7f386a..9512a3a73ebbdddb13ed03e32c51d020f735905d 100644 (file)
@@ -24,6 +24,7 @@
 #include "Model.h"
 #include "Model_AttributeReference.h"
 #include <ModelAPI_AttributeSelection.h>
+#include <Selector_NameGenerator.h>
 #include <TDF_LabelMap.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopTools_ListOfShape.hxx>
@@ -35,24 +36,29 @@ class Model_Document;
  * \ingroup DataModel
  * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
  */
-class Model_AttributeSelection : public ModelAPI_AttributeSelection
+class Model_AttributeSelection : public ModelAPI_AttributeSelection,
+                                 public Selector_NameGenerator
 {
-  Model_AttributeReference myRef;  ///< The reference functionality reusage
-  TDF_LabelMap myScope; ///< the map of valid labels for naming selection solving
+  Model_AttributeReference myRef;  ///< The reference functionality re-usage
   /// temporarily storages to avoid keeping in the data structure if not needed
   ResultPtr myTmpContext;
   /// temporarily storages to avoid keeping in the data structure if not needed
   std::shared_ptr<GeomAPI_Shape> myTmpSubShape;
   /// temporarily storages to avoid keeping in the data structure if not needed
   CenterType myTmpCenterType;
-  /// Reference to the partent attribute, if any (to split selection compounds in issue 1799)
+  /// Reference to the parent attribute, if any (to split selection compounds in issue 1799)
   Model_AttributeSelectionList* myParent;
+
+  std::shared_ptr<Model_Document> myRestoreDocument; // current document to restore by name
+  /// If true attribute selects geometry instead of shape.
+  bool myIsGeometricalSelection;
+
 public:
   /// Defines the result and its selected sub-shape
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, do not store and name the added in the data framework
-  ///           (used to remove immideately, without the following updates)
+  ///           (used to remove immediately, without the following updates)
   /// \returns true if attribute was updated
   MODEL_EXPORT virtual bool setValue(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
@@ -86,7 +92,7 @@ public:
   /// Sets the feature object
   MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
 
-  /// Updates the underlied selection due to the changes in the referenced objects
+  /// Updates the selection due to the changes in the referenced objects
   /// \returns false if update is failed
   MODEL_EXPORT virtual bool update();
 
@@ -104,7 +110,7 @@ public:
   /// NOTE: This method is opposite to Id() method.
   MODEL_EXPORT virtual void setId(int theID);
 
-  /// Selects (i.e. creates Naming data structure) of sub-shape specifed by textual name
+  /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
                                            const std::string& theSubShapeName);
 
@@ -118,16 +124,34 @@ public:
   /// Returns true if attribute was  initialized by some value
   MODEL_EXPORT virtual bool isInitialized();
 
-  /// Returns true if recomute of selection become impossible
+  /// Returns true if recompute of selection become impossible
   MODEL_EXPORT virtual bool isInvalid();
 
   /// Updates the arguments of selection if something was affected by creation
   /// or reorder of features upper in the history line (issue #1757)
   MODEL_EXPORT virtual void updateInHistory();
 
-  /// Returns true if the name was stored using weak naming principle
-  MODEL_EXPORT virtual bool isWeakNaming();
+  // Implementation of the name generator method from the Selector package
+  // This method returns the context name by the label of the sub-selected shape
+  MODEL_EXPORT virtual std::string contextName(const TDF_Label theSelectionLab) override;
+
+  /// This method restores by the context and value name the context label and
+  /// sub-label where the value is. Returns true if it is valid.
+  MODEL_EXPORT virtual bool restoreContext(std::string theName,
+    TDF_Label& theContext, TDF_Label& theValue) override;
+
+  /// Returns the label of the newest context presented by the current one
+  MODEL_EXPORT virtual TDF_Label newestContext(const TDF_Label theCurrentContext) override;
 
+  /// Returns true if the first result is newer than the second one in the tree of features
+  MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2)
+    const override;
+
+  /// Returns the name by context. Adds the part name if the context is located in other document
+  MODEL_EXPORT virtual std::string contextName(const ResultPtr& theContext) const;
+
+  /// Makes the current local selection becomes all sub-shapes with same base geometry.
+  MODEL_EXPORT virtual void combineGeometrical();
 
 protected:
   /// Objects are created for features automatically
@@ -139,9 +163,6 @@ protected:
   /// Returns theType type of the center, or NOT_CENTER if it is not.
   std::shared_ptr<GeomAPI_Shape> internalValue(CenterType& theType);
 
-
-  /// Performs the selection for the body result (TNaming Selection)
-
   /// Performs the selection for the body result (TNaming selection)
   virtual void selectBody(
     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
@@ -150,7 +171,7 @@ protected:
   /// \param theContext the result - owner of the selection
   /// \param theSubShape selected shape
   /// \param theUpdate flag that shows that it must be just update, theShape is null
-  /// \returns true if eveything is selected correctly
+  /// \returns true if everything is selected correctly
   virtual bool selectPart(
     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theUpdate = false);
@@ -159,15 +180,9 @@ protected:
   /// Note: there must be no attributes stored at the same label because Selector clears this lab
   TDF_Label selectionLabel();
 
-  /// Returns the prepared map of valid labels for naming selection solving (creates if not exists)
-  TDF_LabelMap& scope();
-
   /// Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting
   MODEL_EXPORT virtual void setID(const std::string theID);
 
-  /// Returns the name by context. Adds the part name if the context is located in other document
-  std::string contextName(const ResultPtr& theContext) const;
-
   /// Sets the parent attribute
   void setParent(Model_AttributeSelectionList* theParent);
 
@@ -179,11 +194,24 @@ protected:
                         ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel,
                         std::list<ResultPtr>& theResults, TopTools_ListOfShape& theValShapes);
 
+  /// Searches for the newest context, modification of the current, that contains theValue
+  ResultPtr newestContext(const ResultPtr theCurrent,
+    const std::shared_ptr<GeomAPI_Shape> theValue, const bool theAnyValue = false);
+
   /// computes theShapes list - shapes that were generated/modified/deleted the theValShape
   /// during creation from new to old context
   void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape,
     TopTools_ListOfShape& theShapes);
 
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const {
+    return myIsGeometricalSelection;
+  };
+
+  /// Returns the module document label if this selection attribute is not in this document.
+  /// Returns null label otherwise.
+  TDF_Label baseDocumentLab();
+
   friend class Model_Data;
   friend class Model_AttributeSelectionList;
 };
index 9fb4124075eac962de1a6d8b15a7770541194003..617007a5e1b9b0605ec8d52e4c4e56ac67d5c36e 100644 (file)
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <TDF_AttributeIterator.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDF_RelocationTable.hxx>
 #include <TDF_DeltaOnAddition.hxx>
+#include <TDataStd_UAttribute.hxx>
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <NCollection_List.hxx>
 
+/// GUID for UAttribute that indicates the list has "To add all elements that share the same
+/// topology" flag enabled
+static const Standard_GUID kIS_GEOMETRICAL_SELECTION("f16987b6-e6c8-435c-99fa-03a7e0b06e83");
+
 void Model_AttributeSelectionList::append(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily)
@@ -231,7 +237,7 @@ void Model_AttributeSelectionList::remove(const std::set<int>& theIndices)
 {
   int anOldSize = mySize->Get();
   int aRemoved = 0;
-  // iterate one by one and shifting the removed indicies
+  // iterate one by one and shifting the removed indices
   for(int aCurrent = 0; aCurrent < anOldSize; aCurrent++) {
     if (theIndices.find(aCurrent) == theIndices.end()) { // not removed
       if (aRemoved) { // but must be shifted to the removed position
@@ -263,6 +269,19 @@ int Model_AttributeSelectionList::size()
   return mySize->Get();
 }
 
+// returns true if theShape is same with theInList or is contained in it (a compound)
+static bool isIn(GeomShapePtr theInList, GeomShapePtr theShape) {
+  if (theShape->isSame(theInList))
+    return true;
+  if (theInList.get() && theInList->shapeType() == GeomAPI_Shape::COMPOUND) {
+    for(GeomAPI_ShapeIterator anIter(theInList); anIter.more(); anIter.next()) {
+      if (!anIter.current()->isNull() && anIter.current()->isSame(theShape))
+        return true;
+    }
+  }
+  return false;
+}
+
 bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext,
                                             const std::shared_ptr<GeomAPI_Shape>& theSubShape,
                                             const bool theTemporarily)
@@ -281,7 +300,7 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext,
               return true;
           } else {
             // we need to call here isSame instead of isEqual to do not check shapes orientation
-            if (theSubShape->isSame(*aShapes))
+            if (isIn(*aShapes, theSubShape))
               return true;
           }
         }
@@ -301,7 +320,7 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext,
           }
         } else {
           // we need to call here isSame instead of isEqual to do not check shapes orientation
-          if (theSubShape->isSame(aValue)) // shapes are equal
+          if (isIn(aValue, theSubShape)) // shapes are equal
             return true;
         }
       }
@@ -328,15 +347,15 @@ std::shared_ptr<ModelAPI_AttributeSelection>
   }
   TDF_Label aLabel = mySize->Label().FindChild(theIndex + 1);
   // create a new attribute each time, by demand
-  // supporting of old attributes is too slow (synch each time) and buggy on redo
-  // (if attribute is deleted and created, the abort updates attriute and makes the Attr invalid)
+  // supporting of old attributes is too slow (sync each time) and buggy on redo
+  // (if attribute is deleted and created, the abort updates attribute and makes the Attr invalid)
   std::shared_ptr<Model_AttributeSelection> aNewAttr =
     std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
-  aNewAttr->setID(id());
   if (owner()) {
     aNewAttr->setObject(owner());
     aNewAttr->setParent(this);
   }
+  aNewAttr->setID(id());
   return aNewAttr;
 }
 
@@ -371,8 +390,8 @@ bool Model_AttributeSelectionList::isInitialized()
 }
 
 Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
+: myLab(theLabel)
 {
-  myLab = theLabel;
   reinit();
 }
 
@@ -402,3 +421,59 @@ void Model_AttributeSelectionList::cashValues(const bool theEnabled)
     }
   }
 }
+
+bool Model_AttributeSelectionList::isGeometricalSelection() const
+{
+  return myLab.IsAttribute(kIS_GEOMETRICAL_SELECTION);
+}
+
+void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeometricalSelection)
+{
+  if (isGeometricalSelection() == theIsGeometricalSelection)
+    return; // nothing to do
+  if (theIsGeometricalSelection) // store the state
+    TDataStd_UAttribute::Set(myLab, kIS_GEOMETRICAL_SELECTION);
+  else
+    myLab.ForgetAttribute(kIS_GEOMETRICAL_SELECTION);
+  std::set<int> anIndiciesToRemove;  // Update list according to the flag
+  if (theIsGeometricalSelection) { // all objects with same geometry must be combined into single
+    std::list<AttributeSelectionPtr> anAttributes; // collect attributes with geometrical compounds
+    for(int anIndex = 0; anIndex < size(); anIndex++) {
+      AttributeSelectionPtr anAttr = value(anIndex);
+      if (!anAttr.get() || !anAttr->context().get())
+        continue;
+      anAttr->combineGeometrical();
+      if (!anAttr->value().get() || anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND)
+        continue;
+      // check it is equal to some other attribute already presented in the list
+      std::list<AttributeSelectionPtr>::iterator anAttrIter = anAttributes.begin();
+      for(; anAttrIter != anAttributes.end(); anAttrIter++) {
+        if (anAttr->context() == (*anAttrIter)->context() &&
+            anAttr->namingName() == (*anAttrIter)->namingName()) {
+          anIndiciesToRemove.insert(anIndex);
+          break;
+        }
+      }
+      if (anAttrIter == anAttributes.end()) // not removed, so, add to the compare-list
+        anAttributes.push_back(anAttr);
+    }
+  } else { // all objects with same geometry must be divided into separated sub-attributes
+    int anInitialSize = size();
+    for(int anIndex = 0; anIndex < anInitialSize; anIndex++) {
+      AttributeSelectionPtr anAttr = value(anIndex);
+      if (!anAttr.get() || !anAttr->context().get())
+        continue;
+      GeomShapePtr aValue = anAttr->value();
+      if (!aValue.get() || aValue->shapeType() != GeomAPI_Shape::COMPOUND)
+        continue;
+      for(GeomAPI_ShapeIterator anIter(aValue); anIter.more(); anIter.next()) {
+        append(anAttr->context(), anIter.current());
+      }
+      anIndiciesToRemove.insert(anIndex);
+    }
+  }
+  remove(anIndiciesToRemove);
+  myIsCashed = false;
+  myCash.clear(); // empty list as indicator that cash is not used
+  owner()->data()->sendAttributeUpdated(this);
+}
index 7e0736fe836a496485a913a9455348321fdb1ffd..d84ca1ff4187b766745b8e7262242aa73e6ec8df 100644 (file)
@@ -50,7 +50,7 @@ public:
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, do not store and name the added in the data framework
-  ///           (used to remove immideately, without the following updates)
+  ///           (used to remove immediately, without the following updates)
   MODEL_EXPORT virtual void append(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false);
@@ -77,14 +77,14 @@ public:
   /// \param theIndices a list of indices of elements to be removed
   MODEL_EXPORT virtual void remove(const std::set<int>& theIndices);
 
-  /// Returns the number ofselection attributes in the list
+  /// Returns the number of selection attributes in the list
   MODEL_EXPORT virtual int size();
 
   /// Returns true if the object with the shape are in list
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, it checks also the temporary added item
-  /// \returns true if the pair is found in the attirbute
+  /// \returns true if the pair is found in the attribute
   MODEL_EXPORT virtual bool isInList(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false);
@@ -111,6 +111,11 @@ public:
   /// during non-modification operations with this attribute)
   MODEL_EXPORT virtual void cashValues(const bool theEnabled);
 
+  MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
+
+  /// Returns true if is geometrical selection.
+  MODEL_EXPORT virtual bool isGeometricalSelection() const override;
+
 protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
index 8428157d31ca889add69f292514427f879f1dbcd..fee31e5c48e8e1600af0e4dd2b60806cc0cd98c1 100755 (executable)
 
 #include <Model_Data.h>
 #include <Model_Document.h>
+#include <ModelAPI_Session.h>
 #include <TNaming_Builder.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Integer.hxx>
+#include <TDataStd_ExtStringList.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDF_ChildIDIterator.hxx>
 #include <TDF_Reference.hxx>
+#include <TDF_Tool.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepTools_History.hxx>
 #include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeExplorer.h>
 #include <GeomAlgoAPI_MakeShape.h>
 #include <GeomAlgoAPI_SortListOfShapes.h>
 #include <Config_PropManager.h>
 // DEB
 //#include <TCollection_AsciiString.hxx>
-//#include <TDF_Tool.hxx>
 //#define DEB_IMPORT 1
 
-Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner)
-: ModelAPI_BodyBuilder(theOwner),
-  myDividedIndex(1),
-  myVIndex(1),
-  myEIndex(1),
-  myFIndex(1)
-{
+/// reference to the shape in external document: sting list attribute identifier
+static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd");
+
+static const int INVALID_TAG            = -1;
+static const int GENERATED_VERTICES_TAG = 1;
+static const int GENERATED_EDGES_TAG    = 2;
+static const int GENERATED_FACES_TAG    = 3;
+static const int MODIFIED_VERTICES_TAG  = 4;
+static const int MODIFIED_EDGES_TAG     = 5;
+static const int MODIFIED_FACES_TAG     = 6;
+static const int DELETED_TAG            = 7;
+static const int PRIMITIVES_START_TAG   = 11;
+
+static int getGenerationTag(const TopoDS_Shape& theShape) {
+  TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
+  switch (aShapeType) {
+    case TopAbs_VERTEX: return GENERATED_VERTICES_TAG;
+    case TopAbs_EDGE:   return GENERATED_EDGES_TAG;
+    case TopAbs_FACE:   return GENERATED_FACES_TAG;
+  }
+
+  return INVALID_TAG;
 }
 
-// Converts evolution of naming shape to selection evelution and back to avoid
-// naming support on the disabled results. Deeply in the labels tree, recursively.
-static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) {
-  std::list<std::pair<TopoDS_Shape, TopoDS_Shape> > aShapePairs; // to store old and new shapes
-  Handle(TNaming_NamedShape) aName;
-  int anEvolution = -1;
-  if (theLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
-    TNaming_Evolution aNSEvol = aName->Evolution();
-    if ((aNSEvol == TNaming_SELECTED && theFlag) ||
-        (aNSEvol != TNaming_SELECTED && !theFlag)) { // nothing to do, it is already correct
-      return;
-    }
-    anEvolution = (int)(aNSEvol);
-    if (!theFlag) {
-      Handle(TDataStd_Integer) anAttrEvol;
-      if (theLab.FindAttribute(TDataStd_Integer::GetID(), anAttrEvol)) {
-        anEvolution = anAttrEvol->Get();
-      }
-    } else {
-      TDataStd_Integer::Set(theLab, anEvolution);
-    }
+static int getModificationTag(const TopoDS_Shape& theShape) {
+  TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
+  switch (aShapeType) {
+    case TopAbs_VERTEX: return MODIFIED_VERTICES_TAG;
+    case TopAbs_EDGE:   return MODIFIED_EDGES_TAG;
+    case TopAbs_FACE:   return MODIFIED_FACES_TAG;
+  }
 
-    for(TNaming_Iterator anIter(aName); anIter.More(); anIter.Next()) {
-      // iterator goes in reversed order relatively to the Builder, to, make the list reversed
-      aShapePairs.push_front(std::pair<TopoDS_Shape, TopoDS_Shape>
-        (anIter.OldShape(), anIter.NewShape()));
-    }
+  return INVALID_TAG;
+}
 
-    // create new
-    TNaming_Builder aBuilder(theLab);
-    TNaming_Evolution anEvol = (TNaming_Evolution)(anEvolution);
-    std::list<std::pair<TopoDS_Shape, TopoDS_Shape> >::iterator aPairsIter = aShapePairs.begin();
-    for(; aPairsIter != aShapePairs.end(); aPairsIter++) {
-      if (theFlag) { // disabled => make selection
-        if (anEvolution == TNaming_DELETE) // issue 2274 : don't put too many same null shapes
-          aBuilder.Select(aPairsIter->first, aPairsIter->first);
-        else if (anEvolution == TNaming_PRIMITIVE)
-          aBuilder.Select(aPairsIter->second, aPairsIter->second);
-        else
-          aBuilder.Select(aPairsIter->second, aPairsIter->first);
-      } else if (anEvol == TNaming_GENERATED) {
-        aBuilder.Generated(aPairsIter->first, aPairsIter->second);
-      } else if (anEvol == TNaming_MODIFY) {
-        aBuilder.Modify(aPairsIter->first, aPairsIter->second);
-      } else if (anEvol == TNaming_DELETE) {
-        aBuilder.Delete(aPairsIter->first);
-      } else if (anEvol == TNaming_PRIMITIVE) {
-        aBuilder.Generated(aPairsIter->second);
-      } else if (anEvol == TNaming_SELECTED) {
-        aBuilder.Select(aPairsIter->second, aPairsIter->first);
-      }
+static bool isAlreadyStored(const TNaming_Builder* theBuilder,
+                            const TopoDS_Shape& theOldShape,
+                            const TopoDS_Shape& theNewShape)
+{
+  for (TNaming_Iterator aNamingIt(theBuilder->NamedShape());
+    aNamingIt.More();
+    aNamingIt.Next())
+  {
+    if (aNamingIt.NewShape().IsSame(theNewShape)
+      && aNamingIt.OldShape().IsSame(theOldShape))
+    {
+      return true;
     }
   }
-  // recursive call for all sub-labels
-  TDF_ChildIterator anIter(theLab, Standard_False);
-  for(; anIter.More(); anIter.Next()) {
-    evolutionToSelectionRec(anIter.Value(), theFlag);
-  }
+
+  return false;
 }
 
-void Model_BodyBuilder::evolutionToSelection(const bool theFlag)
+Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner)
+: ModelAPI_BodyBuilder(theOwner),
+  myFreePrimitiveTag(PRIMITIVES_START_TAG)
 {
-  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-  if (!aData || !aData->isValid()) // unknown case
-    return;
-  TDF_Label& aShapeLab = aData->shapeLab();
-  evolutionToSelectionRec(aShapeLab, theFlag);
 }
 
-void Model_BodyBuilder::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+void Model_BodyBuilder::store(const GeomShapePtr& theShape,
                               const bool theIsStoreSameShapes)
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
-    TDF_Label& aShapeLab = aData->shapeLab();
+    TDF_Label aShapeLab = aData->shapeLab();
     // clean builders
     clean();
     // store the new shape as primitive
@@ -153,7 +138,8 @@ void Model_BodyBuilder::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
 
     if(!theIsStoreSameShapes) {
       Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
-      if(!aNS.IsNull() && !aNS->IsEmpty()) {
+      // the last condition is for the issue 2751 : existing shape may be found in compound-NS
+      if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) {
         // This shape is already in document, store reference instead of shape;
         const TDF_Label aFoundLabel = aNS->Label();
         TDF_Reference::Set(aShapeLab, aFoundLabel);
@@ -179,12 +165,12 @@ void Model_BodyBuilder::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
   }
 }
 
-void Model_BodyBuilder::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-  const std::shared_ptr<GeomAPI_Shape>& theToShape)
+void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape,
+  const GeomShapePtr& theToShape)
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
-    TDF_Label& aShapeLab = aData->shapeLab();
+    TDF_Label aShapeLab = aData->shapeLab();
     // clean builders
     clean();
     // store the new shape as primitive
@@ -225,15 +211,14 @@ TNaming_Builder* Model_BodyBuilder::builder(const int theTag)
   return aFind->second;
 }
 
-void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag)
+void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape,
+                                      const GeomShapePtr& theNewShape,
+                                      const bool theIsCleanStored)
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
-    TDF_Label& aShapeLab = aData->shapeLab();
     // clean builders
-    if (theDecomposeSolidsTag != -2)
-      clean();
+    if (theIsCleanStored) clean();
     // store the new shape as primitive
     TNaming_Builder* aBuilder = builder(0);
     if (!theOldShape || !theNewShape)
@@ -259,21 +244,6 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theO
   }
 }
 
-void  Model_BodyBuilder::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
-  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-  if (aData) {
-    clean();
-    if (!theShape.get())
-      return; // bad shape
-    TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
-    if (aShape.IsNull())
-      return;  // null shape inside
-    TNaming_Builder aBuilder(aData->shapeLab());
-    aBuilder.Select(aShape, aShape);
-  }
-}
-
 void Model_BodyBuilder::clean()
 {
   TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>(data())->shapeLab();
@@ -281,20 +251,20 @@ void Model_BodyBuilder::clean()
     return;
   std::map<int, TNaming_Builder*>::iterator aBuilder = myBuilders.begin();
   for(; aBuilder != myBuilders.end(); aBuilder++) {
+    Handle(TNaming_NamedShape) aNS = aBuilder->second->NamedShape();
     delete aBuilder->second;
-    // clear also shapes on cleaned sub-labels (#2241)
-    Handle(TNaming_NamedShape) aNS;
-    if (aLab.FindChild(aBuilder->first).FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-      aNS->Clear();
-    }
+    if (!aNS.IsNull() && !aNS->Label().IsNull())
+      aNS->Label().ForgetAttribute(TNaming_NamedShape::GetID());
   }
   myBuilders.clear();
+  myPrimitivesNamesIndexMap.clear();
   // remove the old reference (if any)
   aLab.ForgetAttribute(TDF_Reference::GetID());
-  myDividedIndex = 1;
-  myVIndex = 1;
-  myEIndex = 1;
-  myFIndex = 1;
+  myFreePrimitiveTag = PRIMITIVES_START_TAG;
+  TDF_ChildIDIterator anEntriesIter(aLab, kEXTERNAL_SHAPE_REF, true);
+  for(; anEntriesIter.More(); anEntriesIter.Next()) {
+    anEntriesIter.Value()->Label().ForgetAttribute(kEXTERNAL_SHAPE_REF);
+  }
 }
 
 Model_BodyBuilder::~Model_BodyBuilder()
@@ -304,111 +274,130 @@ Model_BodyBuilder::~Model_BodyBuilder()
 
 void Model_BodyBuilder::buildName(const int theTag, const std::string& theName)
 {
-  std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
-  //aDoc->addNamingName(builder(theTag)->NamedShape()->Label(), theName);
-  TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), theName.c_str());
+  std::string aName = theName;
+  std::string aPrefix = "";
+  switch (theTag) {
+    case GENERATED_VERTICES_TAG: aPrefix = aName.empty() ? "Generated_Vertex" : "GV:"; break;
+    case GENERATED_EDGES_TAG:    aPrefix = aName.empty() ? "Generated_Edge"   : "GE:"; break;
+    case GENERATED_FACES_TAG:    aPrefix = aName.empty() ? "Generated_Face"   : "GF:"; break;
+    case MODIFIED_VERTICES_TAG:  aPrefix = aName.empty() ? "Modified_Vertex"  : "MV:"; break;
+    case MODIFIED_EDGES_TAG:     aPrefix = aName.empty() ? "Modified_Edge"    : "ME:"; break;
+    case MODIFIED_FACES_TAG:     aPrefix = aName.empty() ? "Modified_Face"    : "MF:"; break;
+  }
+  aName.insert(0, aPrefix);
+
+  TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), aName.c_str());
 }
-void Model_BodyBuilder::generated(
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape,
+                                  const std::string& theName,
+                                  const bool theCheckIsInResult)
 {
+  GeomShapePtr aResultShape = shape();
+  if (theCheckIsInResult) {
+    bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(theNewShape, false);
+    if (aNewShapeIsNotInResultShape) {
+      return false;
+    }
+  }
+
   TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
-  builder(theTag)->Generated(aShape);
-  if(!theName.empty())
-    buildName(theTag, theName);
+  builder(myFreePrimitiveTag)->Generated(aShape);
+  if (!theName.empty()) {
+    std::string aName = theName;
+    if (myPrimitivesNamesIndexMap.find(theName) != myPrimitivesNamesIndexMap.end()) {
+      IndexTags& anIndexTags = myPrimitivesNamesIndexMap.find(theName)->second;
+      aName += "_" + std::to_string(++(anIndexTags.index));
+      anIndexTags.tags.push_back(myFreePrimitiveTag);
+      if (anIndexTags.index == 2) {
+        buildName(anIndexTags.tags.front(), theName + "_1");
+      }
+    }
+    else {
+      IndexTags anIndexTags;
+      anIndexTags.index = 1;
+      anIndexTags.tags.push_back(myFreePrimitiveTag);
+      myPrimitivesNamesIndexMap[theName] = anIndexTags;
+    }
+
+    buildName(myFreePrimitiveTag, aName);
+  }
+  ++myFreePrimitiveTag;
+  return true;
 }
 
-void Model_BodyBuilder::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+void Model_BodyBuilder::generated(const GeomShapePtr& theOldShape,
+                                  const GeomShapePtr& theNewShape,
+                                  const std::string& theName)
 {
   TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
   TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
-  builder(theTag)->Generated(anOldShape, aNewShape);
-  if(!theName.empty())
-    buildName(theTag, theName);
-  TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
-  if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
-    TopAbs_ShapeEnum anExplodeShapeType = aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
-    const TDF_Label aLabel = builder(theTag)->NamedShape()->Label();
-    int aTag = 1;
-    std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
-    for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) {
-      TDF_Label aChildLabel = aLabel.FindChild(aTag);
-      TNaming_Builder aBuilder(aChildLabel);
-      aBuilder.Generated(anOldShape, anExp.Current());
-      TCollection_AsciiString aChildName = TCollection_AsciiString((theName + "_").c_str()) + aTag;
-      //aDoc->addNamingName(aChildLabel, aChildName.ToCString());
-      TDataStd_Name::Set(aChildLabel, aChildName.ToCString());
-      aTag++;
-    }
+  TopAbs_ShapeEnum aNewShapeType = aNewShape.ShapeType();
+  int aTag;
+  if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) {
+    // TODO: This is a workaround. New shape should be only vertex, edge or face.
+    TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
+    aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG;
+    for (TopExp_Explorer anExp(aNewShape, aShapeTypeToExplore); anExp.More(); anExp.Next()) {
+      builder(aTag)->Generated(anOldShape, anExp.Current());
+    }
+    buildName(aTag, theName);
+  } else {
+    aTag = getGenerationTag(aNewShape);
+    if (aTag == INVALID_TAG) return;
+    builder(aTag)->Generated(anOldShape, aNewShape);
+    buildName(aTag, theName);
   }
 }
 
-
-void Model_BodyBuilder::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+void Model_BodyBuilder::modified(const GeomShapePtr& theOldShape,
+                                 const GeomShapePtr& theNewShape,
+                                 const std::string& theName)
 {
   TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
   TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
-  builder(theTag)->Modify(anOldShape, aNewShape);
-  if(!theName.empty())
-    buildName(theTag, theName);
-}
-
-void Model_BodyBuilder::deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const int theTag)
-{
-  TopoDS_Shape aShape = theOldShape->impl<TopoDS_Shape>();
-  builder(theTag)->Delete(aShape);
+  int aTag = getModificationTag(aNewShape);
+  if (aTag == INVALID_TAG) return;
+  builder(aTag)->Modify(anOldShape, aNewShape);
+  buildName(aTag, theName);
 }
 
-void Model_BodyBuilder::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-  const int  theKindOfShape,
-  const int  theTag,
-  const GeomShapePtr theShapes)
+void Model_BodyBuilder::loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+                                          const GeomShapePtr& theOldShape,
+                                          const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                          const GeomShapePtr& theShapesToExclude)
 {
-  TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
-  TopTools_MapOfShape aView;
-  TopExp_Explorer ShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape);
+  TopTools_MapOfShape anAlreadyProcessedShapes;
   GeomShapePtr aResultShape = shape();
-  for (; ShapeExplorer.More(); ShapeExplorer.Next ()) {
-    const TopoDS_Shape& aRoot = ShapeExplorer.Current ();
-    if (!aView.Add(aRoot)) continue;
-    std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
-    aRShape->setImpl((new TopoDS_Shape(aRoot)));
-    if (!theMS->isDeleted(aRShape)
-        || aResultShape->isSubShape(aRShape, false)
-        || (theShapes.get() && theShapes->isSubShape(aRShape, false))) {
+  for (GeomAPI_ShapeExplorer anExp(theOldShape, theShapeTypeToExplore);
+       anExp.more();
+       anExp.next())
+  {
+    GeomShapePtr anOldSubShape = anExp.current();
+    const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+    if (!anAlreadyProcessedShapes.Add(anOldSubShape_)
+        || !theAlgo->isDeleted(anOldSubShape)
+        || aResultShape->isSubShape(anOldSubShape, false)
+        || (theShapesToExclude.get() && theShapesToExclude->isSubShape(anOldSubShape, false)))
+    {
       continue;
     }
 
-    ListOfShape aHist;
-    if (BRepTools_History::IsSupportedType(aRoot)) // to avoid crash in #2572
-      theMS->modified(aRShape, aHist);
-    if (aHist.size() == 0 || (aHist.size() == 1 && aHist.front()->isSame(aRShape)))
-      builder(theTag)->Delete(aRoot);
-  }
-}
+    ListOfShape aNewShapes;
+    if (BRepTools_History::IsSupportedType(anOldSubShape_)) { // to avoid crash in #2572
+      theAlgo->modified(anOldSubShape, aNewShapes);
+    }
 
-static void removeBadShapes(ListOfShape& theShapes)
-{
-  ListOfShape::iterator anIt = theShapes.begin();
-  while (anIt != theShapes.end()) {
-    TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
-    bool aSkip = aNewShape.IsNull()
-      || (aNewShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aNewShape)));
-    if (aSkip) {
-      ListOfShape::iterator aRemoveIt = anIt++;
-      theShapes.erase(aRemoveIt);
-    } else {
-      ++anIt;
+    if (aNewShapes.size() == 0
+        || (aNewShapes.size() == 1 && aNewShapes.front()->isSame(anOldSubShape))) {
+      builder(DELETED_TAG)->Delete(anOldSubShape_);
     }
   }
 }
 
 // Keep only the shapes with minimal shape type
-static void keepTopLevelShapes(ListOfShape& theShapes, const TopoDS_Shape& theRoot,
-  const GeomShapePtr& theResultShape = GeomShapePtr())
+static void keepTopLevelShapes(ListOfShape& theShapes,
+                               const TopoDS_Shape& theRoot,
+                               const GeomShapePtr& theResultShape = GeomShapePtr())
 {
   GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE;
   ListOfShape::iterator anIt = theShapes.begin();
@@ -437,348 +426,223 @@ static void keepTopLevelShapes(ListOfShape& theShapes, const TopoDS_Shape& theRo
   }
 }
 
-// returns an ancestor shape-type thaty used for naming-definition of the sub-type
-TopAbs_ShapeEnum typeOfAncestor(const TopAbs_ShapeEnum theSubType) {
-  if (theSubType == TopAbs_VERTEX)
-    return TopAbs_EDGE;
-  if (theSubType == TopAbs_EDGE)
-    return TopAbs_FACE;
-  return TopAbs_VERTEX; // bad case
+/// Checks that shape is presented in the tree with not-selection evolution
+/// In theOriginalLabel it returns label where NS of old sub-shape is stored
+static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAccess2,
+  TopoDS_Shape theShape, TDF_Label& theOriginalLabel)
+{
+  bool aResult = TNaming_Tool::HasLabel(theAccess1, theShape);
+  if (aResult) { //check evolution and a label of this shape
+    for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next())
+    {
+      static Handle(TNaming_NamedShape) aNS;
+      if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+        if (aNS->Evolution() != TNaming_SELECTED) {
+          theOriginalLabel = aNS->Label();
+          return true;
+        }
+      }
+    }
+  }
+  if (!theAccess2.IsNull()) {
+    static const TDF_Label anEmpty;
+    return isShapeInTree(theAccess2, anEmpty, theShape, theOriginalLabel);
+  }
+  return false;
 }
 
-void Model_BodyBuilder::loadAndOrientModifiedShapes (
-  GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-  const int  theKindOfShape,
-  const int  theTag,
-  const std::string& theName,
-  GeomAPI_DataMapOfShapeShape& theSubShapes,
-  const bool theIsStoreSeparate,
-  const bool theIsStoreAsGenerated)
+/// Stores entry to the external label in the entries list at this label
+static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label theThis)
 {
-  static const int THE_ANCHOR_TAG = 100000;
+  // store information about the external document reference to restore old shape on open
+  if (!theExternal.IsNull() && !theExternal.Root().IsEqual(theThis.Root())) {
+    Handle(TDataStd_ExtStringList) anEntries;
+    if (!theThis.FindAttribute(kEXTERNAL_SHAPE_REF, anEntries)) {
+      anEntries = TDataStd_ExtStringList::Set(theThis, kEXTERNAL_SHAPE_REF);
+    }
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(theExternal, anEntry);
+    // check it already contains this entry
+    TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
+    for(; anIter.More(); anIter.Next())
+      if (anIter.Value() == anEntry)
+        break;
+    if (!anIter.More()) {
+      anEntries->Append(anEntry);
+    }
+  }
+}
 
-  int anIndex = 1;
-  int aTag = theTag;
-  bool isBuilt = !theName.empty();
-  std::string aName = theName;
-  std::ostringstream aStream;
+void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+                                           const GeomShapePtr& theOldShape,
+                                           const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                           const std::string& theName)
+{
   GeomShapePtr aResultShape = shape();
-  TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
-  TopTools_MapOfShape aView;
-  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-
-  TopoDS_Shape aShapeToIterate;
-  if (theMS->newShapesCollected(theShapeIn, theKindOfShape)) {
+  GeomShapePtr aShapeToExplore = theOldShape;
+  if (theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) {
     // use optimized set of old shapes for this
-    GeomShapePtr aCompound = theMS->oldShapesForNew(theShapeIn, aResultShape, theKindOfShape);
-    if (aCompound.get())
-      aShapeToIterate = aCompound->impl<TopoDS_Shape>();
-  } else {
-    aShapeToIterate = aShapeIn;
+    GeomShapePtr aCompound = theAlgo->oldShapesForNew(theOldShape,
+                                                      aResultShape,
+                                                      theShapeTypeToExplore);
+    if (aCompound.get()) aShapeToExplore = aCompound;
   }
 
-  TopExp_Explorer aShapeExplorer (aShapeToIterate, (TopAbs_ShapeEnum)theKindOfShape);
-  for (; aShapeExplorer.More(); aShapeExplorer.Next ()) {
-    const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
-    if (!aView.Add(aRoot)) continue;
-
-    bool aNotInTree =
-      TNaming_Tool::NamedShape(aRoot, aData->shapeLab()).IsNull();
-    if (aNotInTree && !theIsStoreSeparate) {
-      // there is no sense to write history if old shape does not exist in the document
-      continue; // but if it is stored separately, it will be builded as a primitive
+  TopTools_MapOfShape anAlreadyProcessedShapes;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  for (GeomAPI_ShapeExplorer anOldShapeExp(aShapeToExplore, theShapeTypeToExplore);
+       anOldShapeExp.more();
+       anOldShapeExp.next())
+  {
+    GeomShapePtr anOldSubShape = anOldShapeExp.current();
+    const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+
+    // There is no sense to write history if shape already processed
+    // or old shape does not exist in the document.
+    bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_);
+    TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+      ModelAPI_Session::get()->moduleDocument())->generalLabel();
+    TDF_Label anOriginalLabel;
+    bool anOldSubShapeNotInTree =
+      !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel);
+    if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) {
+      continue;
     }
-    ListOfShape aList;
-    std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
-    aRShape->setImpl((new TopoDS_Shape(aRoot)));
-    theMS->modified(aRShape, aList);
 
-    if (!theIsStoreSeparate) {
-      //keepTopLevelShapes(aList, aRoot, aResultShape);
-      removeBadShapes(aList);
-    }
-    // sort the list of images before naming
-    GeomAlgoAPI_SortListOfShapes::sort(aList);
+    // Get new shapes.
+    ListOfShape aNewShapes;
+    theAlgo->modified(anOldSubShape, aNewShapes);
 
-    // to trace situation where several objects are produced by one parent (#2317)
-    int aSameParentShapes = (aShapeIn.ShapeType() == TopAbs_WIRE
-                             || aShapeIn.ShapeType() == TopAbs_SHELL
-                             || aShapeIn.ShapeType() == TopAbs_COMPOUND) ? 0 : -1;
-    std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
-      anIt = aList.begin(), aLast = aList.end();
-    for (; anIt != aLast; anIt++) {
-      TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
-      if (theSubShapes.isBound(*anIt)) {
-        std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
-        aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
-      }
-      isBuilt = !theName.empty();
-      if(!aRoot.IsSame(aNewShape)
-         && aResultShape->isSubShape((*anIt), false)
-         && !aResultShape->isSame(*anIt)) // to avoid put of same shape on main label and sub
+    for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
+         aNewShapesIt != aNewShapes.cend();
+         ++aNewShapesIt)
+    {
+      GeomShapePtr aNewShape = *aNewShapesIt;
+      const TopoDS_Shape& aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+      bool isGenerated = anOldSubShape_.ShapeType() != aNewShape_.ShapeType();
+
+      bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
+      bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false);
+      if (aNewShapeIsSameAsOldShape
+          || aNewShapeIsNotInResultShape)
       {
-        if (!theIsStoreSeparate) {
-          aSameParentShapes++;
-        } else if (aNotInTree) // check this new shape can not be represented as
-                              // a sub-shape of higher level sub-shapes
-        {
-          TopAbs_ShapeEnum aNewType = aNewShape.ShapeType();
-          TopAbs_ShapeEnum anAncestorType = typeOfAncestor(aNewType);
-          if (anAncestorType != TopAbs_VERTEX) {
-            bool aFound = false;
-            TopoDS_Shape aResultTShape = aResultShape->impl<TopoDS_Shape>();
-            TopExp_Explorer anAncestorExp(aResultTShape, anAncestorType);
-            for(; anAncestorExp.More() && !aFound; anAncestorExp.Next()) {
-              if (aResultTShape.IsSame(anAncestorExp.Current()))
-                continue;
-              TopExp_Explorer aSubExp(anAncestorExp.Current(), aNewType);
-              for(; aSubExp.More(); aSubExp.Next()) {
-                if (aNewShape.IsSame(aSubExp.Current())) {
-                  aFound = true;
-                  break;
-                }
-              }
-            }
-            if (aFound) {
-              continue; // not need to store this shape in the BRep structure
-            }
-          }
-        }
-
-        int aFoundTag = 0;
-        bool isFoundSameOld = false;
-        bool isFoundDiffOld = false;
-
-        // Check if new shape was already stored.
-        for (std::map<int, TNaming_Builder*>::iterator aBuildersIt = myBuilders.begin();
-             aBuildersIt != myBuilders.end();
-             ++aBuildersIt)
-        {
-          TNaming_Builder* aBuilder = aBuildersIt->second;
-          for (TNaming_Iterator aNamingIt(aBuilder->NamedShape());
-               aNamingIt.More();
-               aNamingIt.Next())
-          {
-            if (aNamingIt.NewShape().IsSame(aNewShape))
-            {
-              aNamingIt.OldShape().IsSame(aRoot) ? isFoundSameOld = true
-                                                 : isFoundDiffOld = true;
-              aFoundTag = aBuildersIt->first;
-            }
-          }
-
-          if (isFoundSameOld || isFoundDiffOld) break;
-        }
+        continue;
+      }
 
-        if (isFoundSameOld) {
-          // Builder already contains same old->new shapes, don't store it twice.
+      TNaming_Builder* aBuilder;
+      if (aResultShape->isSame(aNewShape)) {
+        // keep the modification evolution on the root level (2241 - history propagation issue)
+        aBuilder = builder(0);
+        TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
+        Handle(TDF_Reference) aRef;
+        if (aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
+          // Store only in case if it does not have reference.
           continue;
         }
 
-        int aBuilderTag = aSameParentShapes > 0 ? THE_ANCHOR_TAG : aTag;
-
-        int aCurShapeType = (int)((*anIt)->shapeType());
-        bool needSuffix = false; // suffix for the name based on the shape type
-        if (aCurShapeType != theKindOfShape) {
-          // modified shape has different type => set another tag
-          // to avoid shapes of different types on the same label
-          aBuilderTag = THE_ANCHOR_TAG;
-          needSuffix = true;
-        }
-        std::string aSuffix;
-        if (needSuffix) {
-          switch (aCurShapeType) {
-            case GeomAPI_Shape::VERTEX: aSuffix = "_v_" + std::to_string(myVIndex++); break;
-            case GeomAPI_Shape::EDGE:   aSuffix = "_e_" + std::to_string(myEIndex++); break;
-            case GeomAPI_Shape::FACE:   aSuffix = "_f_" + std::to_string(myFIndex++); break;
-            default: break;
-          }
-        }
-
-        std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>> aKeepShapes, aMoveShapes;
-        if (isFoundDiffOld) {
-          // Found same new shape with different old shape.
-          if (aFoundTag >= THE_ANCHOR_TAG) {
-            // Found on separated tag.
-            aBuilderTag = aFoundTag; // Store it on the same tag.
-            isBuilt = false; // Don't change name;
-          } else {
-            // Found on previous tag.
-            if (aBuilderTag < THE_ANCHOR_TAG) {
-              // New shape shouls not be separated.
-              aBuilderTag = aFoundTag; // Store it on the same tag.
-              isBuilt = false; // Don't change name;
-            } else {
-              // New shape should be separated from others. Move shapes from found tag to new tag.
-              while (myBuilders.find(aBuilderTag) != myBuilders.end()) {
-                ++aBuilderTag;
-              }
-
-              TNaming_Builder* aFoundBuilder = myBuilders.at(aFoundTag);
-              Handle(TNaming_NamedShape) aFoundNamedShape = aFoundBuilder->NamedShape();
-              TDF_Label aFoundLabel = aFoundNamedShape->Label();
-              TNaming_Evolution anEvolution = aFoundNamedShape->Evolution();
-              for (TNaming_Iterator aNamingIt(aFoundNamedShape);
-                   aNamingIt.More();
-                   aNamingIt.Next())
-              {
-                std::pair<TopoDS_Shape, TopoDS_Shape> aShapesPair =
-                  std::make_pair(aNamingIt.OldShape(), aNamingIt.NewShape());
-                aNamingIt.NewShape().IsSame(aNewShape) ? aMoveShapes.push_back(aShapesPair)
-                                                       : aKeepShapes.push_back(aShapesPair);
-              }
-
-              aFoundNamedShape->Clear();
-              for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aKeepIt =
-                     aKeepShapes.begin();
-                   aKeepIt != aKeepShapes.end();
-                   ++aKeepIt)
-              {
-                if (anEvolution == TNaming_GENERATED) {
-                  aFoundBuilder->Generated(aKeepIt->first, aKeepIt->second);
-                } else {
-                  aFoundBuilder->Modify(aKeepIt->first, aKeepIt->second);
-                }
-              }
-            }
-          }
-        } else if (aBuilderTag == THE_ANCHOR_TAG) {
-          while (myBuilders.find(aBuilderTag) != myBuilders.end()) {
-            ++aBuilderTag;
-          }
-        }
+        // Check if new shape was already stored.
+        if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
 
-        if(theIsStoreAsGenerated) {
-          // Here we store shapes as generated, to avoid problem when one parent shape produce
-          // several child shapes. In this case naming could not determine which shape to select.
-          builder(aBuilderTag)->Generated(aRoot, aNewShape);
-          for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aMoveIt =
-               aMoveShapes.begin();
-               aMoveIt != aMoveShapes.end();
-               ++aMoveIt)
-          {
-            builder(aBuilderTag)->Generated(aMoveIt->first, aMoveIt->second);
-          }
-        } else if (aNotInTree) {
-          // not in tree -> store as primitive (stored as separated)
-          builder(aBuilderTag)->Generated(aNewShape);
-        } else if (aCurShapeType != theKindOfShape) {
-           // if different shape type is produced, make it as generated
-          builder(aBuilderTag)->Generated(aRoot, aNewShape);
-        } else {
-          builder(aBuilderTag)->Modify(aRoot, aNewShape);
-          for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aMoveIt =
-               aMoveShapes.begin();
-               aMoveIt != aMoveShapes.end();
-               ++aMoveIt) {
-            builder(aBuilderTag)->Modify(aMoveIt->first, aMoveIt->second);
-          }
+        if (!aBuilder->NamedShape().IsNull() &&
+            ((isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_GENERATED)
+              || (!isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_MODIFY)))
+        {
+          myBuilders.erase(0); // clear old builder to avoid different evolutions crash
+          aBuilder = builder(0);
         }
-        if(isBuilt) {
-          aStream.str(std::string());
-          aStream.clear();
-          aStream << theName;
-          if (theIsStoreSeparate && !isFoundDiffOld)
-             aStream << "_" << anIndex++;
+      } else {
+        int aTag = isGenerated ? getGenerationTag(aNewShape_)
+                               : getModificationTag(aNewShape_);
+        aBuilder = builder(aTag);
 
-          if (aSameParentShapes > 0) {
-            aStream.str(std::string());
-            aStream.clear();
-            aStream << aName << "_" << "divided" << "_" << myDividedIndex++;
-          }
+        // Check if new shape was already stored.
+        if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
 
-          aStream << aSuffix;
-          buildName(aBuilderTag, aStream.str());
-        }
-        if(theIsStoreSeparate && !isFoundDiffOld) {
-          aTag++;
-        }
-      } else if (aResultShape->isSame(*anIt)) {
-        // keep the modification evolution on the root level (2241 - history propagation issue)
-        TNaming_Builder* aBuilder = builder(0);
-        TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
-        Handle(TDF_Reference) aRef;
-        // Store only in case if it does not have reference.
-        if (!aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
-          if (theIsStoreAsGenerated) {
-            TNaming_Builder* aBuilder = builder(0);
-            if (!aBuilder->NamedShape().IsNull() &&
-                aBuilder->NamedShape()->Evolution() != TNaming_GENERATED) {
-              myBuilders.erase(0); // clear old builder to avoid different evolutions crash
-            }
-            builder(0)->Generated(aRoot, aNewShape);
-          } else {
-            TNaming_Builder* aBuilder = builder(0);
-            if (!aBuilder->NamedShape().IsNull() &&
-              aBuilder->NamedShape()->Evolution() != TNaming_MODIFY) {
-              myBuilders.erase(0); // clear old builder to avoid different evolutions crash
-            }
-            builder(0)->Modify(aRoot, aNewShape);
-          }
-        }
+        buildName(aTag, theName);
       }
+
+      isGenerated ? aBuilder->Generated(anOldSubShape_, aNewShape_)
+                  : aBuilder->Modify(anOldSubShape_, aNewShape_);
+      // store information about the external document reference to restore old shape on open
+      storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label());
     }
   }
 }
 
-void Model_BodyBuilder::loadAndOrientGeneratedShapes (
-  GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-  const int  theKindOfShape,
-  const int  theTag,
-  const std::string& theName,
-  GeomAPI_DataMapOfShapeShape& theSubShapes)
+void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+                                            const GeomShapePtr& theOldShape,
+                                            const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                            const std::string& theName)
 {
-  TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
-  TopTools_MapOfShape aView;
-  bool isBuilt = !theName.empty();
-  TopExp_Explorer aShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape);
-  for (; aShapeExplorer.More(); aShapeExplorer.Next ()) {
-    const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
-    if (!aView.Add(aRoot)) continue;
-    //if (TNaming_Tool::NamedShape(aRoot, builder(theTag)->NamedShape()->Label()).IsNull())
-    //  continue; // there is no sense to write history if old shape does not exist in the document
-    ListOfShape aList;
-    std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
-    aRShape->setImpl((new TopoDS_Shape(aRoot)));
-    theMS->generated(aRShape, aList);
-    keepTopLevelShapes(aList, aRoot);
-    std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
-      anIt = aList.begin(), aLast = aList.end();
-    for (; anIt != aLast; anIt++) {
-      TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
-      if (theSubShapes.isBound(*anIt)) {
-        std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
-        aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
-      }
-      if (!aRoot.IsSame (aNewShape)) {
-        builder(theTag)->Generated(aRoot,aNewShape);
-        if(isBuilt)
-          buildName(theTag, theName);
+  GeomShapePtr aResultShape = shape();
+  TopTools_MapOfShape anAlreadyProcessedShapes;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore);
+       anOldShapeExp.more();
+       anOldShapeExp.next())
+  {
+    GeomShapePtr anOldSubShape = anOldShapeExp.current();
+    const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+
+    // There is no sense to write history if shape already processed
+    // or old shape does not exist in the document.
+    bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_);
+    TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+      ModelAPI_Session::get()->moduleDocument())->generalLabel();
+    TDF_Label anOriginalLabel;
+    bool anOldSubShapeNotInTree =
+      !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel);
+    if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) {
+      continue;
+    }
+
+    // Get new shapes.
+    ListOfShape aNewShapes;
+    theAlgo->generated(anOldSubShape, aNewShapes);
+
+    keepTopLevelShapes(aNewShapes, anOldSubShape_);
+
+    for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
+         aNewShapesIt != aNewShapes.cend();
+         ++aNewShapesIt)
+    {
+      GeomShapePtr aNewShape = *aNewShapesIt;
+      const TopoDS_Shape& aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+
+      bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
+      bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false);
+      if (aNewShapeIsSameAsOldShape
+        || aNewShapeIsNotInResultShape)
+      {
+        continue;
       }
-      TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
-      if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
-        TopAbs_ShapeEnum anExplodeShapeType =
-          aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
-        const TDF_Label aLabel = builder(theTag)->NamedShape()->Label();
-        int aTag = 1;
-        std::shared_ptr<Model_Document> aDoc =
-          std::dynamic_pointer_cast<Model_Document>(document());
-        for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) {
-          TDF_Label aChildLabel = aLabel.FindChild(aTag);
-          TNaming_Builder aBuilder(aChildLabel);
-          aBuilder.Generated(aRoot, anExp.Current());
-          TCollection_AsciiString aChildName =
-            TCollection_AsciiString((theName + "_").c_str()) + aTag;
-          TDataStd_Name::Set(aChildLabel, aChildName.ToCString());
-          aTag++;
+
+      TopAbs_ShapeEnum aNewShapeType = aNewShape_.ShapeType();
+      if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) {
+        // TODO: This is a workaround. New shape should be only edge or face.
+        TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE
+                                                                            : TopAbs_FACE;
+        int aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG;
+        for (TopExp_Explorer anExp(aNewShape_, aShapeTypeToExplore); anExp.More(); anExp.Next()) {
+          builder(aTag)->Generated(anOldSubShape_, anExp.Current());
+          // store information about the external document reference to restore old shape on open
+          storeExternalReference(anOriginalLabel, builder(aTag)->NamedShape()->Label());
         }
+        buildName(aTag, theName);
+      }
+      else {
+        int aTag = getGenerationTag(aNewShape_);
+        if (aTag == INVALID_TAG) return;
+        builder(aTag)->Generated(anOldSubShape_, aNewShape_);
+        buildName(aTag, theName);
+        // store information about the external document reference to restore old shape on open
+        storeExternalReference(anOriginalLabel, builder(aTag)->NamedShape()->Label());
       }
     }
   }
 }
 
+// LCOV_EXCL_START
 //=======================================================================
 int getDangleShapes(const TopoDS_Shape&           theShapeIn,
   const TopAbs_ShapeEnum        theGeneratedFrom,
@@ -811,10 +675,11 @@ void loadGeneratedDangleShapes(
   for (; itr.More(); itr.Next())
     theBuilder->Generated(itr.Key(), itr.Value());
 }
+// LCOV_EXCL_STOP
 
 //=======================================================================
-void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
-  const std::string& theName, int&  theTag)
+void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape,
+                                       const std::string& theName)
 {
   if(theShape->isNull()) return;
   TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
@@ -822,11 +687,11 @@ void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
   if (aShape.ShapeType() == TopAbs_SOLID) {
     TopExp_Explorer expl(aShape, TopAbs_FACE);
     for (; expl.More(); expl.Next()) {
-      builder(theTag)->Generated(expl.Current());
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-      theTag++;
+      builder(myFreePrimitiveTag)->Generated(expl.Current());
+      TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+      aName = theName + "_" + aStr.ToCString();
+      buildName(myFreePrimitiveTag, aName);
+      ++myFreePrimitiveTag;
     }
   }
   else if (aShape.ShapeType() == TopAbs_SHELL || aShape.ShapeType() == TopAbs_FACE) {
@@ -836,11 +701,11 @@ void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
     if (Faces.Extent() > 1 || (aShape.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) {
       TopExp_Explorer expl(aShape, TopAbs_FACE);
       for (; expl.More(); expl.Next()) {
-        builder(theTag)->Generated(expl.Current());
-        TCollection_AsciiString aStr(theTag);
-        aName = theName + aStr.ToCString();
-        buildName(theTag, aName);
-        theTag++;
+        builder(myFreePrimitiveTag)->Generated(expl.Current());
+        TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+        aName = theName + "_" + aStr.ToCString();
+        buildName(myFreePrimitiveTag, aName);
+        ++myFreePrimitiveTag;
       }
     }
     TopTools_IndexedDataMapOfShapeListOfShape anEdgeAndNeighbourFaces;
@@ -851,21 +716,21 @@ void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
       if (aLL.Extent() < 2) {
         if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeAndNeighbourFaces.FindKey(i))))
           continue;
-        builder(theTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
-        TCollection_AsciiString aStr(theTag);
-        aName = theName + aStr.ToCString();
-        buildName(theTag, aName);
-        theTag++;
+        builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
+        TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+        aName = theName + "_" + aStr.ToCString();
+        buildName(myFreePrimitiveTag, aName);
+        ++myFreePrimitiveTag;
       } else {
         TopTools_ListIteratorOfListOfShape anIter(aLL);
         const TopoDS_Face& aFace = TopoDS::Face(anIter.Value());
         anIter.Next();
         if(aFace.IsEqual(anIter.Value())) {
-          builder(theTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
-          TCollection_AsciiString aStr(theTag);
-          aName = theName + aStr.ToCString();
-          buildName(theTag, aName);
-          theTag++;
+          builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
+          TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+          aName = theName + "_" + aStr.ToCString();
+          buildName(myFreePrimitiveTag, aName);
+          ++myFreePrimitiveTag;
         }
       }
     }
@@ -873,40 +738,40 @@ void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
     TopTools_IndexedMapOfShape Edges;
     BRepTools::Map3DEdges(aShape, Edges);
     if (Edges.Extent() == 1) {
-      builder(theTag++)->Generated(Edges.FindKey(1));
+      builder(myFreePrimitiveTag++)->Generated(Edges.FindKey(1));
       TopExp_Explorer expl(aShape, TopAbs_VERTEX);
       for (; expl.More(); expl.Next()) {
-        builder(theTag)->Generated(expl.Current());
-        TCollection_AsciiString aStr(theTag);
-        aName = theName + aStr.ToCString();
-        buildName(theTag, aName);
-        theTag++;
+        builder(myFreePrimitiveTag)->Generated(expl.Current());
+        TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+        aName = theName + "_" + aStr.ToCString();
+        buildName(myFreePrimitiveTag, aName);
+        ++myFreePrimitiveTag;
       }
     } else {
       TopExp_Explorer expl(aShape, TopAbs_EDGE);
       for (; expl.More(); expl.Next()) {
-        builder(theTag)->Generated(expl.Current());
-        TCollection_AsciiString aStr(theTag);
-        aName = theName + aStr.ToCString();
-        buildName(theTag, aName);
-        theTag++;
+        builder(myFreePrimitiveTag)->Generated(expl.Current());
+        TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+        aName = theName + "_" + aStr.ToCString();
+        buildName(myFreePrimitiveTag, aName);
+        ++myFreePrimitiveTag;
       }
       // and load generated vertices.
       TopTools_DataMapOfShapeShape generated;
       if (getDangleShapes(aShape, TopAbs_EDGE, generated))
       {
-        TNaming_Builder* pBuilder = builder(theTag++);
+        TNaming_Builder* pBuilder = builder(myFreePrimitiveTag++);
         loadGeneratedDangleShapes(aShape, TopAbs_EDGE, pBuilder);
       }
     }
   } else if (aShape.ShapeType() == TopAbs_EDGE) {
     TopExp_Explorer expl(aShape, TopAbs_VERTEX);
     for (; expl.More(); expl.Next()) {
-      builder(theTag)->Generated(expl.Current());
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-      theTag++;
+      builder(myFreePrimitiveTag)->Generated(expl.Current());
+      TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+      aName = theName + "_" + aStr.ToCString();
+      buildName(myFreePrimitiveTag, aName);
+      ++myFreePrimitiveTag;
     }
   }
 }
@@ -969,8 +834,7 @@ int findAmbiguities(const TopoDS_Shape&           theShapeIn,
 }
 
 //=======================================================================
-void Model_BodyBuilder::loadFirstLevel(
-  std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int&  theTag)
+void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& theName)
 {
   if(theShape->isNull()) return;
   TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
@@ -978,158 +842,41 @@ void Model_BodyBuilder::loadFirstLevel(
   if (aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID) {
     TopoDS_Iterator itr(aShape);
     for (; itr.More(); itr.Next()) {
-      builder(theTag)->Generated(itr.Value());
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-      if(!theName.empty()) buildName(theTag, aName);
-      theTag++;
+      builder(myFreePrimitiveTag)->Generated(itr.Value());
+      TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+      aName = theName + "_" + aStr.ToCString();
+      buildName(myFreePrimitiveTag, aName);
+      ++myFreePrimitiveTag;
       if (itr.Value().ShapeType() == TopAbs_COMPOUND ||
         itr.Value().ShapeType() == TopAbs_COMPSOLID)
       {
-        std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+        GeomShapePtr itrShape(new GeomAPI_Shape());
         itrShape->setImpl(new TopoDS_Shape(itr.Value()));
-        loadFirstLevel(itrShape, theName, theTag);
+        loadFirstLevel(itrShape, theName);
       } else {
-        std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+        GeomShapePtr itrShape(new GeomAPI_Shape());
         itrShape->setImpl(new TopoDS_Shape(itr.Value()));
-        loadNextLevels(itrShape, theName, theTag);
+        loadNextLevels(itrShape, theName);
       }
     }
   } else {
-    std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+    GeomShapePtr itrShape(new GeomAPI_Shape());
     itrShape->setImpl(new TopoDS_Shape(aShape));
-    loadNextLevels(itrShape, theName, theTag);
+    loadNextLevels(itrShape, theName);
   }
   TopTools_ListOfShape   aList;
   if(findAmbiguities(aShape, aList)) {
     TopTools_ListIteratorOfListOfShape it(aList);
-    for (; it.More(); it.Next(),theTag++) {
-      builder(theTag)->Generated(it.Value());
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-    }
-  }
-}
-
-//=======================================================================
-void Model_BodyBuilder::loadDisconnectedEdges(
-  std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int&  theTag)
-{
-  if(theShape->isNull()) return;
-  TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
-  TopTools_DataMapOfShapeListOfShape edgeNaborFaces;
-  TopTools_ListOfShape empty;
-  TopExp_Explorer explF(aShape, TopAbs_FACE);
-  for (; explF.More(); explF.Next()) {
-    const TopoDS_Shape& aFace = explF.Current();
-    TopExp_Explorer explV(aFace, TopAbs_EDGE);
-    for (; explV.More(); explV.Next()) {
-      const TopoDS_Shape& anEdge = explV.Current();
-      if (!edgeNaborFaces.IsBound(anEdge)) edgeNaborFaces.Bind(anEdge, empty);
-      Standard_Boolean faceIsNew = Standard_True;
-      TopTools_ListIteratorOfListOfShape itrF(edgeNaborFaces.Find(anEdge));
-      for (; itrF.More(); itrF.Next()) {
-        if (itrF.Value().IsSame(aFace)) {
-          faceIsNew = Standard_False;
-          break;
-        }
-      }
-      if (faceIsNew)
-        edgeNaborFaces.ChangeFind(anEdge).Append(aFace);
-    }
-  }
-
-  TopTools_MapOfShape anEdgesToDelete;
-  TopExp_Explorer anEx(aShape,TopAbs_EDGE);
-  std::string aName;
-  for(;anEx.More();anEx.Next()) {
-    Standard_Boolean aC0 = Standard_False;
-    TopoDS_Shape anEdge1 = anEx.Current();
-    if (edgeNaborFaces.IsBound(anEdge1)) {
-      const TopTools_ListOfShape& aList1 = edgeNaborFaces.Find(anEdge1);
-      if (aList1.Extent()<2) continue;
-      TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(edgeNaborFaces);
-      for (; itr.More(); itr.Next()) {
-        TopoDS_Shape anEdge2 = itr.Key();
-        if(anEdgesToDelete.Contains(anEdge2)) continue;
-        if (anEdge1.IsSame(anEdge2)) continue;
-        const TopTools_ListOfShape& aList2 = itr.Value();
-        // compare lists of the neighbour faces of edge1 and edge2
-        if (aList1.Extent() == aList2.Extent()) {
-          Standard_Integer aMatches = 0;
-          for(TopTools_ListIteratorOfListOfShape aLIter1(aList1);aLIter1.More();aLIter1.Next())
-            for(TopTools_ListIteratorOfListOfShape aLIter2(aList2);aLIter2.More();aLIter2.Next())
-              if (aLIter1.Value().IsSame(aLIter2.Value())) aMatches++;
-          if (aMatches == aList1.Extent()) {
-            aC0=Standard_True;
-            builder(theTag)->Generated(anEdge2);
-            anEdgesToDelete.Add(anEdge2);
-            TCollection_AsciiString aStr(theTag);
-            aName = theName + aStr.ToCString();
-            buildName(theTag, aName);
-            theTag++;
-          }
-        }
-      }
-      TopTools_MapIteratorOfMapOfShape itDelete(anEdgesToDelete);
-      for(;itDelete.More();itDelete.Next())
-        edgeNaborFaces.UnBind(itDelete.Key());
-      edgeNaborFaces.UnBind(anEdge1);
-    }
-    if (aC0) {
-      builder(theTag)->Generated(anEdge1);
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-      theTag++;
-    }
-  }
-}
-
-void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
-                                                 const std::string& theName, int&  theTag)
-{
-  if(theShape->isNull()) return;
-  TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
-  TopTools_DataMapOfShapeListOfShape vertexNaborEdges;
-  TopTools_ListOfShape empty;
-  TopExp_Explorer explF(aShape, TopAbs_EDGE);
-  for (; explF.More(); explF.Next()) {
-    const TopoDS_Shape& anEdge = explF.Current();
-    TopExp_Explorer explV(anEdge, TopAbs_VERTEX);
-    for (; explV.More(); explV.Next()) {
-      const TopoDS_Shape& aVertex = explV.Current();
-      if (!vertexNaborEdges.IsBound(aVertex)) vertexNaborEdges.Bind(aVertex, empty);
-      Standard_Boolean faceIsNew = Standard_True;
-      TopTools_ListIteratorOfListOfShape itrF(vertexNaborEdges.Find(aVertex));
-      for (; itrF.More(); itrF.Next()) {
-        if (itrF.Value().IsSame(anEdge)) {
-          faceIsNew = Standard_False;
-          break;
-        }
-      }
-      if (faceIsNew) {
-        vertexNaborEdges.ChangeFind(aVertex).Append(anEdge);
-      }
-    }
-  }
-  std::string aName;
-  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(vertexNaborEdges);
-  for (; itr.More(); itr.Next()) {
-    const TopTools_ListOfShape& naborEdges = itr.Value();
-    if (naborEdges.Extent() < 2) {
-      builder(theTag)->Generated(itr.Key());
-      TCollection_AsciiString aStr(theTag);
-      aName = theName + aStr.ToCString();
-      buildName(theTag, aName);
-      theTag++;
+    for (; it.More(); it.Next(), ++myFreePrimitiveTag) {
+      builder(myFreePrimitiveTag)->Generated(it.Value());
+      TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+      aName = theName + "_" + aStr.ToCString();
+      buildName(myFreePrimitiveTag, aName);
     }
   }
 }
 
-std::shared_ptr<GeomAPI_Shape> Model_BodyBuilder::shape()
+GeomShapePtr Model_BodyBuilder::shape()
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData && aData->isValid()) {
@@ -1142,36 +889,11 @@ std::shared_ptr<GeomAPI_Shape> Model_BodyBuilder::shape()
     if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
       TopoDS_Shape aShape = aName->Get();
       if (!aShape.IsNull()) {
-        std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+        GeomShapePtr aRes(new GeomAPI_Shape);
         aRes->setImpl(new TopoDS_Shape(aShape));
         return aRes;
       }
     }
   }
-  return std::shared_ptr<GeomAPI_Shape>();
-}
-
-bool Model_BodyBuilder::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
-  if (theShape.get()) {
-    TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
-    std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-    if (aData) {
-      TDF_Label& aShapeLab = aData->shapeLab();
-      Handle(TNaming_NamedShape) aName;
-      if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
-        TopoDS_Shape aLatest = TNaming_Tool::CurrentShape(aName);
-        if (aLatest.IsNull())
-          return false;
-        if (aLatest.IsEqual(aShape))
-          return true;
-        // check sub-shapes for comp-solids:
-        for (TopExp_Explorer anExp(aShape, aLatest.ShapeType()); anExp.More(); anExp.Next()) {
-          if (aLatest.IsEqual(anExp.Current()))
-            return true;
-        }
-      }
-    }
-  }
-  return false;
+  return GeomShapePtr();
 }
index d34fb0b173bac339d4a8b6e77ea3789334ff8a3d..0689a0f52c6e22625a66bda0d0155e2e11e622ce 100755 (executable)
@@ -41,101 +41,73 @@ class Model_BodyBuilder : public ModelAPI_BodyBuilder
   std::map<int, TNaming_Builder*> myBuilders;
 public:
   /// Stores the shape (called by the execution method).
-  MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+  MODEL_EXPORT virtual void store(const GeomShapePtr& theShape,
                                   const bool theIsStoreSameShapes = true);
 
   /// Stores the generated shape (called by the execution method).
-  MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-                                              const std::shared_ptr<GeomAPI_Shape>& theToShape);
+  MODEL_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
+                                           const GeomShapePtr& theToShape);
 
   /// Stores the modified shape (called by the execution method).
   /// \param theOldShape shape that produces result
   /// \param theNewShape resulting shape
   /// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
   ///          theNewShape is compound of solids, if zero it is not used
-  MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-                                               const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-                                          const int theDecomposeSolidsTag = 0);
-
-  /// Stores the shape without naming support
-  /// \param theShape shape to store
-  MODEL_EXPORT virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape);
+  MODEL_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
+                                          const GeomShapePtr& theNewShape,
+                                          const bool theIsCleanStored = true) override;
 
   /// Returns the shape-result produced by this feature
-  MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+  MODEL_EXPORT virtual GeomShapePtr shape();
 
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
-  MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
+  /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+  MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+    const std::string& theName, const bool theCheckIsInResult = true) override;
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
   /// construction of a prism.
-  MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
+  MODEL_EXPORT virtual void generated(const GeomShapePtr& theOldShape,
+                                      const GeomShapePtr& theNewShape,
+                                      const std::string& theName = "") override;
 
 
   /// Records the shape newShape which is a modification of the shape oldShape.
   /// As an example, consider the case of a face split or merged in a Boolean operation.
-  MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
-
-  /// Records the shape oldShape which was deleted from the current label.
-  /// As an example, consider the case of a face removed by a Boolean operation.
-  MODEL_EXPORT virtual void deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const int theTag = 1);
+  MODEL_EXPORT virtual void modified(const GeomShapePtr& theOldShape,
+                                     const GeomShapePtr& theNewShape,
+                                     const std::string& theName = "") override;
 
   /// load deleted shapes
-  MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                               const GeomShapePtr theShapes = GeomShapePtr());
+  MODEL_EXPORT
+  virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+                                 const GeomShapePtr& theOldShape,
+                                 const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                 const GeomShapePtr& theShapesToExclude = GeomShapePtr()) override;
+
   /// load and orient modified shapes
-  MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
-                                                  GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                                                                          const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes,
-                                               const bool theIsStoreSeparate = false,
-                                               const bool theIsStoreAsGenerated = false);
-   /// load and orient generated shapes
-  MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
-                                                  GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                                                                          const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes);
+  MODEL_EXPORT
+  virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+                                  const GeomShapePtr& theOldShape,
+                                  const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                  const std::string& theName = "") override;
+
+  /// load and orient generated shapes
+  MODEL_EXPORT
+  virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+                                   const GeomShapePtr& theOldShape,
+                                   const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                   const std::string& theName = "") override;
 
   /// Loads shapes of the first level (to be used during shape import)
-  MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
-                                           const std::string& theName, int&  theTag);
-
-  /// Loads disconnected edges
-  MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
-                                                  const std::string& theName, int&  theTag);
-
-  /// Loads disconnected vetexes
-  MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
-                                                     const std::string& theName, int&  theTag);
+  MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
+                                           const std::string& theName) override;
 
   /// Removes the stored builders
   MODEL_EXPORT virtual ~Model_BodyBuilder();
 
-  /// Converts evolution of sub-shapes stored in naming structure to selection
-  /// (theFlag = true) and back (theFlag = false)
-  MODEL_EXPORT virtual void evolutionToSelection(const bool theFlag);
-
-  /// Returns true if the latest modification of this body in the naming history
-  // is equal to the given shape
-  MODEL_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape);
-
 protected:
   /// Default constructor accessible only by Model_Objects
   Model_BodyBuilder(ModelAPI_Object* theOwner);
@@ -148,17 +120,21 @@ protected:
 
 private:
   /// Loads shapes of the next level (to be used during shape import)
-  void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
-                      const std::string& theName, int&  theTag);
+  void loadNextLevels(GeomShapePtr theShape,
+                      const std::string& theName);
 
   /// builds name for the shape kept at the specified tag
   void buildName(const int theTag, const std::string& theName);
 
 private:
-  int myDividedIndex;
-  int myVIndex;
-  int myEIndex;
-  int myFIndex;
+  struct IndexTags {
+    int index;
+    std::vector<int> tags;
+  };
+
+private:
+  int myFreePrimitiveTag;
+  std::map<std::string, IndexTags> myPrimitivesNamesIndexMap;
 
 private:
   friend class Model_ResultBody;
index d7d14ad8cae6bea66468270675810de020136356..bfc4630579c80b776fda7551bca57a10c1307e16 100644 (file)
@@ -111,7 +111,7 @@ void Model_Data::setLabel(TDF_Label theLab)
 std::string Model_Data::name()
 {
   Handle(TDataStd_Name) aName;
-  if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
+  if (shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
 #ifdef DEBUG_NAMES
     myObject->myName = TCollection_AsciiString(aName->Get()).ToCString();
 #endif
@@ -125,8 +125,8 @@ void Model_Data::setName(const std::string& theName)
   bool isModified = false;
   std::string anOldName = name();
   Handle(TDataStd_Name) aName;
-  if (!myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
-    TDataStd_Name::Set(myLab, theName.c_str());
+  if (!shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
+    TDataStd_Name::Set(shapeLab(), theName.c_str());
     isModified = true;
   } else {
     isModified = !aName->Get().IsEqual(theName.c_str());
@@ -143,7 +143,7 @@ void Model_Data::setName(const std::string& theName)
       }
       if (isUserDefined) {
         // name is user-defined, thus special attribute is set
-        TDataStd_UAttribute::Set(myLab, kUSER_DEFINED_NAME);
+        TDataStd_UAttribute::Set(shapeLab(), kUSER_DEFINED_NAME);
       }
     }
   }
@@ -151,7 +151,7 @@ void Model_Data::setName(const std::string& theName)
     ModelAPI_ObjectRenamedMessage::send(myObject, anOldName, theName, this);
   if (isModified && myObject && myObject->document()) {
     std::dynamic_pointer_cast<Model_Document>(myObject->document())->
-      changeNamingName(anOldName, theName, myLab);
+      changeNamingName(anOldName, theName, shapeLab());
   }
 #ifdef DEBUG_NAMES
   myObject->myName = theName;
@@ -160,7 +160,7 @@ void Model_Data::setName(const std::string& theName)
 
 bool Model_Data::hasUserDefinedName() const
 {
-  return myLab.IsAttribute(kUSER_DEFINED_NAME);
+  return shapeLab().IsAttribute(kUSER_DEFINED_NAME);
 }
 
 AttributePtr Model_Data::addAttribute(const std::string& theID, const std::string theAttrType)
@@ -346,10 +346,10 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr)
     }
   } else {
     // trim: need to redisplay
-    if (myObject) {
+    /*if (myObject) {
       static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
       ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
-    }
+    }*/
   }
 }
 
index 598193cb8903bc6eae4ed0b44601ca727bd94e46..2ed26625f42b0da7b4a12cd01cbaeea42d30e7f5 100644 (file)
@@ -172,9 +172,9 @@ class Model_Data : public ModelAPI_Data
   MODEL_EXPORT virtual bool isValid();
 
   /// Returns the label where the shape must be stored (used in ResultBody)
-  TDF_Label& shapeLab()
+  TDF_Label shapeLab() const
   {
-    return myLab;
+    return myLab.IsNull() ? myLab : myLab.Father().FindChild(2);
   }
 
   /// Initializes object by the attributes: must be called just after the object is created
index 7acdecde220b777596bc253df61c14321945cff3..99a624ae09f4746f66d7ef5f9a21596db44d6cf9 100755 (executable)
@@ -32,6 +32,7 @@
 #include <ModelAPI_ResultBody.h>
 #include <Events_Loop.h>
 #include <Events_InfoMessage.h>
+#include <GeomAPI_Tools.h>
 
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
 #include <TDF_ListIteratorOfAttributeDeltaList.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
 #include <TDF_LabelMap.hxx>
+#include <TDF_Tool.hxx>
 #include <TDF_DeltaOnAddition.hxx>
+#include <TDataStd_ExtStringList.hxx>
 #include <TDataStd_UAttribute.hxx>
 #include <TNaming_Builder.hxx>
 #include <TNaming_SameShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Tool.hxx>
+#include<TNaming_OldShapeIterator.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopTools_ListOfShape.hxx>
 
 #include <TopExp_Explorer.hxx>
 #include <TopoDS_Shape.hxx>
@@ -85,13 +91,16 @@ static const int TAG_GENERAL = 1;  // general properties tag
 // general sub-labels
 /// where the reference to the current feature label is located (or no attribute if null feature)
 static const int TAG_CURRENT_FEATURE = 1; ///< reference to the current feature
-/// integer, index of the transaction + GUID for auto recomutation blocking
+/// integer, index of the transaction + GUID for auto recomputation blocking
 static const int TAG_CURRENT_TRANSACTION = 2;
 static const int TAG_SELECTION_FEATURE = 3; ///< integer, tag of the selection feature label
 static const int TAG_NODES_STATE = 4; ///< array, tag of the Object Browser nodes states
 ///< naming structures constructions selected from other document
 static const int TAG_EXTERNAL_CONSTRUCTIONS = 5;
 
+/// reference to the shape in external document: sting list attribute identifier
+static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd");
+
 Model_Document::Model_Document(const int theID, const std::string theKind)
     : myID(theID), myKind(theKind), myIsActive(false), myIsSetCurrentFeature(false),
       myDoc(new TDocStd_Document("BinOcaf"))  // binary OCAF format
@@ -136,6 +145,82 @@ bool Model_Document::isRoot() const
   return this == Model_Session::get()->moduleDocument().get();
 }
 
+/// Makes all modification and generation naming shapes that have old shapes corresponding to
+/// shapes in a root document be equal to this root document
+static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label theRootAccess)
+{
+  TopTools_DataMapOfShapeShape aCurrentToRoot; // shapes that must be updated: from this to root
+  TDF_ChildIDIterator aThisIter(theThisAccess.Root(), kEXTERNAL_SHAPE_REF, true);
+  for(; aThisIter.More(); aThisIter.Next()) {
+    aCurrentToRoot.Clear();
+    Handle(TNaming_NamedShape) aNS;
+    if (!aThisIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS))
+      continue;
+    if (aNS->Evolution() != TNaming_GENERATED && aNS->Evolution() != TNaming_MODIFY)
+      continue;
+    for (TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+      const TopoDS_Shape& anOld = aNSIter.OldShape();
+      if (anOld.IsNull())
+        continue;
+      TNaming_OldShapeIterator aNewIter(anOld, theThisAccess);
+      for (; aNewIter.More(); aNewIter.Next()) {
+        TNaming_Evolution anEvolution = aNewIter.NamedShape()->Evolution();
+        if (anEvolution != TNaming_SELECTED && anEvolution != TNaming_DELETE)
+          break;
+      }
+      if (aNewIter.More())
+        continue;
+      GeomShapePtr anOldShape(new GeomAPI_Shape), aRootShape(new GeomAPI_Shape);
+      anOldShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOld));
+      anOldShape = GeomAPI_Tools::getTypedShape(anOldShape);
+
+      // search the same shape in the root document
+      Handle(TDataStd_ExtStringList) anEntries =
+        Handle(TDataStd_ExtStringList)::DownCast(aThisIter.Value());
+      TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
+      for (; anIter.More(); anIter.Next()) {
+        TDF_Label aRootLab;
+        TDF_Tool::Label(theRootAccess.Data(), anIter.Value(), aRootLab);
+        if (aRootLab.IsNull())
+          continue;
+        Handle(TNaming_NamedShape) aRootNS;
+        if (!aRootLab.FindAttribute(TNaming_NamedShape::GetID(), aRootNS))
+          continue;
+        TNaming_Iterator aRootShapes(aRootNS);
+        for (; aRootShapes.More(); aRootShapes.Next()) {
+          if (aRootShapes.NewShape().IsNull())
+            continue;
+          aRootShape->setImpl(new TopoDS_Shape(aRootShapes.NewShape()));
+          aRootShape = GeomAPI_Tools::getTypedShape(aRootShape);
+          if (!anOldShape->isEqual(aRootShape)) // special checking by geometry
+            continue;
+          // found a good corresponded shape
+          if (!anOld.IsEqual(aRootShapes.NewShape()))
+            aCurrentToRoot.Bind(anOld, aRootShapes.NewShape());
+        }
+      }
+    }
+    if (!aCurrentToRoot.IsEmpty()) { // update the whole named shape content
+      TopTools_ListOfShape anOld, aNew;
+      TNaming_Evolution anEvol = aNS->Evolution();
+      for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+        anOld.Prepend(aCurrentToRoot.IsBound(aNSIter.OldShape()) ?
+          aCurrentToRoot.Find(aNSIter.OldShape()) : aNSIter.OldShape());
+        aNew.Prepend(aNSIter.NewShape());
+      }
+      TNaming_Builder aBuilder(aNS->Label());
+      TopTools_ListOfShape::Iterator anOldIter(anOld), aNewIter(aNew);
+      for(; anOldIter.More(); anOldIter.Next(), aNewIter.Next()) {
+        if (anEvol == TNaming_GENERATED) {
+          aBuilder.Generated(anOldIter.Value(), aNewIter.Value());
+        } else if (anEvol == TNaming_MODIFY) {
+          aBuilder.Modify(anOldIter.Value(), aNewIter.Value());
+        }
+      }
+    }
+  }
+}
+
 bool Model_Document::load(const char* theDirName, const char* theFileName, DocumentPtr theThis)
 {
   Handle(Model_Application) anApp = Model_Application::getApplication();
@@ -220,12 +305,12 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
     aSession->setCheckTransactions(false);
     if (myObjs)
       delete myObjs;
-    myObjs = new Model_Objects(myDoc->Main()); // synchronisation is inside
+    myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
     myObjs->setOwner(theThis);
     // update the current features status
     setCurrentFeature(currentFeature(false), false);
     aSession->setCheckTransactions(true);
-    aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
+    aSession->setActiveDocument(aSession->moduleDocument(), false);
     // this is done in Part result "activate", so no needed here. Causes not-blue active part.
     // aSession->setActiveDocument(anApp->getDocument(myID), true);
 
@@ -239,8 +324,11 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
         anApp->setLoadByDemand(aPart->data()->name(),
           aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId());
     }
-
-  } else { // open failed, but new documnet was created to work with it: inform the model
+    if (!isRoot()) {
+      updateShapesFromRoot(myDoc->Main(),
+        std::dynamic_pointer_cast<Model_Document>(aSession->moduleDocument())->generalLabel());
+    }
+  } else { // open failed, but new document was created to work with it: inform the model
     aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
   }
   return !isError;
@@ -369,10 +457,10 @@ void Model_Document::close(const bool theForever)
       aSub->close(theForever);
   }
 
-  // close for thid document needs no transaction in this document
+  // close for this document needs no transaction in this document
   std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
 
-  // close all only if it is really asked, otherwise it can be undoed/redoed
+  // close all only if it is really asked, otherwise it can be undone/redone
   if (theForever) {
     // flush everything to avoid messages with bad objects
     delete myObjs;
@@ -425,7 +513,7 @@ void Model_Document::compactNested()
       aSumOfTransaction += myTransactions.rbegin()->myOCAFNum;
       myTransactions.pop_back();
     }
-    // the latest transaction is the start of lower-level operation which startes the nested
+    // the latest transaction is the start of lower-level operation which starts the nested
     myTransactions.rbegin()->myOCAFNum += aSumOfTransaction;
     myNestedNum.pop_back();
   }
@@ -521,7 +609,7 @@ static bool isEqualContent(Handle(TDF_Attribute) theAttr1, Handle(TDF_Attribute)
   return false;
 }
 
-/// Returns true if the last transaction is actually empty: modification to te same values
+/// Returns true if the last transaction is actually empty: modification to the same values
 /// were performed only
 static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) {
   Handle(TDF_Delta) aDelta;
@@ -568,7 +656,7 @@ bool Model_Document::finishOperation()
   // do it before flashes to enable and recompute nesting features correctly
   if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) {
     // if all nested operations are closed, make current the higher level objects (to perform
-    // it in the python scripts correctly): sketch become current after creation ofsub-elements
+    // it in the python scripts correctly): sketch become current after creation of sub-elements
     FeaturePtr aCurrent = currentFeature(false);
     CompositeFeaturePtr aMain, aNext = ModelAPI_Tools::compositeOwner(aCurrent);
     while(aNext.get()) {
@@ -627,7 +715,7 @@ bool Model_Document::finishOperation()
 
   // transaction may be empty if this document was created during this transaction (create part)
   if (!myTransactions.empty() && myDoc->CommitCommand()) {
-    // if commit is successfull, just increment counters
+    // if commit is successful, just increment counters
     if (isEmptyTransaction(myDoc)) { // erase this transaction
       myDoc->Undo();
       myDoc->ClearRedos();
@@ -647,7 +735,7 @@ bool Model_Document::finishOperation()
     // nothing inside in all documents, so remove this transaction from the transactions list
     undoInternal(true, false);
   }
-  // on finish clear redos in any case (issue 446) and for all subs (issue 408)
+  // on finish clear redo in any case (issue 446) and for all subs (issue 408)
   myDoc->ClearRedos();
   myRedos.clear();
   for (aSubIter = aSubs.begin(); aSubIter != aSubs.end(); aSubIter++) {
@@ -683,7 +771,7 @@ static void modifiedLabels(const Handle(TDocStd_Document)& theDoc, TDF_LabelList
     if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) {
       anExcludedInt.Add(anAttr.Value()->Label());
       // named shape evolution is changed in history update => skip them,
-      // they are not the features arguents
+      // they are not the features arguments
       continue;
     }
     if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) {
@@ -755,7 +843,7 @@ bool Model_Document::isOperation() const
 
 bool Model_Document::isModified()
 {
-  // is modified if at least one operation was commited and not undoed
+  // is modified if at least one operation was committed and not undone
   return myTransactions.size() != myTransactionSave || isOperation();
 }
 
@@ -768,7 +856,7 @@ bool Model_Document::canUndo()
       (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) &&
       myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */)
     return true;
-  // check other subs contains operation that can be undoed
+  // check other subs contains operation that can be undone
   const std::set<int> aSubs = subDocuments();
   std::set<int>::iterator aSubIter = aSubs.begin();
   for (; aSubIter != aSubs.end(); aSubIter++) {
@@ -826,7 +914,7 @@ bool Model_Document::canRedo()
 {
   if (!myRedos.empty())
     return true;
-  // check other subs contains operation that can be redoed
+  // check other subs contains operation that can be redone
   const std::set<int> aSubs = subDocuments();
   std::set<int>::iterator aSubIter = aSubs.begin();
   for (; aSubIter != aSubs.end(); aSubIter++) {
@@ -952,6 +1040,22 @@ void Model_Document::refsToFeature(FeaturePtr theFeature,
 void Model_Document::removeFeature(FeaturePtr theFeature)
 {
   myObjs->removeFeature(theFeature);
+  // fix for #2723: send signal that part is updated
+  if (!isRoot()) {
+    std::shared_ptr<Model_Document> aRoot =
+      std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument());
+    std::list<ResultPtr> allParts;
+    aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts);
+    std::list<ResultPtr>::iterator aParts = allParts.begin();
+    for(; aParts != allParts.end(); aParts++) {
+      ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aParts);
+      if (aPart->partDoc().get() == this) {
+        static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+        ModelAPI_EventCreator::get()->sendUpdated(aRoot->feature(aPart), anEvent);
+        break;
+      }
+    }
+  }
 }
 
 // recursive function to check if theSub is a child of theMain composite feature
@@ -979,8 +1083,9 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis)
   FeaturePtr anAfterThisSub = theAfterThis;
   if (aCompositeAfter.get()) {
     FeaturePtr aSub = aCompositeAfter;
+    int anIndex = kUNDEFINED_FEATURE_INDEX;
     do {
-      FeaturePtr aNext = myObjs->nextFeature(aSub);
+      FeaturePtr aNext = myObjs->nextFeature(aSub, anIndex);
       if (!isSub(aCompositeAfter, aNext)) {
         anAfterThisSub = aSub;
         break;
@@ -1000,12 +1105,14 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis)
 
 void Model_Document::updateHistory(const std::shared_ptr<ModelAPI_Object> theObject)
 {
-  myObjs->updateHistory(theObject);
+  if (myObjs)
+    myObjs->updateHistory(theObject);
 }
 
 void Model_Document::updateHistory(const std::string theGroup)
 {
-  myObjs->updateHistory(theGroup);
+  if (myObjs)
+    myObjs->updateHistory(theGroup);
 }
 
 const std::set<int> Model_Document::subDocuments() const
@@ -1074,8 +1181,9 @@ std::shared_ptr<ModelAPI_Feature> Model_Document::currentFeature(const bool theV
     TDF_Label aLab = aRef->Get();
     FeaturePtr aResult = myObjs->feature(aLab);
     if (theVisible) { // get nearest visible (in history) going up
+      int anIndex = kUNDEFINED_FEATURE_INDEX;
       while(aResult.get() &&  !aResult->isInHistory()) {
-        aResult = myObjs->nextFeature(aResult, true);
+        aResult = myObjs->nextFeature(aResult, anIndex, true);
       }
     }
     return aResult;
@@ -1111,9 +1219,10 @@ void Model_Document::setCurrentFeature(
 
   if (theVisible && !theCurrent.get()) {
     // needed to avoid disabling of PartSet initial constructions
+    int anIndex = kUNDEFINED_FEATURE_INDEX;
     FeaturePtr aNext =
-      theCurrent.get() ? myObjs->nextFeature(theCurrent) : myObjs->firstFeature();
-    for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent)) {
+      theCurrent.get() ? myObjs->nextFeature(theCurrent, anIndex, false) : myObjs->firstFeature();
+    for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent, anIndex, false)) {
       if (aNext->isInHistory()) {
         break; // next in history is not needed
       } else { // next not in history is good for making current
@@ -1140,14 +1249,15 @@ void Model_Document::setCurrentFeature(
     aRefLab.ForgetAttribute(TDF_Reference::GetID());
   }
   // make all features after this feature disabled in reversed order
-  // (to remove results without deps)
+  // (to remove results without dependencies)
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
 
   bool aPassed = false; // flag that the current object is already passed in cycle
   FeaturePtr anIter = myObjs->lastFeature();
   bool aWasChanged = false;
   bool isCurrentParameter = theCurrent.get() && theCurrent->getKind() == "Parameter";
-  for(; anIter.get(); anIter = myObjs->nextFeature(anIter, true)) {
+  int anIndex = kUNDEFINED_FEATURE_INDEX;
+  for(; anIter.get(); anIter = myObjs->nextFeature(anIter, anIndex, true)) {
     // check this before passed become enabled: the current feature is enabled!
     if (anIter == theCurrent) aPassed = true;
 
@@ -1167,7 +1277,7 @@ void Model_Document::setCurrentFeature(
       //if (!isCurrentParameter)
         aDisabledFlag = false;
     } else if (isCurrentParameter) {
-      // if paramater is active, all other features become enabled (issue 1307)
+      // if parameter is active, all other features become enabled (issue 1307)
       aDisabledFlag = false;
     }
 
@@ -1182,7 +1292,7 @@ void Model_Document::setCurrentFeature(
       ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
       aWasChanged = true;
     }
-    // update for everyone the concealment flag immideately: on edit feature in the midle of history
+    // update for everyone concealment flag immediately: on edit feature in the middle of history
     if (aWasChanged) {
       std::list<ResultPtr> aResults;
       ModelAPI_Tools::allResults(anIter, aResults);
@@ -1191,7 +1301,7 @@ void Model_Document::setCurrentFeature(
         if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
           std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->updateConcealmentFlag();
       }
-      // update the concealment status for disply in isConcealed of ResultBody
+      // update the concealment status for display in isConcealed of ResultBody
       for(aRes = aResults.begin(); aRes != aResults.end(); aRes++) {
         if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
           (*aRes)->isConcealed();
@@ -1209,12 +1319,13 @@ void Model_Document::setCurrentFeatureUp()
   // problems if it is true: here and in "setCurrentFeature"
   FeaturePtr aCurrent = currentFeature(false);
   if (aCurrent.get()) { // if not, do nothing because null is the upper
-    FeaturePtr aPrev = myObjs->nextFeature(aCurrent, true);
+    int anIndex = kUNDEFINED_FEATURE_INDEX;
+    FeaturePtr aPrev = myObjs->nextFeature(aCurrent, anIndex, true);
     // make the higher level composite as current (sketch becomes disabled if line is enabled)
     if (aPrev.get()) {
       FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev);
       // without cycle (issue 1555): otherwise extrusion fuse
-      // will be enabled and displayed whaen inside sketch
+      // will be enabled and displayed when inside sketch
       if (aComp.get())
           aPrev = aComp;
     }
@@ -1334,7 +1445,6 @@ Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2)
   return TDF_LabelMapHasher::IsEqual(theLab1, theLab2);
 }
 
-// searches in this document feature that contains this label
 FeaturePtr Model_Document::featureByLab(const TDF_Label& theLab) {
   TDF_Label aCurrentLab = theLab;
   while(aCurrentLab.Depth() > 3)
@@ -1342,12 +1452,26 @@ FeaturePtr Model_Document::featureByLab(const TDF_Label& theLab) {
   return myObjs->feature(aCurrentLab);
 }
 
+ResultPtr Model_Document::resultByLab(const TDF_Label& theLab)
+{
+  TDF_Label aCurrentLab = theLab;
+  while(aCurrentLab.Depth() > 3) {
+    ObjectPtr aResultObj = myObjs->object(aCurrentLab);
+    if (aResultObj.get()) {
+      return std::dynamic_pointer_cast<ModelAPI_Result>(aResultObj); // this may be null if feature
+    }
+    aCurrentLab = aCurrentLab.Father();
+  }
+  return ResultPtr(); // not found
+}
+
+
 void Model_Document::addNamingName(const TDF_Label theLabel, std::string theName)
 {
   std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
 
   if (aFind != myNamingNames.end()) { // to avoid duplicate-labels
-    // to keep correct order inspite of history line management
+    // to keep correct order in spite of history line management
     std::list<TDF_Label>::iterator anAddAfterThis = aFind->second.end();
     FeaturePtr anAddedFeature = featureByLab(theLabel);
     std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
@@ -1391,6 +1515,17 @@ void Model_Document::changeNamingName(const std::string theOldName,
         } else { // remove from the list
           aFind->second.erase(aLabIter);
         }
+        // check the sketch vertex name located under renamed sketch line
+        TDF_ChildIDIterator aChild(theLabel, TDataStd_Name::GetID());
+        for(; aChild.More(); aChild.Next()) {
+          Handle(TDataStd_Name) aSubName = Handle(TDataStd_Name)::DownCast(aChild.Value());
+          std::string aName = TCollection_AsciiString(aSubName->Get()).ToCString();
+          if (aName.find(theOldName) == 0) { // started from parent name
+            std::string aNewSubName = theNewName + aName.substr(theNewName.size());
+            changeNamingName(aName, aNewSubName, aSubName->Label());
+            aSubName->Set(aNewSubName.c_str());
+          }
+        }
         return;
       }
     }
@@ -1409,7 +1544,7 @@ TDF_Label Model_Document::findNamingName(std::string theName, ResultPtr theConte
             return *aLabIter;
         }
       }
-      return *(aFind->second.rbegin()); // no more variannts, so, return the last
+      return *(aFind->second.rbegin()); // no more variants, so, return the last
   }
   // not found exact name, try to find by sub-components
   std::string::size_type aSlash = theName.rfind('/');
@@ -1480,12 +1615,24 @@ bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) {
         if (!aRefFeat.get()) { // take feature of the result
           aRefFeat = feature(std::dynamic_pointer_cast<ModelAPI_Result>(aRefObj));
         }
-        if (aRefFeat.get() && aRefFeat == theThis) {
-          return false; // other references to this, so this later than other
+        if (aRefFeat.get()) {
+          if (aRefFeat == theThis)
+            return false; // other references to this, so other later than this
+          //if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeat)) {
+          //  if (!isLaterByDep(theThis, aRefFeat)) // nested composites: recursion
+          //    return false;
+          //}
         }
       }
     }
   }
+  FeaturePtr aThisOwner = ModelAPI_Tools::compositeOwner(theThis);
+  if (aThisOwner.get()) {
+    if (aThisOwner == theOther)
+      return true; // composite owner is later that its sub
+    if (!isLaterByDep(aThisOwner, theOther))
+      return false;
+  }
   return myObjs->isLater(theThis, theOther);
 }
 
@@ -1536,7 +1683,7 @@ ResultPtr Model_Document::findByName(
   std::string aName = theName;
   ResultPtr aRes = myObjs->findByName(aName);
   theUniqueContext = !(aRes.get() && myNamingNames.find(aName) != myNamingNames.end());
-  while(!aRes.get() && aName[0] == '_') { // this may be thecontext with the history index
+  while(!aRes.get() && aName[0] == '_') { // this may be theContext with the history index
     aNumInHistory++;
     aName = aName.substr(1);
     aRes = myObjs->findByName(aName);
@@ -1648,17 +1795,17 @@ void Model_Document::synchronizeTransactions()
   Model_Document* aRoot =
     std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument()).get();
   if (aRoot == this)
-    return; // don't need to synchronise root with root
+    return; // don't need to synchronize root with root
 
   std::shared_ptr<Model_Session> aSession =
     std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
-  while(myRedos.size() > aRoot->myRedos.size()) { // remove redos in this
+  while(myRedos.size() > aRoot->myRedos.size()) { // remove redo in this
     aSession->setCheckTransactions(false);
     redo();
     aSession->setCheckTransactions(true);
   }
   /* this case can not be reproduced in any known case for the current moment, so, just comment
-  while(myRedos.size() < aRoot->myRedos.size()) { // add more redos in this
+  while(myRedos.size() < aRoot->myRedos.size()) { // add more redo in this
     undoInternal(false, true);
   }*/
 }
@@ -1778,11 +1925,11 @@ std::shared_ptr<ModelAPI_Feature> Model_Document::producedByFeature(
   if (!aBodyData.get() || !aBodyData->isValid())
     return FeaturePtr();
 
-  TopoDS_Shape anOldShape; // old shape in the pair oldshape->theShape in the named shape
+  TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape
   TopoDS_Shape aShapeContainer; // old shape of the shape that contains aShape as sub-element
   Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;
-  TDF_Label aBodyLab = aBodyData->label();
-  // use childs and this label (the lowest priority)
+  TDF_Label aBodyLab = aBodyData->shapeLab();
+  // use child and this label (the lowest priority)
   TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), Standard_True);
   bool aUseThis = !aNSIter.More();
   while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {
index 0842d3d326b5b53fdf16b85cb584f0c060cb0efa..f4c6233d1c72cd18e37a588fda9c798295f3d6fe 100644 (file)
@@ -38,8 +38,8 @@ class ModelAPI_AttributeSelectionList;
 /**\class Model_Document
  * \ingroup DataModel
  * \brief Document for internal data structure of any object storage.
- * Document contains all data that must be stored/retrived in the file.
- * Also it provides acces to this data: open/save, transactions management etc.
+ * Document contains all data that must be stored/retrieved in the file.
+ * Also it provides access to this data: open/save, transactions management etc.
  */
 class Model_Document : public ModelAPI_Document
 {
@@ -66,11 +66,11 @@ class Model_Document : public ModelAPI_Document
     const char* theDirName, const char* theFileName, std::list<std::string>& theResults);
 
   //! Removes document data
-  //! \param theForever if it is false, document is just hiden
+  //! \param theForever if it is false, document is just hidden
   //!                   (to keep possibility make it back on Undo/Redo)
   MODEL_EXPORT virtual void close(const bool theForever = false);
 
-  //! Starts a new operation (opens a tansaction)
+  //! Starts a new operation (opens a transaction)
   MODEL_EXPORT virtual void startOperation();
   //! Finishes the previously started operation (closes the transaction)
   //! \returns true if transaction in this document is not empty and really was performed
@@ -82,11 +82,11 @@ class Model_Document : public ModelAPI_Document
   //! Returns true if document was modified (since creation/opening)
   MODEL_EXPORT virtual bool isModified();
 
-  //! Returns True if there are available Undos
+  //! Returns True if there are available Undo-s
   MODEL_EXPORT virtual bool canUndo();
   //! Undoes last operation
   MODEL_EXPORT virtual void undo();
-  //! Returns True if there are available Redos
+  //! Returns True if there are available Redo-s
   MODEL_EXPORT virtual bool canRedo();
   //! Redoes last operation
   MODEL_EXPORT virtual void redo();
@@ -176,15 +176,15 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
   //! Performs synchronization of transactions with the module document:
   //! If some document is not active (by undo of activation) but in memory,
-  //! on activation the transactions must be synchronised because all redos performed
-  //! wihtout this participation
+  //! on activation the transactions must be synchronized because all redo-s performed
+  //! without this participation
   MODEL_EXPORT virtual void synchronizeTransactions();
 
   //! Returns feature by the id of the feature (produced by the Data "featureId" method)
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> featureById(const int theId);
 
 
-  /// Creates a construction cresults
+  /// Creates construction results
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
       const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
   /// Creates a body results
@@ -229,7 +229,7 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
       const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
   //! Search a folder containing the given feature.
-  //! Addtionally calculates a zero-based index of the feature in this folder.
+  //! Additionally calculates a zero-based index of the feature in this folder.
   //! \param theFeature feature to search
   //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
   //! \return the folder containing the feature or empty pointer if the feature is top-level.
@@ -238,7 +238,7 @@ class Model_Document : public ModelAPI_Document
       int& theIndexInFolder);
   //! Add a list of features to the folder. The correctness of the adding is not performed
   //! (such checks have been done in corresponding find.. method).
-  //! \return \c true if the movement is successfull
+  //! \return \c true if the movement is successful
   MODEL_EXPORT virtual bool moveToFolder(
       const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
       const std::shared_ptr<ModelAPI_Folder>& theFolder);
@@ -252,7 +252,7 @@ class Model_Document : public ModelAPI_Document
       const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
       const bool theBefore = true);
 
-  ///! Returns true if parametric updater need to execute feature on recomputartion
+  ///! Returns true if parametric updater need to execute feature on recomputation
   ///! On abort, undo or redo it is not necessary: results in document are updated automatically
   bool executeFeatures() {return myExecuteFeatures;}
 
@@ -321,22 +321,22 @@ class Model_Document : public ModelAPI_Document
   }
 
   //! performs compactification of all nested operations into one
-  //! \returns true if resulting transaction is not empty and can be undoed
+  //! \returns true if resulting transaction is not empty and can be undone
   void compactNested();
 
   //! Returns all loaded sub documents
   const std::set<int> subDocuments() const;
 
-  //! The implementation of undo: with or without recoursive calls in the sub-documents
+  //! The implementation of undo: with or without recursive calls in the sub-documents
   void undoInternal(const bool theWithSubs, const bool theSynchronize);
 
   //! Stores the Id of the current operation (normally is called for the root document)
   void operationId(const std::string& theId);
 
-  //! Returns the list of Ids of the operations that can be undoed (called for the root document)
+  //! Returns the list of Ids of the operations that can be undone (called for the root document)
   std::list<std::string> undoList() const;
 
-  //! Returns the list of Ids of the operations that can be redoed (called for the root document)
+  //! Returns the list of Ids of the operations that can be redone (called for the root document)
   std::list<std::string> redoList() const;
 
   //! Internally makes document know that feature was removed or added in history after creation
@@ -366,25 +366,27 @@ class Model_Document : public ModelAPI_Document
   /// Normally is called outside of the transaction, just before "save".
   virtual void storeNodesState(const std::list<bool>& theStates);
 
-  /// Returns the stored nodes states. Normally it is calles just after "open".
+  /// Returns the stored nodes states. Normally it is called just after "open".
   /// Appends the values to theStates list.
   virtual void restoreNodesState(std::list<bool>& theStates) const;
 
-  /// Label that constains structures for selection of constructions of another document
+  /// Label that contains structures for selection of constructions of another document
   TDF_Label extConstructionsLabel() const;
 
   /// searches in this document feature that contains this label
   FeaturePtr featureByLab(const TDF_Label& theLab);
+  /// searches in this document result that contains this label
+  ResultPtr resultByLab(const TDF_Label& theLab);
 
-  /// returns true if theThis is later in the features trre and dependencies than theOther
+  /// returns true if theThis is later in the features tree and dependencies than theOther
   bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther);
 
   /// appends the latest transaction to the previous one (used for AutoUpdate enabling transaction)
   void appendTransactionToPrevious();
 
-  /// Sets the automatic recomutation flag: true means enabled
+  /// Sets the automatic recomputation flag: true means enabled
   void setAutoRecomutationState(const bool theState);
-  /// Returns the current automatic recomutation flag: true means enabled
+  /// Returns the current automatic recomputation flag: true means enabled
   bool autoRecomutationState() const;
 
   friend class Model_Application;
@@ -399,6 +401,7 @@ class Model_Document : public ModelAPI_Document
   friend class Model_ResultBody;
   friend class Model_ResultConstruction;
   friend class Model_SelectionNaming;
+  friend class Model_BodyBuilder;
   friend class DFBrowser;
 
  private:
@@ -410,7 +413,7 @@ class Model_Document : public ModelAPI_Document
 
   //! counter value of transaction on the last "save" call, used for "IsModified" method
   int myTransactionSave;
-  //! number of nested transactions performed (list becasue may be nested inside of nested)
+  //! number of nested transactions performed (list because may be nested inside of nested)
   //! the list is empty if not nested transaction is performed
   std::list<int> myNestedNum;
 
index 6fc21e71e26da169c55bb0d31f06d3667d879b7c..d7ecf71879dc3ee3b39e5f34eadef130e13f536b 100644 (file)
 #include <TDF_ChildIDIterator.hxx>
 #include <TDataStd_ReferenceArray.hxx>
 #include <TDataStd_HLabelArray1.hxx>
-#include <TDataStd_Name.hxx>
 #include <TDF_Reference.hxx>
 #include <TDF_ChildIDIterator.hxx>
 #include <TDF_LabelMapHasher.hxx>
 #include <TDF_LabelMap.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
 
+int kUNDEFINED_FEATURE_INDEX = -1;
+
 static const std::string& groupNameFoldering(const std::string& theGroupID,
                                              const bool theAllowFolder)
 {
@@ -149,7 +150,7 @@ static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced, TDF_
   } else {  // extend array by one more element
     Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(),
                                                                         aRefs->Upper() + 1);
-    int aPassedPrev = 0; // prev feature is found and passed
+    int aPassedPrev = 0; // previous feature is found and passed
     if (thePrevLab.IsNull()) { // null means that inserted feature must be the first
       aNewArray->SetValue(aRefs->Lower(), theReferenced);
       aPassedPrev = 1;
@@ -310,7 +311,7 @@ void Model_Objects::removeFeature(FeaturePtr theFeature)
     for(; aRefIter != aRefs.end(); aRefIter++) {
       std::shared_ptr<ModelAPI_CompositeFeature> aComposite =
         std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aRefIter);
-      if (aComposite.get() && aComposite->isSub(theFeature)) {
+      if (aComposite.get() && aComposite->data()->isValid() && aComposite->isSub(theFeature)) {
         aComposite->removeFeature(theFeature);
       }
     }
@@ -383,7 +384,7 @@ void Model_Objects::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis)
 
   Handle(TDataStd_HLabelArray1) aNewArray =
     new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper());
-  int aPassedMovedFrom = 0; // the prev feature location is found and passed
+  int aPassedMovedFrom = 0; // the previous feature location is found and passed
   int aPassedMovedTo = 0; // the feature is added and this location is passed
   if (!theAfterThis.get()) { // null means that inserted feature must be the first
     aNewArray->SetValue(aRefs->Lower(), aMovedLab);
@@ -628,15 +629,17 @@ std::shared_ptr<ModelAPI_Object> Model_Objects::objectByName(
   createHistory(theGroupID);
   if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in history or not)
     std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
-    std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
-    for(; anObjIter != allObjs.end(); anObjIter++) {
+    // from the end to find the latest result with such name
+    std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+    for(; anObjIter != allObjs.rend(); anObjIter++) {
       if ((*anObjIter)->data()->name() == theName)
         return *anObjIter;
     }
   } else { // searching among results (concealed or not)
     std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
-    std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
-    for(; anObjIter != allObjs.end(); anObjIter++) {
+    // from the end to find the latest result with such name
+    std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+    for(; anObjIter != allObjs.rend(); anObjIter++) {
       std::list<ResultPtr> allRes;
       ModelAPI_Tools::allResults(*anObjIter, allRes);
       for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
@@ -740,31 +743,17 @@ void Model_Objects::setUniqueName(FeaturePtr theFeature)
   // first count all features of such kind to start with index = count + 1
   int aNumObjects = -1; // this feature is already in this map
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myFeatures);
+  std::set<std::string> allNames;
   for (; aFIter.More(); aFIter.Next()) {
     if (aFIter.Value()->getKind() == theFeature->getKind())
       aNumObjects++;
+    allNames.insert(aFIter.Value()->data()->name());
   }
   // generate candidate name
   aName = composeName(theFeature->getKind(), aNumObjects + 1);
   // check this is unique, if not, increase index by 1
-  for (aFIter.Initialize(myFeatures); aFIter.More();) {
-    FeaturePtr aFeature = aFIter.Value();
-    bool isSameName = aFeature->data()->name() == aName;
-    if (!isSameName) {  // check also results to avoid same results names (actual for Parts)
-      const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
-      std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for (; aRIter != aResults.cend(); aRIter++) {
-        isSameName = (*aRIter)->data()->name() == aName;
-      }
-    }
-
-    if (isSameName) {
-      aNumObjects++;
-      aName = composeName(theFeature->getKind(), aNumObjects + 1);
-      // reinitialize iterator to make sure a new name is unique
-      aFIter.Initialize(myFeatures);
-    } else
-      aFIter.Next();
+  for(aNumObjects++; allNames.find(aName) != allNames.end(); aNumObjects++) {
+    aName = composeName(theFeature->getKind(), aNumObjects + 1);
   }
   theFeature->data()->setName(aName);
 }
@@ -865,7 +854,7 @@ void Model_Objects::synchronizeFeatures(
       ObjectPtr aFeature = isFolder ? ObjectPtr(new ModelAPI_Folder)
                                     : ObjectPtr(aSession->createFeature(aFeatureID, anOwner));
       if (!aFeature.get()) {
-        // somethig is wrong, most probably, the opened document has invalid structure
+        // something is wrong, most probably, the opened document has invalid structure
         Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send();
         aLabIter.Value()->Label().ForgetAllAttributes();
         continue;
@@ -966,7 +955,7 @@ void Model_Objects::synchronizeFeatures(
   }
   // update results of the features (after features created because
   // they may be connected, like sketch and sub elements)
-  // After synchronisation of back references because sketch
+  // After synchronization of back references because sketch
   // must be set in sub-elements before "execute" by updateResults
   std::set<FeaturePtr> aProcessed; // composites must be updated after their subs (issue 360)
   TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
@@ -1005,14 +994,14 @@ void Model_Objects::synchronizeFeatures(
     anOwner->setExecuteFeatures(true);
 }
 
-/// synchronises back references for the given object basing on the collected data
+/// synchronizes back references for the given object basing on the collected data
 void Model_Objects::synchronizeBackRefsForObject(const std::set<AttributePtr>& theNewRefs,
   ObjectPtr theObject)
 {
   if (!theObject.get() || !theObject->data()->isValid())
     return; // invalid
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
-  // iterate new list to compare with curent
+  // iterate new list to compare with current
   std::set<AttributePtr>::iterator aNewIter = theNewRefs.begin();
   for(; aNewIter != theNewRefs.end(); aNewIter++) {
     if (aData->refsToMe().find(*aNewIter) == aData->refsToMe().end()) {
@@ -1114,9 +1103,9 @@ static void collectReferences(std::shared_ptr<ModelAPI_Data> theData,
 void Model_Objects::synchronizeBackRefs()
 {
   // collect all back references in the separated container: to update everything at once,
-  // without additional Concealment switchin on and off: only the final modification
+  // without additional Concealment switching on and off: only the final modification
 
-  // referenced (slave) objects to referencing attirbutes
+  // referenced (slave) objects to referencing attributes
   std::map<ObjectPtr, std::set<AttributePtr> > allRefs;
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeatures(myFeatures);
   for(; aFeatures.More(); aFeatures.Next()) {
@@ -1157,7 +1146,7 @@ void Model_Objects::synchronizeBackRefs()
     FeaturePtr aFeature = aFeatures.Value();
     std::list<ResultPtr> aResults;
     ModelAPI_Tools::allResults(aFeature, aResults);
-    // update the concealment status for disply in isConcealed of ResultBody
+    // update the concealment status for display in isConcealed of ResultBody
     std::list<ResultPtr>::iterator aRIter = aResults.begin();
     for(; aRIter != aResults.cend(); aRIter++) {
       (*aRIter)->isConcealed();
@@ -1370,7 +1359,8 @@ std::shared_ptr<ModelAPI_Folder> Model_Objects::createFolder(
     std::shared_ptr<Model_Data> aPrevData =
         std::dynamic_pointer_cast<Model_Data>(theBeforeThis->data());
     if (aPrevData.get()) {
-      aPrevFeatureLab = nextLabel(aPrevData->label().Father(), true);
+      int anIndex = kUNDEFINED_FEATURE_INDEX;
+      aPrevFeatureLab = nextLabel(aPrevData->label().Father(), anIndex, true);
     }
   } else { // find the label of the last feature
     Handle(TDataStd_ReferenceArray) aRefs;
@@ -1489,7 +1479,7 @@ std::shared_ptr<ModelAPI_Folder> Model_Objects::findFolder(
 
     if (!aLastFeatureInFolder.IsNull()) {
       if (IsEqual(aCurLabel, aLastFeatureInFolder))
-        aLastFeatureInFolder.Nullify(); // the last feature in the folder is achived
+        aLastFeatureInFolder.Nullify(); // the last feature in the folder is achieved
       continue;
     }
 
@@ -1796,7 +1786,7 @@ std::shared_ptr<ModelAPI_Feature> Model_Objects::feature(
     const std::shared_ptr<ModelAPI_Result>& theResult)
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theResult->data());
-  if (aData.get()) {
+  if (aData.get() && aData->isValid()) {
     TDF_Label aFeatureLab = aData->label().Father().Father().Father();
     FeaturePtr aFeature = feature(aFeatureLab);
     while(!aFeature.get() && aFeatureLab.Depth() > 1) { // this may be sub-result of result
@@ -1840,8 +1830,6 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set<FeaturePtr>& t
     }
   }
 
-  // for not persistent is will be done by parametric updater automatically
-  //if (!theFeature->isPersistentResult()) return;
   // check the existing results and remove them if there is nothing on the label
   std::list<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
   while(aResIter != theFeature->results().cend()) {
@@ -1875,16 +1863,20 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set<FeaturePtr>& t
         if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) {
           aNewBody = createBody(theFeature->data(), aResIndex);
         } else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
-          std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
-          theFeature->setResult(aNewP, aResIndex);
-          if (!aNewP->partDoc().get())
-            // create the part result: it is better to restore the previous result if it is possible
-            theFeature->execute();
+          if (aResIndex <= theFeature->results().size()) { // to avoid crash if previous execute
+            // for index = 0 erases result
+            std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
+            theFeature->setResult(aNewP, aResIndex);
+            if (!aNewP->partDoc().get())
+              // create the part result: it is better to restore the previous result if possible
+              theFeature->execute();
+          }
         } else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
-          theFeature->execute(); // construction shapes are needed for sketch solver
-          if (!theFeature->results().empty()) // to fix #2640 : update sketch, but not naming
-            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theFeature->firstResult())
-              ->facesNum(false);
+          ResultConstructionPtr aConstr = createConstruction(theFeature->data(), aResIndex);
+          if (!aConstr->updateShape())
+            theFeature->execute(); // not stored shape in the data structure, execute to have it
+          else
+            theFeature->setResult(aConstr, aResIndex); // result is ready without execution
         } else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
           aNewBody = createGroup(theFeature->data(), aResIndex);
         } else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {
@@ -1904,9 +1896,16 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set<FeaturePtr>& t
   if (aResSize > 0) { // check there exist a body that must be updated
     std::list<ResultPtr>::const_iterator aRes = theFeature->results().cbegin();
     for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) {
-      if ((*aRes)->data()->isValid() && (*aRes)->groupName() == ModelAPI_ResultBody::group()) {
-        ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
-        aBody->updateSubs(aBody->shape(), false);
+      if ((*aRes)->data()->isValid()) {
+        if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) {
+          ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
+          aBody->updateSubs(aBody->shape(), false);
+        } else if ((*aRes)->groupName() == ModelAPI_ResultConstruction::group()) {
+          // update the cashed myShape presented in construction
+          ResultConstructionPtr aConstr =
+            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+          aConstr->updateShape();
+        }
       }
     }
   }
@@ -1939,32 +1938,35 @@ ResultPtr Model_Objects::findByName(const std::string theName)
   return aResult;
 }
 
-TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, const bool theReverse)
+TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse)
 {
   Handle(TDataStd_ReferenceArray) aRefs;
   if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
-    for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { // iterate all existing features
+    int aStart = theIndex == kUNDEFINED_FEATURE_INDEX ? aRefs->Lower() : theIndex;
+    for(int a = aStart; a <= aRefs->Upper(); a++) { // iterate all existing features
       TDF_Label aCurLab = aRefs->Value(a);
       if (aCurLab.IsEqual(theCurrent)) {
         a += theReverse ? -1 : 1;
-        if (a >= aRefs->Lower() && a <= aRefs->Upper())
+        if (a >= aRefs->Lower() && a <= aRefs->Upper()) {
+          theIndex = a;
           return aRefs->Value(a);
-        break; // finish iiteration: it's last feature
+        }
+        break; // finish iteration: it's last feature
       }
     }
   }
   return TDF_Label();
 }
 
-FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, const bool theReverse)
+FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse)
 {
   std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theCurrent->data());
   if (aData.get() && aData->isValid()) {
     TDF_Label aFeatureLabel = aData->label().Father();
     do {
-      TDF_Label aNextLabel = nextLabel(aFeatureLabel, theReverse);
+      TDF_Label aNextLabel = nextLabel(aFeatureLabel, theIndex, theReverse);
       if (aNextLabel.IsNull())
-        break; // last or something is wrong
+        break; // the last or something is wrong
       FeaturePtr aFound = feature(aNextLabel);
       if (aFound)
         return aFound; // the feature is found
index 0991cf21077dba0fe2b3bcc38a0caafd91f4ebbf..26e6e6d19b70b2613a762e44521f1eaccedfec91 100644 (file)
@@ -40,6 +40,8 @@
 static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper);
 static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2);
 
+extern int kUNDEFINED_FEATURE_INDEX;
+
 /**\class Model_Objects
  * \ingroup DataModel
  * \brief Manager of objects of the document. Normally one this class corresponds to
@@ -49,7 +51,7 @@ static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLa
 class Model_Objects
 {
  public:
-  //! Registers the fieature in the data structure
+  //! Registers the feature in the data structure
   //! \param theFeature feature that must be added to the data structure
   //! \param theAfterThis the feature will be added after this feature;
   //!        if it is null, the added feature will be the first
@@ -167,7 +169,7 @@ class Model_Objects
       const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
       const bool theBelow);
   //! Search a folder containing the given feature.
-  //! Addtionally calculates a zero-based index of the feature in this folder.
+  //! Additionally calculates a zero-based index of the feature in this folder.
   //! \param theFeature feature to search
   //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
   //! \return the folder containing the feature or empty pointer if the feature is top-level.
@@ -176,7 +178,7 @@ class Model_Objects
       int& theIndexInFolder);
   //! Add a list of features to the folder. The correctness of the adding is not performed
   //! (such checks have been done in corresponding find.. method).
-  //! \return \c true if the movement is successfull
+  //! \return \c true if the movement is successful
   bool moveToFolder(const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
                     const std::shared_ptr<ModelAPI_Folder>& theFolder);
   //! Remove features from the folder
@@ -194,7 +196,7 @@ class Model_Objects
   //! Returns the owner of this manager
   DocumentPtr owner() {return myDoc;}
 
-  //! Deletes all managed features wit hemmitting of corresponded signal
+  //! Deletes all managed features with emitting of corresponded signal
   ~Model_Objects();
 
  protected:
@@ -206,15 +208,15 @@ class Model_Objects
   //! feature type + "_" + index
   void setUniqueName(FeaturePtr theFeature);
 
-  //! Initializes the foldet with an unique name ("Folder_" + index)
+  //! Initializes the folder with an unique name ("Folder_" + index)
   void setUniqueName(FolderPtr theFolder);
 
   //! Synchronizes myFeatures list with the updated document
-  //! \param theUpdated list of labels that are marked as modified, so featrues must be also
+  //! \param theUpdated list of labels that are marked as modified, so features must be also
   //! \param theUpdateReferences causes the update of back-references
   //! \param theExecuteFeatures requires re-execute modified persistent features
   //!            (not needed on undo/redo/abort/open)
-  //! \param theOpen - on open nothing must be reexecuted, except not persistent results
+  //! \param theOpen - on open nothing must be re-executed, except not persistent results
   //! \param theFlush makes flush all events in the end of all modifications of this method
   void synchronizeFeatures(const TDF_LabelList& theUpdated, const bool theUpdateReferences,
     const bool theOpen, const bool theExecuteFeatures, const bool theFlush);
@@ -255,8 +257,9 @@ class Model_Objects
 
   /// Returns the next (from the history point of view) feature, any: invisible or disabled
   /// \param theCurrent previous to the resulting feature
-  /// \param theReverse if it is true, iterates in reverced order (next becomes previous)
-  FeaturePtr nextFeature(FeaturePtr theCurrent, const bool theReverse = false);
+  /// \param theReverse if it is true, iterates in reversed order (next becomes previous)
+  /// \param theIndex may be used for optimization: index of theCurrent in references array
+  FeaturePtr nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse = false);
   /// Returns to the first (from the history point of view) feature, any: invisible or disabled
   FeaturePtr firstFeature();
   /// Returns to the last (from the history point of view) feature, any: invisible or disabled
@@ -266,8 +269,8 @@ class Model_Objects
 
   /// Returns the next or previous label
   /// \param theCurrent given label
-  /// \param theReverse if it is true, iterates in reverced order (next becomes previous)
-  TDF_Label nextLabel(TDF_Label theCurrent, const bool theReverse = false);
+  /// \param theReverse if it is true, iterates in reversed order (next becomes previous)
+  TDF_Label nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse = false);
 
   /// Returns the result group identifier of the given feature (for this at least one result must
   /// be created before)
@@ -281,14 +284,14 @@ class Model_Objects
   //! history. Not very fast method, for calling once, not in big cycles.
   std::list<std::shared_ptr<ModelAPI_Object> > allObjects();
 
-  //! synchronises back references for the given object basing on the collected data
+  //! synchronizes back references for the given object basing on the collected data
   void synchronizeBackRefsForObject(
     const std::set<std::shared_ptr<ModelAPI_Attribute>>& theNewRefs, ObjectPtr theObject);
 
   /// Just removes all features without touching the document data (to be able undo)
   virtual void eraseAllFeatures();
 
-  // Check whether the pre-image of the result had user-defined name.
+  // Check whether the predefined-image of the result had user-defined name.
   // If yes, return this name.
   bool hasCustomName(DataPtr theFeatureData,
                      ResultPtr theResult,
@@ -301,7 +304,7 @@ class Model_Objects
  private:
   TDF_Label myMain; ///< main label of the data storage
 
-  DocumentPtr myDoc; ///< doc,ument, owner of this objects manager: needed for events creation
+  DocumentPtr myDoc; ///< document, owner of this objects manager: needed for events creation
 
   /// All managed features (not only in history of OB)
   /// For optimization mapped by labels
@@ -311,7 +314,7 @@ class Model_Objects
   NCollection_DataMap<TDF_Label, ObjectPtr> myFolders;
 
   /// Map from group id to the array that contains all objects located in history.
-  /// Each array is updated by demand from scratch, by browing all the features in the history.
+  /// Each array is updated by demand from scratch, by browsing all the features in the history.
   std::map<std::string, std::vector<ObjectPtr> > myHistory;
 
   friend class Model_Document;
index eaee3ac1e01df37a144fb4e18d3fde829dd745fa..c226ac7626e8ac6994eb2905f7cfa6f4864d89e2 100644 (file)
@@ -52,17 +52,53 @@ Model_ResultBody::~Model_ResultBody()
   delete myBuilder;
 }
 
-void Model_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
-    std::shared_ptr<GeomAPI_Shape> theShapeIn, const int  theKindOfShape, const int  theTag,
-    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-    const bool theIsStoreSeparate,
-    const bool theIsStoreAsGenerated,
-    const bool theSplitInSubs)
+bool Model_ResultBody::generated(const GeomShapePtr& theNewShape,
+  const std::string& theName, const bool theCheckIsInResult)
 {
-  if (theSplitInSubs && mySubs.size()) { // consists of subs
+  bool aResult = false;
+  if (mySubs.size()) { // consists of subs
+    for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+         aSubIter != mySubs.cend();
+         ++aSubIter)
+    {
+      const ResultBodyPtr& aSub = *aSubIter;
+      if (aSub->generated(theNewShape, theName, theCheckIsInResult))
+        aResult = true;
+    }
+  } else { // do for this directly
+    if (myBuilder->generated(theNewShape, theName, theCheckIsInResult))
+      aResult = true;
+  }
+  return aResult;
+}
+
+void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                           const GeomShapePtr& theOldShape,
+                                           const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                           const std::string& theName)
+{
+  if (mySubs.size()) { // consists of subs
+    for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+         aSubIter != mySubs.cend();
+         ++aSubIter)
+    {
+      const ResultBodyPtr& aSub = *aSubIter;
+      aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+    }
+  } else { // do for this directly
+    myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+  }
+}
+
+void Model_ResultBody::loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                          const GeomShapePtr& theOldShape,
+                                          const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                          const std::string& theName)
+{
+  if (/*theSplitInSubs &&*/ mySubs.size()) { // consists of subs
     // optimization of getting of new shapes for specific sub-result
-    if (!theMS->newShapesCollected(theShapeIn, theKindOfShape))
-      theMS->collectNewShapes(theShapeIn, theKindOfShape);
+    if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore))
+      theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore);
     std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
     for(; aSubIter != mySubs.cend(); aSubIter++) {
       // check that sub-shape was also created as modification of ShapeIn
@@ -84,14 +120,10 @@ void Model_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
           }
         }
       }*/
-      (*aSubIter)->loadAndOrientModifiedShapes(
-        theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
-        theIsStoreAsGenerated, theSplitInSubs);
+      (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
     }
   } else { // do for this directly
-    myBuilder->loadAndOrientModifiedShapes(
-      theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
-        theIsStoreAsGenerated);
+    myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
   }
 }
 
@@ -129,7 +161,6 @@ bool Model_ResultBody::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, con
 {
   bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
   if (aChanged) { // state is changed, so modifications are needed
-    myBuilder->evolutionToSelection(theFlag);
     updateSubs(shape(), false); // to set disabled/enabled
   }
   return aChanged;
@@ -213,6 +244,7 @@ void Model_ResultBody::updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisS
     TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
     if (!aDataLab.IsNull()) {
       TDataStd_UAttribute::Set(aDataLab, kUpdateConnectedTopology);
+      isConnectedTopology(); // to store this flag in transaction, #2630
     }
   }
   // iterate all sub-solids of compsolid to make sub-results synchronized with them
@@ -277,20 +309,6 @@ void Model_ResultBody::updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisS
   }
 }
 
-bool Model_ResultBody::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
-  if (myBuilder->isLatestEqual(theShape))
-    return true;
-  // also check that it is asked for sub-elements
-  std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
-  for(; aSubIter != mySubs.cend(); aSubIter++) {
-    if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) {
-      return true;
-    }
-  }
-  return false;
-}
-
 bool Model_ResultBody::isConnectedTopology()
 {
   TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
index 6047bc059c71ea4e56f277b0bea1c4c6e561f5eb..721ad71f33402952dc1babfbcd68809d34efdc6d 100644 (file)
@@ -33,7 +33,7 @@
 * Provides a shape that may be displayed in the viewer.
 * May provide really huge results, so, working with this kind
 * of result must be optimized.
-* Also provides a conainer of sub-body result in case it is compound or compsolid.
+* Also provides a container of sub-body result in case it is compound or compsolid.
 */
 class Model_ResultBody : public ModelAPI_ResultBody
 {
@@ -49,12 +49,24 @@ public:
   /// Removes the stored builders
   MODEL_EXPORT virtual ~Model_ResultBody();
 
-  /// load and orient modified shapes for sub-objects
-  MODEL_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
-    std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
-    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-    const bool theIsStoreSeparate = false, const bool theIsStoreAsGenerated = false,
-    const bool theSplitInSubs = false);
+  /// Records the subshape newShape which was generated during a topological construction.
+  /// As an example, consider the case of a face generated in construction of a box.
+  MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+    const std::string& theName, const bool theCheckIsInResult = true) override;
+
+  /// load generated shapes
+  MODEL_EXPORT
+  virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                   const GeomShapePtr& theOldShape,
+                                   const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                   const std::string& theName = "") override;
+
+  /// load modified shapes for sub-objects
+  MODEL_EXPORT
+  virtual void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                  const GeomShapePtr& theOldShape,
+                                  const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                  const std::string& theName = "") override;
 
 
   /// Returns the number of sub-elements
@@ -64,11 +76,11 @@ public:
   MODEL_EXPORT virtual ResultBodyPtr subResult(const int theIndex,
     bool forTree = false) const;
 
-  /// Returns true if feature or reuslt belong to this composite feature as subs
+  /// Returns true if feature or result belong to this composite feature as subs
   /// Returns theIndex - zero based index of sub if found
   MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const;
 
-  /// Returns the parameters of color definition in the resources config manager
+  /// Returns the parameters of color definition in the resources configuration manager
   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
                                             std::string& theDefault);
 
@@ -83,10 +95,6 @@ public:
   /// Sets all subs as concealed in the data tree (referenced by other objects)
   MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
 
-  /// Returns true if the latest modification of this body in the naming history
-  // is equal to the given shape
-  MODEL_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape);
-
   /// Returns true is the topology is connected.
   MODEL_EXPORT virtual bool isConnectedTopology();
 
@@ -98,7 +106,7 @@ protected:
   void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
                   const bool theShapeChanged = true);
 
-  // Checks the state of children and partents to send events of creation/erase when needed
+  // Checks the state of children and parents to send events of creation/erase when needed
   void updateConcealment();
 
   friend class Model_Objects;
index 1d0c715c7914bbd2db94fdb03782a8554dcc1d7f..272cb7338a24527bc298cd3b8807e42d9544fce8 100644 (file)
 
 #include <Model_Data.h>
 #include <ModelAPI_CompositeFeature.h>
-#include <Model_SelectionNaming.h>
+#include <GeomAlgoAPI_SketchBuilder.h>
+#include <GeomAPI_Tools.h>
 #include <ModelAPI_Events.h>
-#include <Config_PropManager.h>
+#include <Model_Document.h>
 #include <GeomAPI_PlanarEdges.h>
 #include <GeomAPI_Shape.h>
-#include <GeomAlgoAPI_SketchBuilder.h>
 #include <Events_Loop.h>
+#include <GeomDataAPI_Point.h>
+#include <GeomDataAPI_Dir.h>
 
-#include <TDF_Reference.hxx>
-#include <TDF_ChildIterator.hxx>
+#include <TDF_ChildIDIterator.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Builder.hxx>
-#include <TDataStd_Integer.hxx>
 #include <TDataStd_IntPackedMap.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_UAttribute.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
 #include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <TopoDS_ListOfShape.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TNaming_Tool.hxx>
-#include <Precision.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+
+#include <algorithm>
 
-// identifier that it is full result selected, but in external document (for internal index is 0)
-Standard_GUID kFULL_RESULT_ID("ee87e529-da6f-46af-be25-5e0fefde52f7");
 
+// identifier of the infinite result
+Standard_GUID kIS_INFINITE("dea8cc5a-53f2-49c1-94e8-a947bed20a9f");
+// identifier of the result not in history
+Standard_GUID kIS_IN_HISTORY("a9aec01c-805e-44d1-b5d2-a63f06522f8a");
 
 void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName,
                                        std::string& theDefault)
@@ -65,13 +66,10 @@ void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::str
 void Model_ResultConstruction::setShape(std::shared_ptr<GeomAPI_Shape> theShape)
 {
   if (myShape != theShape) {
+    storeShape(theShape);
     if (!theShape.get() || !theShape->isEqual(myShape)) {
-        static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
-        ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
-        if (theShape.get()) {
-          myFacesUpToDate = false;
-          myFaces.clear();
-        }
+      static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+      ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
     }
     myShape = theShape;
   }
@@ -82,803 +80,387 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape()
   return myShape;
 }
 
-Model_ResultConstruction::Model_ResultConstruction()
-{
-  myIsInHistory = true;
-  myIsInfinite = false;
-  myFacesUpToDate = false;
-}
-
-void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
+static std::string shortName(
+  std::shared_ptr<ModelAPI_ResultConstruction>& theConstr)
 {
-  myIsInHistory = isInHistory;
+  std::string aName = theConstr->data()->name();
+  // remove "-", "/" and "&" command-symbols
+  aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end());
+  aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end());
+  aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
+  // remove the last 's', 'e', 'f' and 'r' symbols:
+  // they are used as markers of start/end/forward/reversed indicators
+  static const std::string aSyms("sefr");
+  std::string::iterator aSuffix = aName.end() - 1;
+  while(aSyms.find(*aSuffix) != std::string::npos) {
+    --aSuffix;
+  }
+  aName.erase(aSuffix + 1, aName.end());
+  return aName;
 }
 
-int Model_ResultConstruction::facesNum(const bool theUpdateNaming)
+bool Model_ResultConstruction::updateShape()
 {
-  if (!myFacesUpToDate) {
-    std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
-      std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(myShape);
-    if (aWirePtr.get()) {
-      std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
-      GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
-        aWirePtr->norm(), aWirePtr, aFaces);
-      std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
-      for(; aFIter != aFaces.end(); aFIter++) {
-        std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
-        if (aFace.get() && !aFace->isNull())
-          myFaces.push_back(aFace);
-      }
-    }
-    myFacesUpToDate = true;
-
-    // update all the faces and sub-elements in the naming structure
-    if (theUpdateNaming) {
-      DocumentPtr anEmptyExt;
-      bool aNotExt = false;
-      TDF_Label aDataLab = startLabel(anEmptyExt, aNotExt);
-      TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
-      for(; aSubsIter.More(); aSubsIter.Next()) {
-        const TDF_Label aLab = aSubsIter.Value();
-        if (aLab.Tag() == 1) // skip the root shape label
-          continue;
-        Handle(TNaming_NamedShape) aNS;
-        if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-          update(aLab.Tag() - 1, anEmptyExt, aNotExt);
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData && aData->isValid()) {
+    TDF_Label aShapeLab = aData->shapeLab();
+    Handle(TNaming_NamedShape) aNS;
+    if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+      TopoDS_Shape aShape = aNS->Get();
+      if (!aShape.IsNull()) {
+        if (aShape.ShapeType() == TopAbs_COMPOUND) {
+          // restore the sketch planar edges object
+          std::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
+          aBigWire->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+          FeaturePtr aSketch =
+            document()->feature(std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner()));
+          std::shared_ptr<GeomDataAPI_Point> anOrigin =
+            std::dynamic_pointer_cast<GeomDataAPI_Point>(aSketch->data()->attribute("Origin"));
+          std::shared_ptr<GeomDataAPI_Dir> aDirX =
+            std::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute("DirX"));
+          std::shared_ptr<GeomDataAPI_Dir> aNorm =
+            std::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute("Norm"));
+          if (anOrigin.get() && aDirX.get() && aNorm.get()) {
+            aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir());
+            myShape = aBigWire;
+            return true;
+          }
         }
+        // just restore shape
+        GeomShapePtr aGShape(new GeomAPI_Shape);
+        aGShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+        myShape = GeomAPI_Tools::getTypedShape(aGShape); // restore the sketch sub-components
+        return true;
       }
     }
   }
-  return int(myFaces.size());
+  return false;
 }
 
-std::shared_ptr<GeomAPI_Face> Model_ResultConstruction::face(const int theIndex)
+Model_ResultConstruction::Model_ResultConstruction()
 {
-  return myFaces[theIndex];
 }
 
-bool Model_ResultConstruction::isInfinite()
+bool Model_ResultConstruction::isInHistory()
 {
-  return myIsInfinite;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    return !aData->label().IsAttribute(kIS_IN_HISTORY); // by default no attribute, but in history
+  }
+  return true;  // unknown case
 }
 
-void Model_ResultConstruction::setInfinite(const bool theInfinite)
+void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
 {
-  myIsInfinite = theInfinite;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    if (!isInHistory)
+      TDataStd_UAttribute::Set(aData->label(), kIS_IN_HISTORY);
+    else
+      aData->label().ForgetAttribute(kIS_IN_HISTORY);
+  }
 }
 
-void Model_ResultConstruction::setIsConcealed(const bool theValue)
+bool Model_ResultConstruction::isInfinite()
 {
-  // do nothing: the construction element is never concealed
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    return aData->label().IsAttribute(kIS_INFINITE);
+  }
+  return false;  // unknown case
 }
 
-static const int kSTART_VERTEX_DELTA = 1000000;
-
-static void registerSubShape(TDF_Label theMainLabel, TopoDS_Shape theShape, std::string theFullName,
-  const int theID, std::shared_ptr<Model_Document> theDoc,
-  bool theSelectionMode)
+void Model_ResultConstruction::setInfinite(const bool theInfinite)
 {
-  TDF_Label aLab = theID == 0 ? theMainLabel : theMainLabel.FindChild(theID);
-  TNaming_Builder aBuilder(aLab);
-  // wire never happens as sub, it must be generated to be found
-  // by SelectionNaming TNaming_Tool::NamedShape
-  if (theSelectionMode && theShape.ShapeType() != TopAbs_WIRE)
-    aBuilder.Select(theShape, theShape);
-  else
-    aBuilder.Generated(theShape);
-
-  theDoc->addNamingName(aLab, theFullName);
-  TDataStd_Name::Set(aLab, theFullName.c_str());
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    if (theInfinite)
+      TDataStd_UAttribute::Set(aData->label(), kIS_INFINITE);
+    else
+      aData->label().ForgetAttribute(kIS_INFINITE);
+  }
 }
 
-#include <TopTools_OrientedShapeMapHasher.hxx>
-
-// generates a full-name for sub-element of the composite feature (sketch)
-std::string fullName(CompositeFeaturePtr theComposite, const TopoDS_Shape& theSubShape,
-  Handle(TDataStd_IntPackedMap) theRefs = Handle(TDataStd_IntPackedMap)())
+int Model_ResultConstruction::facesNum(const bool theUpdateNaming)
 {
-  TopAbs_ShapeEnum aShapeType = theSubShape.ShapeType();
-  gp_Pnt aVertexPos;
-  NCollection_Map<TopoDS_Edge> allExactEdges;
-  NCollection_DataMap<TopoDS_Edge, TopoDS_Edge, Model_EdgesHasher> allEdges;
-  NCollection_DataMap<Handle(Geom_Curve), TopoDS_Edge, Model_CurvesHasher> allCurves;
-  /// map from edges from theSubShape to the found corresponded indices of the sub-components
-  NCollection_DataMap<TopoDS_Edge, NCollection_List<int>, TopTools_OrientedShapeMapHasher>
-    anEdgesCorrespondence;
-  if (aShapeType == TopAbs_VERTEX) { // compare positions
-    aVertexPos = BRep_Tool::Pnt(TopoDS::Vertex(theSubShape));
-  } else {
-    for(TopExp_Explorer anEdgeExp(theSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
-      TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
-      allExactEdges.Add(anEdge);
-      allEdges.Bind(anEdge, anEdge);
-      Standard_Real aFirst, aLast;
-      Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-      allCurves.Bind(aCurve, anEdge);
-      anEdgesCorrespondence.Bind(anEdge, NCollection_List<int>());
-    }
-  }
-  std::map<int, int> anOrientations; //map from edges IDs to orientations of these edges in face
-  std::map<int, std::string> aSubNames; //map from edges IDs to names of edges
-  TColStd_PackedMapOfInteger aRefs; // indixes of sub-elements in composite
-
-
-  const int aSubNum = theComposite->numberOfSubs();
-  for(int a = 0; a < aSubNum; a++) {
-    FeaturePtr aSub = theComposite->subFeature(a);
-    const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-    std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
-    // there may be many shapes (circle and center): register if at least one is in selection
-    for(; aRes != aResults.cend(); aRes++) {
-      ResultConstructionPtr aConstr =
-        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-      if (!aConstr->shape()) {
-        continue;
-      }
-      if (aShapeType == TopAbs_VERTEX) {
-        if (aConstr->shape()->isVertex()) { // compare vertices positions
-          const TopoDS_Shape& aVertex = aConstr->shape()->impl<TopoDS_Shape>();
-          gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aVertex));
-          if (aPnt.IsEqual(aVertexPos, Precision::Confusion())) {
-            aRefs.Add(theComposite->subFeatureId(a));
-            aSubNames[theComposite->subFeatureId(a)] = Model_SelectionNaming::shortName(aConstr);
-          }
-        } else { // get first or last vertex of the edge: last is stored with additional delta
-          const TopoDS_Shape& anEdge = aConstr->shape()->impl<TopoDS_Shape>();
-          int aDelta = kSTART_VERTEX_DELTA;
-          for(TopExp_Explorer aVExp(anEdge, TopAbs_VERTEX); aVExp.More(); aVExp.Next()) {
-            gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aVExp.Current()));
-            if (aPnt.IsEqual(aVertexPos, Precision::Confusion())) {
-              aRefs.Add(aDelta + theComposite->subFeatureId(a));
-              aSubNames[aDelta + theComposite->subFeatureId(a)] =
-                Model_SelectionNaming::shortName(aConstr, aDelta / kSTART_VERTEX_DELTA);
-              break;
-            }
-            aDelta += kSTART_VERTEX_DELTA;
-          }
-        }
-      } else {
-        if (aConstr->shape()->isEdge()) {
-          const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-          TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-          if (anEdge.IsNull())
-            continue;
-          if (allEdges.IsBound(anEdge)) {
-            anEdgesCorrespondence.ChangeFind(allEdges.Find(anEdge)).Append(a);
-          } else {
-            Standard_Real aFirst, aLast;
-            Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-            if (allCurves.IsBound(aCurve)) {
-              anEdgesCorrespondence.ChangeFind(allCurves.Find(aCurve)).Append(a);
-            }
-          }
-        }
-      }
-    }
-  }
-
-  if (aShapeType != TopAbs_VERTEX) { // get best candidates from the correspondances
-    NCollection_DataMap<TopoDS_Edge, NCollection_List<int>, TopTools_OrientedShapeMapHasher>
-      ::Iterator aCorIter(anEdgesCorrespondence);
-    for(; aCorIter.More(); aCorIter.Next()) {
-      TopoDS_Edge anOrig = aCorIter.Key();
-      NCollection_List<int>::Iterator aCandidate(aCorIter.Value());
-      int aBestScore = 0;
-      int aBestIndex = -1;
-      ResultConstructionPtr aBestConstr;
-      for(; aCandidate.More(); aCandidate.Next()) {
-        FeaturePtr aSub = theComposite->subFeature(aCandidate.Value());
-        const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-        std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
-        // there may be many shapes (circle and center): register if at least one is in selection
-        for(; aRes != aResults.cend(); aRes++) {
-          ResultConstructionPtr aConstr =
-            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-          if (!aConstr->shape() || !aConstr->shape()->isEdge())
-            continue;
-          const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-          TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-          if (anEdge.IsNull())
-            continue;
-          // detect score of the candidate
-          int aScore = 0;
-          if (anEdge.IsEqual(anOrig))
-            aScore = 10;
-          else if (anEdge.IsSame(anOrig))
-            aScore = 9;
-          else {
-            Standard_Real aFirst, aLast;
-            Handle(Geom_Curve) anOrigCurve = BRep_Tool::Curve(anOrig, aFirst, aLast);
-            Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-            if (anOrigCurve == aCurve) {
-              if (Model_EdgesHasher::IsEqual(anEdge, anOrig)) {
-                aScore = 8;
-              } else {
-                aScore = 6;
-              }
-            } else {
-              if (Model_EdgesHasher::IsEqual(anEdge, anOrig)) {
-                aScore = 7;
-              } else if (Model_CurvesHasher::IsEqual(aCurve, anOrigCurve)) {
-                aScore = 5;
-              }
-            }
-          }
-          if (aScore > aBestScore) {
-            aBestIndex = aCandidate.Value();
-            aBestScore = aScore;
-            aBestConstr = aConstr;
-          }
-        }
-      }
-      if (aBestIndex >= 0) {
-        int anID = theComposite->subFeatureId(aBestIndex);
-        aRefs.Add(anID);
-        aSubNames[anID] = Model_SelectionNaming::shortName(aBestConstr);
-        if (aShapeType != TopAbs_EDGE) { // face needs the sub-edges on sub-labels
-          // add edges to sub-label to support naming for edges selection
-          int anOrient = Model_SelectionNaming::edgeOrientation(theSubShape, anOrig);
-          anOrientations[anID] = anOrient;
-        }
-      }
-    }
-  }
-  std::stringstream aName;
-  // #1839 : do not store name of the feature in the tree, since this name could be changed
-  if (theSubShape.ShapeType() != TopAbs_COMPOUND) { // compound means the whole construction result
-    if (theSubShape.ShapeType() == TopAbs_FACE) aName<<"Face";
-    else if (theSubShape.ShapeType() == TopAbs_WIRE) aName<<"Wire";
-    else if (theSubShape.ShapeType() == TopAbs_EDGE) aName<<"Edge";
-    else if (theSubShape.ShapeType() == TopAbs_VERTEX) aName<<"Vertex";
-
-    // make a composite name from all sub-elements indexes: "1_2_3_4"
-    TColStd_MapIteratorOfPackedMapOfInteger aRef(aRefs);
-    for(; aRef.More(); aRef.Next()) {
-      aName<<"-"<<aSubNames[aRef.Key()];
-      if (anOrientations.find(aRef.Key()) != anOrientations.end()) {
-        if (anOrientations[aRef.Key()] == 1)
-          aName<<"f";
-        else if (anOrientations[aRef.Key()] == -1)
-          aName<<"r";
-      }
+  int aResult = 0;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    TDF_Label aShapeLab = aData->shapeLab();
+    TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+    for (; anOldIter.More(); anOldIter.Next()) {
+      aResult++;
     }
   }
-  if (!theRefs.IsNull()) {
-    Handle(TColStd_HPackedMapOfInteger) aMap = new TColStd_HPackedMapOfInteger(aRefs);
-    theRefs->ChangeMap(aMap);
-  }
-  return aName.str();
+  return aResult;
 }
 
-// stores shape and name on sub-label of the main stored shape
-static void saveSubName(CompositeFeaturePtr theComposite,
-  TDF_Label& theLab, const bool isSelectionMode, TopoDS_Shape aSub,
-  std::shared_ptr<Model_Document> theDoc, std::string theFullName)
+std::shared_ptr<GeomAPI_Face> Model_ResultConstruction::face(const int theIndex)
 {
-  // trying to store the edge of composite result, not sketch sub as it is
-  if (aSub.ShapeType() == TopAbs_EDGE) {
-    ResultPtr aRes = theComposite->firstResult();
-    ResultConstructionPtr aConstr = std::dynamic_pointer_cast<Model_ResultConstruction>(aRes);
-    if (aConstr.get()) {
-      Standard_Real aSubFirst, aSubLast;
-      TopoDS_Edge aSubEdge = TopoDS::Edge(aSub);
-      Handle(Geom_Curve) aSubCurve = BRep_Tool::Curve(aSubEdge, aSubFirst, aSubLast);
-      for(int aFaceIndex = 0; aFaceIndex < aConstr->facesNum(); aFaceIndex++) {
-        GeomShapePtr aGFace = aConstr->face(aFaceIndex);
-        TopoDS_Shape aFace = aGFace->impl<TopoDS_Shape>();
-        for(TopExp_Explorer anExp(aFace, TopAbs_EDGE); anExp.More(); anExp.Next()) {
-          TopoDS_Edge anEdge = TopoDS::Edge(anExp.Current());
-          Standard_Real aFirst, aLast;
-          Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-          if (Model_CurvesHasher::IsEqual(aCurve, aSubCurve) &&
-              ((fabs(aFirst - aSubFirst) < 1.e-9 &&  fabs(aLast - aSubLast) < 1.e-9)) ||
-              (fabs(aFirst - aSubLast) < 1.e-9 &&  fabs(aLast - aSubFirst) < 1.e-9)) {
-            aSub = anEdge;
-            break;
-          }
-        }
+  std::shared_ptr<GeomAPI_Face> aResult;
+  int anIndex = 0;
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData.get() && aData->isValid()) {
+    TDF_Label aShapeLab = aData->shapeLab();
+    TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+    for (; anOldIter.More(); anOldIter.Next()) {
+      if (anIndex == theIndex) {
+        Handle(TNaming_NamedShape) aNS;
+        anOldIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS);
+        aResult.reset(new GeomAPI_Face);
+        aResult->setImpl(new TopoDS_Shape(aNS->Get()));
+        break;
       }
+      anIndex++;
     }
   }
-
-  TNaming_Builder aBuilder(theLab);
-  if (isSelectionMode)
-    aBuilder.Select(aSub, aSub);
-  else
-    aBuilder.Generated(aSub);
-  theDoc->addNamingName(theLab, theFullName.c_str());
-  TDataStd_Name::Set(theLab, theFullName.c_str());
+  return aResult;
 }
 
-
-TDF_Label Model_ResultConstruction::startLabel(
-  const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theExternal)
+void Model_ResultConstruction::setIsConcealed(const bool theValue)
 {
-  theExternal = theExtDoc.get() && theExtDoc != document();
-  if (theExternal) { // external document is used
-    std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theExtDoc);
-    return aDoc->extConstructionsLabel();
-  }
-  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-  return aData->label();
+  // do nothing: the construction element is never concealed
 }
 
-int Model_ResultConstruction::select(const std::shared_ptr<GeomAPI_Shape>& theSubShape,
-  const std::shared_ptr<ModelAPI_Document> theExtDoc, const int theIndex)
+void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShape)
 {
-  int anIndex; // resulting index of the sub-label
-  TopoDS_Shape aSubShape;
-  if (theSubShape.get()) {
-    aSubShape = theSubShape->impl<TopoDS_Shape>();
-  } else if (shape().get()) {
-    aSubShape = shape()->impl<TopoDS_Shape>();
-  }
-  // if external document requires this selection, put the naming structures to this doc
-  // to support the naming mechanism in this document correctly
-  bool anExternal;
-  TDF_Label aDataLab = startLabel(theExtDoc, anExternal);
-  if (theIndex == -1) {
-    anIndex = anExternal ? 2 : 1; // for the external doc don't mind about the main shape
-
-    if (theSubShape.get() || anExternal) { // searching for already selected sub (or whole for ext)
-      // iterate all the already presented shapes to see the same
-      TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
-      for(; aSubsIter.More(); aSubsIter.Next()) {
-        const TDF_Label aLab = aSubsIter.Value();
-        if (aLab.Tag() == 1) // skip the root shape label
-          continue;
-        Handle(TNaming_NamedShape) aNS;
-        if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-          if (aNS->Get().IsSame(aSubShape)) {
-            return aLab.Tag() - 1; // found exactly the needed shape, nothing else to do
-          }
-        }
-        anIndex = aLab.Tag(); // searching for the latest index
-      }
-      anIndex = (anIndex == 1) ? 2 : (anIndex + 1); // next after 1-root, or next after all
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData && aData->isValid()) {
+    std::string aMyName = data()->name();
+    TDF_Label aShapeLab = aData->shapeLab();
+    if (!theShape.get() || theShape->isNull()) {
+      aShapeLab.ForgetAllAttributes();
+      TDataStd_Name::Set(aShapeLab, aMyName.c_str()); // restore name forgotten
+      return;
     }
-  } else {
-    anIndex = theIndex + 1;
-  }
-
-  // set the naming structure at index
-  TDF_Label aLab = aDataLab.FindChild(anIndex, Standard_True);
-
-  // if the subshape is part of a result face, select the whole face (#1997)
-  bool isSelectionMode = false; // and other don't set shapes - all the naming is in face label
-  if (!aSubShape.IsNull() && aSubShape.ShapeType() > TopAbs_FACE) {
-    // but before check that sub-vertex correctly detected as intersection of sketch edges (#2389)
-    int anEdgesNum = 2;
-    if (aSubShape.ShapeType() == TopAbs_VERTEX) {
-      anEdgesNum = 0;
+    std::shared_ptr<Model_Document> aMyDoc =
+      std::dynamic_pointer_cast<Model_Document>(document());
+    const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+    if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) {
+      aShapeLab.ForgetAllAttributes(); // clear all previously stored
+      TNaming_Builder aBuilder(aShapeLab);
+      aBuilder.Generated(aShape);
+      TDataStd_Name::Set(aShapeLab, aMyName.c_str());
+      aMyDoc->addNamingName(aShapeLab, aMyName);
+    } else if (aShape.ShapeType() == TopAbs_EDGE) { // store sub-vertices on sub-labels
+      aShapeLab.ForgetAllAttributes(); // clear all previously stored
+      TNaming_Builder aBuilder(aShapeLab);
+      aBuilder.Generated(aShape);
+
+      TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
+      for(int anIndex = 1; anExp.More(); anExp.Next(), anIndex++) {
+        TDF_Label aSubLab = aShapeLab.FindChild(anIndex);
+        TNaming_Builder aBuilder(aSubLab);
+        aBuilder.Generated(anExp.Current());
+        std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex");
+        TDataStd_Name::Set(aSubLab, aVertexName.c_str());
+        aMyDoc->addNamingName(aSubLab, aVertexName);
+      }
+      TDataStd_Name::Set(aShapeLab, aMyName.c_str());
+      aMyDoc->addNamingName(aShapeLab, aMyName);
+    } else { // this is probably sketch, so, work with it as with composite
+      std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
+        std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theShape);
+      if (!aWirePtr.get())
+        return; // unknown case
       ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
-      FeaturePtr aThisFeature = document()->feature(aThisPtr);
+      FeaturePtr aThisFeature = aMyDoc->feature(aThisPtr);
       CompositeFeaturePtr aComposite =
         std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aThisFeature);
-      if (aComposite.get()) {
-        const int aSubNum = aComposite->numberOfSubs();
-        for(int a = 0; a < aSubNum; a++) {
-          int aSubID = aComposite->subFeatureId(a);
-          FeaturePtr aSub = aComposite->subFeature(a);
-          const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-          std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
-          for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
-            ResultConstructionPtr aConstr =
-              std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-            if (aConstr->shape() && aConstr->shape()->isEdge()) {
-              TopoDS_Shape aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-              for(TopExp_Explorer anExp(aResShape, TopAbs_VERTEX); anExp.More(); anExp.Next()) {
-                if (aSubShape.IsSame(anExp.Current())) {
-                  anEdgesNum++;
-                  break;
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-    if (anEdgesNum > 1) {
-      for(int aFaceIndex = 0; aFaceIndex < facesNum(); aFaceIndex++) {
-        TopExp_Explorer anExp(face(aFaceIndex)->impl<TopoDS_Shape>(), aSubShape.ShapeType());
-        for(; anExp.More(); anExp.Next()) {
-          if (aSubShape.IsSame(anExp.Current())) { // this is the case: select the whole face
-            // here just store the face index (to update face if update of edge is needed)
-            TNaming_Builder aBuilder(aLab);
-            aBuilder.Select(aSubShape, aSubShape);
-            int aFaceSelID = select(face(aFaceIndex), theExtDoc, -1);
-            TDF_Reference::Set(aLab, aLab.Father().FindChild(aFaceSelID));
-            isSelectionMode = true;
-            break;
+      if (!aComposite || aComposite->numberOfSubs() == 0)
+        return; // unknown case
+      // collect indices of curves of current composite
+      NCollection_DataMap<Handle(Geom_Curve), int> aCurvesIndices;
+      NCollection_DataMap<int, TopoDS_Edge> anEdgeIndices;
+      std::map<int, std::string> aComponentsNames; // names of components that lay on index
+      const int aSubNum = aComposite->numberOfSubs();
+      for (int a = 0; a < aSubNum; a++) {
+        FeaturePtr aSub = aComposite->subFeature(a);
+        const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+        std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
+        for (; aRes != aResults.cend(); aRes++) {
+          ResultConstructionPtr aConstr =
+            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+          if (aConstr->shape() && aConstr->shape()->isEdge()) {
+            TopoDS_Edge anEdge = TopoDS::Edge(aConstr->shape()->impl<TopoDS_Shape>());
+            Standard_Real aFirst, aLast;
+            Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+            aCurvesIndices.Bind(aCurve, a);
+            anEdgeIndices.Bind(a, anEdge);
+            aComponentsNames[a] = shortName(aConstr);
           }
         }
       }
-    }
-  }
-
-  // external full result is not identified by index == 0, so, add here the ID
-  if (!theSubShape.get()) {
-    TDataStd_UAttribute::Set(aLab, kFULL_RESULT_ID);
-    // empty NS
-    TNaming_Builder aBuilder(aLab);
-    // store all sub-faces naming since faces may be used for extrusion, where all edges are needed
-    Handle(TDataStd_IntPackedMap) anIndices = TDataStd_IntPackedMap::Set(aLab);
-    std::list<int> aFacesIndexes;
-    for(int a = 0; a < facesNum(); a++) {
-      anIndices->Add(select(face(a), theExtDoc, -1));
-    }
-    return anIndex - 1;
-  }
-
-  { // this to have erased Builder after the shape was generated (NS on this label may be changed)
-    TNaming_Builder aBuilder(aLab);
-    if (aSubShape.IsNull()) {
-      return anIndex - 1; // just keep empty named shape
-    }
-    // wire never happens as sub, it must be generated to be found
-    // by SelectionNaming TNaming_Tool::NamedShape
-    if (isSelectionMode && aSubShape.ShapeType() != TopAbs_WIRE) {
-      aBuilder.Select(aSubShape, aSubShape);
-    } else {
-      aBuilder.Generated(aSubShape);
-    }
-  }
-
-  if (anIndex == 1 && isInfinite()) { // infinitive results has no sub-selection
-    return anIndex - 1;
-  }
-  ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
-  FeaturePtr aThisFeature = document()->feature(aThisPtr);
-  CompositeFeaturePtr aComposite =
-    std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aThisFeature);
-  if (!aComposite || aComposite->numberOfSubs() == 0) {
-    // saving of context is enough: result construction contains exactly the needed shape
-    return anIndex - 1;
-  }
-
-  // identify the results of sub-object of the composite by edges
-  // save type of the selected shape in integer attribute
-  TopAbs_ShapeEnum aShapeType = aSubShape.ShapeType();
-  TDataStd_Integer::Set(aLab, (int)aShapeType);
-  gp_Pnt aVertexPos;
-  // curves of the sketch sub-elements are used, so, edges are not equal
-  TColStd_MapOfTransient allCurves;
-  if (aShapeType == TopAbs_VERTEX) { // compare positions
-    aVertexPos = BRep_Tool::Pnt(TopoDS::Vertex(aSubShape));
-  } else {
-    for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
-      TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
-      Standard_Real aFirst, aLast;
-      Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-      allCurves.Add(aCurve);
-    }
-  }
-  std::shared_ptr<Model_Document> aMyDoc =
-    std::dynamic_pointer_cast<Model_Document>(document());
-  // iterate and store the result ids of sub-elements and sub-elements to sub-labels
-  Handle(TDataStd_IntPackedMap) aRefs = TDataStd_IntPackedMap::Set(aLab);
-  const int aSubNum = aComposite->numberOfSubs();
-  // subs are placed on unique labels because of #2248: sketch curve may produce several edges,
-  // but #2401 - on stable labels
-  NCollection_Map<int> aUsedIDMap; // already used lab tags for placement of shapes
 
-  for(int a = 0; a < aSubNum; a++) {
-    FeaturePtr aSub = aComposite->subFeature(a);
-    const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-    std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
-    // there may be many shapes (circle and center): register if at least one is in selection
-    for(; aRes != aResults.cend(); aRes++) {
-      ResultConstructionPtr aConstr =
-        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-      if (!aConstr->shape()) {
-        continue;
-      }
-      if (aShapeType != TopAbs_VERTEX) {
-        if (aConstr->shape()->isEdge()) {
-          const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-          TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-          if (!anEdge.IsNull()) {
+      std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
+      GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
+        aWirePtr->norm(), aWirePtr, aFaces);
+      // order is important to store faces in the same order if sketch is created from scratch
+      NCollection_IndexedDataMap<TopoDS_Face, TColStd_ListOfInteger> aNewIndices; // edges indices
+      std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
+      for (; aFIter != aFaces.end(); aFIter++) {
+        std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
+        // put them to a label, trying to keep the same faces on the same labels
+        if (aFace.get() && !aFace->isNull()) {
+          TopoDS_Face aTopoFace = TopoDS::Face(aFace->impl<TopoDS_Shape>());
+          aNewIndices.Add(aTopoFace, TColStd_ListOfInteger());
+          // keep new indices of sub-elements used in this face
+          for (TopExp_Explorer anEdges(aTopoFace, TopAbs_EDGE); anEdges.More(); anEdges.Next()) {
+            TopoDS_Edge anEdge = TopoDS::Edge(anEdges.Current());
             Standard_Real aFirst, aLast;
             Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-            if (allCurves.Contains(aCurve)) {
-              int anID = aComposite->subFeatureId(a);
-              if (aShapeType != TopAbs_EDGE) { // face needs the sub-edges on sub-labels
-                // add edges to sub-label to support naming for edges selection
-                TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE);
-                for(; anEdgeExp.More(); anEdgeExp.Next()) {
-                  TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
-                  Standard_Real aFirst, aLast;
-                  Handle(Geom_Curve) aFaceCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-                  if (Model_CurvesHasher::IsEqual(aFaceCurve, aCurve)) {
-                    while(aUsedIDMap.Contains(anID))
-                      anID += 100000;
-                    aUsedIDMap.Add(anID);
-                    TDF_Label aSubLab = aLab.FindChild(anID);
-                    std::string aFullNameSub = fullName(aComposite, anEdge);
-                    saveSubName(aComposite, aSubLab, isSelectionMode, anEdge, aMyDoc, aFullNameSub);
-
-                    int anOrient = Model_SelectionNaming::edgeOrientation(aSubShape, anEdge);
-                    if (anOrient != 0) {
-                      // store the orientation of edge relatively to face if needed
-                      TDataStd_Integer::Set(aSubLab, anOrient);
-                    }
-                  }
-                }
-              } else { // put vertices of the selected edge to sub-labels
-                // add edges to sub-label to support naming for edges selection
-                for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_VERTEX);
-                      anEdgeExp.More(); anEdgeExp.Next()) {
-                    TopoDS_Vertex aV = TopoDS::Vertex(anEdgeExp.Current());
-                    while(aUsedIDMap.Contains(anID))
-                      anID += 100000;
-                    aUsedIDMap.Add(anID);
-                    TDF_Label aSubLab = aLab.FindChild(anID);
-                    std::string aFullNameSub = fullName(aComposite, aV);
-                    saveSubName(aComposite, aSubLab, isSelectionMode, aV, aMyDoc, aFullNameSub);
-                }
-              }
+            if (aCurvesIndices.IsBound(aCurve)) {
+              int anIndex = aCurvesIndices.Find(aCurve);
+              if ((aFirst > aLast) != (anEdge.Orientation() == TopAbs_REVERSED))
+                anIndex = -anIndex;
+              aNewIndices.ChangeFromKey(aTopoFace).Append(anIndex);
             }
           }
         }
       }
-    }
-  }
-  std::string aFullName = fullName(aComposite, aSubShape, aRefs);
-  // store the selected as primitive
-  registerSubShape(aLab, aSubShape, aFullName, 0, aMyDoc, isSelectionMode);
-  return anIndex - 1;
-}
-
-std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape(const int theIndex,
-  const std::shared_ptr<ModelAPI_Document> theExtDoc)
-{
-  std::shared_ptr<GeomAPI_Shape> aResult;
-  if (theIndex == 0)
-    return aResult; // the whole shape, so, NULL
-
-  bool isExt;
-  TDF_Label aLab = startLabel(theExtDoc, isExt).FindChild(theIndex + 1);
-  if (!aLab.IsNull()) { // index is not bad
-    Handle(TNaming_NamedShape) aSelection;
-    if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
-      TopoDS_Shape aSelShape = aSelection->Get();
-      if (aSelShape.IsNull())
-        return aResult; // shape equal to context => null
-      aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
-      aResult->setImpl(new TopoDS_Shape(aSelShape));
-    }
-  }
-
-  return aResult;
-}
-
-bool Model_ResultConstruction::update(const int theIndex,
-  const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theModified)
-{
-  theModified = false;
-  bool anExt;
-  TDF_Label aLab = startLabel(theExtDoc, anExt).FindChild(theIndex + 1, Standard_True);
-  if (theIndex == 0 || aLab.IsAttribute(kFULL_RESULT_ID)) { // full for external same as index == 0
-    // it is just reference to construction, not sub-shape
-    // if there is a sketch, the sketch-naming must be updated
-    if (!isInfinite()) {
-      // update all faces named by the whole result
-      bool aRes = true;
-      Handle(TDataStd_IntPackedMap) anIndices;
-      if (aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), anIndices)) {
-        NCollection_Map<TopoDS_Shape> aFaces; // collect faces, updated in the tree
-        TColStd_MapIteratorOfPackedMapOfInteger anIndexIter(anIndices->GetMap());
-        Handle(TColStd_HPackedMapOfInteger) aNewPackedMap =
-          new TColStd_HPackedMapOfInteger; // with only faces that are ok
-        // iterate to find existing faces, updated
-        for(; anIndexIter.More(); anIndexIter.Next()) {
-          if (update(anIndexIter.Key(), theExtDoc, theModified)) {
-            GeomShapePtr aFace = shape(anIndexIter.Key(), theExtDoc);
-            if (!aFaces.Contains(aFace->impl<TopoDS_Shape>())) {
-              aNewPackedMap->ChangeMap().Add(anIndexIter.Key());
-              aFaces.Add(aFace->impl<TopoDS_Shape>());
+      NCollection_DataMap<int, TopoDS_Face> aFacesOrder; // faces -> tag where they must be set
+      NCollection_List<TopoDS_Face> anUnorderedFaces; // faces that may be located at any index
+      // searching for the best new candidate to old location
+      NCollection_IndexedDataMap<TopoDS_Face, TColStd_ListOfInteger>::Iterator
+        aNewIter(aNewIndices);
+      for (; aNewIter.More(); aNewIter.Next()) {
+        double aBestFound = 0, aBestNotFound = 1.e+100;
+        int aBestTag = 0;
+        const TColStd_ListOfInteger& aNewInd = aNewIter.Value();
+        // old faces indices where they where located
+        TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+        for (; anOldIter.More(); anOldIter.Next()) {
+          int aTag = anOldIter.Value()->Label().Tag();
+          if (aFacesOrder.IsBound(aTag))
+            continue; // already found a best candidate
+          Handle(TDataStd_IntPackedMap) anOldIndices =
+            Handle(TDataStd_IntPackedMap)::DownCast(anOldIter.Value());
+          double aFound = 0, aNotFound = 0;
+          TColStd_ListOfInteger::Iterator aNewIndIter(aNewInd);
+          for (; aNewIndIter.More(); aNewIndIter.Next()) {
+            if (anOldIndices->Contains(aNewIndIter.Value())) {
+              aFound += 1.;
+            }
+            else if (anOldIndices->Contains(-aNewIndIter.Value())) { // different orientation
+              aFound += 0.001;
+            }
+            else {
+              aNotFound += 1.;
             }
           }
-        }
-        // then iterate all existing faces to find new faces
-        int aCurrentFacesNum = facesNum();
-        for(int a = 0; a < aCurrentFacesNum; a++) {
-          GeomShapePtr aFace = face(a);
-          if (!aFaces.Contains(aFace->impl<TopoDS_Shape>())) {
-            // add this one
-            int aNewFaceIndex = select(aFace, theExtDoc, -1);
-            if (aNewFaceIndex > 0) {
-              aNewPackedMap->ChangeMap().Add(aNewFaceIndex);
+          if (aNotFound < aBestNotFound) {
+            if (aFound > aBestFound) {
+              aBestNotFound = aNotFound;
+              aBestFound = aFound;
+              aBestTag = aTag;
             }
           }
         }
-        anIndices->ChangeMap(aNewPackedMap);
-      }
-      return aRes;
-    } else {
-      // check is this modified or not
-      std::shared_ptr<GeomAPI_Shape> aNewShape = shape();
-      TopoDS_Shape anOldSh;
-      Handle(TNaming_NamedShape) aNS;
-      if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-        anOldSh = aNS->Get();
-      }
-      if (aNewShape.get()) {
-        if (anOldSh.IsNull())
-          theModified = true;
-        else {
-          std::shared_ptr<GeomAPI_Shape> anOldShape(new GeomAPI_Shape);
-          anOldShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOldSh));
-          theModified = !anOldShape->isEqual(aNewShape);
+        if (aBestTag != 0) { // found an appropriate face
+          aFacesOrder.Bind(aBestTag, aNewIter.Key());
+        } else {
+          anUnorderedFaces.Append(aNewIter.Key());
         }
       }
-      else if (!anOldSh.IsNull()) {
-        theModified = true;
-      }
-
-      // For correct naming selection, put the shape into the naming structure.
-      // It seems sub-shapes are not needed: only this shape is (and can be ) selected.
-      TNaming_Builder aBuilder(aLab);
-      aBuilder.Generated(aNewShape->impl<TopoDS_Shape>());
-    }
-    return shape() && !shape()->isNull();
-  }
-  // construction: identification by the results indexes, recompute faces and
-  // take the face that more close by the indexes
-  ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
-  FeaturePtr aContextFeature = document()->feature(aThisPtr);
+      aShapeLab.ForgetAllAttributes(); // clear all previously stored
+      TDataStd_Name::Set(aShapeLab, aMyName.c_str()); // restore name forgotten
+      TNaming_Builder aBuilder(aShapeLab); // store the compound to get it ready on open of document
+      aBuilder.Generated(aShape);
+      aMyDoc->addNamingName(aShapeLab, aMyName);
+      // set new faces to the labels
+      int aCurrentTag = 1;
+      NCollection_List<TopoDS_Face>::Iterator anUnordered(anUnorderedFaces);
+      for(int aCurrentTag = 1; !aFacesOrder.IsEmpty() || anUnordered.More(); aCurrentTag++) {
+        TopoDS_Face aFaceToPut;
+        if (aFacesOrder.IsBound(aCurrentTag)) {
+          aFaceToPut = aFacesOrder.Find(aCurrentTag);
+          aFacesOrder.UnBind(aCurrentTag);
+        } else if (anUnordered.More()){
+          aFaceToPut = anUnordered.Value();
+          anUnordered.Next();
+        }
 
-  // sketch sub-element
-  if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature).get())
-  {
-    // update the referenced object if it is sub
-    Handle(TDF_Reference) aRef;
-    if (aLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
-      int aFaceIndex = aRef->Get().Tag();
-      // don't check selection since face may disappear, but the shape stays correct
-      Model_ResultConstruction::update(aFaceIndex, theExtDoc, theModified);
-    }
-    // getting a type of selected shape
-    Handle(TDataStd_Integer) aTypeAttr;
-    if (!aLab.FindAttribute(TDataStd_Integer::GetID(), aTypeAttr)) {
-      return false;
-    }
-    TopAbs_ShapeEnum aShapeType = (TopAbs_ShapeEnum)(aTypeAttr->Get());
-    // selected indexes will be needed in each "if"
-    Handle(TDataStd_IntPackedMap) aSubIds;
-    std::shared_ptr<GeomAPI_Shape> aNewSelected;
-    bool aNoIndexes =
-      !aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), aSubIds) || aSubIds->Extent() == 0;
-    // for now working only with composite features
-    CompositeFeaturePtr aComposite =
-      std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
-    if (!aComposite.get() || aComposite->numberOfSubs() == 0) {
-      return false;
-    }
+        if (!aFaceToPut.IsNull()) {
+          TopTools_MapOfShape aFaceEdges;
+          for(TopExp_Explorer anEdges(aFaceToPut, TopAbs_EDGE); anEdges.More(); anEdges.Next()) {
+            aFaceEdges.Add(anEdges.Current());
+          }
 
-    if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) {
-      // compound is for the whole sketch selection
-      // If this is a wire with plane defined then it is a sketch-like object
-      if (!facesNum()) // no faces, update can not work correctly
-        return false;
-      // if there is no edges indexes, any face can be used: take the first
-      std::shared_ptr<GeomAPI_Shape> aNewSelected;
-      if (aNoIndexes) {
-        aNewSelected = face(0);
-      } else { // searching for most looks-like initial face by the indexes
-        // prepare edges of the current result for the fast searching
-        // curves and orientations of edges
-        NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
-        const int aSubNum = aComposite->numberOfSubs();
-        for(int a = 0; a < aSubNum; a++) {
-          int aSubID = aComposite->subFeatureId(a);
-          if (aSubIds->Contains(aSubID)) {
-            FeaturePtr aSub = aComposite->subFeature(a);
-            const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-            std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
-            for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
-              ResultConstructionPtr aConstr =
-                std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-              if (aConstr->shape() && aConstr->shape()->isEdge()) {
-                const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-                TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-                if (!anEdge.IsNull()) {
-                  Standard_Real aFirst, aLast;
-                  Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-                  // searching for orientation information
-                  int anOrient = 0;
-                  Handle(TDataStd_Integer) anInt;
-                  if (aLab.FindChild(aSubID).FindAttribute(TDataStd_Integer::GetID(), anInt)) {
-                    anOrient = anInt->Get();
-                  }
-                  allCurves.Bind(aCurve, anOrient);
-                }
+          TDF_Label aLab = aShapeLab.FindChild(aCurrentTag);
+          TNaming_Builder aFaceBuilder(aLab);
+          aFaceBuilder.Generated(aFaceToPut);
+          // store also indices of the new face edges
+          Handle(TDataStd_IntPackedMap) aNewMap = TDataStd_IntPackedMap::Set(aLab);
+          const TColStd_ListOfInteger& aNewInd = aNewIndices.FindFromKey(aFaceToPut);
+          std::stringstream aName;
+          aName<<"Face";
+          TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE);
+          TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0;
+          for(TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); anIter.Next()) {
+            int anIndex = anIter.Value();
+            int aModIndex = anIndex > 0 ? anIndex : -anIndex;
+            aNewMap->Add(anIndex);
+            aName<<"-"<<aComponentsNames[aModIndex];
+            if (anIter.Value() > 0)
+              aName<<"f";
+            else
+              aName<<"r";
+            // collect all edges of the face which are modified in sub-label of the face
+            if (anEdgeIndices.IsBound(aModIndex) &&
+                !aFaceEdges.Contains(anEdgeIndices.Find(aModIndex))) {
+              if (!anEdgesBuilder) {
+                TDF_Label anEdgesLabel = aLab.FindChild(1);
+                anEdgesBuilder = new TNaming_Builder(anEdgesLabel);
+                std::ostringstream aSubName;
+                // tag is needed for Test1922 to distinguish sub-edges of different faces
+                aSubName<<"SubEdge_"<<aCurrentTag;
+                TDataStd_Name::Set(anEdgesLabel, aSubName.str().c_str());
               }
+              anEdgesBuilder->Modify(anEdgeIndices.Find(aModIndex), aPutEdges.Current());
             }
-          }
-        }
-        aNewSelected = Model_SelectionNaming::findAppropriateFace(
-          aThisPtr, allCurves, aShapeType == TopAbs_WIRE);
-      }
-      if (aNewSelected) { // store this new selection
-        select(aNewSelected, theExtDoc, theIndex);
-        theModified = true;
-        return true;
-      } else {
-        // if the selection is not found, put the empty shape:
-        // it's better to have disappeared shape, than the old, the lost one
-        TNaming_Builder anEmptyBuilder(aLab);
-        return false;
-      }
-    } else if (aShapeType == TopAbs_EDGE) {
-      // just reselect the edge by the id
-      const int aSubNum = aComposite->numberOfSubs();
-      for(int a = 0; a < aSubNum; a++) {
-        // if aSubIds take any, the first appropriate
-        if (aSubIds->IsEmpty() || aSubIds->Contains(aComposite->subFeatureId(a))) {
-          // found the appropriate feature
-          FeaturePtr aFeature = aComposite->subFeature(a);
-          std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
-            aFeature->results().cbegin();
-          for(;aResIter != aFeature->results().cend(); aResIter++) {
-            ResultConstructionPtr aRes =
-              std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
-            if (aRes && aRes->shape() && aRes->shape()->isEdge()) { // found!
-              select(aRes->shape(), theExtDoc, theIndex);
-              theModified = true;
-              return true;
-            }
-          }
-        }
-      }
-    } else if (aShapeType == TopAbs_VERTEX) {
-      // just reselect the vertex by the id of edge
-      const int aSubNum = aComposite->numberOfSubs();
-      for(int a = 0; a < aSubNum; a++) {
-        // if aSubIds take any, the first appropriate
-        int aFeatureID = aComposite->subFeatureId(a);
-        if (aSubIds->IsEmpty() || aSubIds->Contains(aFeatureID) ||
-          aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA) ||
-          aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA * 2)) {
-            // searching for deltas
-            int aVertexNum = 0;
-            if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA)) aVertexNum = 1;
-            else if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA * 2)) aVertexNum = 2;
-            // found the feature with appropriate edge
-            FeaturePtr aFeature = aComposite->subFeature(a);
-            std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
-              aFeature->results().cbegin();
-            for(;aResIter != aFeature->results().cend(); aResIter++) {
-              ResultConstructionPtr aRes =
-                std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
-              if (aRes && aRes->shape()) {
-                if (aRes->shape()->isVertex() && aVertexNum == 0) { // found!
-                  select(aRes->shape(), theExtDoc, theIndex);
-                  theModified = true;
-                  return true;
-                } else if (aRes->shape()->isEdge() && aVertexNum > 0) {
-                  const TopoDS_Shape& anEdge = aRes->shape()->impl<TopoDS_Shape>();
-                  int aVIndex = 1;
-                  for(TopExp_Explorer aVExp(anEdge, TopAbs_VERTEX); aVExp.More(); aVExp.Next()) {
-                    if (aVIndex == aVertexNum) { // found!
-                      std::shared_ptr<GeomAPI_Shape> aVertex(new GeomAPI_Shape);
-                      aVertex->setImpl(new TopoDS_Shape(aVExp.Current()));
-                      select(aVertex, theExtDoc, theIndex);
-                      theModified = true;
-                      return true;
-                    }
-                    aVIndex++;
+            // put also modified vertices, otherwise vertex of original edge has no history
+            if (anEdgeIndices.IsBound(aModIndex)) {
+              TopExp_Explorer aVExpOld(anEdgeIndices.Find(aModIndex), TopAbs_VERTEX);
+              TopExp_Explorer aVExpNew(aPutEdges.Current(), TopAbs_VERTEX);
+              for(; aVExpNew.More() && aVExpOld.More(); aVExpNew.Next(), aVExpOld.Next()) {
+                if (!aVExpOld.Current().IsSame(aVExpNew.Current())) {
+                  if (!aVerticesBuilder) {
+                    TDF_Label aVertLabel = aLab.FindChild(2);
+                    aVerticesBuilder = new TNaming_Builder(aVertLabel);
+                    std::ostringstream aSubName;
+                    // tag is needed for Test1922 to distinguish sub-edges of different faces
+                    aSubName<<"SubVertex_"<<aCurrentTag;
+                    TDataStd_Name::Set(aVertLabel, aSubName.str().c_str());
                   }
+                  aVerticesBuilder->Modify(aVExpOld.Current(), aVExpNew.Current());
+
                 }
               }
             }
+            aPutEdges.Next();
+          }
+          if (anEdgesBuilder)
+            delete anEdgesBuilder;
+          if (aVerticesBuilder)
+            delete aVerticesBuilder;
+          TDataStd_Name::Set(aLab, TCollection_ExtendedString(aName.str().c_str()));
+          aMyDoc->addNamingName(aLab, aName.str());
+          // put also wires to sub-labels to correctly select them instead of collection by edges
+          int aWireTag = 3; // first tag is for SubEdge-s, second - for vertices
+          for(TopExp_Explorer aWires(aFaceToPut, TopAbs_WIRE); aWires.More(); aWires.Next()) {
+            TDF_Label aWireLab = aLab.FindChild(aWireTag);
+            TNaming_Builder aWireBuilder(aWireLab);
+            aWireBuilder.Generated(aWires.Current());
+            std::ostringstream aWireName;
+            aWireName<<aName.str()<<"_wire";
+            if (aWireTag > 3)
+              aWireName<<"_"<<aWireTag - 2;
+            TDataStd_Name::Set(aWireLab, aWireName.str().c_str());
+            aMyDoc->addNamingName(aWireLab, aWireName.str());
+            aWireTag++;
+          }
         }
       }
     }
-  } else { // simple construction element: the selected is that needed
-    select(shape(), theExtDoc, theIndex);
-    theModified = true;
-    return true;
   }
-  return false; // unknown case
 }
index b5ea41cd985bb9589aa74b3c07ceae5ef82d6174..3ba48777fc81fc3e42ae1607519b03d6203a1181 100644 (file)
@@ -39,22 +39,13 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction
 {
   std::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
   std::shared_ptr<GeomAPI_Shape> myShape;  ///< shape of this result created "on the fly"
-  bool myFacesUpToDate; ///< is true if faces in myuFaces are computed and up to date
-  /// stores the up to date faces if they exist
-  std::vector<std::shared_ptr<GeomAPI_Face> > myFaces;
-  bool myIsInHistory;
-  bool myIsInfinite;
  public:
   /// Retuns the parameters of color definition in the resources config manager
   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
                                             std::string& theDefault);
 
   /// By default object is displayed in the object browser.
-  MODEL_EXPORT virtual bool isInHistory()
-  {
-    return myIsInHistory;
-  }
-
+  MODEL_EXPORT virtual bool isInHistory();
   /// Sets the result
   MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
   /// Returns the shape-result produced by this feature
@@ -76,39 +67,16 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction
   /// The construction element is never concealed
   MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
 
-  // methods related to selection of sub-shapes in construction, used by SelectionAttribute
-
-  /// Selects theSubShape in the construction. Returns an index of the selected sub-shape.
-  /// Puts the selected shape with a needed BRepNaming sub-structure to the data tree of result.
-  /// If theSubShape is null, it selects the whole construction and returns zero index.
-  /// If theIndex is not -1, it re-selects over the existing data (used for update selection).
-  /// If theExtDoc is document where this selection is needed, if it differs from this,
-  /// naming structures will be located there.
-  int select(const std::shared_ptr<GeomAPI_Shape>& theSubShape,
-    const std::shared_ptr<ModelAPI_Document> theExtDoc, const int theIndex = -1);
-
-  /// Returns already selected shape by the given index. Zero index means the whole construction,
-  /// so, the returned shape in this case is null.
-  /// If theExtDoc is document where this selection is needed, if it differs from this,
-  /// naming structures will be located there.
-  std::shared_ptr<GeomAPI_Shape> shape(const int theIndex,
-    const std::shared_ptr<ModelAPI_Document> theExtDoc);
-
-  /// Updates the existing selection by the index.
-  /// Returns false if update is failed. Returns theModified true if the selection was updated.
-  /// If theExtDoc is document where this selection is needed, if it differs from this,
-  /// naming structures will be updated there.
-  bool update(const int theIndex, const std::shared_ptr<ModelAPI_Document> theExtDoc,
-    bool& theModified);
+  /// Updates the shape taking the current value from the data structure, returns true
+  /// if update has been correctly done
+  MODEL_EXPORT virtual bool updateShape();
 
  protected:
   /// Makes a body on the given feature
   Model_ResultConstruction();
 
-  /// Searchies for the working label selection/update will start from
-  /// Returns true if this is label of the external document.
-  /// theExtDoc is document where this selection is required
-  TDF_Label startLabel(const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theExternal);
+  /// Stores shape in the data structure to allow identification it by the naming
+  void storeShape(std::shared_ptr<GeomAPI_Shape> theShape);
 
   friend class Model_Objects;
 };
index 255f5e3802ce81352513e45182dd92b5dad70178..dbad51c7be3630204a22249cccb871b745d5c82a 100644 (file)
@@ -169,6 +169,8 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shape()
 {
   std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
   if (myShape.IsNull()) { // shape is not produced yet, create it
+    SessionPtr aMgr = ModelAPI_Session::get();
+    bool aToSendUpdate = aMgr->isOperation(); // inside of operation may send an update evnet
     if (myTrsf.get()) { // get shape of the base result and apply the transformation
       ResultPtr anOrigResult = baseRef();
       std::shared_ptr<GeomAPI_Shape> anOrigShape = anOrigResult->shape();
@@ -180,6 +182,10 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shape()
           aResult->setImpl(new TopoDS_Shape(aShape));
         }
       }
+      if (!myShape.IsNull() && aToSendUpdate) {
+        static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+        ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+      }
       return aResult;
     } else {
       DocumentPtr aDoc = Model_ResultPart::partDoc();
@@ -205,9 +211,14 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shape()
         }
       }
     }
+    if (!myShape.IsNull() && aToSendUpdate) {
+      static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+      ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+    }
   }
-  if (!myShape.IsNull())
+  if (!myShape.IsNull()) {
     aResult->setImpl(new TopoDS_Shape(myShape));
+  }
   return aResult;
 }
 
@@ -312,6 +323,24 @@ gp_Trsf Model_ResultPart::sumTrsf() {
   return aResult;
 }
 
+bool Model_ResultPart::combineGeometrical(const int theIndex, std::string& theNewName)
+{
+  std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
+  if (aDoc.get()) {
+    AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature();
+    AttributeSelectionPtr aThisAttr = aSelAttr->value(theIndex - 1);
+    if (aThisAttr.get()) {
+      aThisAttr->combineGeometrical();
+      if (aThisAttr->value().get()) {
+        int anIndex;
+        theNewName = nameInPart(aThisAttr->value(), anIndex);
+        return true;
+      }
+    }
+  }
+  return false; // something is wrong
+}
+
 std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shapeInPart(
   const std::string& theName, const std::string& theType, int& theIndex)
 {
index b6a1305115ef082accb27186ce9e4342fec6dd2c..d632ae187b7184f7e41b333e48099de74cfbaea9 100644 (file)
@@ -79,6 +79,8 @@ class Model_ResultPart : public ModelAPI_ResultPart
   /// Returns the shape by the name in the part
   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
     const std::string& theName, const std::string& theType, int& theIndex);
+  /// Updates the selection inside of the part as a geometrical selection
+  MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::string& theNewName);
   /// Updates the shape-result of the part (called on Part feature execution)
   MODEL_EXPORT virtual void updateShape();
   /// Applies the additional transformation of the part
diff --git a/src/Model/Model_SelectionNaming.cpp b/src/Model/Model_SelectionNaming.cpp
deleted file mode 100644 (file)
index 802b13c..0000000
+++ /dev/null
@@ -1,1218 +0,0 @@
-// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "Model_SelectionNaming.h"
-#include "Model_Document.h"
-#include "Model_Objects.h"
-#include "Model_Data.h"
-#include <ModelAPI_Feature.h>
-#include <Events_InfoMessage.h>
-#include <ModelAPI_Session.h>
-#include <ModelAPI_ResultPart.h>
-#include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_CompositeFeature.h>
-#include <ModelAPI_ResultBody.h>
-#include <GeomAPI_Wire.h>
-#include <GeomAPI_Edge.h>
-
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <BRep_Builder.hxx>
-#include <TNaming_Iterator.hxx>
-#include <TNaming_Tool.hxx>
-#include <TNaming_NamedShape.hxx>
-#include <TNaming_Localizer.hxx>
-#include <TNaming_SameShapeIterator.hxx>
-#include <TDataStd_Name.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <Precision.hxx>
-#include <algorithm>
-#include <stdexcept>
-
-#ifdef DEB_NAMING
-#include <BRepTools.hxx>
-#endif
-
-Model_SelectionNaming::Model_SelectionNaming(TDF_Label theSelectionLab)
-{
-  myLab = theSelectionLab;
-}
-
-// searches named shape by the shape in the given document (identified by the label)
-// tries to find s shape nearest to the context-label
-static Handle(TNaming_NamedShape) shapeToNS(const TDF_Label theLabAccess,
-  const TopoDS_Shape& theShape, const TDF_Label& theContextLab)
-{
-  Handle(TNaming_NamedShape) aResult;
-  if (!TNaming_Tool::HasLabel(theLabAccess, theShape)) // no shape in the document
-    return aResult;
-  int aContextLabDepth = theContextLab.IsNull() ? 100 : theContextLab.Depth();
-  TNaming_SameShapeIterator aNSIter(theShape, theLabAccess);
-  for(; aNSIter.More(); aNSIter.Next()) {
-    TDF_Label aLabel = aNSIter.Label();
-    Handle(TNaming_NamedShape) aNS;
-    if (aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-      if (aNS->Evolution() != TNaming_SELECTED && aNS->Evolution() != TNaming_DELETE) {
-        // check this is new shape in this named shape
-        bool aIsNew = false;
-        for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next())
-          if (!aNSIter.NewShape().IsNull() && aNSIter.NewShape().IsSame(theShape))
-            aIsNew = true;
-        if (!aIsNew)
-          continue;
-        // check this is the context-shape
-        while(aLabel.Depth() > aContextLabDepth)
-          aLabel = aLabel.Father();
-        if (aLabel.IsEqual(theContextLab))
-          return aNS;
-        if (aResult.IsNull()) // take the first, otherwise it will get shapes from results, etc
-          aResult = aNS; // keep some result anyway - if there are no context labels return any
-      }
-    }
-  }
-  return aResult;
-}
-
-std::string Model_SelectionNaming::getShapeName(
-  std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape,
-  ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext)
-{
-  std::string aName;
-  // add the result name to the name of the shape
-  // (it was in BodyBuilder, but did not work on Result rename)
-  bool isNeedContextName = theContext->shape().get() != NULL;
-  // check if the subShape is already in DF
-  std::shared_ptr<Model_Data> aData =
-    std::dynamic_pointer_cast<Model_Data>(theContext->data());
-  TDF_Label aContextDataLab(aData.get() && aData->isValid() ? aData->label() : TDF_Label());
-  Handle(TNaming_NamedShape) aNS = shapeToNS(myLab, theShape, aContextDataLab);
-  Handle(TDataStd_Name) anAttr;
-  if(!aNS.IsNull() && !aNS->IsEmpty()) { // in the document
-    if(aNS->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) {
-      if (isNeedContextName && aData && aContextDataLab.IsEqual(aNS->Label())) {
-        // do nothing because this context name will be added later in this method
-      } else {
-        aName = TCollection_AsciiString(anAttr->Get()).ToCString();
-        // indexes are added to sub-shapes not primitives
-        // (primitives must not be located at the same label)
-        if(!aName.empty() && aNS->Evolution() != TNaming_PRIMITIVE && isNeedContextName) {
-          const TDF_Label& aLabel = aNS->Label();
-          static const std::string aPostFix("_");
-          TNaming_Iterator anItL(aNS);
-          for(int i = 1; anItL.More(); anItL.Next(), i++) {
-            // in #1766 IsEqual produced no index of the face
-            if(anItL.NewShape().IsSame(theShape)) {
-              aName += aPostFix;
-              aName += TCollection_AsciiString (i).ToCString();
-              break;
-            }
-          }
-        }
-        // if a shape is under another context, use this name, not theContext
-        std::shared_ptr<Model_Data> aContextData =
-          std::dynamic_pointer_cast<Model_Data>(theContext->data());
-        // for constructions the naming is in arguments and has no evolution, so, apply this only
-        // for bodies
-        if (isNeedContextName && theContext->groupName() == ModelAPI_ResultBody::group() &&
-            !aNS->Label().IsDescendant(aContextData->label())) {
-          isNeedContextName = false;
-          TDF_Label aNSDataLab = aNS->Label();
-          if (aNSDataLab.Depth() % 2 == 0)
-            aNSDataLab = aNSDataLab.Father();
-          ObjectPtr aNewContext = theDoc->objects()->object(aNSDataLab);
-          while(!aNewContext.get() && aNSDataLab.Depth() > 5) {
-            aNSDataLab = aNSDataLab.Father().Father();
-            aNewContext = theDoc->objects()->object(aNSDataLab);
-          }
-          if (aNewContext.get()) {
-            // this is to avoid duplicated names of results problem
-            std::string aContextName = aNewContext->data()->name();
-            // myLab corresponds to the current time
-            TDF_Label aCurrentLab = myLab;
-            while(aCurrentLab.Depth() > 3)
-              aCurrentLab = aCurrentLab.Father();
-
-            int aNumInHistoryNames =
-              theDoc->numberOfNameInHistory(aNewContext, aCurrentLab);
-            while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times
-              aContextName = "_" + aContextName;
-              aNumInHistoryNames--;
-            }
-
-            aName = aContextName + "/" + aName;
-          }
-        }
-      }
-    }
-  }
-
-  // Name is empty and this is full context, it just add the whole context name that must be added
-  bool isEmptyName = aName.empty();
-  if (isNeedContextName && (!isEmptyName || theWholeContext)) {
-    aName = theContext->data()->name() + (isEmptyName ? "" : ("/" + aName));
-    if (theAnotherDoc)
-      aName = theContext->document()->kind() + "/" + aName; // PartSet
-  }
-  return aName;
-}
-
-bool isTrivial (const TopTools_ListOfShape& theAncestors, TopTools_IndexedMapOfShape& theSMap)
-{
-  // a trivial case: F1 & F2,  aNumber = 1, i.e. intersection gives 1 edge.
-  TopoDS_Compound aCmp;
-  BRep_Builder BB;
-  BB.MakeCompound(aCmp);
-  TopTools_ListIteratorOfListOfShape it(theAncestors);
-  for(;it.More();it.Next()) {
-    if (theSMap.Contains(it.Value()))
-      continue;
-    BB.Add(aCmp, it.Value());
-    theSMap.Add(it.Value());
-  }
-  int aNumber(0);
-  TopTools_IndexedDataMapOfShapeListOfShape aMap2;
-  TopExp::MapShapesAndAncestors(aCmp, TopAbs_EDGE, TopAbs_FACE, aMap2);
-  for (int i = 1; i <= aMap2.Extent(); i++) {
-    const TopoDS_Shape& aKey = aMap2.FindKey(i);
-    const TopTools_ListOfShape& anAncestors = aMap2.FindFromIndex(i);
-    if(anAncestors.Extent() > 1) aNumber++;
-  }
-  if(aNumber > 1) return false;
-  return true;
-}
-
-const TopoDS_Shape findCommonShape(
-  const TopAbs_ShapeEnum theType, const TopTools_ListOfShape& theList)
-{
-  if(theList.Extent() < 1) {
-    return TopoDS_Shape();
-  } else if (theList.Extent() == 1) { // check that sub-shape is bounded by this alone shape
-    TopTools_MapOfShape aSubsInShape;
-    TopExp_Explorer anExp(theList.First(), theType);
-    for(; anExp.More(); anExp.Next()) {
-      if (aSubsInShape.Contains(anExp.Current())) { // found duplicate
-        return anExp.Current();
-      }
-      aSubsInShape.Add(anExp.Current());
-    }
-  }
-
-  // Store in maps sub-shapes from each face.
-  std::vector<TopTools_MapOfShape> aVec;
-  for(TopTools_ListIteratorOfListOfShape anIt(theList); anIt.More(); anIt.Next()) {
-    const TopoDS_Shape aFace = anIt.Value();
-    TopTools_MapOfShape aMap;
-    for(TopExp_Explorer anExp(aFace, theType); anExp.More(); anExp.Next()) {
-      const TopoDS_Shape& aSubShape = anExp.Current();
-      aMap.Add(anExp.Current());
-    }
-    aVec.push_back(aMap);
-  }
-
-  // Find sub-shape shared between all faces.
-  TopoDS_Shape aSharedShape;
-  for(TopTools_MapIteratorOfMapOfShape anIt(aVec[0]); anIt.More(); anIt.Next()) {
-    const TopoDS_Shape& aSubShape = anIt.Value();
-    int aSharedNb = 1;
-    for(int anIndex = 1; anIndex < aVec.size(); ++anIndex) {
-      if(aVec[anIndex].Contains(aSubShape)) {
-        ++aSharedNb;
-      }
-    }
-    if(aSharedNb == theList.Extent()) {
-      if(aSharedShape.IsNull()) {
-        aSharedShape = aSubShape;
-      } else {
-        // More than one shape shared between all faces, return null shape in this case.
-        return TopoDS_Shape();
-      }
-    }
-  }
-
-  return aSharedShape;
-}
-
-// searches theType shape that contains theConnectionType sub-shapes in each shape from the List,
-// so, implements the neighbours searching
-/*
-const TopoDS_Shape findCommonShapeByNB(const TopAbs_ShapeEnum theType,
-  const TopAbs_ShapeEnum theConnectionType, const TopTools_ListOfShape& theList)
-{
-TopTools_MapOfShape aCheckedShapes; // already checked shapes of type theType
-  TopoDS_Shape aResult; // theType result shape
-  for(TopTools_ListIteratorOfListOfShape anIt(theList); anIt.More(); anIt.Next()) { // iterate all
-    for(TopExp_Explorer anExp(anIt.ChangeValue(), theType); anExp.More(); anExp.Next()) {
-      if (aCheckedShapes.Contains(anExp.Current()))
-        continue; // already checked
-      aCheckedShapes.Add(anExp.Current());
-      TopTools_MapOfShape aConnectors; // all connectors of the checked theType shape
-      for(TopExp_Explorer aCExp(anExp.Current(), theConnectionType); aCExp.More(); aCExp.Next()) {
-        aConnectors.Add(aCExp.Current());
-      }
-      // check that all shapes from the List contain the connector sub-shapes
-      bool aFound = true;
-      for(TopTools_ListIteratorOfListOfShape anIt2(theList); anIt2.More() && aFound; anIt2.Next()) {
-        if (anIt2.Value().IsSame(anIt.Value()))
-          continue;
-        aFound = false;
-        for(TopExp_Explorer anE(anIt2.ChangeValue(), theConnectionType); anE.More(); anE.Next()) {
-          if (aConnectors.Contains(anE.Current())) {
-            aFound = true;
-            break;
-          }
-        }
-      }
-      if (aFound) {
-        if (!aResult.IsNull()) // more than one result
-          return TopoDS_Shape();
-        aResult = anExp.Current();
-      }
-    }
-  }
-  return aResult;
-}*/
-
-std::string Model_SelectionNaming::vertexNameByEdges(TopoDS_Shape theContext, TopoDS_Shape theSub,
-  std::shared_ptr<Model_Document> theDoc, ResultPtr& theContextRes, const bool theAnotherDoc)
-{
-  std::string aResult;
-  TopTools_IndexedDataMapOfShapeListOfShape aMap;
-  TopExp::MapShapesAndAncestors(theContext, TopAbs_VERTEX, TopAbs_EDGE, aMap);
-  const TopTools_ListOfShape& aList22  = aMap.FindFromKey(theSub);
-  if(aList22.Extent() >= 2)  { // regular solution
-    TopTools_MapOfShape aFMap;
-    TopTools_ListOfShape aListE;
-    TopTools_ListIteratorOfListOfShape itl2(aList22);
-    for (int i = 1;itl2.More();itl2.Next(),i++) {
-      if(aFMap.Add(itl2.Value()))
-        aListE.Append(itl2.Value());
-    }
-    TopTools_ListIteratorOfListOfShape itl(aListE);
-    for (int i = 1;itl.More();itl.Next(),i++) {
-      const TopoDS_Shape& anEdge = itl.Value();
-      std::string anEdgeName = getShapeName(theDoc, anEdge, theContextRes, theAnotherDoc, false);
-      if (anEdgeName.empty()) { // edge is not in DS
-        aResult.clear();
-        return aResult;
-      }
-      if(i == 1)
-        aResult = anEdgeName;
-      else
-        aResult += "&" + anEdgeName;
-    }
-  }
-  return aResult;
-}
-
-std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
-  std::shared_ptr<GeomAPI_Shape> theSubSh, const std::string& theDefaultName,
-  const bool theAnotherDoc)
-{
-  std::string aName("Undefined name");
-  if(!theContext.get()
-      || !theContext->shape().get()
-      || theContext->shape()->isNull()) {
-    return !theDefaultName.empty() ? theDefaultName : aName;
-  }
-
-  // if it is in result of another part
-  std::shared_ptr<Model_Document> aDoc =
-    std::dynamic_pointer_cast<Model_Document>(theContext->document());
-  if (theContext->groupName() == ModelAPI_ResultPart::group()) {
-    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theContext);
-    int anIndex;
-    if (theSubSh.get())
-      return aPart->data()->name() + "/" + aPart->nameInPart(theSubSh, anIndex);
-    else
-      return aPart->data()->name();
-  }
-
-  if (!theSubSh.get() || theSubSh->isNull()) { // no subshape, so just the whole feature name
-    // but if it is in another Part, add this part name
-    std::string aPartName;
-    if (theAnotherDoc)
-      aPartName = theContext->document()->kind() + "/"; // PartSet
-    return aPartName + theContext->data()->name();
-  }
-  TopoDS_Shape aSubShape = theSubSh->impl<TopoDS_Shape>();
-  TopoDS_Shape aContext  = theContext->shape()->impl<TopoDS_Shape>();
-#ifdef DEB_NAMING
-  if(aSubShape.ShapeType() == TopAbs_COMPOUND) {
-    BRepTools::Write(aSubShape, "Selection.brep");
-    BRepTools::Write(aContext, "Context.brep");
-  }
-#endif
-  aName = getShapeName(aDoc, aSubShape, theContext, theAnotherDoc,
-    theContext->shape()->isEqual(theSubSh));
-
-  if(aName.empty() ) { // not in the document!
-    TopAbs_ShapeEnum aType = aSubShape.ShapeType();
-    switch (aType) {
-    case TopAbs_FACE:
-      // the Face should be in DF. If it is not the case, it is an error ==> to be debugged
-      break;
-    case TopAbs_EDGE:
-      {
-        // name structure: F1 & F2 [& F3 & F4],
-        // where F1 & F2 the faces which gives the Edge in trivial case
-        // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
-        if (BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) {
-          aName = "Degenerated_Edge";
-          break;
-        }
-        TopTools_IndexedDataMapOfShapeListOfShape aMap;
-        TopExp::MapShapesAndAncestors(aContext, TopAbs_EDGE, TopAbs_FACE, aMap);
-        TopTools_IndexedMapOfShape aSMap; // map for ancestors of the sub-shape
-        bool isTrivialCase(true);
-        if(aMap.Contains(aSubShape)) {
-          const TopTools_ListOfShape& anAncestors = aMap.FindFromKey(aSubShape);
-          // check that it is not a trivial case (F1 & F2: aNumber = 1)
-          isTrivialCase = isTrivial(anAncestors, aSMap);
-          if (!isTrivialCase) { // another try: check that common shape can be processed anyway
-            isTrivialCase = !findCommonShape(TopAbs_EDGE, anAncestors).IsNull();
-          }
-        } else
-          break;
-        TopTools_MapOfShape aNbs;
-        if(!isTrivialCase) { // find Neighbors
-          TNaming_Localizer aLocalizer;
-          TopTools_MapOfShape aMap3;
-          aLocalizer.FindNeighbourg(aContext, aSubShape, aMap3);
-          //int n = aMap3.Extent();
-          TopTools_MapIteratorOfMapOfShape it(aMap3);
-          for(;it.More();it.Next()) {
-            const TopoDS_Shape& aNbShape = it.Key(); // neighbor edge
-            //TopAbs_ShapeEnum aType = aNbShape.ShapeType();
-            const TopTools_ListOfShape& aList  = aMap.FindFromKey(aNbShape);
-            TopTools_ListIteratorOfListOfShape it2(aList);
-            for(;it2.More();it2.Next()) {
-              if(aSMap.Contains(it2.Value())) continue; // skip this Face
-              aNbs.Add(it2.Value());
-            }
-          }
-        }  // else a trivial case
-
-        // build name of the sub-shape Edge
-        // iterate faces of the context to get stable order, not map-order
-        TopTools_MapOfShape aStoredFaces; // to avoid duplicates
-        for(TopExp_Explorer aContExp(aContext, TopAbs_FACE); aContExp.More(); aContExp.Next()) {
-          const TopoDS_Shape& aFace = aContExp.Current();
-          if (aStoredFaces.Contains(aFace) || !(aSMap.Contains(aFace) || aNbs.Contains(aFace)))
-            continue;
-          aStoredFaces.Add(aFace);
-          std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
-          if(aName.empty())
-            aName = aFaceName;
-          else
-            aName += "&" + aFaceName;
-        }
-      }
-      break;
-
-    case TopAbs_VERTEX:
-      // name structure (Monifold Topology):
-      // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
-      // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition,
-      //                               but it should be kept as is to obtain safe recomputation
-      // 2) F1 | F2      - intersection of 2 faces definses a vertex - applicable for case
-      //                   when 1 faces is cylindrical, conical, spherical or revolution and etc.
-      // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
-      //                   or compound of 2 open faces.
-      // 4) E1 | E2      - intesection of 2 edges defines a vertex - when we have a case of
-      //                   two independent edges (wire or compound)
-      // implemented 2 first cases
-      {
-        TopTools_IndexedDataMapOfShapeListOfShape aMap;
-        TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
-        TopTools_ListOfShape aList;
-        TopTools_MapOfShape aFMap;
-        // simetimes when group is moved in history, naming may be badly updated, so
-        // avoid crash in FindFromKey (issue 1842)
-        if (aMap.Contains(aSubShape)) {
-          const TopTools_ListOfShape& aList2  = aMap.FindFromKey(aSubShape);
-          // fix is below
-          TopTools_ListIteratorOfListOfShape itl2(aList2);
-          for (int i = 1;itl2.More();itl2.Next(),i++) {
-            if(aFMap.Add(itl2.Value()))
-              aList.Append(itl2.Value());
-          }
-        } else
-          break;
-        int n = aList.Extent();
-        bool isByFaces = n >= 3;
-        if (isByFaces) { // check that by faces vertex is identified uniquly (2317)
-          TopoDS_Shape aVertex = findCommonShape(TopAbs_VERTEX, aList);
-          isByFaces = !aVertex.IsNull() && aVertex.ShapeType() == TopAbs_VERTEX;
-        }
-
-        if(!isByFaces) { // open topology case or Compound case => via edges
-          aName = vertexNameByEdges(aContext, aSubShape, aDoc, theContext, theAnotherDoc);
-          isByFaces = aName.empty();
-          if (isByFaces) { // try to find a vertex in sketch faces
-            ResultConstructionPtr aConstr =
-              std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
-            if (aConstr.get() && aConstr->facesNum()) {
-              for(int aFace = aConstr->facesNum() - 1; isByFaces && aFace >= 0; aFace--) {
-                std::shared_ptr<GeomAPI_Face> aGFace = aConstr->face(aFace);
-                aName = vertexNameByEdges(aGFace->impl<TopoDS_Face>(), aSubShape,
-                  aDoc, theContext, theAnotherDoc);
-                isByFaces = aName.empty();
-              }
-            }
-          }
-        }
-
-        if (isByFaces) {
-          TopTools_ListIteratorOfListOfShape itl(aList);
-          for (int i = 1;itl.More();itl.Next(),i++) {
-            const TopoDS_Shape& aFace = itl.Value();
-            std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
-            if(i == 1)
-              aName = aFaceName;
-            else
-              aName += "&" + aFaceName;
-          }
-        }
-      }
-      break;
-    }
-  }
-  return aName;
-}
-
-TopAbs_ShapeEnum translateType (const std::string& theType)
-{
-  // map from the textual shape types to OCCT enumeration
-  static std::map<std::string, TopAbs_ShapeEnum> aShapeTypes;
-
-  if(aShapeTypes.size() == 0) {
-    aShapeTypes["compound"]   = TopAbs_COMPOUND;
-    aShapeTypes["compounds"]  = TopAbs_COMPOUND;
-    aShapeTypes["compsolid"]  = TopAbs_COMPSOLID;
-    aShapeTypes["compsolids"] = TopAbs_COMPSOLID;
-    aShapeTypes["solid"]      = TopAbs_SOLID;
-    aShapeTypes["solids"]     = TopAbs_SOLID;
-    aShapeTypes["shell"]      = TopAbs_SHELL;
-    aShapeTypes["shells"]     = TopAbs_SHELL;
-    aShapeTypes["face"]       = TopAbs_FACE;
-    aShapeTypes["faces"]      = TopAbs_FACE;
-    aShapeTypes["wire"]       = TopAbs_WIRE;
-    aShapeTypes["wires"]      = TopAbs_WIRE;
-    aShapeTypes["edge"]       = TopAbs_EDGE;
-    aShapeTypes["edges"]      = TopAbs_EDGE;
-    aShapeTypes["vertex"]     = TopAbs_VERTEX;
-    aShapeTypes["vertices"]   = TopAbs_VERTEX;
-    aShapeTypes["COMPOUND"]   = TopAbs_COMPOUND;
-    aShapeTypes["COMPOUNDS"]  = TopAbs_COMPOUND;
-    aShapeTypes["COMPSOLID"]  = TopAbs_COMPSOLID;
-    aShapeTypes["COMPSOLIDS"] = TopAbs_COMPSOLID;
-    aShapeTypes["SOLID"]      = TopAbs_SOLID;
-    aShapeTypes["SOLIDS"]     = TopAbs_SOLID;
-    aShapeTypes["SHELL"]      = TopAbs_SHELL;
-    aShapeTypes["SHELLS"]     = TopAbs_SHELL;
-    aShapeTypes["FACE"]       = TopAbs_FACE;
-    aShapeTypes["FACES"]      = TopAbs_FACE;
-    aShapeTypes["WIRE"]       = TopAbs_WIRE;
-    aShapeTypes["WIRES"]      = TopAbs_WIRE;
-    aShapeTypes["EDGE"]       = TopAbs_EDGE;
-    aShapeTypes["EDGES"]      = TopAbs_EDGE;
-    aShapeTypes["VERTEX"]     = TopAbs_VERTEX;
-    aShapeTypes["VERTICES"]   = TopAbs_VERTEX;
-  }
-  if (aShapeTypes.find(theType) != aShapeTypes.end())
-    return aShapeTypes[theType];
-  Events_InfoMessage("Model_SelectionNaming",
-    "Shape type defined in XML is not implemented!").send();
-  return TopAbs_SHAPE;
-}
-
-const TopoDS_Shape getShapeFromNS(
-  const std::string& theSubShapeName, Handle(TNaming_NamedShape) theNS)
-{
-  TopoDS_Shape aSelection;
-  std::string::size_type n = theSubShapeName.rfind('/');
-  if (n == std::string::npos) n = -1;
-  std::string aSubString = theSubShapeName.substr(n + 1);
-  n = aSubString.rfind('_');
-  int indx = 1;
-  if (n != std::string::npos) {// for primitives this is a first
-    // if we have here the same name as theSubShapeName, there is no index in compound, it is whole
-    Handle(TDataStd_Name) aName;
-    if (!theNS->Label().FindAttribute(TDataStd_Name::GetID(), aName) ||
-        aName->Get() != aSubString.c_str()) {
-      aSubString = aSubString.substr(n+1);
-      indx = atoi(aSubString.c_str());
-    }
-  }
-
-  TNaming_Iterator anItL(theNS);
-  for(int i = 1; anItL.More(); anItL.Next(), i++) {
-    if (i == indx) {
-      return anItL.NewShape();
-    }
-  }
-  return aSelection;
-}
-
-const TopoDS_Shape findFaceByName(
-  const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc,
-  const ResultPtr theDetectedContext, bool theContextIsUnique)
-{
-  TopoDS_Shape aFace;
-  std::string aSubString = theSubShapeName;
-
-  static const ResultPtr anEmpty;
-  TDF_Label aLabel = theDoc->findNamingName(aSubString,
-    theContextIsUnique ? theDetectedContext : anEmpty);
-  if (aLabel.IsNull()) { // try to remove additional artificial suffix
-    std::string::size_type n = aSubString.rfind('_');
-    if (n != std::string::npos) {
-      aSubString = aSubString.substr(0, n);
-      aLabel = theDoc->findNamingName(aSubString,
-        theContextIsUnique ? theDetectedContext : anEmpty);
-    }
-  }
-  if(aLabel.IsNull()) return aFace;
-  Handle(TNaming_NamedShape) aNS;
-  if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-    aFace = getShapeFromNS(theSubShapeName, aNS);
-  }
-  return aFace;
-}
-
-size_t ParseName(const std::string& theSubShapeName,   std::list<std::string>& theList)
-{
-  std::string aName = theSubShapeName;
-  std::string aLastName = aName;
-  size_t n1(0), n2(0); // n1 - start position, n2 - position of the delimiter
-  while ((n2 = aName.find('&', n1)) != std::string::npos) {
-    const std::string aName1 = aName.substr(n1, n2 - n1); //name of face
-    theList.push_back(aName1);
-    n1 = n2 + 1;
-    aLastName = aName.substr(n1);
-  }
-  if(!aLastName.empty())
-    theList.push_back(aLastName);
-  return theList.size();
-}
-
-std::string getContextName(const std::string& theSubShapeName)
-{
-  std::string aName;
-  std::string::size_type n = theSubShapeName.find('/');
-  if (n == std::string::npos) return theSubShapeName;
-  aName = theSubShapeName.substr(0, n);
-  return aName;
-}
-
-/// Parses naming name of sketch sub-elements: takes indices and orientation
-/// (if theOriented = true) from this name. Map theIDs constains indices ->
-/// orientations and start/end vertices: negative is reversed, 2 - start, 3 - end
-bool parseSubIndices(CompositeFeaturePtr theComp, //< to iterate names
-  const std::string& theName, const char* theShapeType,
-  std::map<int, int>& theIDs, const bool theOriented = false)
-{
-  // collect all IDs in the name
-  std::map<std::string, int> aNames; // short name of sub -> ID of sub of theComp
-  const int aSubNum = theComp->numberOfSubs();
-  for(int a = 0; a < aSubNum; a++) {
-    FeaturePtr aSub = theComp->subFeature(a);
-    const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-    std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
-    // there may be many shapes (circle and center)
-    for(; aRes != aResults.cend(); aRes++) {
-      ResultConstructionPtr aConstr =
-        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-      if (aConstr.get()) {
-        aNames[Model_SelectionNaming::shortName(aConstr)] = theComp->subFeatureId(a);
-      }
-    }
-  }
-
-  size_t aPrevPos = theName.find("/") + 1, aLastNamePos;
-  bool isShape = false; // anyway the first world must be 'Vertex'
-  do {
-    aLastNamePos = theName.find('-', aPrevPos);
-    std::string anID = theName.substr(aPrevPos, aLastNamePos - aPrevPos);
-    if (!isShape) {
-      if (anID != theShapeType)
-        return false;
-      isShape = true;
-    } else {
-      int anOrientation = 1; // default
-      if (theOriented) { // here must be a symbol in the end of digit 'f' or 'r'
-        std::string::iterator aSymbol = anID.end() - 1;
-        if (*aSymbol == 'r') anOrientation = -1;
-        anID.erase(aSymbol); // remove last symbol
-      }
-      // check start/end symbols
-      std::string::iterator aBack = anID.end() - 1;
-      if (*aBack == 's') {
-        anOrientation *= 2;
-        anID.erase(aBack); // remove last symbol
-      } else if (*aBack == 'e') {
-        anOrientation *= 3;
-        anID.erase(aBack); // remove last symbol
-      }
-
-      if (aNames.find(anID) != aNames.end()) {
-        theIDs[aNames[anID]] = anOrientation;
-      }
-    }
-    aPrevPos = aLastNamePos + 1;
-  } while (aLastNamePos != std::string::npos);
-  return true;
-}
-
-/// produces theEdge orientation relatively to theContext face
-int Model_SelectionNaming::edgeOrientation(const TopoDS_Shape& theContext, TopoDS_Edge& theEdge)
-{
-  if (theContext.ShapeType() != TopAbs_FACE && theContext.ShapeType() != TopAbs_WIRE)
-    return 0;
-  if (theEdge.Orientation() == TopAbs_FORWARD)
-    return 1;
-  if (theEdge.Orientation() == TopAbs_REVERSED)
-    return -1;
-  return 0; // unknown
-}
-
-int Model_CurvesHasher::HashCode(const Handle(Geom_Curve)& theCurve, const Standard_Integer Upper)
-{
-  double aFirstParam = theCurve->FirstParameter();
-  if (aFirstParam < -1.e+100 || aFirstParam > 1.e+100)
-    aFirstParam = 0;
-  double aLastParam = theCurve->LastParameter();
-  if (aLastParam < -1.e+100 || aLastParam > 1.e+100)
-    aLastParam = 2;
-  else aLastParam = (aLastParam + aFirstParam) / 2.; // to avoid in periodic same first and last
-
-  gp_XYZ aCoordSum = theCurve->Value(aFirstParam).XYZ() + theCurve->Value(aLastParam).XYZ();
-  return ::HashCode(aCoordSum.X() + aCoordSum.Y() / 123. + aCoordSum.Z() / 123456., Upper);
-}
-bool Model_CurvesHasher::IsEqual(const Handle(Geom_Curve)& theC1, const Handle(Geom_Curve)& theC2)
-{
-  if (theC1->DynamicType() != theC2->DynamicType())
-    return false;
-  double aFirstParam1 = theC1->FirstParameter();
-  if (aFirstParam1 < -1.e+100 || aFirstParam1 > 1.e+100)
-    aFirstParam1 = 0;
-  double aFirstParam2 = theC2->FirstParameter();
-  if (aFirstParam2 < -1.e+100 || aFirstParam2 > 1.e+100)
-    aFirstParam2 = 0;
-  if (fabs(aFirstParam1 - aFirstParam2) > 1.e-9)
-    return false;
-
-  double aLastParam1 = theC1->LastParameter();
-  if (aLastParam1 < -1.e+100 || aLastParam1 > 1.e+100)
-    aLastParam1 = 2.;
-  else aLastParam1 = (aLastParam1 + aFirstParam1) / 2.; // to avoid in periodic same first and last
-  double aLastParam2 = theC2->LastParameter();
-  if (aLastParam2 < -1.e+100 || aLastParam2 > 1.e+100)
-    aLastParam2 = 2.;
-  else aLastParam2 = (aLastParam2 + aFirstParam2) / 2.; // to avoid in periodic same first and last
-
-  if (fabs(aLastParam1 - aLastParam2) > 1.e-9)
-    return false;
-
-  return theC1->Value(aFirstParam1).IsEqual(theC2->Value(aFirstParam2), Precision::Confusion()) &&
-    theC1->Value(aLastParam1).IsEqual(theC2->Value(aLastParam2), Precision::Confusion());
-}
-
-int Model_EdgesHasher::HashCode(const TopoDS_Edge& theEdge, const Standard_Integer Upper)
-{
-  Standard_Real aFirst, aLast;
-  Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
-  return Model_CurvesHasher::HashCode(aCurve, Upper);
-}
-
-bool Model_EdgesHasher::IsEqual(const TopoDS_Edge& theE1, const TopoDS_Edge& theE2)
-{
-  GeomEdgePtr aSh1(new GeomAPI_Edge);
-  aSh1->setImpl(new TopoDS_Shape(theE1));
-  GeomEdgePtr aSh2(new GeomAPI_Edge);
-  aSh2->setImpl(new TopoDS_Shape(theE2));
-  return aSh1->isEqual(aSh2);
-}
-
-std::shared_ptr<GeomAPI_Shape> Model_SelectionNaming::findAppropriateFace(
-  std::shared_ptr<ModelAPI_Result>& theConstr,
-  NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher>& theCurves, const bool theIsWire)
-{
-  int aBestFound = 0; // best number of found edges (not percentage: issue 1019)
-  int aBestNotFound = 1000000; // best number of not found edges (must be minimum)
-  int aBestOrient = 0; // for the equal "BestFound" additional parameter is orientation
-  std::shared_ptr<GeomAPI_Shape> aResult;
-  ResultConstructionPtr aConstructionContext =
-      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theConstr);
-  if (!aConstructionContext.get())
-    return aResult;
-  for(int aFaceIndex = 0; aFaceIndex < aConstructionContext->facesNum(); aFaceIndex++) {
-    int aFound = 0, aNotFound = 0, aSameOrientation = 0;
-    TopoDS_Face aFace =
-      TopoDS::Face(aConstructionContext->face(aFaceIndex)->impl<TopoDS_Shape>());
-    std::list<TopoDS_Shape> aFacesWires; // faces or wires to iterate
-    if (theIsWire) {
-      for(TopExp_Explorer aWires(aFace, TopAbs_WIRE); aWires.More(); aWires.Next()) {
-        aFacesWires.push_back(aWires.Current());
-      }
-    } else {
-      aFacesWires.push_back(aFace);
-    }
-    std::list<TopoDS_Shape>::iterator aFW = aFacesWires.begin();
-    for(; aFW != aFacesWires.end(); aFW++) {
-      TopExp_Explorer anEdgesExp(*aFW, TopAbs_EDGE);
-      TColStd_MapOfTransient alreadyProcessed; // to avoid counting edges with same curves (841)
-      for(; anEdgesExp.More(); anEdgesExp.Next()) {
-        TopoDS_Edge anEdge = TopoDS::Edge(anEdgesExp.Current());
-        if (!anEdge.IsNull()) {
-          Standard_Real aFirst, aLast;
-          Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-          if (alreadyProcessed.Contains(aCurve))
-            continue;
-          alreadyProcessed.Add(aCurve);
-          if (theCurves.IsBound(aCurve)) {
-            aFound++;
-            int anOrient = theCurves.Find(aCurve);
-            if (anOrient != 0) {  // extra comparision score is orientation
-              if (edgeOrientation(aFace, anEdge) == anOrient)
-                aSameOrientation++;
-            }
-          } else {
-            aNotFound++;
-          }
-        }
-      }
-      if (theIsWire && aFound + aNotFound != 0) {
-        if (aBestNotFound > aNotFound || (aBestNotFound == aNotFound && aFound > aBestFound) ||
-          (aBestNotFound == aNotFound && aFound == aBestFound && aSameOrientation > aBestOrient)) {
-          aBestFound = aFound;
-          aBestOrient = aSameOrientation;
-          aBestNotFound = aNotFound;
-          std::shared_ptr<GeomAPI_Wire> aWire(new GeomAPI_Wire);
-          aWire->setImpl(new TopoDS_Shape(*aFW));
-          aResult = aWire;
-        }
-        aFound = 0;
-        aNotFound = 0;
-        aSameOrientation = 0;
-      }
-    }
-    if (!theIsWire) {
-      if (aFound + aNotFound != 0) {
-        if (aBestNotFound > aNotFound || (aBestNotFound == aNotFound && aFound > aBestFound) ||
-          (aBestNotFound == aNotFound && aFound == aBestFound && aSameOrientation > aBestOrient)) {
-          aBestFound = aFound;
-          aBestOrient = aSameOrientation;
-          aBestNotFound = aNotFound;
-          aResult = aConstructionContext->face(aFaceIndex);
-        }
-      }
-    }
-  }
-  return aResult;
-}
-
-std::string Model_SelectionNaming::shortName(
-  std::shared_ptr<ModelAPI_ResultConstruction>& theConstr, const int theEdgeVertexPos)
-{
-  std::string aName = theConstr->data()->name();
-  // remove "-", "/" and "&" command-symbols
-  aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end());
-  aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end());
-  aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
-  // remove the last 's', 'e', 'f' and 'r' symbols:
-  // they are used as markers of start/end/forward/rewersed indicators
-  static const std::string aSyms("sefr");
-  std::string::iterator aSuffix = aName.end() - 1;
-  while(aSyms.find(*aSuffix) != std::string::npos) {
-    --aSuffix;
-  }
-  aName.erase(aSuffix + 1, aName.end());
-
-  if (theEdgeVertexPos == 1) {
-    aName += "s"; // start
-  } else if (theEdgeVertexPos == 2) {
-    aName += "e"; // end
-  }
-  return aName;
-}
-
-// type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT
-bool Model_SelectionNaming::selectSubShape(const std::string& theType,
-  const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc,
-  std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected, std::shared_ptr<ModelAPI_Result>& theCont)
-{
-  if(theSubShapeName.empty() || theType.empty()) return false;
-  TopAbs_ShapeEnum aType = translateType(theType);
-
-  // check that it was selected in another document
-  size_t aSlash = theSubShapeName.find("/");
-  std::string aSubShapeName = theSubShapeName;
-  std::shared_ptr<Model_Document> aDoc = theDoc;
-  if (aSlash != std::string::npos) {
-    std::string aDocName = theSubShapeName.substr(0, aSlash);
-    ResultPartPtr aFoundPart;
-    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    if (aDocName == aRootDoc->kind()) {
-      aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
-    } else {
-      for (int a = aRootDoc->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
-        ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
-            aRootDoc->object(ModelAPI_ResultPart::group(), a));
-        if (aPart.get() && aPart->isActivated() && aPart->data()->name() == aDocName) {
-          aDoc = std::dynamic_pointer_cast<Model_Document>(aPart->partDoc());
-          aFoundPart = aPart;
-          break;
-        }
-      }
-    }
-    if (aDoc != theDoc) {
-      // so, the first word is the document name => reduce the string for the next manips
-      aSubShapeName = theSubShapeName.substr(aSlash + 1);
-      if (aSubShapeName.empty() && aFoundPart.get()) { // the whole Part result
-        theCont = aFoundPart;
-        return true;
-      }
-    }
-  }
-
-  std::string aContName = getContextName(aSubShapeName);
-  if(aContName.empty()) return false;
-  bool anUniqueContext = false;
-  ResultPtr aCont = aDoc->findByName(aContName, aSubShapeName, anUniqueContext);
-   // possible this is body where postfix is added to distinguish several shapes on the same label
-  int aSubShapeId = -1; // -1 means sub shape not found
-  // for result body the name wihtout "_" has higher priority than with it: it is always added
-  if ((!aCont.get()/* || (aCont->groupName() == ModelAPI_ResultBody::group())*/) &&
-       aContName == aSubShapeName) {
-    size_t aPostIndex = aContName.rfind('_');
-    if (aPostIndex != std::string::npos) {
-      std::string anEmpty, aSubContName = aContName.substr(0, aPostIndex);
-      ResultPtr aSubCont = aDoc->findByName(aSubContName, anEmpty, anUniqueContext);
-      if (aSubCont.get()) {
-        try {
-          std::string aNum = aContName.substr(aPostIndex + 1);
-          aSubShapeId = std::stoi(aNum);
-        } catch (std::invalid_argument&) {
-          aSubShapeId = -1;
-        }
-        if (aSubShapeId > 0) {
-          aContName = aSubContName;
-          aCont = aSubCont;
-        }
-      }
-    }
-  }
-
-
-  static const ResultPtr anEmpty;
-  TopoDS_Shape aSelection;
-  switch (aType)
-  {
-  case TopAbs_FACE:
-  case TopAbs_WIRE:
-    {
-      aSelection = findFaceByName(aSubShapeName, aDoc, aCont, anUniqueContext);
-    }
-    break;
-  case TopAbs_EDGE:
-    {
-      const TDF_Label& aLabel =
-        aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
-      if(!aLabel.IsNull()) {
-        Handle(TNaming_NamedShape) aNS;
-        if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-          aSelection = getShapeFromNS(aSubShapeName, aNS);
-        }
-      }
-    }
-    break;
-  case TopAbs_VERTEX:
-    {
-      const TDF_Label& aLabel =
-        aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
-      if(!aLabel.IsNull()) {
-        Handle(TNaming_NamedShape) aNS;
-        if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-          aSelection = getShapeFromNS(aSubShapeName, aNS);
-        }
-      }
-    }
-    break;
-  case TopAbs_COMPOUND:
-  case TopAbs_COMPSOLID:
-  case TopAbs_SOLID:
-  case TopAbs_SHELL:
-  default: {//TopAbs_SHAPE
-    /// case when the whole sketch is selected, so,
-    /// selection type is compound, but there is no value
-    if (aCont.get() && aCont->shape().get()) {
-      if (aCont->shape()->impl<TopoDS_Shape>().ShapeType() == aType) {
-        theCont = aCont;
-        return true;
-      } else if (aSubShapeId > 0) { // try to find sub-shape by the index
-        TopExp_Explorer anExp(aCont->shape()->impl<TopoDS_Shape>(), aType);
-        for(; aSubShapeId > 1 && anExp.More(); aSubShapeId--) {
-          anExp.Next();
-        }
-        if (anExp.More()) {
-          std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
-          aShapeToBeSelected->setImpl(new TopoDS_Shape(anExp.Current()));
-          theShapeToBeSelected = aShapeToBeSelected;
-          theCont = aCont;
-          return true;
-        }
-      }
-    }
-    return false;
-    }
-  }
-  if (!aSelection.IsNull() &&
-      aSelection.ShapeType() != aType && aSelection.ShapeType() != TopAbs_COMPOUND)
-      aSelection.Nullify(); // to avoid selection of face instead of edge that is described by face
-  // another try to find edge or vertex by faces
-  std::list<std::string> aListofNames;
-  size_t aN = aSelection.IsNull() ? ParseName(aSubShapeName, aListofNames) : 0;
-  if ((aSelection.IsNull() && (aType == TopAbs_EDGE || aType == TopAbs_VERTEX)) ||
-      (!aSelection.IsNull() && aSelection.ShapeType() != aType)) { // edge by one face as example
-    if(aN >= 1) {
-      TopTools_ListOfShape aList;
-      std::list<std::string>::iterator it = aListofNames.begin();
-      for(; it != aListofNames.end(); it++) {
-        ResultPtr aFaceContext = aCont;
-        if (it != aListofNames.begin()) { // there may be other context for different sub-faces
-          std::string aContName = getContextName(*it);
-          if(!aContName.empty()) {
-            aFaceContext = aDoc->findByName(aContName, *it, anUniqueContext);
-          }
-        }
-        TopoDS_Shape aFace = findFaceByName(*it, aDoc, aFaceContext, anUniqueContext);
-        if (aFace.IsNull() && aFaceContext.get() &&
-            aFaceContext->groupName() == ModelAPI_ResultConstruction::group() ) {
-          // search the construction sub-elements for the intersection if they are in the tree
-          size_t aSlash = it->find("/");
-          if (aSlash != std::string::npos) {
-            std::string aSubShapeName = it->substr(aSlash + 1);
-            aFace = findFaceByName(aSubShapeName, aDoc, aFaceContext, true);
-          }
-        }
-        if(!aFace.IsNull())
-          aList.Append(aFace);
-      }
-      aSelection = findCommonShape(aType, aList);
-      //if (aSelection.IsNull() && aType == TopAbs_EDGE) { // try to find selection by neighbours
-      //  aSelection = findCommonShapeByNB(aType, TopAbs_VERTEX, aList);
-      //}
-    }
-  }
-  // in case of construction, there is no registered names for all sub-elements,
-  // even for the main element; so, trying to find them by name (without "&" intersections)
-  if (aSelection.IsNull() && aN < 2) {
-    size_t aConstrNamePos = aSubShapeName.find("/");
-    bool isFullName = aConstrNamePos == std::string::npos;
-    std::string anEmpty, aContrName = aContName;
-    ResultPtr aConstr = aDoc->findByName(aContrName, anEmpty, anUniqueContext);
-    if (aConstr.get() && aConstr->groupName() == ModelAPI_ResultConstruction::group()) {
-      theCont = aConstr;
-      if (isFullName) {
-        // For the full construction selection shape must be empty.
-        //theShapeToBeSelected = aConstr->shape();
-        return true;
-      }
-      // for sketch sub-elements selected
-      CompositeFeaturePtr aComposite =
-        std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aConstr));
-      if (aComposite.get()) {
-        if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE) {
-          // collect all IDs in the name
-          bool isVertexByEdge = false;
-          std::map<int, int> anIDs;
-          if (!parseSubIndices(aComposite, aSubShapeName,
-              aType == TopAbs_EDGE ? "Edge" : "Vertex", anIDs)) {
-            // there is a case when vertex is identified by one circle-edge (2253)
-            if (aType == TopAbs_VERTEX &&
-                parseSubIndices(aComposite, aSubShapeName, "Edge", anIDs))
-              isVertexByEdge = true;
-            else
-              return false;
-          }
-
-          const int aSubNum = aComposite->numberOfSubs();
-          for(int a = 0; a < aSubNum; a++) {
-            int aCompID = aComposite->subFeatureId(a);
-            if (anIDs.find(aCompID) != anIDs.end()) { // found the vertex/edge shape
-              FeaturePtr aSub = aComposite->subFeature(a);
-              const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-              std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIt = aResults.cbegin();
-              // there may be many shapes (circle and center)
-              for(; aRIt != aResults.cend(); aRIt++) {
-                ResultConstructionPtr aRes =
-                  std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRIt);
-                if (aRes) {
-                  int anOrientation = abs(anIDs[aCompID]);
-                  TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
-                  if (anOrientation == 1) {
-                    if (!isVertexByEdge && aType == aShape.ShapeType()) {
-                      theShapeToBeSelected = aRes->shape();
-                      return true;
-                    } else if (isVertexByEdge && aType != aShape.ShapeType()) {
-                      // check that there is only one vertex produces by and circular edge
-                      TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
-                      TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
-                      if (anExp.More())
-                        aShape = anExp.Current();
-                      anExp.Next();
-                      if (!anExp.More() || anExp.Current().IsSame(aShape)) {
-                        std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
-                        aShapeToBeSelected->setImpl(new TopoDS_Shape(aShape));
-                        theShapeToBeSelected = aShapeToBeSelected;
-                        return true;
-                      }
-                    }
-                  } else { // take first or second vertex of the edge
-                    TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
-                    if (aShape.ShapeType() == TopAbs_VERTEX) continue;
-                    TopExp_Explorer anExp(aShape, aType);
-                    for(; anExp.More() && anOrientation != 2; anOrientation--)
-                      anExp.Next();
-                    if (anExp.More()) {
-                      std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
-                      aShapeToBeSelected->setImpl(new TopoDS_Shape(anExp.Current()));
-                      theShapeToBeSelected = aShapeToBeSelected;
-                      return true;
-                    }
-                  }
-                }
-              }
-            }
-          }
-          // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
-        } else if (aType == TopAbs_FACE || aType == TopAbs_WIRE) {
-          std::map<int, int> anIDs;
-          if (!parseSubIndices(aComposite, aSubShapeName,
-              aType == TopAbs_FACE ? "Face" : "Wire", anIDs, true))
-            return false;
-
-          // curves and orientations of edges
-          NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
-          const int aSubNum = aComposite->numberOfSubs();
-          for(int a = 0; a < aSubNum; a++) {
-            int aSubID = aComposite->subFeatureId(a);
-            if (anIDs.find(aSubID) != anIDs.end()) {
-              FeaturePtr aSub = aComposite->subFeature(a);
-              const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-              std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
-              for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
-                ResultConstructionPtr aConstr =
-                  std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-                if (aConstr->shape() && aConstr->shape()->isEdge()) {
-                  const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-                  TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-                  if (!anEdge.IsNull()) {
-                    Standard_Real aFirst, aLast;
-                    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-                    allCurves.Bind(aCurve, anIDs[aSubID] > 0 ? 1 : -1);
-                  }
-                }
-              }
-            }
-          }
-          std::shared_ptr<GeomAPI_Shape> aFoundFW =
-            findAppropriateFace(aConstr, allCurves, aType == TopAbs_WIRE);
-          if (aFoundFW.get()) {
-            theShapeToBeSelected = aFoundFW;
-            return true;
-          }
-        } else if (aType == TopAbs_WIRE) {
-          // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
-          std::map<int, int> anIDs;
-          if (!parseSubIndices(aComposite, aSubShapeName, "Wire", anIDs))
-            return false;
-
-           // curves and orientations of edges
-          NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
-          const int aSubNum = aComposite->numberOfSubs();
-          for(int a = 0; a < aSubNum; a++) {
-            int aSubID = aComposite->subFeatureId(a);
-            if (anIDs.find(aSubID) != anIDs.end()) {
-              FeaturePtr aSub = aComposite->subFeature(a);
-              const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
-              std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
-              for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
-                ResultConstructionPtr aConstr =
-                  std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
-                if (aConstr->shape() && aConstr->shape()->isEdge()) {
-                  const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
-                  TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
-                  if (!anEdge.IsNull()) {
-                    Standard_Real aFirst, aLast;
-                    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
-                    allCurves.Bind(aCurve, anIDs[aSubID] > 0 ? 1 : -1);
-                  }
-                }
-              }
-            }
-          }
-          std::shared_ptr<GeomAPI_Shape> aFoundFW =
-            findAppropriateFace(aConstr, allCurves, aType == TopAbs_WIRE);
-          if (aFoundFW.get()) {
-            theShapeToBeSelected = aFoundFW;
-            return true;
-          }
-        }
-      }
-    }
-  } else if (aSelection.IsNull() && aN >= 2 && aType == TopAbs_VERTEX) {
-    // support of shape name as intersection separated by "&"
-    static std::string anEdgeType = "edge"; // for now it works only with su-edges
-    std::list<std::string>::iterator aSubNames = aListofNames.begin();
-    TopTools_ListOfShape aSubsList;
-    for(; aSubNames != aListofNames.end(); aSubNames++) {
-      std::string aSubName = *aSubNames;
-      std::shared_ptr<GeomAPI_Shape> aSubShapeFound;
-      std::shared_ptr<ModelAPI_Result> aContextFound;
-      if (selectSubShape(anEdgeType, aSubName, theDoc, aSubShapeFound, aContextFound)) {
-        if (aSubShapeFound.get())
-          aSubsList.Append(aSubShapeFound->impl<TopoDS_Shape>());
-      }
-    }
-    aSelection = findCommonShape(TopAbs_VERTEX, aSubsList);
-  }
-  if (!aSelection.IsNull()) {
-    // Select it (must be after N=0 checking,
-    // since for simple constructions the shape must be null)
-    std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
-    aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelection));
-    theShapeToBeSelected = aShapeToBeSelected;
-    theCont = aCont;
-    return true;
-  }
-
-  return false;
-}
diff --git a/src/Model/Model_SelectionNaming.h b/src/Model/Model_SelectionNaming.h
deleted file mode 100644 (file)
index 3494369..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef Model_SelectionNaming_H_
-#define Model_SelectionNaming_H_
-
-#include <ModelAPI_Result.h>
-#include <GeomAPI_Shape.h>
-#include <Model_Document.h>
-#include <TDF_Label.hxx>
-#include <TopoDS_Shape.hxx>
-#include <NCollection_DataMap.hxx>
-#include <Geom_Curve.hxx>
-#include <TopoDS_Edge.hxx>
-
-// class to compare curves in the same way as in GeomAPI_Edge
-class Model_CurvesHasher
-{
-public:
-  DEFINE_STANDARD_ALLOC
-  /// standard hash code
-  static int HashCode (const Handle(Geom_Curve)& theCurve, const Standard_Integer Upper);
-  /// comapre curves by parameters and points on them
-  static bool IsEqual (const Handle(Geom_Curve)& theC1, const Handle(Geom_Curve)& theC2);
-};
-
-// class to compare edges in the same way as in GeomAPI_Edge
-class Model_EdgesHasher
-{
-public:
-  DEFINE_STANDARD_ALLOC
-  /// standard hash code
-  static int HashCode (const TopoDS_Edge& theEdge, const Standard_Integer Upper);
-  /// comapre curves by parameters and points on them
-  static bool IsEqual (const TopoDS_Edge& theE1, const TopoDS_Edge& theE2);
-};
-
-
-/**\class Model_SelectionNaming
- * \ingroup DataModel
- * \brief The set of methods that allow to generate a string-name for the selection attribute.
- */
-class Model_SelectionNaming
-{
-  TDF_Label myLab; ///< Selection label of the selection attribute
-public:
-  /// Constructor for the selection attribute by the selection label
-  Model_SelectionNaming(TDF_Label theSelectionLab);
-
-  /// Produces the string-name for the selected shape
-  std::string namingName(ResultPtr& theContext, std::shared_ptr<GeomAPI_Shape> theSubSh,
-    const std::string& theDefaultName, const bool theAnotherDoc);
-
-  /// Makes a selection by the string-name
-  /// \param theType string of the type of the shape
-  /// \param theSubShapeName string-identifier of the selected shape
-  /// \param theDoc document where the selected shape is searched
-  /// \param theShapeToBeSelected resulting selected shape
-  /// \param theCont the selection context of the resulting selected shape
-  bool selectSubShape(const std::string& theType, const std::string& theSubShapeName,
-    std::shared_ptr<Model_Document> theDoc, std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected,
-    std::shared_ptr<ModelAPI_Result>& theCont);
-
-  /// Searches the face more appropriate to the given curves
-  /// (with higher level of matched parameters)
-  /// \param theConstr construction result that contains one or several  faces
-  /// \param theCurves map from the face edges curves to orientation
-  ///                  (-1 reversed, 0 unknown, 1 forward)
-  /// \param theIsWire for wire algorithm isquite the same,
-  ///                  but if in face several wires, it returns the needed wire
-  /// \returns faces fron this construction if found
-  static std::shared_ptr<GeomAPI_Shape> findAppropriateFace(
-    std::shared_ptr<ModelAPI_Result>& theConstr,
-    NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher>& theCurves,
-    const bool theIsWire);
-
-  /// Returns orientation of the edge in the context shape
-  static int edgeOrientation(const TopoDS_Shape& theContext, TopoDS_Edge& theEdge);
-
-  /// Returns the name of sketch sub-element, shortened by exclusion of some symbols and with added
-  /// the vertex position (if needed)
-  /// \param theConstr result with name - basis for the name
-  /// \param theEdgeVertexPos position of the vertex on edge: 1 - first , 2 - second
-  /// \returns the generated name
-  static std::string shortName(std::shared_ptr<ModelAPI_ResultConstruction>& theConstr,
-    const int theEdgeVertexPos = 0);
-
-protected:
-  /// Gets the stored name from the document
-  std::string getShapeName(std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape,
-    ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext);
-
-  /// Tries to find the name of the context sub-shape as combination of edges in context
-  std::string vertexNameByEdges(TopoDS_Shape theContext, TopoDS_Shape theSub,
-    std::shared_ptr<Model_Document> theDoc, ResultPtr& theContextRes, const bool theAnotherDoc);
-};
-
-#endif
index a22db3780ba50741c258ef66f0e94007c4118420..3d372479414ee02be9b4c58df45984a6da05bef5 100644 (file)
@@ -55,7 +55,7 @@
 
 static Model_Session* myImpl = new Model_Session();
 
-// t oredirect all calls to the root document
+// tredirect all calls to the root document
 #define ROOT_DOC std::dynamic_pointer_cast<Model_Document>(moduleDocument())
 
 bool Model_Session::load(const char* theFileName)
@@ -114,7 +114,7 @@ void Model_Session::abortOperation()
     myOperationAttachedToNext = false;
   }
   setCheckTransactions(true);
-  // here the update mechanism may work after abort, so, supress the warnings about
+  // here the update mechanism may work after abort, so, suppress the warnings about
   // modifications outside of the transactions
   bool aWasCheck = myCheckTransactions;
   myCheckTransactions = false;
@@ -294,7 +294,7 @@ void Model_Session::setActiveDocument(
     std::shared_ptr<ModelAPI_Document> aPrevious = myCurrentDoc;
     myCurrentDoc = theDoc;
     if (theDoc.get() && theSendSignal) {
-      // this must be before the synchronisation call because features in PartSet lower than this
+      // this must be before the synchronization call because features in PartSet lower than this
       // part feature must be disabled and don't recomputed anymore (issue 1156,
       // translation feature is failed on activation of Part 2)
       if (isOperation()) { // do it only in transaction, not on opening of document
@@ -306,7 +306,7 @@ void Model_Session::setActiveDocument(
           }
         }
       }
-      // syncronize the document: it may be just opened or opened but removed before
+      // synchronize the document: it may be just opened or opened but removed before
       std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theDoc);
       if (aDoc.get()) {
         bool aWasChecked = myCheckTransactions;
@@ -320,7 +320,7 @@ void Model_Session::setActiveDocument(
           new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
       Events_Loop::loop()->send(aMsg);
     }
-    // make the current state correct and synchronised in the module and sub-documents
+    // make the current state correct and synchronized in the module and sub-documents
     if (isOperation()) { // do it only in transaction, not on opening of document
       if (myCurrentDoc == moduleDocument()) {
         // make the current feature the latest in root, in previous root current become also last
@@ -475,6 +475,10 @@ void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessa
         if (!aCases.empty()) {
           validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(), aCases);
         }
+        if (aMsgAttr->isGeometricalSelection()) {
+          validators()->registerGeometricalSelection(aMsgAttr->featureId(),
+                                                     aMsgAttr->attributeId());
+        }
       }
     }
     // plugins information was started to load, so, it will be loaded
@@ -615,7 +619,7 @@ void Model_Session::blockAutoUpdate(const bool theBlock)
     }
     if (!isOperation) {
       finishOperation();
-      // append this transaction to the previous one: ne don't need this separated operation in list
+      // append this transaction to the previous one: don't need this separated operation in list
       ROOT_DOC->appendTransactionToPrevious();
     }
   }
index 60b2c72062af6c02e22c288e5627dc35dc48c112..5e2ccff5f8726e77de59cbef4692acd2857e95ad 100755 (executable)
@@ -40,6 +40,7 @@
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
 #include <GeomAPI_Shape.h>
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Point2D.h>
@@ -76,10 +77,6 @@ Model_Update::Model_Update()
   aLoop->registerListener(this, kReorderEvent);
   static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
   aLoop->registerListener(this, kUpdatedSel);
-  static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
-  aLoop->registerListener(this, kAutomaticOff);
-  static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
-  aLoop->registerListener(this, kAutomaticOn);
 
   //  Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
   myIsParamUpdated = false;
@@ -198,7 +195,7 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) {
       }
     }
   }
-  // proccess also results
+  // process also results
   std::list<ResultPtr> allResults; // list of this feature and results
   ModelAPI_Tools::allResults(theFeature, allResults);
   std::list<ResultPtr>::iterator aRes = allResults.begin();
@@ -240,8 +237,6 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
   static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED);
   static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
   static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
-  static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
-  static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
 
 #ifdef DEB_UPDATE
   std::cout<<"****** Event "<<theMessage->eventID().eventText()<<std::endl;
@@ -253,7 +248,7 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
     if (!myUpdateBlocked) { // process all modified features, even if preview is blocked
       bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments
       myIsPreviewBlocked = false;
-      // iterate everything and add efatures in state "MustBeUpdated" into modified
+      // iterate everything and add features in state "MustBeUpdated" into modified
       std::list<std::shared_ptr<ModelAPI_Document> > allDocs =
         ModelAPI_Session::get()->allOpenedDocuments();
       std::list<std::shared_ptr<ModelAPI_Document> >::iterator aDoc = allDocs.begin();
@@ -331,7 +326,7 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
       if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
         myIsParamUpdated = true;
       }
-      // on undo/redo, abort do not update persisten features
+      // on undo/redo, abort do not update persistent features
       FeaturePtr anUpdated = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
       if (anUpdated.get()) {
         if (addModified(anUpdated, FeaturePtr()))
@@ -395,7 +390,7 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
       }
       myIsFinish = false;
     }
-    // processed features must be only on finish, so clear anyway (to avoid reimport on load)
+    // processed features must be only on finish, so clear anyway (to avoid re-import on load)
     myProcessOnFinish.clear();
 
     // #2156: current must be sketch, left after the macro execution
@@ -409,7 +404,8 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
     }
 
     if (anActiveDoc.get() && aCurrent.get() && aCurrent->data()->isValid()) {
-      if (anActiveDoc->currentFeature(false) != aCurrent)
+      if (anActiveDoc->currentFeature(false) != aCurrent &&
+          ModelAPI_Tools::compositeOwner(anActiveDoc->currentFeature(false)) == aCurrent)
         anActiveDoc->setCurrentFeature(aCurrent, false); // #2156 make the current feature back
     }
 
@@ -483,7 +479,7 @@ void Model_Update::processFeatures(const bool theFlushRedisplay)
   }
 }
 
-// collects all the feautres this feature depends on: reasons
+// collects all the features this feature depends on: reasons
 static void allReasons(FeaturePtr theFeature, std::set<FeaturePtr>& theReasons) {
   std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > > aDeps;
   theFeature->data()->referencesToObjects(aDeps);
@@ -690,7 +686,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
     theFeature->data()->execState(ModelAPI_StateDone);
 
   // this checking must be after the composite feature sub-elements processing:
-  // composite feature status may depend on it's subelements
+  // composite feature status may depend on it's sub-elements
   if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) &&
     theFeature->getKind() != "Part") {
       // don't disable Part because it will make disabled all the features
@@ -713,7 +709,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
           aDoExecute = true;
         } else if (theFeature->results().size()) { // execute only not-results features
           aDoExecute = !(theFeature->firstResult()->groupName() == ModelAPI_ResultBody::group() ||
-                         theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group());
+            theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group() ||
+            theFeature->getKind() == "Sketch");
         } else {
           aDoExecute = aState != ModelAPI_StateInvalidArgument;
         }
index 41fa0f7014a03e24137734cbd4bc447925905271..5bf41b28976b71d3a371eafcf31ad30f6b75d576 100644 (file)
@@ -377,3 +377,27 @@ bool Model_ValidatorsFactory::isMainArgument(std::string theFeature, std::string
   std::map<std::string, std::string>::iterator aFound = myMainArgument.find(theFeature);
   return aFound != myMainArgument.end() && aFound->second == theAttribute;
 }
+
+void Model_ValidatorsFactory::registerGeometricalSelection(std::string theFeature,
+                                                           std::string theAttribute)
+{
+  std::map<std::string, std::set<std::string> >::iterator aFind =
+    myGeometricalSelection.find(theFeature);
+  if (aFind == myGeometricalSelection.end()) {
+    std::set<std::string> aNewSet;
+    aNewSet.insert(theAttribute);
+    myGeometricalSelection[theFeature] = aNewSet;
+  }
+  else {
+    aFind->second.insert(theAttribute);
+  }
+}
+
+bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature,
+                                                     std::string theAttribute)
+{
+  std::map<std::string, std::set<std::string> >::iterator aFind =
+    myGeometricalSelection.find(theFeature);
+  return aFind != myGeometricalSelection.end()
+         && aFind->second.find(theAttribute) != aFind->second.end();
+}
index 939cdf21390017aebd1c22b3bc2de2de5e62e94e..7dcf2ff98c2470ec64311439b3ab4d3a0f9cf5df 100644 (file)
@@ -58,6 +58,7 @@ class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
           std::map<std::string, std::set<std::string> > > > myCases;
   /// Stores main attribute for each feature
   std::map<std::string, std::string> myMainArgument;
+  std::map<std::string, std::set<std::string> > myGeometricalSelection;
 
  public:
   /// Registers the instance of the validator by the ID
@@ -123,6 +124,12 @@ class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
   /// Returns true is the attribute is a main argument of the feature
   virtual bool isMainArgument(std::string theFeature, std::string theAttribute);
 
+  /// Register the selection attribute as geometrical selection
+  virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute);
+
+  /// Returns true if the attribute is a geometrical selection
+  virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute);
+
 
 protected:
   /// Adds the defualt validators that are usefull for all features.
index 14148d04694b8d586a00cf2126519d4dadf11d59..22b949c54246424129624587d7063bf6f956c6d3 100644 (file)
@@ -166,6 +166,7 @@ ADD_UNIT_TESTS(TestConstants.py
                TestResults.py
                TestIntArray.py
                Test1512.py
+               Test1562.py
                TestDoubleArray.py
                Test1757.py
                Test1998.py
@@ -210,6 +211,7 @@ ADD_UNIT_TESTS(TestConstants.py
                Test2607.py
                TestBlockRecalculation.py
                TestSelectionScope.py
+               TestSelectorShell.py
                TestWeakNaming2125.py
                TestWeakNaming2222.py
                TestWeakNaming2245.py
@@ -223,4 +225,12 @@ ADD_UNIT_TESTS(TestConstants.py
                TestWeakNaming2445.py
                TestWeakNaming2446.py
                TestWeakNaming2452.py
+               Test2685.py
+               TestGeomNamingPlacement.py
+               TestGeomNamingRevolution.py
+               TestGeomNamingEdgeByFilter.py
+               TestGeomNamingSketchPlane.py
+               TestGeomNamingBoxWithFillet.py
+               TestContainerSelector.py
+               TestSaveOpen.py
 )
index e5113a5c2fea4df2c8dcad75153abfaab8196014..db3acb539818eb043ace5bfdf0d440223fcdb952 100644 (file)
@@ -207,3 +207,6 @@ template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr
 
 // Geometry casts
 %template(shapeToEdge) shared_ptr_cast<GeomAPI_Edge, GeomAPI_Shape>;
+
+template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
+%template(featureToPresentation) shared_ptr_cast<GeomAPI_IPresentable, ModelAPI_Feature>;
index 78d8ba769dfce1ccaa620fe49605ab0f8b849990..27b2427b968674ba6bb44e4afc86a7575db66205 100644 (file)
@@ -64,7 +64,7 @@ class ModelAPI_AttributeRefList : public ModelAPI_Attribute
   /// Returns the referenced object by the zero-based index
   ///\param theIndex zero-based index in the list
   ///\param theWithEmpty if it is false, counts the not-empty referenced objects only
-  virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) const = 0;
+  virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) = 0;
 
   /// Substitutes the object by another one. Does nothing if such object is not found.
   virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) = 0;
index 212e83be9941a605b78cd7c69ee5c9903eef3403..d2dec5bc49e02e0e4b0ceb595b33acd1c849f9f6 100644 (file)
@@ -47,7 +47,7 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, do not store and name the added in the data framework
-  ///           (used to remove immideately, without the following updates)
+  ///           (used to remove immediately, without the following updates)
   /// \returns true if attribute was updated
   virtual bool setValue(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
@@ -78,7 +78,7 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Returns the context of the selection : result or feature
   virtual std::shared_ptr<ModelAPI_Object> contextObject() = 0;
 
-  /// Updates the underlied selection due to the changes in the referenced objects
+  /// Updates the selection due to the changes in the referenced objects
   /// \returns false if update is failed
   virtual bool update() = 0;
 
@@ -115,12 +115,17 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Returns true if recompute of selection become impossible
   virtual bool isInvalid() = 0;
 
-  /// Returns true if the name was stored using weak naming principle
-  MODELAPI_EXPORT virtual bool isWeakNaming() = 0;
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const = 0;
 
   /// To virtually destroy the fields of successors
   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
 
+  /// Returns the name by context. Adds the part name if the context is located in other document
+  MODELAPI_EXPORT virtual std::string contextName(const ResultPtr& theContext) const = 0;
+
+  /// Makes the current local selection becomes all sub-shapes with same base geometry.
+  MODELAPI_EXPORT virtual void combineGeometrical() = 0;
 
  protected:
   /// Objects are created for features automatically
index fe432944a2f7efe47803c52b3320300c797e8077..7bdd59a6bef1723ed77e78b7bbbc7deb7268826a 100644 (file)
@@ -74,7 +74,7 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute
   /// \param theContext object where the sub-shape was selected
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, it checks also the temporary added item
-  /// \returns true if the pair is found in the attirbute
+  /// \returns true if the pair is found in the attribute
   virtual bool isInList(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false) = 0;
@@ -98,6 +98,11 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute
   /// during non-modification operations with this attribute)
   virtual void cashValues(const bool theEnabled) = 0;
 
+  virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
+
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const = 0;
+
   /// Returns the type of this class of attributes
   static std::string typeId()
   {
index 8da3d2158fc56eeb50d6d2e65362f293c816f1bd..6523241df7f2262654cd9f31e8fe5824153c6337 100755 (executable)
@@ -42,92 +42,61 @@ public:
   MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
 
   /// Stores the shape (called by the execution method).
-  virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+  virtual void store(const GeomShapePtr& theShape,
                      const bool theIsStoreSameShapes = true) = 0;
 
   /// Stores the generated shape (called by the execution method).
-  virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-                                 const std::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
+  virtual void storeGenerated(const GeomShapePtr& theFromShape,
+                              const GeomShapePtr& theToShape) = 0;
 
   /// Stores the modified shape (called by the execution method).
-  virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-                                 const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-                            const int theDecomposeSolidsTag = 0) = 0;
-
-  /// Stores the shape without naming support
-  virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+  virtual void storeModified(const GeomShapePtr& theOldShape,
+                             const GeomShapePtr& theNewShape,
+                             const bool theIsCleanStored = true) = 0;
 
   /// Returns the shape-result produced by this feature
-  virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
+  virtual GeomShapePtr shape() = 0;
 
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
-  virtual void generated(
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1) = 0;
+  /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+  virtual bool generated(const GeomShapePtr& theNewShape,
+    const std::string& theName, const bool theCheckIsInResult = true) = 0;
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
   /// construction of a prism.
-  virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1) = 0;
+  virtual void generated(const GeomShapePtr& theOldShape,
+                         const GeomShapePtr& theNewShape,
+                         const std::string& theName = "") = 0;
 
   /// Records the shape newShape which is a modification of the shape oldShape.
   /// As an example, consider the case of a face split or merged in a Boolean operation.
-  virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1) = 0;
-
-  /// Records the shape oldShape which was deleted from the current label.
-  /// As an example, consider the case of a face removed by a Boolean operation.
-  virtual void deleted(
-    const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
+  virtual void modified(const GeomShapePtr& theOldShape,
+                        const GeomShapePtr& theNewShape,
+                        const std::string& theName = "") = 0;
 
   /// load deleted shapes
-  virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                               const GeomShapePtr theShapes = GeomShapePtr()) = 0;
+  virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+                                 const GeomShapePtr& theOldShape,
+                                 const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                 const GeomShapePtr& theShapesToAvoid = GeomShapePtr()) = 0;
+
   /// load and orient modified shapes
-  virtual void loadAndOrientModifiedShapes (
-                                                  GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                                                                          const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes,
-                                               const bool theIsStoreSeparate = false,
-                                               const bool theIsStoreAsGenerated = false) = 0;
+  virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+                                  const GeomShapePtr& theOldShape,
+                                  const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                  const std::string& theName = "") = 0;
+
   /// load and orient generated shapes
-  virtual void loadAndOrientGeneratedShapes (
-                                                  GeomAlgoAPI_MakeShape* theMS,
-                                               std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-                                               const int  theKindOfShape,
-                                               const int  theTag,
-                                                                                          const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
+  virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+                                   const GeomShapePtr& theOldShape,
+                                   const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                   const std::string& theName = "") = 0;
 
   /// load shapes of the first level (to be used during shape import)
-  virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
-                              const std::string& theName, int&  theTag) = 0;
-
-  /// load disconnected edges
-  virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
-                                     const std::string& theName, int&  theTag) = 0;
-
-  /// load disconnected vetexes
-  virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
-                                        const std::string& theName,int&  theTag) = 0;
-
-  /// Converts evolution of sub-shapes stored in naming structure to selection
-  /// (theFlag = true) and back (theFlag = false)
-  virtual void evolutionToSelection(const bool theFlag) = 0;
-
-  /// Returns true if the latest modification of this body in the naming history
-  // is equal to the given shape
-  virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+  virtual void loadFirstLevel(GeomShapePtr theShape,
+                              const std::string& theName) = 0;
 
 protected:
   /// Returns the data manager of this object: attributes
@@ -137,7 +106,7 @@ protected:
   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
 
 protected:
-  /// Deafult constructor accessible only from Model_Object
+  /// Default constructor accessible only from Model_Object
   MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
 
   ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
index 8fc0c819a87fc355761c57f14465e86881911740..b9227b04336c441a6ec097d900299ffb0f1a5344 100644 (file)
@@ -25,12 +25,6 @@ ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature()
 
 }
 
-void ModelAPI_CompositeFeature::exchangeIDs(
-  std::shared_ptr<ModelAPI_Feature> theFeature1, std::shared_ptr<ModelAPI_Feature> theFeature2)
-{
-  // by default nothing is in the implementation
-}
-
 void ModelAPI_CompositeFeature::erase()
 {
   // erase all sub-features
index 1011b350b9272fe6fb185582fa7af3e32a48de25..29276b544a55e523cce9393de6ac900218764134 100644 (file)
@@ -55,10 +55,6 @@ public:
   /// structures of the owner (the remove from the document will be done outside just after)
   virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
 
-  /// Exchanges IDs of two given features: needed for more correct naming in some cases (issue 769)
-  MODELAPI_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
-    std::shared_ptr<ModelAPI_Feature> theFeature2);
-
   /// in addition removes all subs
   MODELAPI_EXPORT virtual void erase();
 };
index c0ffdf16d67b6061157d3c22df960ab129b1e1c2..3bba79c8c12108e9b0a1dda75baae3ee7a6640e0 100644 (file)
@@ -54,14 +54,18 @@ bool ModelAPI_Expression::isVariable(const std::string& theString)
 {
   if (theString.empty())
     return false;
-  std::string::const_iterator it = theString.begin();
-  if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
-    return false;
-  it++;
-  for ( ; it != theString.end(); ++it ) {
-    if(!(isalnum(*it) || (*it) == '_')) {
+  try {
+    std::string::const_iterator it = theString.begin();
+    if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
       return false;
+    it++;
+    for ( ; it != theString.end(); ++it ) {
+      if(!(isalnum(*it) || (*it) == '_')) {
+        return false;
+      }
     }
+  } catch(...) {
+    return false;
   }
   return true;
 }
index 236ee3dffae018b4abd0b3d589a3f5ede79e74b2..5f1e3c989c8f4ae5c3b66be2b54927ac6730fa29 100644 (file)
@@ -91,7 +91,7 @@ void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& theResu
 void ModelAPI_Feature::removeResult(const std::shared_ptr<ModelAPI_Result>& theResult)
 {
   theResult->setDisabled(theResult, true);
-  // flush visualisation changes
+  // flush visualization changes
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
   aLoop->flush(aRedispEvent);
@@ -138,7 +138,7 @@ void ModelAPI_Feature::removeResults(
     }
   }
   if (!aGroup.empty() && theFlush) {
-    // flush visualisation changes
+    // flush visualization changes
     static Events_Loop* aLoop = Events_Loop::loop();
     static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
     aLoop->flush(aRedispEvent);
@@ -173,8 +173,10 @@ void ModelAPI_Feature::erase()
   while (!myResults.empty()) {  // remove one by one with messages
     std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
     aRes->setDisabled(aRes, true); // to avoid activation of the Part result
-    if (!myResults.empty()) // disabling result may erase the list (on undo of Part, issue 665)
+    if (!myResults.empty()) {// disabling result may erase the list (on undo of Part, issue 665)
       myResults.erase(myResults.begin());
+      aRes->erase();
+    }
   }
   ModelAPI_Object::erase();
 }
index 1f09fb2becbbd7805c565e2e895bc18a628a21dc..64a2d432ecf1d8536d402758355859675dcc7be1 100644 (file)
@@ -30,7 +30,7 @@
 class ModelAPI_Data;
 class ModelAPI_Document;
 
-// sometimes it is usefull for debug to see name of each object (bad for memory and performance)
+// sometimes it is useful for debug to see name of each object (bad for memory and performance)
 //#define DEBUG_NAMES
 
 /**\class ModelAPI_Object
@@ -115,6 +115,7 @@ class ModelAPI_Object: public ModelAPI_Entity
   MODELAPI_EXPORT virtual void erase();
 
   friend class Model_Objects;
+  friend class ModelAPI_Feature;
   friend class Model_Document;
 
 };
index 588d138bf17cb447927b3273fed0f6fdfbeb1988..e0f0f8c87af3842860ef28e52175cf52fa594e80 100644 (file)
@@ -35,9 +35,9 @@ void ModelAPI_Result::initAttributes()
 {
   // append the color attribute. It is empty, the attribute will be filled by a request
   DataPtr aData = data();
-  aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
-  aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId());
-  aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId());
+  aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId())->setIsArgument(false);
+  aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
+  aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
 }
 
 bool ModelAPI_Result::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
index 0ee6696c2e4d28b6c8e8b79eb1d020d618e449ba..22284d1ee6c0443a738c72d37d7b12cb148c67e5 100644 (file)
@@ -39,8 +39,8 @@ std::string ModelAPI_ResultBody::groupName()
   return group();
 }
 
-void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
-  const bool theIsStoreSameShapes)
+void ModelAPI_ResultBody::store(const GeomShapePtr& theShape,
+                                const bool theIsStoreSameShapes)
 {
   myBuilder->store(theShape, theIsStoreSameShapes);
   myConnect = ConnectionNotComputed;
@@ -53,8 +53,8 @@ void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
   updateSubs(theShape);
 }
 
-void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-  const std::shared_ptr<GeomAPI_Shape>& theToShape)
+void ModelAPI_ResultBody::storeGenerated(const GeomShapePtr& theFromShape,
+                                         const GeomShapePtr& theToShape)
 {
   myBuilder->storeGenerated(theFromShape, theToShape);
   myConnect = ConnectionNotComputed;
@@ -67,11 +67,11 @@ void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& t
   updateSubs(theToShape);
 }
 
-void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-  const int theDecomposeSolidsTag)
+void ModelAPI_ResultBody::storeModified(const GeomShapePtr& theOldShape,
+                                        const GeomShapePtr& theNewShape,
+                                        const bool theIsCleanStored)
 {
-  myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
+  myBuilder->storeModified(theOldShape, theNewShape, theIsCleanStored);
   myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
@@ -82,94 +82,60 @@ void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& th
   updateSubs(theNewShape);
 }
 
-void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
-  myBuilder->storeWithoutNaming(theShape);
-  myConnect = ConnectionNotComputed;
-
-  static Events_Loop* aLoop = Events_Loop::loop();
-  static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-  static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
-  aECreator->sendUpdated(data()->owner(), aRedispEvent);
-}
-
-std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
+GeomShapePtr ModelAPI_ResultBody::shape()
 {
   return myBuilder->shape();
 }
 
-void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-  const std::string& theName, const int theTag)
+bool ModelAPI_ResultBody::generated(const GeomShapePtr& theNewShape,
+  const std::string& theName, const bool theCheckIsInResult)
 {
-  myBuilder->generated(theNewShape, theName, theTag);
+  return myBuilder->generated(theNewShape, theName, theCheckIsInResult);
 }
 
-void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-  const int theTag)
+void ModelAPI_ResultBody::generated(const GeomShapePtr& theOldShape,
+                                    const GeomShapePtr& theNewShape,
+                                    const std::string& theName)
 {
-  myBuilder->generated(theOldShape, theNewShape, theName, theTag);
+  myBuilder->generated(theOldShape, theNewShape, theName);
 }
 
-void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-  const int theTag)
+void ModelAPI_ResultBody::modified(const GeomShapePtr& theOldShape,
+                                   const GeomShapePtr& theNewShape,
+                                   const std::string& theName)
 {
-  myBuilder->modified(theOldShape, theNewShape, theName, theTag);
+  myBuilder->modified(theOldShape, theNewShape, theName);
 }
 
 
-void ModelAPI_ResultBody::deleted(
-  const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
-{
-  myBuilder->deleted(theOldShape, theTag);
-}
-
-void ModelAPI_ResultBody::loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-  const int  theKindOfShape,
-  const int  theTag,
-  const GeomShapePtr theShapes)
-{
-  myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag, theShapes);
-}
-
-void ModelAPI_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
-  const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-  const bool theIsStoreSeparate,
-  const bool theIsStoreAsGenerated,
-  const bool /*theSplitInSubs*/)
-{
-  myBuilder->loadAndOrientModifiedShapes(
-    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
-    theIsStoreAsGenerated);
-}
-
-void ModelAPI_ResultBody::loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS,
-  std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
-  const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
+void ModelAPI_ResultBody::loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+                                            const GeomShapePtr& theOldShape,
+                                            const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                            const GeomShapePtr& theShapesToExclude)
 {
-  myBuilder->loadAndOrientGeneratedShapes(
-    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
+  myBuilder->loadDeletedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theShapesToExclude);
 }
 
-void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
-  const std::string& theName, int&  theTag)
+void ModelAPI_ResultBody::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+                                             const GeomShapePtr& theOldShape,
+                                             const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                             const std::string& theName)
 {
-  myBuilder->loadFirstLevel(theShape, theName, theTag);
+  myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
 }
 
-void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
-  const std::string& theName, int&  theTag)
+void ModelAPI_ResultBody::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+                                              const GeomShapePtr& theOldShape,
+                                              const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                              const std::string& theName)
 {
-  myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
+  myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
 }
 
-void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
-  const std::string& theName, int&  theTag)
+void ModelAPI_ResultBody::loadFirstLevel(GeomShapePtr theShape,
+                                         const std::string& theName)
 {
-  myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
+  myBuilder->loadFirstLevel(theShape, theName);
 }
 
 bool ModelAPI_ResultBody::isConnectedTopology()
index b934744c6a93e15336f28d498dc8c5f912b1012f..1ad95f5d1e7dfb3b11c02af52e6721fe578ac25f 100644 (file)
@@ -36,12 +36,12 @@ class GeomAlgoAPI_MakeShape;
 * Provides a shape that may be displayed in the viewer.
 * May provide really huge results, so, working with this kind
 * of result must be optimized.
-* Also provides a conainer of sub-body result in case it is compound or compsolid.
+* Also provides a container of sub-body result in case it is compound or compsolid.
 */
 class ModelAPI_ResultBody : public ModelAPI_Result
 {
 public:
-  /// Iternal enumeration for storage the information of connected topology flag
+  /// Internal enumeration for storage the information of connected topology flag
   enum ConnectedTopologyFlag {
     ConnectionNotComputed, ///< not yet computed
     IsConnected,           ///< the topology is connected
@@ -87,7 +87,7 @@ public:
   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> subResult(
     const int theIndex, bool forTree = false) const = 0;
 
-  /// Returns true if feature or reuslt belong to this composite feature as subs
+  /// Returns true if feature or result belong to this composite feature as subs
   /// Returns theIndex - zero based index of sub if found
   MODELAPI_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const = 0;
 
@@ -95,81 +95,64 @@ public:
   /// param[in] theShape shape to store.
   /// param[in] theIsStoreSameShapes if false stores reference to the same shape
   ///                                if it is already in document.
-  MODELAPI_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
-    const bool theIsStoreSameShapes = true);
+  MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape,
+                                     const bool theIsStoreSameShapes = true);
 
   /// Stores the generated shape (called by the execution method).
-  MODELAPI_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-    const std::shared_ptr<GeomAPI_Shape>& theToShape);
+  MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
+                                              const GeomShapePtr& theToShape);
 
   /// Stores the modified shape (called by the execution method).
-  MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
-
-  /// Stores the shape without naming support
-  MODELAPI_EXPORT virtual void storeWithoutNaming(
-    const std::shared_ptr<GeomAPI_Shape>& theShape);
+  MODELAPI_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
+                                             const GeomShapePtr& theNewShape,
+                                             const bool theIsCleanStored = true);
 
   /// Returns the shape-result produced by this feature
-  MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+  MODELAPI_EXPORT virtual GeomShapePtr shape();
 
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
-  MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
+  /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+  MODELAPI_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+    const std::string& theName, const bool theCheckIsInResult = true);
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
   /// construction of a prism.
-  MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1);
+  MODELAPI_EXPORT virtual void generated(const GeomShapePtr& theOldShape,
+                                         const GeomShapePtr& theNewShape,
+                                         const std::string& theName = "");
 
   /// Records the shape newShape which is a modification of the shape oldShape.
   /// As an example, consider the case of a face split or merged in a Boolean operation.
-  MODELAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1);
-
-  /// Records the shape oldShape which was deleted from the current label.
-  /// As an example, consider the case of a face removed by a Boolean operation.
-  MODELAPI_EXPORT virtual void deleted(
-    const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1);
+  MODELAPI_EXPORT virtual void modified(const GeomShapePtr& theOldShape,
+                                        const GeomShapePtr& theNewShape,
+                                        const std::string& theName = "");
 
   /// load deleted shapes
-  MODELAPI_EXPORT virtual void loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
-    std::shared_ptr<GeomAPI_Shape>  theShapeIn,
-    const int  theKindOfShape,
-    const int  theTag,
-    const GeomShapePtr theShapes = GeomShapePtr());
+  MODELAPI_EXPORT
+  virtual void loadDeletedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                 const GeomShapePtr& theOldShape,
+                                 const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                 const GeomShapePtr& theShapesToExclude = GeomShapePtr());
 
   /// load and orient modified shapes
-  MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
-    std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
-    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-    const bool theIsStoreSeparate = false, const bool theIsStoreAsGenerated = false,
-    const bool theSplitInSubs = false);
+  MODELAPI_EXPORT
+  virtual void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                  const GeomShapePtr& theOldShape,
+                                  const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                  const std::string& theName = "");
 
   /// load and orient generated shapes
-  MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS,
-    std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
-    const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
+  MODELAPI_EXPORT
+  virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+                                   const GeomShapePtr& theOldShape,
+                                   const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+                                   const std::string& theName = "");
 
   /// load shapes of the first level (to be used during shape import)
-  MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
-    const std::string& theName, int&  theTag);
-
-  /// load disconnected edges
-  MODELAPI_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
-    const std::string& theName, int&  theTag);
-
-  /// load disconnected vetexes
-  MODELAPI_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
-    const std::string& theName, int&  theTag);
-
-  /// Returns true if the latest modification of this body in the naming history
-  // is equal to the given shape
-  MODELAPI_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+  MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
+                                              const std::string& theName);
 
   /// Returns true is the topology is connected.
   MODELAPI_EXPORT virtual bool isConnectedTopology() = 0;
@@ -179,7 +162,7 @@ public:
   MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
 
   /// Updates the sub-bodies if shape of this object is compsolid or compound
-  MODELAPI_EXPORT virtual void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
+  MODELAPI_EXPORT virtual void updateSubs(const GeomShapePtr& theThisShape,
     const bool theShapeChanged = true) = 0;
 
 protected:
index ff637277d5d1c72940ae44e7714b1c85e0aadb9a..225102be5723411a3191b4536c986c4138d2029e 100644 (file)
@@ -63,6 +63,10 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result
   /// Sets the result
   virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape) = 0;
 
+  /// Updates the shape taking the current value from the data structure, returns true
+  /// if update has been correctly done
+  virtual bool updateShape() = 0;
+
   /// Sets the flag that it must be displayed in history (default is true)
   virtual void setIsInHistory(const bool isInHistory) = 0;
 
index bd8a697f8529060f2e3249b01bf9d3534b13171e..db0baf99ca3ae07a774872deb992d4f84671ae2f 100644 (file)
@@ -63,7 +63,7 @@ class ModelAPI_ResultPart : public ModelAPI_Result
   /// Returns the part-document of this result
   virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
 
-  /// Returns the original part result: for transfomration features results this is
+  /// Returns the original part result: for transformation features results this is
   /// the original Part feature result
   virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
 
@@ -87,6 +87,9 @@ class ModelAPI_ResultPart : public ModelAPI_Result
   virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
     const std::string& theName, const std::string& theType, int& theIndex) = 0;
 
+  /// Updates the selection inside of the part as a geometrical selection
+  virtual bool combineGeometrical(const int theIndex, std::string& theNewName) = 0;
+
   /// Returns the shape selected in the selection index
   virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
 
index a2c8af67abe69d060c96f75bcb140f12376753e4..e40e05536bbb58755672bb7329e52c7b24efeeb7 100644 (file)
@@ -128,6 +128,12 @@ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
  /// Returns true if the attribute must be checked (the case is selected)
   virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0;
 
+  /// Register the selection attribute as geometrical selection
+  virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
+
+  /// Returns true if the attribute is a geometrical selection
+  virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
+
  protected:
   /// Get instance from Session
   ModelAPI_ValidatorsFactory()
index bd2599e08c9ca09a496b8c57848ff9458289c8a2..39cd4f49b46c0bb14d12054b0ad27bc82feca948 100644 (file)
@@ -71,14 +71,10 @@ aPart = aSession.activeDocument()
 #=========================================================================
 # Make extrusion on triangle
 #=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin.pnt(), dirx.dir(), norm.dir(), aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -93,7 +89,7 @@ aSession.setActiveDocument(aPartSet)
 aPlane = aPartSet.addFeature("Plane")
 aPlane.string("creation_method").setValue("by_other_plane")
 aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
-aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_2")
+aPlane.selection("plane").selectSubShape("face", "Part_1/_weak_name_5_Extrusion_1_1")
 aPlane.real("distance").setValue(0.001)
 aPlane.boolean("reverse").setValue(False)
 aSession.finishOperation()
index 5a8182c2c1bb7bd83715b368a5cb2bcdb02337ed..8494772c8061d27c759f557269492c13c56a8880 100755 (executable)
@@ -155,13 +155,13 @@ def check_owner(selection, topology_type, feature):
   aSession.abortOperation()
 
 # check faces
-check_owner("Extrusion_1_1/Generated_Face_1", "face", aBox)
-check_owner("Fuse_1_1/Modified_Face_2", "face", aBox)
-check_owner("Cut_1_1/Modified_Face_1", "face", aHoleExt)
-check_owner("Fuse_1_1/Modified_Face_1", "face", aTower)
+check_owner("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4", "face", aBox)
+check_owner("Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face", "face", aBox)
+check_owner("Cut_1_1/Modified_Face&Sketch_2/SketchCircle_1_2", "face", aHoleExt)
+check_owner("Fuse_1_1/Modified_Face&Sketch_3/SketchCircle_2_2", "face", aTower)
 # check edges without ambiguity
-check_owner("Fuse_1_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
-check_owner("Fuse_1_1/Modified_Face_1&Extrusion_3_1/To_Face_1", "edge", aTower)
+check_owner("[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", "edge", aBox)
+check_owner("[Fuse_1_1/Modified_Face&Sketch_3/SketchCircle_2_2][Extrusion_3_1/To_Face]", "edge", aTower)
 
 # check the connected topology method: solid is not a compound of connected topology
 assert(aFuse.firstResult().shape().isConnectedTopology() == False)
diff --git a/src/ModelAPI/Test/Test1562.py b/src/ModelAPI/Test/Test1562.py
new file mode 100644 (file)
index 0000000..b49bcf0
--- /dev/null
@@ -0,0 +1,82 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+lenParam = model.addParameter(Part_1_doc, "len", "45")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(63.23267137124048, -31.30105453337777, -32.56343706523536, -31.30105453337777)
+SketchLine_2 = Sketch_1.addLine(-32.56343706523536, -31.30105453337777, -32.56343706523536, -163.6364723017416)
+SketchLine_3 = Sketch_1.addLine(-32.56343706523536, -163.6364723017416, 63.23267137124048, -163.6364723017416)
+SketchLine_4 = Sketch_1.addLine(63.23267137124048, -163.6364723017416, 63.23267137124048, -31.30105453337777)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
+SketchLine_5 = Sketch_2.addLine(43.23267137124047, 69.97394590606471, -1.767328628759523, 69.97394590606471)
+SketchLine_6 = Sketch_2.addLine(-1.767328628759523, 69.97394590606471, -1.767328628759523, 20.8583125692591)
+SketchLine_7 = Sketch_2.addLine(-1.767328628759523, 20.8583125692591, 43.23267137124047, 20.8583125692591)
+SketchLine_8 = Sketch_2.addLine(43.23267137124047, 20.8583125692591, 43.23267137124047, 69.97394590606471)
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"), False)
+SketchLine_9 = SketchProjection_1.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.result(), SketchLine_7.endPoint(), 20, True)
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_7.result(), "len")
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), 0, model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_8"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_8"))
+SketchCircle_1 = Sketch_3.addCircle(-89.76476373103716, -34.76230113958862, 5.223553090716001)
+ExtrusionCut_2.setNestedSketch(Sketch_3)
+model.do()
+# on increase of parameter selected part of extrusion is increased and selected face is removed (U becomes L)
+# so, check that selection is still correct and cut from not existing part produces correct shape anyway
+lenParam.setValue(100)
+model.do()
+
+# check the result validity
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(ExtrusionCut_2.feature()))
+
+# set the value back to avoid changed the name text in selection of "to_object" in check python dump
+lenParam.setValue(45)
+
+model.end()
+
+assert(model.checkPythonDump())
index 8418bdc89bf762d073b2768ab3ce4e1982cfb223..6f725da2c00215d5f264119e5ee9680ab986e399 100644 (file)
@@ -54,13 +54,13 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 300, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 300, 0)
 
 #=========================================================================
 # Cut another rectangle to make a groove
 #=========================================================================
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/To_Face"), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
 SketchLine_5 = Sketch_2.addLine(-47.794137712106, -188.943752610533, 90.842718875892, -188.943752610533)
 SketchLine_6 = Sketch_2.addLine(90.842718875892, -188.943752610533, 90.842718875892, -51.567231082425)
 SketchLine_7 = Sketch_2.addLine(90.842718875892, -51.567231082425, -47.794137712106, -51.567231082425)
@@ -79,8 +79,8 @@ model.do()
 #=========================================================================
 # Make a cylindrical hole using one of the produced faces
 #=========================================================================
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4)"))
 SketchCircle_1 = Sketch_3.addCircle(143.412751420315, -228.52745656314, 32.158435160764)
 ExtrusionCut_2.setNestedSketch(Sketch_3)
 
@@ -92,8 +92,8 @@ Part_1.document().setCurrentFeature(ExtrusionCut_1.feature(), True)
 #=========================================================================
 # Modify the cylindrical hole base face by another groove in the history before the hole is created
 #=========================================================================
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), -50, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
 SketchLine_9 = Sketch_4.addLine(-176.701443076057, -151.212050129331, -91.83965287802501, -151.212050129331)
 SketchLine_10 = Sketch_4.addLine(-91.83965287802501, -151.212050129331, -91.83965287802501, -84.473709256573)
 SketchLine_11 = Sketch_4.addLine(-91.83965287802501, -84.473709256573, -176.701443076057, -84.473709256573)
@@ -125,6 +125,6 @@ import ModelAPI
 
 assert(ModelAPI.ModelAPI_Session.get().validators().validate(Sketch_4.feature()))
 assert(ModelAPI.ModelAPI_Session.get().validators().validate(ExtrusionCut_2.feature()))
-assert(Sketch_3.feature().selection("External").namingName() == "ExtrusionCut_3_1/Modfied_5")
+assert(Sketch_3.feature().selection("External").namingName() == "(ExtrusionCut_3_1/Modified_Face&Sketch_2/SketchLine_6)(ExtrusionCut_3_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face)")
 
 assert(model.checkPythonDump())
index 123cab3cb370fffb75893422f0db433ba33a7ee2..cb931c2d55be7b8d0994262cd10a8a2b17d8ddeb 100644 (file)
@@ -42,9 +42,9 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"))
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
 SketchCircle_1 = Sketch_2.addCircle(12.88847795756506, 28.93359954982685, 11.55225986344597)
 model.do()
 
index 743598addfd710c08254055a1db31e7e09850198..ac0ff8c4b83df90427fef6cbd0d21513dba786fd 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -27,8 +29,9 @@ Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(-106.3464837049742, -78.0445969125214, -108.0617495711835, 165.5231560891939)
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+model.do()
 model.end()
 
 assert(model.checkPythonDump())
index daf3d34731eeb2e6ef43b24a0d864e34d9bc0b09..f0133e287e791fd8212afcd16bf637846a5770f3 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -47,7 +49,7 @@ SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint()
 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 200)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 200)
-SketchArc_2 = Sketch_1.addArc(250, 0, 1.232595164407831e-032, 0, 500, 0, False)
+SketchArc_2 = Sketch_1.addArc(250, 0, 1.232595164407831e-32, 0, 500, 0, False)
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.center())
 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.startPoint())
@@ -63,10 +65,11 @@ SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12")
 model.do()
 Sketch_1.setName("toto")
 Sketch_1.result().setName("tutu")
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "tutu/Face-SketchLine_1f-SketchLine_3f-SketchArc_1_2f-SketchArc_2_2f")], model.selection(), 10, 0)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "tutu/Edge-SketchLine_2")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "tutu/Face-SketchLine_1r-SketchArc_2_2f-SketchLine_3f-SketchArc_1_2f")], model.selection(), 10, 0)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "tutu/SketchLine_2")])
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_2&Extrusion_2_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_1&Extrusion_2_1/To_Edge_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Extrusion_2_1/Generated_Edge&tutu/SketchLine_2_StartVertex]e[Extrusion_2_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_2_1/Generated_Edge&tutu/SketchLine_2_EndVertex]e[Extrusion_2_1/To_Edge]e")])
+model.do()
 model.end()
 
 # check that resulting group selection is valid
index 1da5212a856bc0705b6a8e4ef5712b7b4dd900ae..3540fa05502af7e8da49c302c2ec82770c6d599a 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -31,16 +33,16 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates
 model.do()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f")], model.selection(), 5, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 5, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchCircle_3 = Sketch_2.addCircle(-0.01730125245914903, 1.175069067120482, 0.2787321880802174)
 SketchCircle_4 = Sketch_2.addCircle(-0.01730125245914903, 1.175069067120482, 0.3197841740766353)
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchCircle_4.center())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f")], model.selection(), 0, 3)
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOZ"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 0, 3)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_1 = Sketch_3.addLine(-3.362323990279312, -0.5188129046480872, 0.8318943090987101, -0.5188129046480872)
 SketchLine_2 = Sketch_3.addLine(0.8318943090987101, -0.5188129046480872, 0.8318943090987101, 7.155729512171993)
 SketchLine_3 = Sketch_3.addLine(0.8318943090987101, 7.155729512171993, -3.362323990279312, 7.155729512171993)
@@ -54,15 +56,16 @@ SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_4.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1")])
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face_1"), 0, model.selection(), 0)
-Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")])
-Remove_SubShapes_1_objects = [model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3"), model.selection("SOLID", "Partition_1_1_1_4")]
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4"), model.selection("EDGE", "Sketch_2/SketchLine_1")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face"), 0, model.selection(), 0)
+Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
+Partition_1_objects = [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Remove_SubShapes_1_objects_1 = [model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3"), model.selection("SOLID", "Partition_1_1_1_4")]
 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
-Remove_SubShapes_1.setSubShapesToKeep(Remove_SubShapes_1_objects)
-
-
+Remove_SubShapes_1.setSubShapesToKeep(Remove_SubShapes_1_objects_1)
+model.do()
 model.end()
 
 # check that remove sub-shapes contains correct selection
index 10747cdea20fb9b0bfee451497b2337a12845cde..521adb37ff5cf6a12f28385e42361410c98af4e8 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -52,20 +54,20 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_24")
 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint())
 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_25")
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5, False)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*l")
 SketchConstraintLength_1.setName("SketchConstraintLength_2")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "l")
@@ -93,20 +95,26 @@ SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552
 SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
 SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY"))
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
+Face_3 = model.addFace(Part_1_doc, Face_3_objects)
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
+Face_4 = model.addFace(Part_1_doc, Face_4_objects)
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Face_1_1/Edge_6&Face_1_1/Edge_7"))
+SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "[Face_1_1/Edge_6]e[Face_1_1/Edge_7]e"))
 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
 SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
 SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
 SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
 SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
 SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
@@ -118,24 +126,26 @@ SketchConstraintEqual_5.setName("SketchConstraintEqual_6")
 SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_13.result(), "l")
 SketchConstraintLength_3.setName("SketchConstraintLength_4")
 model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
-Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_4&Face_4_1/Edge_5"))
-MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
-Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_2&Face_4_1/Edge_3"))
-MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "l", 4)
-Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_3"))
-MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "l", 3)
-Recover_4 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_1&Face_4_1/Edge_9"))
-MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "l", 2)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_1_1_8"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_1_1_5")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
+Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_4]e[Face_4_1/Edge_5]e"))
+LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
+Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_2]e[Face_4_1/Edge_3]e"))
+LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "l", 4)
+Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_2]e"))
+LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "l", 3)
+Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_1]e[Face_4_1/Edge_9]e"))
+LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "l", 2)
+Group_1_objects = [model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_1_1_8"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_1_1_5")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 Group_1.setName("Group_3")
 Group_1.result().setName("assemblages")
-Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")])
+Group_2_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
 Group_2.setName("Group_1")
 Group_2.result().setName("eau")
 Group_2.result().setColor(0, 170, 255)
@@ -143,8 +153,11 @@ Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_4_1")])
 Group_3.setName("Group_2")
 Group_3.result().setName("acier")
 Group_3.result().setColor(170, 85, 0)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_5"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_1_1_8")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_4_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("SHELL", "Shell_1_1")])
+Shell_1_objects = [model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_5"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_1_1_8")]
+Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_4_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("SHELL", "Shell_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
 model.end()
 
 # move groups
index 3b4306e64d5474d71022a612f199007d0f7a09f8..2b971addd31857707217339565b72fd5dacb7275 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from ModelAPI import *
 from GeomAlgoAPI import *
@@ -44,7 +46,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 60)
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 90, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 90, 0)
 model.do()
 aSession = ModelAPI_Session.get()
 aSession.setActiveDocument(partSet, False)
index 8697b5d15f77b03564e52fd9bf140938d1c31e73..68e41a29d58dd6565164b4c9163bc5c861fc3f75 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -25,14 +27,16 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-9.954190485756755, -75.16051465706819, 60.31858435553394)
+SketchCircle_1 = Sketch_1.addCircle(-9.954190485756754, -75.16051465706819, 60.31858435553394)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1__cc"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchCircle_2 = Sketch_2.addCircle(-9.954190485756755, -75.16051465706819, 33.11263086848982)
+SketchCircle_2 = Sketch_2.addCircle(-9.954190485756754, -75.16051465706819, 33.11263086848982)
 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_2.center())
+model.do()
+model.do()
 model.end()
 
 assert(model.checkPythonDump())
index 27427d75f37070481f2b42c9e3b4fe8dd9c9e184..46cea4b8864a76c610107954da2d5d45aaf0b559 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,12 +43,12 @@ SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchL
 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchCircle_1 = Sketch_2.addCircle(26.06240015364781, 18.07716886601709, 12.23427461205297)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
 model.do()
 
 Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
@@ -57,13 +59,13 @@ Folder_2.setName("Cylinder")
 from GeomAPI import GeomAPI_Shape
 
 # check result shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [1])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [7])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [30])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [60])
-model.testResultsVolumes(Boolean_1, [101488.717162133529200218617916107])
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [7])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [30])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [60])
+model.testResultsVolumes(Cut_1, [101488.717162133529200218617916107])
 
 model.end()
 
index e52fec361983eaeb2da4b8bd01217d71fe8f1b1b..110d934e8a22133bc3a73bc02a6a1ebbf2585cd7 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -42,7 +44,7 @@ SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchL
 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_5 = Sketch_2.addLine(10, 21.9014765990379, 0, 21.9014765990379)
 SketchLine_5.setName("SketchLine_9")
@@ -74,7 +76,7 @@ SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_8.result(), 10)
 model.do()
 Sketch_2.setName("Sketch_3")
 Sketch_2.result().setName("Sketch_3")
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_9r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_9r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_10 = Sketch_3.addLine(29.60939424565112, 0, 19.60939424565112, 0)
 SketchLine_10.setName("SketchLine_14")
@@ -107,12 +109,12 @@ model.do()
 Sketch_3.setName("Sketch_4")
 Sketch_3.result().setName("Sketch_4")
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), "h", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Fillet_1_objects = [model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_divided_5_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&Extrusion_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_6&ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_divided_4_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_1_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_6&ExtrusionCut_1_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_divided_4_1&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionCut_2_1/Modfied_divided_5_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_divided_5_1&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_9")]
+Fillet_1_objects = [model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_16&weak_name_2]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_18&weak_name_2]")]
 Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2)
-Group_1_objects = [model.selection("FACE", "Fillet_1_1/Modified_Face_3"), model.selection("FACE", "Fillet_1_1/Modified_Face_5"), model.selection("FACE", "Fillet_1_1/Modified_Face_9"), model.selection("FACE", "Fillet_1_1/Modified_Face_15")]
+Group_1_objects = [model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_1"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_4"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_2"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_3")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Fillet_1_1/Fillet_Face_13&Fillet_1_1/Modified_Face_4"), model.selection("EDGE", "Fillet_1_1/Modified_Face_11&Fillet_1_1/Fillet_Face_13")])
-Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Fillet_1_1/Modified_Face_12&ExtrusionCut_1_1/Generated_Face_4&Fillet_1_1/Modified_Face_11"), model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Face_4&Fillet_1_1/Modified_Face_11&Fillet_1_1/Modified_Face_6")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)][Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)]")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Fillet_1_1/Modified_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][Fillet_1_1/Modified_Face&Sketch_3/SketchLine_12]")])
 model.do()
 
 Folder_1 = model.addFolder(Part_1_doc, Sketch_3, ExtrusionCut_2)
index 89121b8a753ca2e835e3be4f7467d57afc8e7a68..8d021171750790337bed30cd963c467bee7505d8 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -31,7 +33,7 @@ model.addParameter(Part_1_doc, "Drill2_InnerRadius", "0.5")
 model.addParameter(Part_1_doc, "Drill2_DepthMin", "6.5")
 model.addParameter(Part_1_doc, "Drill2_DepthMax", "7.5")
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_1 = Sketch_1.addLine(64., 0, 0, 0)
+SketchLine_1 = Sketch_1.addLine(64, 0, 0, 0)
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result())
@@ -50,7 +52,7 @@ SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 36)
 SketchLine_5 = Sketch_1.addLine(22, 36, 22, 0)
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result())
-SketchLine_6 = Sketch_1.addLine(32., 36., 32., 0)
+SketchLine_6 = Sketch_1.addLine(32, 36, 32, 0)
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_3.result())
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result())
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result())
@@ -60,8 +62,10 @@ SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine
 SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_6.startPoint(), SketchLine_3.endPoint(), "Width/2")
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s"), True)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True)
 SketchPoint_2 = SketchProjection_2.createdFeature()
+model.do()
+model.do()
 model.end()
 
 assert(SketchProjection_2.external().namingName() != "")
index 20d2655e046bc838070f2252be0fec271f922fb0..caea5a405c6a99d975d6486954d2451aae924638 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
+
 from salome.shaper import model
 
 model.begin()
@@ -167,7 +170,7 @@ SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], Sketch
 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result())
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Fillet1")
 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_35.result(), "D1_in/2", True)
-SketchConstraintAngle_4 = Sketch_1.setAngleComplementary(SketchLine_23.result(), SketchLine_22.result(), 44.99999999999992)
+SketchConstraintAngle_4 = Sketch_1.setAngleComplementary(SketchLine_23.result(), SketchLine_22.result(), 44.99999999999991)
 SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_14.result(), SketchLine_9.result())
 SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_23.startPoint(), "Width/32*11")
 SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance(SketchLine_23.startPoint(), SketchLine_22.startPoint(), "Chamfer")
@@ -195,19 +198,19 @@ SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance(SketchLin
 SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True)
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 360, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_2"), False)
 SketchPoint_3 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_28"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])"), False)
 SketchLine_36 = SketchProjection_4.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(14.5, 0, 2.25)
 SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchCircle_1.center())
 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], "Drill1_Radius")
 model.do()
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "PartSet/XOZ"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_14&Revolution_1_1/Generated_Face_15")], "Fillet1")
-Fillet_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "Revolution_1_1/Generated_Face_6"), model.selection("FACE", "Revolution_1_1/Generated_Face_8"), model.selection("FACE", "Revolution_1_1/Generated_Face_10")]
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "Fillet1")
+Fillet_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_31"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_29"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_27"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25")]
 Fillet_2 = model.addFillet(Part_1_doc, Fillet_2_objects, "Fillet2")
 model.do()
 
index a3ef0be37754fb4ec9760dd2b190567628017000..cead3dfb76e32cb28f28fa009401ce6a00ca9099 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
-from GeomAPI import *
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
 
 model.begin()
 partSet = model.moduleDocument()
@@ -40,26 +41,9 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
 Extrusion_1.result().setName("Cube")
-
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"),
-                  model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"),
-                  model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"),
-                  model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"),
-                  model.selection("EDGE", "Cube/Generated_Face_2&Cube/Generated_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_2&Cube/From_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_2&Cube/To_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_3&Cube/Generated_Face_2"),
-                  model.selection("EDGE", "Cube/Generated_Face_1&Cube/From_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_3&Cube/To_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_3&Cube/From_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_1&Cube/To_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_4&Cube/Generated_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_4&Cube/From_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_4&Cube/To_Face_1"),
-                  model.selection("EDGE", "Cube/Generated_Face_4&Cube/Generated_Face_3")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_1][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_1][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/Generated_Face&Sketch_1/SketchLine_3]")]
 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
 # check all the names of Edge_1 results are different
 names = set()
@@ -70,7 +54,7 @@ assert(len(names) == len(Edge_1.results())), "Some edges have equal name"
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_2.addCircle(200, 0, 50)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection("EDGE", "Cube"), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection("EDGE", "Cube"), 10, 0)
 model.do()
 # check Extrusion_2
 model.testNbResults(Extrusion_2, 1)
index abf10ad1edd15e385feb39a396823b11708e6199..80869d143098ce66184482025a677362dda7eeb7 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -51,8 +53,8 @@ SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 3)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 8)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r")], model.selection(), 5, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), 5, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 5, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), 5, True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_8 = Sketch_2.addLine(7.560741003605092, 9.43062705614625, -1.095841663628257, 9.43062705614625)
 SketchLine_9 = Sketch_2.addLine(-1.095841663628257, 9.43062705614625, -1.095841663628257, -5.449377136847041)
@@ -67,8 +69,8 @@ SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_9.result())
 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_10.result())
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_11.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("FACE", "Face_1_1")])
 model.do()
 
 # now add an additional edge to the first sketch as it is described in the issue
@@ -76,10 +78,10 @@ SketchLine_8 = Sketch_1.addLine(0, 3, 8, 3)
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_8.endPoint())
 model.do()
-Part_1_doc.setCurrentFeature(Boolean_1.feature(), True)
+Part_1_doc.setCurrentFeature(Fill_1.feature(), True)
 model.end()
 
 # check that the plane is located as previously
-model.testNbSubResults(Boolean_1, [2])
-model.testResultsVolumes(Boolean_1, [120])
+model.testNbSubResults(Fill_1, [2])
+model.testResultsVolumes(Fill_1, [120])
 assert(model.checkPythonDump())
index cb70bf6847dea8a3efece1becf0c29cedf52c945..0ef8930c226c60d85b6d3f98837817a0789c9a24 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -47,9 +49,9 @@ SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(),
 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8")
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 50)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchArc_1_2f-SketchLine_1r")], model.selection(), 100, 0)
 model.do()
-Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
 Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
 # check that resulting build-solid feature is invalid: only one not-closed face is used
 from ModelAPI import *
@@ -58,7 +60,7 @@ assert(aFactory.validate(Solid_1.feature()) == False)
 ModelAPI_Session.get().abortOperation()
 # another try: to make a solid with a face inside
 model.begin()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), 70, True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), 70, True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_5 = Sketch_2.addLine(14.9039069695087, 8.923908092675951, 26.86805702948195, 11.13714035991706)
 SketchLine_6 = Sketch_2.addLine(26.86805702948195, 11.13714035991706, 18.50962242738747, 32.13572332177004)
@@ -70,11 +72,10 @@ SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint())
 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f")])
-Solid_2_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Face_1_1")]
-Solid_2 = model.addSolid(Part_1_doc, Solid_2_objects)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f")])
+Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Face_1_1")]
+Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
+model.do()
 model.end()
 
-assert(aFactory.validate(Solid_2.feature()) == False)
-
 assert(model.checkPythonDump())
index 9fefd083133ca5f5e9c058c4c400487431a2442f..d17dc6161630df9b08c999bef2c33392872dc495 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -38,13 +40,13 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchCircle_1 = Sketch_2.addCircle(0, -10, 25)
 model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")])
 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1/Face_2_1"), model.selection("FACE", "Partition_1_1_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("COMPOUND", "Partition_1_1")])
 model.do()
 
 assert(Group_1.feature().error() == "")
index 09838dd7a48bdb86502320a75a10785519bdcfbd..9c0ece97a0efb7d51c93efb3989ea6bb74f9dfad 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  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
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -65,7 +67,7 @@ SketchLine_7.result().setName("SketchLine_8")
 SketchLine_7.setAuxiliary(True)
 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint())
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.endPoint())
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_3.result(), 93.56999999999999)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_3.result(), 93.56999999998719)
 SketchArc_2 = Sketch_1.addArc(2.349985665002739, 1.087256027998574, 2.499428733897898, 3.48259875277915, 3.77688682869805, 3.017010693505298, True)
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
@@ -79,14 +81,14 @@ SketchLine_8.setName("SketchLine_9")
 SketchLine_8.result().setName("SketchLine_9")
 SketchLine_8.setAuxiliary(True)
 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_8.endPoint())
-SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_7.result(), 32.91)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_7.result(), 32.91000000001281)
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_2.center())
 SketchLine_9 = Sketch_1.addLine(1.546759218272496, 0.000964964207000808, 4.166514953924199, 2.685528408329715)
 SketchLine_9.setName("SketchLine_10")
 SketchLine_9.result().setName("SketchLine_10")
 SketchLine_9.setAuxiliary(True)
 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_9.endPoint())
-SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 7.82)
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 7.820000000000003)
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_3.center())
 SketchLine_10 = Sketch_1.addLine(4.166514953924199, 2.685528408329715, 4.411514953924289, 2.446442922550623)
 SketchLine_10.setName("SketchLine_11")
@@ -109,7 +111,7 @@ SketchLine_12.result().setName("SketchLine_13")
 SketchLine_12.setAuxiliary(True)
 SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_12.startPoint())
 SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_12.endPoint())
-SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_11.result(), SketchLine_12.result(), 8.018000000000001)
+SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_11.result(), SketchLine_12.result(), 8.018000000993595)
 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], 1.32)
 SketchArc_5 = Sketch_1.addArc(1.545335047953034, 0, 4.534275383417573, 2.308616054576027, 3.791202568545627, -3.03637143583555, True)
 SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint())
@@ -154,6 +156,18 @@ SketchLine_17.result().setName("SketchLine_18")
 SketchArc_11.setName("SketchArc_14")
 SketchArc_11.result().setName("SketchArc_14")
 SketchArc_11.results()[1].setName("SketchArc_14_2")
+SketchArc_10.setName("SketchArc_10")
+SketchArc_10.result().setName("SketchArc_10")
+SketchArc_10.results()[1].setName("SketchArc_10_2")
+SketchArc_9.setName("SketchArc_9")
+SketchArc_9.result().setName("SketchArc_9")
+SketchArc_9.results()[1].setName("SketchArc_9_2")
+SketchLine_16.setName("SketchLine_16")
+SketchLine_16.result().setName("SketchLine_16")
+SketchLine_15.setName("SketchLine_15")
+SketchLine_15.result().setName("SketchLine_15")
+SketchLine_14.setName("SketchLine_14")
+SketchLine_14.result().setName("SketchLine_14")
 SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchArc_8.startPoint())
 SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchArc_8.results()[1])
 SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_8.endPoint())
@@ -190,13 +204,13 @@ SketchArc_15.setName("SketchArc_18")
 SketchArc_15.result().setName("SketchArc_18")
 SketchArc_15.results()[1].setName("SketchArc_18_2")
 SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint())
-SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1])
+SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1])
 SketchArc_16 = Sketch_1.addArc(1.552616124088898, 0, 3.904833906055851, 3.190047534283911, 5.51611606287941, 0, True)
 SketchArc_16.setName("SketchArc_19")
 SketchArc_16.result().setName("SketchArc_19")
 SketchArc_16.results()[1].setName("SketchArc_19_2")
 SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint())
-SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1])
+SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1])
 SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_16.endPoint())
 SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_13.result())
 SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_14.center(), SketchArc_6.center())
@@ -214,7 +228,7 @@ SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_20.endPoint()
 SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_3.result())
 SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result())
 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_20.result(), 0.03, True)
-SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 170)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 169.9999999984344)
 SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_19.result(), 0.045, True)
 SketchArc_17 = Sketch_1.addArc(2.429999974807022, 2.369762445224826, 1.08, 2.370000000000011, 2.429999974807022, 3.719762440932702, True)
 SketchArc_17.setName("SketchArc_23")
@@ -250,6 +264,15 @@ SketchArc_23.result().setName("SketchArc_26")
 SketchArc_23.results()[1].setName("SketchArc_26_2")
 SketchLine_23.setName("SketchLine_24")
 SketchLine_23.result().setName("SketchLine_24")
+SketchArc_22.setName("SketchArc_22")
+SketchArc_22.result().setName("SketchArc_22")
+SketchArc_22.results()[1].setName("SketchArc_22_2")
+SketchArc_21.setName("SketchArc_21")
+SketchArc_21.result().setName("SketchArc_21")
+SketchArc_21.results()[1].setName("SketchArc_21_2")
+SketchArc_20.setName("SketchArc_20")
+SketchArc_20.result().setName("SketchArc_20")
+SketchArc_20.results()[1].setName("SketchArc_20_2")
 SketchLine_22.setName("SketchLine_21")
 SketchLine_22.result().setName("SketchLine_21")
 SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchArc_19.startPoint())
@@ -293,7 +316,7 @@ SketchLine_31.result().setName("SketchLine_32")
 SketchLine_31.setAuxiliary(True)
 SketchConstraintCoincidence_75 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_31.startPoint())
 SketchConstraintCoincidence_76 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchArc_1.results()[1])
-SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_3.result(), 59.94)
+SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_3.result(), 59.93999999988066)
 SketchLine_32 = Sketch_1.addLine(1.871489087529827, 3.334796428456965, 1.871489087529827, 3.598813126524882)
 SketchLine_32.setName("SketchLine_33")
 SketchLine_32.result().setName("SketchLine_33")
@@ -308,14 +331,14 @@ SketchConstraintCoincidence_80 = Sketch_1.setCoincident(SketchLine_33.endPoint()
 SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result())
 SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_33.result())
 model.do()
-Extrusion_1_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2f-SketchArc_1_2r-SketchLine_5f-SketchArc_11_2f-SketchLine_14r-SketchLine_15f-SketchLine_16r-SketchArc_9_2f-SketchArc_15_2r-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_20f-SketchArc_17_2r-SketchLine_21r-SketchArc_20_2r-SketchLine_22r-SketchLine_23r-SketchArc_23_2f-SketchLine_24f-SketchArc_27_2f-SketchLine_25f-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f")]
+Extrusion_1_objects = [model.selection("WIRE", "Sketch_1/Face-SketchLine_5f-SketchArc_1_2r-SketchLine_33f-SketchArc_11_2f-SketchLine_2f-SketchLine_14r-SketchArc_9_2f-SketchLine_34r-SketchArc_15_2r-SketchLine_16r-SketchLine_15f-SketchLine_1r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_20f-SketchArc_17_2r-SketchLine_33f-SketchArc_23_2f-SketchLine_23r-SketchLine_22r-SketchLine_24f-SketchLine_25f-SketchArc_27_2f-SketchLine_34r-SketchArc_20_2r-SketchLine_21r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_28r-SketchArc_23_2f-SketchLine_33r-SketchArc_17_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_29r-SketchArc_11_2f-SketchLine_33r-SketchArc_1_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2f-SketchLine_30f-SketchArc_15_2r-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Face-SketchLine_34f-SketchArc_27_2f-SketchLine_31r-SketchArc_20_2r_wire")]
 Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 0.1785, 0.1785)
-Extrusion_2_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f")]
-Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), model.selection("FACE", "Extrusion_1_2/From_Face_2"), -0.05, model.selection("FACE", "Extrusion_1_2/From_Face_2"), 0)
-Extrusion_3_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r")]
-Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0.05, model.selection("FACE", "Extrusion_1_2/To_Face_1"), 0)
-Extrusion_4_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_11_2r-SketchArc_17_2f-SketchLine_27f-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2r-SketchArc_20_2f-SketchLine_26r-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f")]
-Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0.15, model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0)
+Extrusion_2_objects = [model.selection("WIRE", "Sketch_1/Face-SketchArc_13_2r-SketchArc_14_2r-SketchArc_10_2r-SketchLine_26f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_19_2f-SketchArc_18_2f-SketchLine_27r-SketchArc_12_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r")]
+Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), model.selection("FACE", "Extrusion_1_2_2/From_Face"), -0.05, model.selection("FACE", "Extrusion_1_2_2/From_Face"), 0)
+Extrusion_3_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_13_2r-SketchArc_14_2r-SketchArc_10_2r-SketchLine_26f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_19_2f-SketchArc_18_2f-SketchLine_27r-SketchArc_12_2r"), model.selection("FACE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire")]
+Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection(), model.selection("FACE", "Extrusion_1_1_1/To_Face"), 0.05, model.selection("FACE", "Extrusion_1_2_1/To_Face"), 0)
+Extrusion_4_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_28r-SketchArc_23_2f-SketchLine_33r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_1/Face-SketchLine_29r-SketchArc_11_2f-SketchLine_33r-SketchArc_1_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_27f-SketchArc_17_2f-SketchLine_33r-SketchArc_11_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchLine_34f-SketchArc_27_2f-SketchLine_31r-SketchArc_20_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_34f-SketchArc_20_2f-SketchLine_26r-SketchArc_9_2r"), model.selection("WIRE", "Sketch_1/Face-SketchArc_9_2f-SketchLine_30f-SketchArc_15_2r-SketchLine_34f_wire")]
+Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Extrusion_1_1_2/To_Face"), 0.15, model.selection("FACE", "Extrusion_1_1_2/To_Face"), 0)
 Extrusion_4.setName("Extrusion_6")
 Extrusion_4.result().setName("Extrusion_6_1")
 Extrusion_4.result().subResult(0).setName("Extrusion_6_1_1")
@@ -325,8 +348,8 @@ Extrusion_4.results()[1].setName("Extrusion_6_2")
 Extrusion_4.results()[1].subResult(0).setName("Extrusion_6_2_1")
 Extrusion_4.results()[1].subResult(1).setName("Extrusion_6_2_2")
 Extrusion_4.results()[1].subResult(2).setName("Extrusion_6_2_3")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/To_Face_3&Extrusion_3_1/Generated_Face_10&Extrusion_3_1/Generated_Face_11"), model.selection("VERTEX", "Extrusion_6_1/To_Face_1&Extrusion_6_1/Generated_Face_9&Extrusion_6_1/Generated_Face_8"))
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Extrusion_6_1/Generated_Face_3&Extrusion_6_1/To_Face_3&Extrusion_6_1/Generated_Face_4"), False)
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1_3/To_Face][Extrusion_3_1_3/Generated_Face&Sketch_1/SketchLine_28][Extrusion_3_1_3/Generated_Face&Sketch_1/SketchArc_24_2]"), model.selection("VERTEX", "[Extrusion_6_1_1/To_Face][Extrusion_6_1_1/Generated_Face&Sketch_1/SketchArc_23_2][Extrusion_6_1_1/Generated_Face&Sketch_1/SketchLine_33]"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "[Extrusion_6_1_3/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_6_1_3/To_Face][Extrusion_6_1_3/Generated_Face&Sketch_1/SketchLine_33]"), False)
 Partition_1_objects = [model.selection("COMPSOLID", "Extrusion_6_1"), model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_6_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
diff --git a/src/ModelAPI/Test/Test2685.py b/src/ModelAPI/Test/Test2685.py
new file mode 100644 (file)
index 0000000..f851694
--- /dev/null
@@ -0,0 +1,66 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(22, 5, 10)
+SketchCircle_2 = Sketch_1.addCircle(0, 0, 7.5)
+SketchCircle_3 = Sketch_1.addCircle(29, -20, 7.5)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin", 1), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_1 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 22, True)
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_2 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 5, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 7.5)
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7.5)
+SketchLine_3 = Sketch_1.addLine(22, 5, 22, 41.96787958115183)
+SketchLine_3.setAuxiliary(True)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_3.startPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_3.result(), 7, True)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_2.result(), 20, True)
+SketchArc_1 = Sketch_1.addArc(22, 5, 19.39053135678072, 27.42761377547613, 44.57891020979248, 5, True)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchArc_1.center())
+SketchLine_4 = Sketch_1.addLine(22, 5, 85.59353403141361, 5)
+SketchLine_4.setAuxiliary(True)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(44.57891020979248, 5, 44.57891020979248, -20)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 25)
+model.end()
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK))
diff --git a/src/ModelAPI/Test/TestContainerSelector.py b/src/ModelAPI/Test/TestContainerSelector.py
new file mode 100644 (file)
index 0000000..3f5b592
--- /dev/null
@@ -0,0 +1,36 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+# a wire selection: container of intersections (edges are intesection of faces)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "[[Box_1_1/Left][Box_1_1/Bottom]][[Box_1_1/Front][Box_1_1/Left]][[Box_1_1/Left][Box_1_1/Top]][[Box_1_1/Back][Box_1_1/Left]]")])
+model.end()
+
+assert(model.checkPythonDump())
index 5eb24bc40250c3a57b256c2e5c2e74e53ace80f2..0d368254f4f73fdc56b09e3add03ffad442f7c77 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -45,9 +47,9 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 70)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 50)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
 Extrusion_1.result().setName("box")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
 SketchLine_5 = Sketch_2.addLine(10, 55, 50, 55)
 SketchLine_6 = Sketch_2.addLine(50, 55, 50, -5)
 SketchLine_7 = Sketch_2.addLine(50, -5, 10, -5)
@@ -67,12 +69,12 @@ SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchLine
 SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_8.result(), 60)
 SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_7.result(), 40)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 15, 5)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 15, 5)
 Extrusion_2.result().setName("tool")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box")], [model.selection("SOLID", "tool")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box")], [model.selection("SOLID", "tool")])
 model.do()
 
-assert(Boolean_1.result().name() == Extrusion_1.result().name()), "Boolean CUT name '{}' != '{}'".format(Boolean_1.result().name(), Extrusion_1.result().name())
+assert(Cut_1.result().name() == Extrusion_1.result().name()), "Boolean CUT name '{}' != '{}'".format(Cut_1.result().name(), Extrusion_1.result().name())
 
 model.end()
 
index 8e1e7944f14141d7741c4179e944ebfac6d5bda2..b15ec73dc433ee66f14cadd28c1bf29f58d468b1 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -28,30 +30,30 @@ Box_1 = model.addBox(Part_1_doc, 100, 100, 10)
 Box_1.result().setName("plate")
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "plate/Front"), 50, True)
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "plate/Left"), 50, True)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "plate"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")])
-#Partition_1.result().setName("plate")
+Partition_1_objects = [model.selection("SOLID", "plate"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 Partition_1.result().subResult(0).setName("Partition_1_1_1")
 Partition_1.result().subResult(1).setName("top_left")
 Partition_1.result().subResult(2).setName("bottom_right")
 Partition_1.result().subResult(3).setName("Partition_1_1_4")
-Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_1/Modified_Face_3_3"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Partition_1_1_1/Modified_Face_3_3&top_left/Modified_Face_3_1&bottom_right/Modified_Face_3_2"), False)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_1/Modified_Face&_plate/Top"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&_plate/Top][Partition_1_1_1/Modified_Face&Plane_2/Plane_2][Partition_1_1_1/Modified_Face&Plane_1/Plane_1]"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchCircle_1 = Sketch_1.addCircle(50, 50, 40)
 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection(), 10, model.selection("FACE", "Partition_1_1_1/Modified_Face_3_4"), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection(), 10, model.selection("FACE", "Partition_1_1_1/Modified_Face&_plate/Bottom"), 10)
 Extrusion_1.result().setName("cylinder")
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "plate")], [model.selection("SOLID", "cylinder")])
+Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "plate")], [model.selection("SOLID", "cylinder")])
 model.do()
 
 # check the name of result is kept
-CommonResult = Boolean_1.result()
+CommonResult = Common_1.result()
 CommonResultName = CommonResult.name()
 assert(CommonResultName == Partition_1.result().name()), "Name of Boolean COMMON result '{}' != '{}'".format(CommonResultName, Partition_1.result().name())
 # check sub-result names are lost
-BooleanName = Boolean_1.name() + "_1"
+BooleanName = Common_1.name() + "_1"
 for i in range(0, CommonResult.numberOfSubs()):
   refName = BooleanName + '_' + str(i + 1)
   subResult = CommonResult.subResult(i)
index 7da2b0e44bfe9b9a8a6134164098b2cf60c8f061..13760a4f45a0674695a95cf677ef3cafa665b2ee 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -26,7 +28,6 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_1 = Sketch_1.addLine(80, 0, 0, 0)
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
@@ -58,27 +59,26 @@ SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_6.e
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0)
 Extrusion_1.result().setName("compsolid")
-
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "compsolid/Generated_Face_5"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_5"))
 SketchCircle_1 = Sketch_2.addCircle(65, -30, 10)
 SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "compsolid/Generated_Face_5&compsolid/Generated_Face_4&compsolid/To_Face_3"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/To_Face]"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintDistanceVertical_3 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center(), 20)
 SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), 15)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), model.selection(), 10, model.selection("FACE", "compsolid/Generated_Face_1"), 10)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), model.selection(), 10, model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), 10)
 Extrusion_2.result().setName("cyl")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3")], [model.selection("SOLID", "cyl")])
 
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3")], [model.selection("SOLID", "cyl")])
 model.do()
 
 # check the name of Extrusion_1 is kept
-CutResult = Boolean_1.result()
+CutResult = Cut_1.result()
 CutResultName = CutResult.name()
 assert(CutResultName == Extrusion_1.result().name()), "Name of Boolean CUT result '{}' != '{}'".format(CutResultName, Extrusion_1.result().name())
 # check sub-result names are lost
-BooleanName = Boolean_1.name() + "_1"
+BooleanName = Cut_1.name() + "_1"
 for i in range(0, CutResult.numberOfSubs()):
   refName = BooleanName + '_' + str(i + 1)
   subResult = CutResult.subResult(i)
index ca2ac6c92655074b93f2af128991e49c5253191c..850b6f0f8b30c3600daa873ca370f46e5719f573 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -61,17 +63,17 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 35)
 SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 30)
 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 15)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
 Extrusion_1.result().setName("box")
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 20, 20)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 20, 20)
 Extrusion_2.result().setName("prism")
 Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
 Extrusion_3.result().setName("cylinder")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face_1"))
-SketchLine_8 = Sketch_2.addLine(45, 30, 25, 30)
-SketchLine_9 = Sketch_2.addLine(25, 30, 25, -100)
-SketchLine_10 = Sketch_2.addLine(25, -100, 45, -100)
-SketchLine_11 = Sketch_2.addLine(45, -100, 45, 30)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face"))
+SketchLine_8 = Sketch_2.addLine(45, -10, 25, -10)
+SketchLine_9 = Sketch_2.addLine(25, -10, 25, -140)
+SketchLine_10 = Sketch_2.addLine(25, -140, 45, -140)
+SketchLine_11 = Sketch_2.addLine(45, -140, 45, -10)
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
@@ -82,21 +84,22 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_10.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result())
 SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 20)
 SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_9.result(), 130)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "box/Generated_Face_3&box/Generated_Face_2&box/From_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[box/Generated_Face&Sketch_1/SketchLine_3][box/Generated_Face&Sketch_1/SketchLine_2][box/From_Face]"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 30)
 SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 25)
 model.do()
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15)
 Extrusion_4.result().setName("cut_tool")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], [model.selection("SOLID", "cut_tool")])
+Cut_1_objects_1 = [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")]
+Cut_1 = model.addCut(Part_1_doc, Cut_1_objects_1, [model.selection("SOLID", "cut_tool")])
 model.do()
 
 Extrusions = [Extrusion_1, Extrusion_2, Extrusion_3]
-BooleanResults = Boolean_1.results()
+BooleanResults = Cut_1.results()
 for i in range(len(BooleanResults)):
   assert(BooleanResults[i].name() == Extrusions[i].result().name()), "Name of result {} of Boolean CUT '{}' != '{}'".format(i, BooleanResults[i].name(), Extrusions[i].result().name())
-  BooleanName = Boolean_1.name() + "_" + str(i + 1)
+  BooleanName = Cut_1.name() + "_" + str(i + 1)
   for sub in range(0, BooleanResults[i].numberOfSubs()):
     refName = BooleanName + '_' + str(sub + 1)
     subResult = BooleanResults[i].subResult(sub)
index e1fa838ce1f22d8ca699eb89bacac53962687235..c9babd78e03e39da30f1398e6ea6ab7e35b41ed0 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -38,7 +40,8 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result())
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
 Face_1.result().setName("triangle")
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "triangle")], model.selection(), 10, 0)
 model.do()
index 9d083212ac0b10ffc8a3b44c1426e6ce6c3a8a94..bb15cbb73767e41d75971cd5a3fce2930e9838fb 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -43,15 +45,15 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50)
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 20, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 20, 0)
 Extrusion_1.result().setName("plate")
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "plate")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "plate/To_Face_1"))
-SketchCircle_1 = Sketch_2.addCircle(30, 35, 10)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "plate/Generated_Face_4&plate/To_Face_1"), False)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "plate/To_Face"))
+SketchCircle_1 = Sketch_2.addCircle(30.00000000000001, 15, 10)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[plate/Generated_Face&Sketch_1/SketchLine_4][plate/To_Face]"), False)
 SketchLine_5 = SketchProjection_2.createdFeature()
 SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_5.result(), 20, True)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "plate/Generated_Face_1&plate/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[plate/Generated_Face&Sketch_1/SketchLine_1][plate/To_Face]"), False)
 SketchLine_6 = SketchProjection_3.createdFeature()
 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_6.result(), 15, True)
 SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10)
index b20f90afb33e27b8efce697f33d1e0fd852cfaad..1b22fcb45f7a8322f57495ef1d2bbacb08017367 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -29,7 +31,7 @@ Box_1.result().setName("box")
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "box/Front"))
 SketchCircle_1 = Sketch_1.addCircle(7, 6, 2)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Face_1.result().setName("circle")
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "circle")], model.selection(), 0, 3, [model.selection("SOLID", "box")])
 model.do()
index 6e008eee728a37719d479851ecd117d9267cb6d4..a7e817cde9a021fd81411a810246b6fb96bb5bb5 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 from ModelAPI import *
 
@@ -29,15 +31,15 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
 Cylinder_1.result().setName("cylinder")
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "cylinder/Face_1"), 10, NB_COPIES)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "([cylinder/Face_1][cylinder/Face_2])([cylinder/Face_1][cylinder/Face_3])"), 10, NB_COPIES)
 model.do()
 
-TransResult = MultiTranslation_1.result()
+TransResult = LinearCopy_1.result()
 TransResultName = TransResult.name()
 assert(TransResultName == Cylinder_1.result().name()), "MultiTranslation name '{}' != '{}'".format(TransResultName, Cylinder_1.result().name())
 # check sub-result names
 assert(NB_COPIES == TransResult.numberOfSubs()), "Number of results {} is not equal to reference {}".format(TransResult.numberOfSubs(), NB_COPIES)
-MultiTranslationName = MultiTranslation_1.name() + "_1"
+MultiTranslationName = LinearCopy_1.name() + "_1"
 for i in range(0, NB_COPIES):
   refName = MultiTranslationName + '_' + str(i + 1)
   subResult = TransResult.subResult(i)
index ad2043f7f860a5283f896890ad27928609eac428..8081237904280d9dee043f721ee5facdd7b33e7d 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -33,7 +35,7 @@ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(),
 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result())
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_3.result(), 30)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_3.result(), 30.00000000000014)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60)
 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_4 = SketchProjection_1.createdFeature()
@@ -42,11 +44,11 @@ SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_4.result(), SketchConst
 [SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored()
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_4.result(), 30, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 20, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection(), 20, 0)
 Extrusion_1.result().setName("prism")
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_7r-SketchLine_5r")], model.selection("EDGE", "Sketch_1/SketchLine_6"), 360, 0)
 Revolution_1.result().setName("spinner")
-Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "spinner")], model.selection("VERTEX", "spinner/Lateral_6&spinner/Base_Edge_10"), model.selection("FACE", "prism/Generated_Face_2"), False, True)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "spinner")], model.selection("VERTEX", "[spinner/Generated_Face&Sketch_1/SketchLine_7][spinner/Generated_Face&Sketch_1/SketchLine_5]"), model.selection("FACE", "prism/Generated_Face&Sketch_1/SketchLine_2"), False, True)
 model.do()
 
 assert(Placement_1.result().name() == Revolution_1.result().name()), "Placement name '{}' != '{}'".format(Placement_1.result().name(), Revolution_1.result().name())
index cb367867213ad562d58559b840a32554dd79d9cd..949be3febfa466986bad0f414990c47d8117b823 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -41,7 +43,7 @@ SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint())
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5)
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_1.endPoint(), 8, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_2_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), 10, 0)
 Extrusion_1.result().setName("prism")
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], model.selection("EDGE", "PartSet/OX"), 30)
 model.do()
index bad08c5e7ad8232472c3bdfcc8f8630b68f8ffd4..3a8cb09d70570b6030ededec38f72c4f8a902118 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 model.begin()
@@ -26,7 +28,7 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
 Cylinder_1.result().setName("cylinder")
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "cylinder/Face_1"), 20)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "([cylinder/Face_1][cylinder/Face_2])([cylinder/Face_1][cylinder/Face_3])"), 20)
 model.do()
 
 assert(Translation_1.result().name() == Cylinder_1.result().name()), "Translation name '{}' != '{}'".format(Translation_1.result().name(), Cylinder_1.result().name())
index 3e8b58b4e6cb7a605e86ded3be7ec7b47e9d9a36..f4c21551e9274d80db5df3a8d9a57dc9cc632ddb 100644 (file)
@@ -50,7 +50,7 @@ SketchLine_2 = SketchProjection_2.createdFeature()
 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_2.result(), SketchCircle_4.center(), 5, True)
 SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_4.center(), 25)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], [model.selection("COMPOUND", "all-in-Revolution_1")])
 model.do()
 
index 3806afedd08cfd829d9f552da038b8c384ca402c..81386cd039b95d71d84283aca850579568a1b583 100644 (file)
@@ -18,7 +18,7 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
-__updated__ = "2018-01-16"
+# -*- coding: utf-8 -*-
 
 from salome.shaper import model
 
@@ -43,8 +43,8 @@ SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchL
 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1")], 2)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")], 2)
 model.do()
 
 Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
diff --git a/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py b/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py
new file mode 100644 (file)
index 0000000..515732d
--- /dev/null
@@ -0,0 +1,91 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param_p = model.addParameter(Part_1_doc, "p", "5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 0, 30.0000000000845)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(0, 30.0000000000845, 30.00000000002328, 30.00000000002326)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(30.00000000002328, 30.00000000002326, 29.99999999996195, 0)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_5 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result())
+SketchLine_6 = Sketch_1.addLine(29.99999999996195, 0, 0, 0)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 30)
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_3.result())
+SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 30, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r"))
+SketchLine_7 = Sketch_2.addLine(20, 7, 10, 7)
+SketchLine_8 = Sketch_2.addLine(10, 7, 10, 0)
+SketchLine_9 = Sketch_2.addLine(10, 0, 20, 0)
+SketchLine_10 = Sketch_2.addLine(20, 0, 20, 7)
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_10.result())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"), False)
+SketchLine_11 = SketchProjection_4.createdFeature()
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_11.result())
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_11).endPoint(), SketchLine_8.endPoint(), 10, True)
+SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 10)
+SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_8.result(), 7)
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_8f-SketchLine_9f-SketchLine_10f_wire")], model.selection(), "p", 0, [model.selection("SOLID", "Extrusion_1_1")])
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]")], 3)
+model.do()
+# increase the extrusion-cut heigh to make face of a box divided into two
+param_p.setValue(30);
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Fillet_1.feature()))
+model.do()
+# set the value back and check again
+param_p.setValue(5);
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Fillet_1.feature()))
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py b/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py
new file mode 100644 (file)
index 0000000..a97c9cd
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 15, 15, 15)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), 5, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), 10, True)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 5, True)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True)
+Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), 5, True)
+Plane_9 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), 10, True)
+Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_5"), model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Box_2 = model.addBox(Part_1_doc, 2, 2, 10)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("FACE", "Box_2_1/Bottom"), model.selection("FACE", "_weak_name_4_Partition_1_1_14"), False, True)
+model.do()
+# update the selection of the placement
+Placement_1.setEndShape(model.selection("EDGE", "Partition_1_1_5/Generated_Edge&Plane_3/Plane_3&Plane_2/Plane_2"))
+model.end()
+
+# check that placement is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Placement_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/ModelAPI/Test/TestGeomNamingPlacement.py b/src/ModelAPI/Test/TestGeomNamingPlacement.py
new file mode 100644 (file)
index 0000000..254bf50
--- /dev/null
@@ -0,0 +1,89 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param = model.addParameter(Part_1_doc, "p", "60")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(30, 30, -20, 30)
+SketchLine_2 = Sketch_1.addLine(-20, 30, -20, -20)
+SketchLine_3 = Sketch_1.addLine(-20, -20, 30, -20)
+SketchLine_4 = Sketch_1.addLine(30, -20, 30, 30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_2.startPoint(), 50)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.endPoint(), SketchLine_3.endPoint(), 50)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20)
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchLine_5 = Sketch_2.addLine(19.58333333333334, 17.27351642784226, -0.4166666666666646, 17.27351642784226)
+SketchLine_6 = Sketch_2.addLine(-0.4166666666666646, 17.27351642784226, -0.4166666666794808, -42.72648357216971)
+SketchLine_7 = Sketch_2.addLine(-0.4166666666794808, -42.72648357216971, 19.58333333332052, -42.72648357216971)
+SketchLine_8 = Sketch_2.addLine(19.58333333332052, -42.72648357216971, 19.58333333333334, 17.27351642784226)
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_7.startPoint(), 30, True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
+SketchPoint_3 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_7.endPoint(), 25, True)
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_7.result(), 20)
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_8.result(), "p")
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), -5, -2)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Box_1 = model.addBox(Part_1_doc, 50, 50, 30)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_1_1/To_Face"), False, True)
+model.do()
+# change parameter to split extrusion top face to two
+param.setValue(100)
+model.end()
+
+# check that placement is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Placement_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/ModelAPI/Test/TestGeomNamingRevolution.py b/src/ModelAPI/Test/TestGeomNamingRevolution.py
new file mode 100644 (file)
index 0000000..7f2e935
--- /dev/null
@@ -0,0 +1,78 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param = model.addParameter(Part_1_doc, "p", "10")
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchLine_1 = Sketch_1.addLine(6.82842712474619, 7.171572875253809, 2.82842712474619, 7.171572875253809)
+SketchLine_2 = Sketch_1.addLine(2.82842712474619, 7.171572875253809, 2.82842712474619, 3.171572875253809)
+SketchLine_3 = Sketch_1.addLine(2.82842712474619, 3.171572875253809, 6.82842712474619, 3.171572875253809)
+SketchLine_4 = Sketch_1.addLine(6.82842712474619, 3.171572875253809, 6.82842712474619, 7.171572875253809)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchCircle_1 = Sketch_1.addCircle(4.440892098500626e-16, 0, 1)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 4)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 4)
+SketchLine_5 = Sketch_1.addLine(0, 10, 10, 0)
+SketchLine_5.setAuxiliary(True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_2.startPoint())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_5.startPoint(), 4, True)
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False)
+SketchLine_6 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_1.center())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 1)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_6).endPoint(), SketchCircle_1.center(), "p", True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 1, 1)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f_wire")], model.selection("EDGE", "[Cut_1_1/Modified_Face&Box_1_1/Left][Cut_1_1/Modified_Face&Box_1_1/Top]"), 45, 0)
+model.do()
+# relocate circle to split the edge - axis of revolution
+param.setValue(5)
+model.end()
+
+# check that revolution is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Revolution_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/ModelAPI/Test/TestGeomNamingSketchPlane.py b/src/ModelAPI/Test/TestGeomNamingSketchPlane.py
new file mode 100644 (file)
index 0000000..57cb642
--- /dev/null
@@ -0,0 +1,107 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+lenParam = model.addParameter(Part_1_doc, "len", "500")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-302.4220649391276, 58.25973730731688, -52.42206493912754, 58.25973730731688)
+SketchLine_2 = Sketch_1.addLine(-52.42206493912754, 58.25973730731688, -52.42206493912754, -61.38418346467283)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-52.42206493912754, -61.38418346467283, 147.5779350608725, -61.38418346467283)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(147.5779350608725, -61.38418346467283, 147.5779350608725, 58.25973730731685)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(147.5779350608725, 58.25973730731685, 297.5779350608724, 58.25973730731685)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(297.5779350608724, 58.25973730731685, 297.5779350608724, -192.2459441196271)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(297.5779350608724, -192.2459441196271, -302.4220649391276, -192.2459441196271)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(-302.4220649391276, -192.2459441196271, -302.4220649391276, 58.25973730731688)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 600)
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_1.result())
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 250)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 200)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 600, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchLine_9 = Sketch_2.addLine(236.9930310780426, -200, -144.601680073095, -200)
+SketchLine_10 = Sketch_2.addLine(-144.601680073095, -200, -144.601680073095, -500)
+SketchLine_11 = Sketch_2.addLine(-144.601680073095, -500, 236.9930310780426, -500)
+SketchLine_12 = Sketch_2.addLine(236.9930310780426, -500, 236.9930310780426, -200)
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result())
+SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
+SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
+SketchLine_13 = SketchProjection_1.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_13.result(), SketchLine_9.endPoint(), 200, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_13.result(), "len", True)
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1"))
+SketchCircle_1 = Sketch_3.addCircle(27.57793506087247, -80, 42.03963933117138)
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1]"), False)
+SketchProjection_2.setName("SketchProjection_3")
+SketchProjection_2.result().setName("SketchProjection_3")
+SketchLine_14 = SketchProjection_2.createdFeature()
+SketchLine_14.setName("SketchLine_15")
+SketchLine_14.result().setName("SketchLine_15")
+SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_14.result(), SketchCircle_1.center(), 80, True)
+SketchConstraintDistance_4.setName("SketchConstraintDistance_4")
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/From_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1]"), False)
+SketchProjection_3.setName("SketchProjection_4")
+SketchProjection_3.result().setName("SketchProjection_4")
+SketchLine_15 = SketchProjection_3.createdFeature()
+SketchLine_15.setName("SketchLine_16")
+SketchLine_15.result().setName("SketchLine_16")
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_15.result(), SketchCircle_1.center(), 80, True)
+SketchConstraintDistance_3.setName("SketchConstraintDistance_3")
+model.do()
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_1_2r_wire")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_7"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+model.do()
+# update the sketch 2 to make split of a size of a box
+lenParam.setValue(700)
+model.end()
+
+# check that sketch_3 and extrusion are updated well
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(ExtrusionCut_2.feature()))
diff --git a/src/ModelAPI/Test/TestSaveOpen.py b/src/ModelAPI/Test/TestSaveOpen.py
new file mode 100644 (file)
index 0000000..5bc57a2
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Point_2 = model.addPoint(partSet, 1, 2, 3)
+Point_name = Point_2.name()
+model.end()
+
+# check save document in a current folder
+aSession = ModelAPI_Session.get()
+aFiles = StringList()
+aSession.save(".", aFiles)
+assert(len(aFiles) == 1)
+
+# check open of the same document
+assert(aSession.load(".") == False) # error because this document is already opened
+
+# close the current document
+aSession.closeAll()
+
+# open again: it must be correct now
+assert(aSession.load("."))
+
+# check the created point is opened
+partSet = model.moduleDocument()
+assert(partSet.size("Features") == 1)
+assert(partSet.object("Features", 0).data().name() == Point_name)
index 62e1e96de2fb7e9483ef98cb9816796a2fe6519e..f8a754dc8038c712f71aba880eab5f63d8e7bf4d 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from GeomAPI import *
 
 from salome.shaper import model
@@ -41,7 +43,7 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")])
 Sketch_2_origin = GeomAPI_Pnt(0, -10, 0)
 Sketch_2_norm = GeomAPI_Dir(0, -1, 0)
@@ -60,20 +62,20 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_8.result(), "len")
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False)
 SketchLine_9 = SketchProjection_1.createdFeature()
 SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_5.startPoint(), SketchLine_9.result(), 20, True)
 ExtrusionCut_1.setNestedSketch(Sketch_2)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&Extrusion_1_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
 model.do()
 # make sketch_2 cut the whole top face of the initial extrusion, so, one of the cylinder becomes invalid
 lenParam.setValue(100)
 Part_1_doc.setCurrentFeature(Cylinder_2.feature(), True)
 model.do()
 # update selection of cylinder base points
-model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&Extrusion_1_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_1").fillAttribute(Cylinder_1.basePoint())
-model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_divided_1_1&Extrusion_1_1/Generated_Face_1").fillAttribute(Cylinder_2.basePoint())
+model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)]").fillAttribute(Cylinder_1.basePoint())
+model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face&weak_name_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]").fillAttribute(Cylinder_2.basePoint())
 model.end()
 
 # check that both cylinders are valid and have correct results
diff --git a/src/ModelAPI/Test/TestSelectorShell.py b/src/ModelAPI/Test/TestSelectorShell.py
new file mode 100644 (file)
index 0000000..3038845
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+# select a shell of a box : this test checks selection of a shell
+aBoxResult = Box_1.feature().results()[0]
+aShell = GeomAPI_ShapeExplorer(aBoxResult.shape(), GeomAPI_Shape.SHELL)
+aGroup = Part_1_doc.addFeature("Group")
+aGroup.selectionList("group_list").append(aBoxResult, aShell.current())
+model.end()
+
+# check that the resulting group is correct
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(aGroup))
+
+assert(model.checkPythonDump())
index e9ec85ba5c2891e8738df36b7ea2599e2f18cdc7..dadd65fa38c14c53ef697ffef2cd732798dd5425 100644 (file)
@@ -34,9 +34,9 @@ SketchCircle_2 = Sketch_1.addCircle(0, 0, 103.3027146966417)
 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 410, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchCircle_3 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"))
-SketchCircle_4 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchCircle_3 = Sketch_2.addCircle(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1/To_Face]"))
+SketchCircle_4 = Sketch_2.addCircle(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"))
 SketchArc_1 = Sketch_2.addArc(-76.31943784014528, 69.61892179185162, 22.73963059863011, 100.7688447087372, -98.26117835861398, -31.87776170424145, False)
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.startPoint())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.endPoint())
@@ -48,13 +48,15 @@ SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.startPoint(),
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.results()[1], SketchArc_2.endPoint())
 model.do()
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchArc_2_2r")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchLine_1 = Sketch_3.addLine(72.49453964599654, -117.643151959956, 76.08424302289386, 111.5797586569786)
 SketchArc_3 = Sketch_3.addArc(23.82028040531734, -147.9761102212422, 72.49453964599654, -117.643151959956, 29.20403695178628, -205.0750334594096, False)
 SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_1.startPoint(), SketchArc_3.startPoint())
-SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1", 13), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), False)
 SketchArc_4 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
+model.do()
+model.do()
 model.end()
 
 from ModelAPI import *
index 1aa708b3fd467ed97e66e3533aec8161ed911942..9d76f132e560397510784c6265d1942ced335c74 100644 (file)
@@ -61,15 +61,15 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "ep_base")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 3.65)
 SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 4.65)
 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_4.result(), 1.65)
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base")
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base", False)
 SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2")
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", False)
 SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY"))
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2")
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", False)
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
 SketchLine_11 = Sketch_2.addLine(2.26, -2.31, 1.64, -2.31)
 SketchLine_12 = Sketch_2.addLine(1.64, -2.31, 1.64, -1.69)
 SketchLine_13 = Sketch_2.addLine(1.64, -1.69, 2.26, -1.69)
@@ -86,21 +86,21 @@ SketchPoint_1 = Sketch_2.addPoint(1.925, -1.875)
 SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62)
 SketchConstraintLength_5.setName("SketchConstraintLength_10")
 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result())
-SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2")
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", False)
 SketchConstraintDistance_4.setName("SketchConstraintDistance_6")
-SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2")
+SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False)
 SketchConstraintDistance_5.setName("SketchConstraintDistance_7")
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
 SketchLine_15 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
 SketchLine_16 = SketchProjection_2.createdFeature()
-SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2")
+SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2", False)
 SketchConstraintDistance_6.setName("SketchConstraintDistance_8")
-SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2")
+SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2", False)
 SketchConstraintDistance_7.setName("SketchConstraintDistance_9")
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")], model.selection(), 0, 0.02)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r")], model.selection(), 0, 0.02)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f"))
 SketchLine_17 = Sketch_3.addLine(0, 2.950000000000001, 0, 1.700000000000001)
 SketchLine_17.setName("SketchLine_15")
 SketchLine_17.result().setName("SketchLine_15")
@@ -120,24 +120,22 @@ SketchLine_20.result().setName("SketchLine_18")
 SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX"))
 SketchLine_21.setName("SketchLine_19")
 SketchLine_21.result().setName("SketchLine_19")
-#SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_21.result())
-#SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result())
 SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0)
 SketchLine_22.setName("SketchLine_20")
 SketchLine_22.result().setName("SketchLine_20")
-SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result())
-SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result())
 SketchLine_23 = Sketch_3.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
 SketchLine_23.setName("SketchLine_21")
 SketchLine_23.result().setName("SketchLine_21")
-SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"))
+SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"))
 SketchLine_24.setName("SketchLine_22")
 SketchLine_24.result().setName("SketchLine_22")
 SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_17.result(), 1.25)
 SketchConstraintLength_6.setName("SketchConstraintLength_5")
-SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint())
+SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint())
 SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2")
 SketchConstraintLength_7.setName("SketchConstraintLength_6")
 SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2")
@@ -145,99 +143,108 @@ SketchConstraintLength_8.setName("SketchConstraintLength_7")
 SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2")
 SketchConstraintLength_9.setName("SketchConstraintLength_8")
 SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result())
-SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
 SketchLine_25.setName("SketchLine_23")
 SketchLine_25.result().setName("SketchLine_23")
-SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2")
+SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", False)
 SketchConstraintDistance_8.setName("SketchConstraintDistance_5")
 SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2")
 SketchConstraintLength_10.setName("SketchConstraintLength_9")
-SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"))
+SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
 SketchLine_26.setName("SketchLine_35")
 SketchLine_26.result().setName("SketchLine_35")
-SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375)
+SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False)
 SketchConstraintDistance_9.setName("SketchConstraintDistance_12")
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_21")])
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1"))
+Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_15"), model.selection("EDGE", "Sketch_3/SketchLine_17"), model.selection("EDGE", "Sketch_3/SketchLine_18"), model.selection("EDGE", "Sketch_3/SketchLine_20"), model.selection("EDGE", "Sketch_3/SketchLine_21")]
+Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
+Extrusion_3_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")]
+Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_27 = Sketch_4.addLine(0, 2.950000000000001, 0, 0)
 SketchLine_27.setName("SketchLine_26")
 SketchLine_27.result().setName("SketchLine_26")
-SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1"))
-SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result())
-SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1"))
-SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result())
+SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"))
+SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result())
+SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"))
+SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result())
 SketchLine_28 = Sketch_4.addLine(0, 0, 3.975000000000001, 0)
 SketchLine_28.setName("SketchLine_27")
 SketchLine_28.result().setName("SketchLine_27")
-SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1"))
-SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result())
+SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
+SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result())
 SketchLine_29 = Sketch_4.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
 SketchLine_29.setName("SketchLine_28")
 SketchLine_29.result().setName("SketchLine_28")
-SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
-SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_5/Generated_Edge_1&Extrusion_3_5/To_Edge_1"))
-SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result())
+SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
+SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_5/Generated_Edge&Sketch_3/SketchLine_21_EndVertex]e[Extrusion_3_5/To_Edge]e"))
+SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result())
 model.do()
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_26"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_27"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_28")])
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")], model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1"))
+Edge_2_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")]
+Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
+Extrusion_4_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")]
+Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
 Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
 SketchLine_30 = Sketch_5.addLine(0, 2.950000000000001, 0, 0)
 SketchLine_30.setName("SketchLine_29")
 SketchLine_30.result().setName("SketchLine_29")
-SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1"))
-SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result())
-SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1"))
-SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result())
+SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"))
+SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result())
+SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"))
+SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result())
 SketchLine_31 = Sketch_5.addLine(0, 0, 3.975000000000001, 0)
 SketchLine_31.setName("SketchLine_30")
 SketchLine_31.result().setName("SketchLine_30")
-SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
-SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1"))
-SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result())
+SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
+SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
+SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result())
 SketchLine_32 = Sketch_5.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
 SketchLine_32.setName("SketchLine_31")
 SketchLine_32.result().setName("SketchLine_31")
-SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
-SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_3/Generated_Edge_1&Extrusion_4_3/To_Edge_1"))
-SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result())
+SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
+SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_3/To_Edge]e"))
+SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result())
 SketchLine_33 = Sketch_5.addLine(3.975000000000001, 0.95, 0, 2.950000000000001)
 SketchLine_33.setName("SketchLine_32")
 SketchLine_33.result().setName("SketchLine_32")
-SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
-SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint())
-SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
+SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint())
 SketchLine_34 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0)
 SketchLine_34.setName("SketchLine_33")
 SketchLine_34.result().setName("SketchLine_33")
-SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result())
 SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0)
 SketchLine_35.setName("SketchLine_34")
 SketchLine_35.result().setName("SketchLine_34")
-SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result())
-SketchConstraintCoincidence_41 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result())
-SketchConstraintCoincidence_42 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result())
+SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result())
+SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result())
 SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_34.result())
 SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_35.result())
-SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2")
-SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2")
+SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2", False)
+SketchConstraintDistance_10.setName("SketchConstraintDistance_10")
+SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2", False)
+SketchConstraintDistance_11.setName("SketchConstraintDistance_11")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_29f-SketchLine_30f-SketchLine_32f-SketchLine_33r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_32f-SketchLine_33f-SketchLine_34r")])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2")
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f_wire")])
+Translation_1_objects = [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")]
+Translation_1 = model.addTranslation(Part_1_doc, Translation_1_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2")
 Recover_1_objects = [Face_2.result(), Face_3.result(), Face_1.result(), Extrusion_3.result(), Extrusion_4.result(), Extrusion_3.results()[1], Extrusion_3.results()[3], Extrusion_3.results()[4], Extrusion_4.results()[1], Extrusion_3.results()[2], Extrusion_4.results()[2]]
 Recover_1 = model.addRecover(Part_1_doc, Translation_1, Recover_1_objects)
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")], model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)")
+Translation_2_objects = [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")]
+Translation_2 = model.addTranslation(Part_1_doc, Translation_2_objects, model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)")
 Recover_2_objects = [Recover_1.results()[8], Recover_1.results()[9], Recover_1.results()[10], Recover_1.results()[6], Recover_1.results()[7], Recover_1.results()[5], Recover_1.result(), Recover_1.results()[3], Recover_1.results()[2], Recover_1.results()[4], Recover_1.results()[1]]
 Recover_2 = model.addRecover(Part_1_doc, Translation_2, Recover_2_objects)
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_1")])
 Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "Translation_2_11"), 0, model.selection(), 0)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)
 model.end()
index 10c00199a5853ffa784aba2bd9f01e8903c3e5ab..c075e912d1f5b47d120f79e733384a3a4acc4e7f 100644 (file)
@@ -40,8 +40,8 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"))
 SketchLine_5 = Sketch_2.addLine(-3.660618520812283, -7.666051414039341, -9.927240775274454, -7.666051414039341)
 SketchLine_6 = Sketch_2.addLine(-9.927240775274454, -7.666051414039341, -9.927240775274454, 7.885614342469023)
 SketchLine_7 = Sketch_2.addLine(-9.927240775274454, 7.885614342469023, -3.660618520812283, 7.885614342469023)
@@ -55,7 +55,7 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 10, 0)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
 model.do()
 model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
index 0113da48ab38c2880bbbdb2a4630a25c0c06e5a2..bd4f577e69c371038d296f96a6679f886b007772 100644 (file)
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -56,9 +58,9 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), 2)
 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_8.result(), 4)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
 SketchCircle_1.setAuxiliary(True)
@@ -67,7 +69,7 @@ SketchCircle_2 = Sketch_2.addCircle(4.113620667976081, 2.375000000000003, 1.1)
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
 SketchCircle_3 = Sketch_2.addCircle(-4.113620667974014, 2.375000000003604, 1.1)
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center())
-SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-012, -4.75000000000001, 1.1)
+SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-12, -4.75000000000001, 1.1)
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center())
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1])
@@ -79,12 +81,12 @@ SketchLine_10 = Sketch_2.addLine(-4.113620667974014, 2.375000000003604, 0, 0)
 SketchLine_10.setAuxiliary(True)
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.endPoint())
-SketchLine_11 = Sketch_2.addLine(4.163806340121522e-012, -4.75000000000001, 0, 0)
+SketchLine_11 = Sketch_2.addLine(4.163806340121522e-12, -4.75000000000001, 0, 0)
 SketchLine_11.setAuxiliary(True)
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_11.startPoint())
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.endPoint())
 SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_12 = SketchProjection_4.createdFeature()
 SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_12.result(), 30.00000000000006)
 SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_10.result(), 119.9999999999498)
@@ -173,39 +175,39 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_16.center(), Sket
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True)
 model.do()
 ExtrusionCut_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_16_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_12_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_12_2f-SketchCircle_10_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_6_2f-SketchCircle_5_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_7_2r_wire")]
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
 Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_3.result().setDeflection(1e-005)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3.result().setDeflection(1e-05)
 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_21 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4.934853156880259)
 SketchLine_22 = Sketch_3.addLine(3.5, 4.934853156880259, 6.2, 4.934853156880259)
 SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
 SketchLine_23 = Sketch_3.addLine(6.2, 4.934853156880259, 6.2, 3.008501119175777)
 SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
 SketchLine_24 = SketchProjection_6.createdFeature()
 SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.result())
 SketchLine_25 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
 SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.startPoint())
 SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.endPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_5"), False)
 SketchLine_26 = SketchProjection_7.createdFeature()
 SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_26.result())
 SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_26.result())
 SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_22.result())
 SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_27 = SketchProjection_8.createdFeature()
 SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_25.result(), SketchLine_27.result())
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
 SketchLine_28 = SketchProjection_9.createdFeature()
 SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_28.result(), 0.5, True)
 model.do()
 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0)
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
 model.do()
index 6656fbe9d5719e0bced0134b717b9bf99d67c8f0..28898903065ad50ece10c39373d84feacc08021b 100644 (file)
@@ -178,9 +178,9 @@ SketchLine_22 = SketchProjection_4.createdFeature()
 SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
 SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
 model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_11"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_10"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_4_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_5_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_16"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_11"), model.selection("EDGE", "Sketch_1/SketchLine_10"), model.selection("EDGE", "Sketch_1/SketchArc_4_2"), model.selection("EDGE", "Sketch_1/SketchLine_12"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchArc_5_2"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Wire_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_19"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_6_2")]
+Wire_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchArc_7_2"), model.selection("EDGE", "Sketch_2/SketchLine_20"), model.selection("EDGE", "Sketch_2/SketchLine_19"), model.selection("EDGE", "Sketch_2/SketchLine_18"), model.selection("EDGE", "Sketch_2/SketchArc_6_2")]
 Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
index 21caaa1da5f7d78f8b86ec9a58e0f264493e0b60..83613dda42e8df0195fe1ab4721a94a6d833340d 100644 (file)
@@ -87,9 +87,9 @@ SketchConstraintHorizontal_10 = Sketch_1.setHorizontal(SketchLine_19.result())
 SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_20.result())
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 100)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_24&Extrusion_1_1/To_Face_2"), 200)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_20][Extrusion_1_1_2/To_Face]"), 200)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 50)
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1")], model.selection("EDGE", "Extrusion_2_1/Generated_Face_24&Extrusion_2_1/To_Face_2"), 150)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1")], model.selection("EDGE", "[Extrusion_2_1_2/Generated_Face&Sketch_1/SketchLine_20][Extrusion_2_1_2/To_Face]"), 150)
 Boolean_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Translation_1_1")], [model.selection("COMPSOLID", "Translation_2_1")])
 model.do()
 model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
index 07260dcf26708b2d45e138c8245493f4ff6b8210..ca344ce987718519f9a7db4691c7f05b72dcb99f 100644 (file)
@@ -25,6 +25,7 @@
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_NExplode.h>
 
 #include <GeomDataAPI_Dir.h>
@@ -1067,6 +1068,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
     isDumpByGeom = aSelectedFeature && aSelectedFeature->isInHistory();
   }
 
+  if (theAttrSelect->isGeometricalSelection() && aShape->shapeType() == GeomAPI_Shape::COMPOUND
+    && theAttrSelect->context().get() && !aShape->isEqual(theAttrSelect->context()->shape())
+    && theAttrSelect->context()->groupName() != ModelAPI_ResultPart::group()) {
+    GeomAPI_ShapeIterator anIt(aShape);
+    aShape = anIt.current();
+  }
+
   myDumpBuffer << "\"" << aShape->shapeTypeStr();
   bool aStandardDump = true;
   if (isDumpByGeom) {
@@ -1096,13 +1104,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
                  << aMiddlePoint->y() << ", "
                  << aMiddlePoint->z() << ")";
     aStandardDump = false;
-  } else if (theAttrSelect->isWeakNaming() ||
-    (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() &&
-       aShape != theAttrSelect->context()->shape())) { // weak naming for local selection only
+  } else if (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() &&
+       aShape != theAttrSelect->context()->shape()) { // weak naming for local selection only
     GeomAlgoAPI_NExplode aNExplode(theAttrSelect->context()->shape(), aShape->shapeType());
     int anIndex = aNExplode.index(aShape);
     if (anIndex != 0) { // found a week-naming index, so, export it
-      myDumpBuffer<<"\", \""<<theAttrSelect->context()->data()->name()<<"\", "<<anIndex;
+      myDumpBuffer<<"\", \""<<
+        theAttrSelect->contextName(theAttrSelect->context())<<"\", "<<anIndex;
       aStandardDump = false;
     }
   }
index ffdab15225c33898e756327f385a0401c7d900ea..d658206b4edd234876920cff8be3b980f14f9052 100644 (file)
@@ -377,7 +377,7 @@ std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType)
   return ""; // bad case
 }
 
-/// stores the features information, recoursively stores sub-documetns features
+/// stores the features information, recursively stores sub-documents features
 std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >& theStore,
   const bool theCompare) // if false => store
@@ -390,7 +390,7 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
      }
   }
   // store the model features information: iterate all features
-  int anObjectsCount = 0; // stores the number of compared features for this document to compate
+  int anObjectsCount = 0; // stores the number of compared features for this document to compare
   std::set<std::string> aProcessed; // processed features names (that are in the current document)
 
   // process all objects (features and folders)
@@ -422,7 +422,7 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
       ModelAPI_Tools::allResults(aFeature, allResults);
       std::list<ResultPtr>::iterator aRes = allResults.begin();
       for(; aRes != allResults.end(); aRes++) {
-        // recoursively store features of sub-documents
+        // recursively store features of sub-documents
         if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
           DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
           if (aDoc.get()) {
@@ -511,21 +511,32 @@ static bool checkDump(SessionPtr theSession,
   return true;
 }
 
-bool checkPythonDump()
+bool checkPythonDump(const checkDumpType theCheckType)
 {
   static const std::string anErrorByNaming("checkPythonDump by naming");
   static const std::string anErrorByGeometry("checkPythonDump by geometry");
+  static const std::string anErrorByWeak("checkPythonDump by weak naming");
 
   static char aFileForNamingDump[] = "./check_dump_byname.py";
   static char aFileForGeometryDump[] = "./check_dump_bygeom.py";
+  static char aFileForWeakDump[] = "./check_dump_weak.py";
 
   SessionPtr aSession = ModelAPI_Session::get();
-  // dump with the selection by names
-  if (!dumpToPython(aSession, aFileForNamingDump, "topological_naming", anErrorByNaming))
-    return false;
-  // dump with the selection by geometry
-  if (!dumpToPython(aSession, aFileForGeometryDump, "geometric_selection", anErrorByGeometry))
-    return false;
+  if (theCheckType & CHECK_NAMING) {
+    // dump with the selection by names
+    if (!dumpToPython(aSession, aFileForNamingDump, "topological_naming", anErrorByNaming))
+      return false;
+  }
+  if (theCheckType & CHECK_GEOMETRICAL) {
+    // dump with the selection by geometry
+    if (!dumpToPython(aSession, aFileForGeometryDump, "geometric_selection", anErrorByGeometry))
+      return false;
+  }
+  if (theCheckType & CHECK_WEAK) {
+    // dump with the selection by weak naming
+    if (!dumpToPython(aSession, aFileForWeakDump, "weak_naming", anErrorByWeak))
+      return false;
+  }
 
    // map from document name to feature name to feature data
   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
@@ -537,10 +548,18 @@ bool checkPythonDump()
     return false;
   }
 
-  // check dump with the selection by names
-  bool isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
-  // check dump with the selection by geometry
-  isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+  bool isOk = true;
+  if (theCheckType & CHECK_NAMING) {
+    // check dump with the selection by names
+    isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
+  }
+  if (theCheckType & CHECK_GEOMETRICAL) {
+    // check dump with the selection by geometry
+    isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+  }
+  if (theCheckType & CHECK_WEAK) {
+    isOk = isOk && checkDump(aSession, aFileForWeakDump, aStore, anErrorByWeak);
+  }
 
   return isOk;
 }
index aa5286d84b46dbcb5a1393ad9aaa899761a25327..8da24a0e5b8962cc07e94d8e87d1c91190d7504f 100644 (file)
@@ -168,11 +168,19 @@ ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTy
 MODELHIGHAPI_EXPORT
 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
 
+/// Enumeration to manage the check python dump modes.
+enum checkDumpType {
+  CHECK_NAMING = 1, ///< check topological naming only
+  CHECK_GEOMETRICAL = 2, ///< check geometrical naming only
+  CHECK_NAMING_AND_GEOMETRICAL = 3, ///< default option, check topological and geometrical dumps
+  CHECK_WEAK = 4, ///< check weak naming only
+};
+
 /// Performs the high level API dump, then closes all and executes the script:
 /// model must be recreated fully, with all attributes
 /// \returns true if check is well done
 MODELHIGHAPI_EXPORT
-bool checkPythonDump();
+bool checkPythonDump(const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
 
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------
index d89e4c754e95234d8e2a00f98362da58e0784f03..59b7b443d0d8d5b60ddc3530497f2f4c8faa68f6 100644 (file)
@@ -55,9 +55,9 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_1.result(), 6.2)
 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
 SketchCircle_1.setAuxiliary(True)
@@ -73,7 +73,7 @@ SketchLine_9 = Sketch_2.addLine(0, 0, 4.113620667973598, 2.375000000005359)
 SketchLine_9.setAuxiliary(True)
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint())
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
 SketchLine_10 = SketchProjection_4.createdFeature()
 SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_10.result(), 30)
 SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_2.results()[1]], SketchCircle_1.center(), 120, 3)
@@ -173,9 +173,9 @@ SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"
 SketchLine_15 = SketchProjection_5.createdFeature()
 SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result())
 model.do()
-ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_3_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_18_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_14_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_10_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_7_2f")]
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_3_2f_wire"), model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_18_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_14_2f_wire"), model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_15_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_10_2f-SketchCircle_14_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_7_2f-SketchCircle_6_2r_wire")]
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
 model.do()
 model.end()
index aebb48e5009ff5b78fc983e8e24ad0657c096427..b52f97bc8c2d455624b6dc9926625bb257e9c048 100644 (file)
@@ -28,7 +28,7 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_1 = Sketch_1.addCircle(-325.90051457976, -18.010291595197, 258.003584159371)
 model.do()
 Sketch_1.result().setDeflection(5e-006)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
 Extrusion_1.result().setDeflection(0.5)
 model.end()
 
index b54f6e4eee19902ad0652be1c036c71bb2bbe6ac..cde321d1e92d3139df679e268f4d00fe42d76d96 100644 (file)
@@ -34,24 +34,19 @@ void ModuleBase_ISelection::appendSelected(const QList<ModuleBase_ViewerPrsPtr>
 {
   // collect the objects from the viewer
   QObjectPtrList anExistedObjects;
-  QList<ModuleBase_ViewerPrsPtr>::const_iterator aPrsIt = theValuesTo.begin(),
-                                              aPrsLast = theValuesTo.end();
-  for (; aPrsIt != aPrsLast; aPrsIt++) {
-    if ((*aPrsIt)->owner() && (*aPrsIt)->object())
-      anExistedObjects.push_back((*aPrsIt)->object());
+  foreach(ModuleBase_ViewerPrsPtr aPrs, theValuesTo) {
+    if (aPrs->owner() && aPrs->object())
+      anExistedObjects.append(aPrs->object());
   }
 
-
-  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(),
-                                              aLast = theValues.end();
-  for (; anIt != aLast; anIt++) {
-    ObjectPtr anObject = (*anIt)->object();
+  ObjectPtr anObject;
+  foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) {
+    anObject = aPrs->object();
     if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) {
       theValuesTo.append(std::shared_ptr<ModuleBase_ViewerPrs>(
                new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
     }
   }
-
 }
 
 //********************************************************************
index cef49758a23bc02fe4bc26c59943d222f697c483..33b8d8a6450dcf922a08a571b33d391971a36f77 100644 (file)
@@ -185,9 +185,14 @@ protected:
       int aIdx;
       int aCount = 0;
       int aSize = myChildren.size();
+      int aMaxCount = aSize * aSize;
       int aShift = 0;
       while (i < aSize) {
         aCount++;
+        // To avoid unlimited cycling
+        if (aCount > aMaxCount)
+          break;
+
         aNode = myChildren.at(i);
         aObject = aNode->object();
         if (aObject.get()) {
@@ -202,9 +207,6 @@ protected:
         else
           aShift++;
         i++;
-        // To avoid unlimited cycling
-        if (aCount > aSize * aSize)
-          break;
       }
     }
   }
index d81556ac18bbdd20b80d2ec258f5de0cf3632ecc..afe02011207e204d86fdf19b73a03c4e911a6f2e 100755 (executable)
@@ -62,6 +62,7 @@
 #include <QClipboard>
 #include <QTimer>
 #include <QMainWindow>
+#include <QCheckBox>
 
 #include <memory>
 #include <string>
@@ -159,11 +160,17 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
 
   aMainLay->addWidget(myListView->getControl(), 2, 0, 1, -1);
   aMainLay->setRowStretch(2, 1);
-  //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
-  //aMainLay->setRowMinimumHeight(3, 20);
-  //this->setLayout(aMainLay);
   connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
 
+  bool aSameTop = theData->getBooleanAttribute("same_topology", false);
+  if (aSameTop) {
+    myGeomCheck = new QCheckBox(tr("Add elements that share the same topology"), this);
+    aMainLay->addWidget(myGeomCheck);
+    connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool)));
+  }
+  else
+    myGeomCheck = 0;
+
   myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
   if (myShapeTypes.size() > 1 || myIsUseChoice) {
     if (defaultValues.contains(myFeatureId + attributeID())) {
@@ -240,9 +247,9 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
     return false;
 
   AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+  AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
   std::string aType = anAttribute->attributeType();
   if (aType == ModelAPI_AttributeSelectionList::typeId()) {
-    AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
     // Restore shape type
     std::string aSelectionType = aSelectionListAttr->selectionType().c_str();
     if (!aSelectionType.empty()) {
@@ -251,6 +258,8 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
       myIsFirst = false;
     }
   }
+  if (myGeomCheck)
+    myGeomCheck->setChecked(aSelectionListAttr->isGeometricalSelection());
   updateSelectionList();
   return true;
 }
@@ -1040,4 +1049,15 @@ void ModuleBase_WidgetMultiSelector::onListActivated()
 {
   //focusTo();
   emitFocusInWidget();
-}
\ No newline at end of file
+}
+
+void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn)
+{
+  AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+  std::string aType = anAttribute->attributeType();
+  if (aType == ModelAPI_AttributeSelectionList::typeId()) {
+    AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+    aSelectionListAttr->setGeometricalSelection(theOn);
+    updateObject(myFeature);
+  }
+}
index 1a40c13039cbd13a795a93da7441f84a470dd3db..4c2898107e52197f3cc3f1a899462ff0514ae699 100755 (executable)
@@ -37,6 +37,7 @@
 #include <QMap>
 
 class QWidget;
+class QCheckBox;
 //class QComboBox;
 class ModuleBase_ListView;
 class ModuleBase_IWorkshop;
@@ -132,6 +133,8 @@ protected slots:
 
   void onListActivated();
 
+  void onSameTopology(bool theOn);
+
 protected:
   /// Returns true if the event is processed. The default implementation is empty, returns false.
   virtual bool processDelete();
@@ -247,6 +250,8 @@ protected:
 
   bool myIsFirst;
   std::string myDefMode;
+
+  QCheckBox* myGeomCheck;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
index 7d8596556b0eaf6a7c47c734fd3e4057ad04db4d..11b96c37c5d1005aa46b27ba63066fc747681985 100644 (file)
@@ -219,16 +219,19 @@ QIntList ModuleBase_WidgetPointInput::shapeTypes() const
 
 //********************************************************************
 bool ModuleBase_WidgetPointInput
-::setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+::setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+  const bool theToValidate)
 {
-  GeomShapePtr aShape = thePrs->shape();
-  if (aShape->isVertex()) {
-    GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
-    GeomPointPtr aPnt = aVertex->point();
-    myXSpin->setValue(aPnt->x());
-    myYSpin->setValue(aPnt->y());
-    myZSpin->setValue(aPnt->z());
-    return true;
+  if (theValues.size() == 1) {
+    GeomShapePtr aShape = theValues.first()->shape();
+    if (aShape.get() && aShape->isVertex()) {
+      GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
+      GeomPointPtr aPnt = aVertex->point();
+      myXSpin->setValue(aPnt->x());
+      myYSpin->setValue(aPnt->y());
+      myZSpin->setValue(aPnt->z());
+      return true;
+    }
   }
   return false;
 }
index bae10d61a71ca2af8a2a6d763f2e911d5224a037..8026492118a1c46e6e7f5f66b69b391266cb5ea8 100644 (file)
@@ -61,7 +61,8 @@ public:
 
   /// Fills the attribute with the value of the selected owner
   /// \param thePrs a selected owner
-  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+    const bool theToValidate);
 
 protected:
   /// Retunrs a list of possible shape types
index 6fbd9b1749203f2bb5d23bf7a158f41070e96898..16b47680e337ab0a01b3dfd3951c90d9b3228d4a 100644 (file)
@@ -130,7 +130,8 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr&
             std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttr);
           aSelectAttr->setValue(myPresentedObject, GeomShapePtr(), true);
           GeomShapePtr aShape = aSelectAttr->value();
-          if (!aShape.get() && aSelectAttr->contextFeature()->firstResult().get()) {
+          if (!aShape.get() && aSelectAttr->contextFeature().get() &&
+            aSelectAttr->contextFeature()->firstResult().get()) {
             aShape = aSelectAttr->contextFeature()->firstResult()->shape();
           }
           if (aShape.get()) {
index dac7f0aa30707da709887f763c9753fce9f98b7d..419f778f10cdbfe058e151c67f6823228bdd6438 100644 (file)
@@ -23,6 +23,7 @@
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 #include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Events.h>
 //--------------------------------------------------------------------------------------
 ParametersAPI_Parameter::ParametersAPI_Parameter(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
@@ -92,3 +93,14 @@ ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
   return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
 }
+
+//--------------------------------------------------------------------------------------
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+                     const ParameterPtr & theParameter)
+{
+  FeaturePtr aParam = theParameter->feature();
+  if (aParam) {
+    ModelAPI_ReplaceParameterMessage::send(aParam, 0);
+    thePart->removeFeature(aParam);
+  }
+}
index 7abc34850c0fd9a3123d5e9f853f3914bc0a1ad5..6d444d9f6c4c054a133a17205c2248b494d914ab 100644 (file)
@@ -83,6 +83,13 @@ ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
                           const std::string & theExpression,
                           const std::string & theComment = std::string());
 
+/**\ingroup CPPHighAPI
+ * \brief Remove Parameter feature and substitute it by the value in referred features
+ */
+PARAMETERSAPI_EXPORT
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+                     const ParameterPtr & theParameter);
+
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------
 #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */
index 8cc950e41978a2e7711300aad7e61609bdfecb18..8cbc233f3725c26fe875ef991d4ea1f09dce937c 100644 (file)
@@ -116,6 +116,9 @@ INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES})
 ADD_UNIT_TESTS(TestParameterCreation.py
                TestParameterRename.py
                TestParameterChangeValue.py
+               TestParameterDelete.py
+               TestParameterErrorMsg.py
+               TestParametersMgr.py
                Test1806.py
                Test2392.py
                Test2474.py
index cc299083317be073bda56b3ab5da4bda2d24feca..cd5328a3432b966f7e527e7d86af14264044d92a 100644 (file)
@@ -48,7 +48,7 @@
 //------------------------------------------------------------------------------
 // Tools
 
-std::string toStdString(double theValue)
+static std::string toStdString(double theValue)
 {
   std::ostringstream sstream;
   sstream << theValue;
@@ -59,7 +59,7 @@ std::string toStdString(double theValue)
   return sstream.str() + aPnt;
 }
 
-std::set<std::string> toSet(const std::list<std::string>& theContainer)
+static std::set<std::string> toSet(const std::list<std::string>& theContainer)
 {
   return std::set<std::string>(theContainer.begin(), theContainer.end());
 }
index aaa647d9d124d502a4576e52fd2f3c9ae4ffbcdf..dc0c766e66917b94a68fb0c8979f13494922d42e 100644 (file)
@@ -100,8 +100,6 @@ bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttrib
                                                    Events_InfoMessage& theError) const
 {
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
-  ResultParameterPtr aParam =
-      std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aFeature->firstResult());
 
   AttributeStringPtr aStrAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
@@ -116,11 +114,6 @@ bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttrib
     return false;
   }
 
-  if (!aParam.get()) {
-    theError = "Result is empty.";
-    return false;
-  }
-
   theError = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value();
   return theError.empty();
 }
diff --git a/src/ParametersPlugin/Test/TestParameterDelete.py b/src/ParametersPlugin/Test/TestParameterDelete.py
new file mode 100644 (file)
index 0000000..c1db59d
--- /dev/null
@@ -0,0 +1,53 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from ModelAPI import *
+import math
+
+def assertLineLength(theLine, theLength):
+    dx = theLine.startPoint().x() - theLine.endPoint().x()
+    dy = theLine.startPoint().y() - theLine.endPoint().y()
+    assert(math.fabs(dx**2 + dy**2 - theLength**2)  < 1.e-8), "Line length {} is not equal to expected {}".format(math.sqrt(dx**2 + dy**2), theLength)
+
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+ParamLen = model.addParameter(Part_1_doc, "Len", "100")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -30, 100, -30)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Len")
+model.do()
+
+aLength = ParamLen.value()
+assertLineLength(SketchLine_1, aLength)
+
+# delete parameter
+model.removeParameter(Part_1_doc, ParamLen)
+model.do()
+
+# move line and check the constraint is still here
+SketchLine_1.startPoint().setValue(SketchLine_1.startPoint().x() + 10., SketchLine_1.startPoint().y())
+model.do()
+assertLineLength(SketchLine_1, aLength)
+
+model.end()
diff --git a/src/ParametersPlugin/Test/TestParameterErrorMsg.py b/src/ParametersPlugin/Test/TestParameterErrorMsg.py
new file mode 100644 (file)
index 0000000..1030c77
--- /dev/null
@@ -0,0 +1,37 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+# check error on empty name
+Param1 = model.addParameter(partSet, "", "100")
+assert(Param1.feature().error() != "")
+# check error on empty value
+Param2 = model.addParameter(partSet, "L", "")
+assert(Param2.feature().error() != "")
+# check error if name is not variable
+Param3 = model.addParameter(partSet, "100", "100")
+assert(Param3.feature().error() != "")
+# check error on wrong value expression
+Param4 = model.addParameter(partSet, "N", "+-.so&@")
+assert(Param4.feature().error() != "")
+model.end()
index 703ee35d1a39e2d0ba9ef4e41e3c61a5396b9fd2..8129eb0ba0f3d78d3b1619b07d167a0e534499a6 100644 (file)
@@ -63,7 +63,11 @@ __updated__ = "2015-04-27"
 class TestParameterRename(unittest.TestCase):
     def setUp(self):
         self.aSession = ModelAPI_Session.get()
-        self.aDocument = self.aSession.moduleDocument()
+        model.begin()
+        partSet = self.aSession.moduleDocument()
+        Part = model.addPart(partSet)
+        model.end()
+        self.aDocument = Part.document()
         self.createParameters()
         self.createFeature()
 
@@ -73,8 +77,8 @@ class TestParameterRename(unittest.TestCase):
         pass
 
     def createParameters(self):
-        ltNames = ["x1", "y1", "x2"]
-        ltExpressions = ["150.", "200.", "x1 + y1 + 100.0"]
+        ltNames = ["x1", "y1", "x2", "n", "px"]
+        ltExpressions = ["150.", "200.", "x1 + y1 + 100.0", "5", "50"]
         self.dtParams = {}
         for name, expr in zip(ltNames, ltExpressions):
             self.aSession.startOperation()
@@ -123,8 +127,7 @@ class TestParameterRename(unittest.TestCase):
         anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint"))
         aStartPoint.setValue(0., 0.)
         anEndPoint.setValue(0., 100.)
-        anOYRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OY"))
-        anOY.selection("External").setValue(anOYRes, anOYRes.shape())
+        anOY.selection("External").selectSubShape("EDGE", "PartSet/OY")
         anOY.execute()
         refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult()))
         valueX = aDistanceConstraint1.real("ConstraintValue")
@@ -140,8 +143,7 @@ class TestParameterRename(unittest.TestCase):
         anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint"))
         aStartPoint.setValue(0., 0.)
         anEndPoint.setValue(100., 0.)
-        anOXRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OX"))
-        anOX.selection("External").setValue(anOXRes, anOXRes.shape())
+        anOX.selection("External").selectSubShape("EDGE", "PartSet/OX")
         anOX.execute()
         refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult()))
         valueY = aDistanceConstraint2.real("ConstraintValue")
@@ -164,6 +166,41 @@ class TestParameterRename(unittest.TestCase):
         self.assertEqual(self.anCircleCentr.y(), 170.)
         self.assertEqual(aRadiusAttr.value(), 150.)
 
+        # add a line and rotate it around origin
+        self.aSession.startOperation()
+        aSketchLine = aSketchFeature.addFeature("SketchLine")
+        aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+        aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
+        aStartPoint.setText("px", "0")
+        aEndPoint.setValue(0., 0.)
+        self.aSession.finishOperation()
+        self.aSession.startOperation()
+        aEndPoint.move(100., 0.)
+        self.aSession.finishOperation()
+
+        self.aSession.startOperation()
+        aMultiRotation = aSketchFeature.addFeature("SketchMultiRotation")
+        aMultiRotation.reflist("MultiRotationList").append(aSketchLine.lastResult())
+        aMultiRotation.refattr("MultiRotationCenter").setAttr(anCircleCentr)
+        aMultiRotation.real("MultiRotationAngle").setValue(60.0)
+        aMultiRotation.string("AngleType").setValue("SingleAngle")
+        aMultiRotation.boolean("MultiRotationReversed").setValue(False)
+        aMultiRotation.integer("MultiRotationObjects").setText("n")
+        self.aSession.finishOperation()
+
+        self.aMultiRotCopies = aMultiRotation.integer("MultiRotationObjects")
+
+        # create 3D point
+        self.aSession.startOperation()
+        aPoint3D = self.aDocument.addFeature("Point")
+        aPoint3D.string("creation_method").setValue("by_xyz")
+        aCoords = geomDataAPI_Point(aPoint3D.attribute("point3d"))
+        aCoords.setText("px", "0", "0")
+        self.aSession.finishOperation()
+
+        self.aPoint2D = aStartPoint
+        self.aPoint3D = aCoords
+
     def test_rename(self):
         # Rename
         aParam = self.dtParams["x1"]
@@ -188,6 +225,44 @@ class TestParameterRename(unittest.TestCase):
         self.assertEqual(self.anCircleCentr.y(), 170.)
         self.assertEqual(self.aRadiusAttr.value(), 150.)
 
+    def test_rename_integer(self):
+        # rename integer parameter
+        aParam = self.dtParams["n"]
+        aResultAttr = modelAPI_ResultParameter(aParam.firstResult())
+        self.aSession.startOperation()
+        aResultAttr.data().setName("m")
+        self.aSession.finishOperation()
+
+        # Check rename in the parameter
+        self.assertEqual(aParam.name(), "m")
+        self.assertEqual(aParam.string("variable").value(), "m")
+        self.assertEqual(aResultAttr.data().name(), "m")
+
+        # Check rename in feature
+        self.assertEqual(self.aMultiRotCopies.text(), "m")
+        # Check corresponding value
+        self.assertEqual(self.aMultiRotCopies.value(), 5)
+
+    def test_rename_point(self):
+        # rename parameter in point coordinates
+        aParam = self.dtParams["px"]
+        aResultAttr = modelAPI_ResultParameter(aParam.firstResult())
+        self.aSession.startOperation()
+        aResultAttr.data().setName("p")
+        self.aSession.finishOperation()
+
+        # Check rename in the parameter
+        self.assertEqual(aParam.name(), "p")
+        self.assertEqual(aParam.string("variable").value(), "p")
+        self.assertEqual(aResultAttr.data().name(), "p")
+
+        # Check rename in feature
+        self.assertEqual(self.aPoint2D.textX(), "p")
+        self.assertEqual(self.aPoint3D.textX(), "p")
+        # Check corresponding value
+        self.assertEqual(self.aPoint2D.x(), 50.)
+        self.assertEqual(self.aPoint3D.x(), 50.)
+
     def test_rename_not_unique(self):
         # Rename to not unique name
         aParam = self.dtParams["x1"]
@@ -230,6 +305,7 @@ class TestParameterRename(unittest.TestCase):
         self.assertEqual(self.anCircleCentr.y(), 170.)
         self.assertEqual(self.aRadiusAttr.value(), 150.)
 
+
 if __name__ == "__main__":
     test_program = unittest.main(exit=False)
     assert test_program.result.wasSuccessful(), "Test failed"
diff --git a/src/ParametersPlugin/Test/TestParametersMgr.py b/src/ParametersPlugin/Test/TestParametersMgr.py
new file mode 100644 (file)
index 0000000..8477271
--- /dev/null
@@ -0,0 +1,42 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    TestParametersMgr.py
+
+    class ParametersPlugin_ParametersMgr
+"""
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+
+__updated__ = "2018-12-05"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aKind = "ParametersMgr"
+aParamMgr = aDocument.addFeature(aKind)
+assert(aParamMgr is not None)
+assert(aParamMgr.getKind() == aKind)
+aSession.finishOperation()
index 640af398ae868f252f563d34e61c89562c30fe6b..a7480b35a8a1078888d5397ea677861cf6f6a477 100755 (executable)
@@ -161,8 +161,21 @@ void PartSet_OverconstraintListener::processEvent(
       std::set<ObjectPtr> aModifiedObjects;
       PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
       CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch();
+
+      // check the sketch in the message and the active sketch are the same
+      std::shared_ptr<ModelAPI_SolverFailedMessage> anErrorMsg =
+          std::dynamic_pointer_cast<ModelAPI_SolverFailedMessage>(theMessage);
+      if (aSketch && anErrorMsg && !anErrorMsg->objects().empty()) {
+        ObjectPtr anObject = *anErrorMsg->objects().begin();
+        CompositeFeaturePtr aSketchFromMsg =
+            std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(anObject);
+        if (!aSketchFromMsg || aSketchFromMsg != aSketch)
+          aSketch = CompositeFeaturePtr();
+      }
+
       if (aSketch.get()) {
-        for (int i = 0; i < aSketch->numberOfSubs(); i++) {
+        int aNumberOfSubs = aSketch->numberOfSubs();
+        for (int i = 0; i < aNumberOfSubs; i++) {
           FeaturePtr aFeature = aSketch->subFeature(i);
           aModifiedObjects.insert(aFeature); // is necessary to redisplay presentations
           std::list<ResultPtr> aResults = aFeature->results();
index 7585f21be350561ffb95193bcca7cc5641c6f114..961c35ccb43b7fa3b3f9a85eed5d8536178b2681 100755 (executable)
@@ -24,6 +24,7 @@
 
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultPart.h>
 
 #include <XGUI_Tools.h>
 #include <XGUI_Displayer.h>
@@ -49,7 +50,9 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorksho
   foreach (ObjectPtr anObj, aDisplayed) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
     // result constructions should not be taken as a body
-    if (aResult.get() != NULL && aResult->groupName() == ModelAPI_ResultBody::group()) {
+    if (aResult.get() != NULL &&
+      ((aResult->groupName() == ModelAPI_ResultBody::group()) ||
+      ((aResult->groupName() == ModelAPI_ResultPart::group()))) ) {
       GeomShapePtr aShape = aResult->shape();
       if (aShape.get()) {
         // vertices, edges should not be taken as a body
index 56f6c33f6c0f1a2281fde3e7e0922c997068b56b..808de929f96e6d9d29585f539fd17362759407aa 100644 (file)
@@ -143,7 +143,8 @@ bool PartSet_PreviewSketchPlane::getDefaultSizeOfView(
     return false;
 
   Bnd_Box aBox;
-  for (int aSubFeatureId = 0; aSubFeatureId < theSketch->numberOfSubs(); aSubFeatureId++) {
+  int aNumberOfSubs = theSketch->numberOfSubs();
+  for (int aSubFeatureId = 0; aSubFeatureId < aNumberOfSubs; aSubFeatureId++) {
     FeaturePtr aFeature = theSketch->subFeature(aSubFeatureId);
     if (!aFeature.get())
       continue;
index b600306b92cf5f5ed26f09d9dacf6e0ac6473950..c1f7bd1f0f05d5108c585b6f3316e8096cc6bf22 100755 (executable)
@@ -285,7 +285,8 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape,
   CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
                                                                           (aResultFeature);
   std::list<ResultPtr> anAuxiliaryResults;
-  for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) {
+  int aNumberOfSubs = aSketchFeature->numberOfSubs();
+  for (int i = 0; i < aNumberOfSubs; i++) {
     FeaturePtr aFeature = aSketchFeature->subFeature(i);
     if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) {
       std::list<ResultPtr> aResults = aFeature->results();
index a67aa0f36fc60f44ea18a9a3eb13156a6ea66440..84a0ab0c06c314294fbe07fa4665ac999756d878 100755 (executable)
@@ -197,6 +197,7 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule)
 
 PartSet_SketcherMgr::~PartSet_SketcherMgr()
 {
+  delete mySketchPlane;
 }
 
 void PartSet_SketcherMgr::onEnterViewPort()
@@ -970,7 +971,8 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
   // Remove invalid sketch entities
   std::set<FeaturePtr> anInvalidFeatures;
   ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
-  for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+  int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+  for (int i = 0; i < aNumberOfSubs; i++) {
     FeaturePtr aFeature = myCurrentSketch->subFeature(i);
     if (aFeature.get()) {
       if (!aFactory->validate(aFeature))
@@ -1011,7 +1013,8 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
   QStringList anInfo;
   Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
   const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
-  for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+  aNumberOfSubs = myCurrentSketch->numberOfSubs();
+  for (int i = 0; i < aNumberOfSubs; i++) {
     FeaturePtr aFeature = myCurrentSketch->subFeature(i);
 #ifdef DEBUG_SKETCHER_ENTITIES
     anInfo.append(ModuleBase_Tools::objectInfo(aFeature));
@@ -1081,7 +1084,8 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
   }
   else {
     // Hide all sketcher sub-Objects
-    for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+    int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+    for (int i = 0; i < aNumberOfSubs; i++) {
       FeaturePtr aFeature = myCurrentSketch->subFeature(i);
       std::list<ResultPtr> aResults = aFeature->results();
       std::list<ResultPtr>::const_iterator aIt;
@@ -1479,7 +1483,7 @@ bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const
   FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject);
   if (anObjectFeature.get()) {
     int aSize = myCurrentSketch->numberOfSubs();
-    for (int i = 0; i < myCurrentSketch->numberOfSubs() && !isFoundObject; i++) {
+    for (int i = 0; i < aSize && !isFoundObject; i++) {
       FeaturePtr aCurrentFeature = myCurrentSketch->subFeature(i);
       isFoundObject = myCurrentSketch->subFeature(i) == anObjectFeature;
     }
@@ -1900,7 +1904,8 @@ void PartSet_SketcherMgr::updateBySketchParameters(
       if (aPrevState != theState) {
         ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
         XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
-        for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+        int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+        for (int i = 0; i < aNumberOfSubs; i++) {
           FeaturePtr aSubFeature = myCurrentSketch->subFeature(i);
           bool aProcessed = false;
           bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, theType, aProcessed);
index 16a0d0faaf09c0ab942858d44edc5a4b472be7ea..0d91654e57e91d2ebc2bfbff1bdc5115b4a96510 100755 (executable)
@@ -664,7 +664,8 @@ void PartSet_Tools::sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite
     return;
 
   static Events_Loop* aLoop = Events_Loop::loop();
-  for (int i = 0; i < theComposite->numberOfSubs(); i++) {
+  int aNumberOfSubs = theComposite->numberOfSubs();
+  for (int i = 0; i < aNumberOfSubs; i++) {
     FeaturePtr aSubFeature = theComposite->subFeature(i);
     static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
     aECreator->sendUpdated(aSubFeature, theEventId);
@@ -756,6 +757,9 @@ ResultPtr PartSet_Tools::createFixedByExternalCenter(
 void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
   int& theFirst, int& theLast)
 {
+  theFirst = -1;
+  theLast = -1;
+
   DocumentPtr aDoc = theFolder->document();
   FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theFolder);
   if (!aFolder.get())
@@ -763,18 +767,19 @@ void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
 
   AttributeReferencePtr aFirstFeatAttr =
     aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID());
+  if (!aFirstFeatAttr.get())
+    return;
   FeaturePtr aFirstFeatureInFolder = ModelAPI_Feature::feature(aFirstFeatAttr->value());
-  if (!aFirstFeatureInFolder.get()) {
-    theFirst = -1;
+  if (!aFirstFeatureInFolder.get())
     return;
-  }
+
   AttributeReferencePtr aLastFeatAttr =
     aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID());
+  if (!aLastFeatAttr.get())
+    return;
   FeaturePtr aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value());
-  if (!aLastFeatureInFolder.get()) {
-    theLast = -1;
+  if (!aLastFeatureInFolder.get())
     return;
-  }
 
   theFirst = aDoc->index(aFirstFeatureInFolder);
   theLast = aDoc->index(aLastFeatureInFolder);
index e8acf5f61d42c2321c4de8c27d13b1108de6bcce..b8434fbff6d7ca2b8bec9fb89c944a258747dde3 100644 (file)
@@ -270,6 +270,7 @@ void PartSet_ObjectNode::update()
         else {
           aNode = new PartSet_ObjectNode(aBody, this);
           myChildren.append(aNode);
+          aNode->update();
         }
       }
       else if (aFieldRes.get()) {
@@ -482,7 +483,9 @@ ModuleBase_ITreeNode* PartSet_FolderNode::createNode(const ObjectPtr& theObj)
   //ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObj);
   //if (aCompRes.get())
   //  return new PartSet_CompsolidNode(theObj, this);
-  return new PartSet_ObjectNode(theObj, this);
+  ModuleBase_ITreeNode* aNode = new PartSet_ObjectNode(theObj, this);
+  aNode->update();
+  return aNode;
 }
 
 void PartSet_FolderNode::update()
@@ -813,7 +816,9 @@ ModuleBase_ITreeNode* PartSet_RootNode::createNode(const ObjectPtr& theObj)
   if (aFeature->getKind() == PartSetPlugin_Part::ID())
     return new PartSet_PartRootNode(theObj, this);
 
-  return new PartSet_ObjectNode(theObj, this);
+  PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this);
+  aNode->update();
+  return aNode;
 }
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -859,11 +864,19 @@ void PartSet_PartRootNode::update()
 
   bool aHasFields = myFieldsFolder->childrenCount() > 0;
   bool aHasGroups = myGroupsFolder->childrenCount() > 0;
-  if (aHasFields && (!myChildren.contains(myFieldsFolder))) {
-    myChildren.insert(3, myFieldsFolder);
+  if (aHasFields) {
+    if (!myChildren.contains(myFieldsFolder)) {
+      myChildren.insert(3, myFieldsFolder);
+    }
+  } else if (myChildren.contains(myFieldsFolder)) {
+    myChildren.removeAll(myFieldsFolder);
   }
-  if (aHasGroups && (!myChildren.contains(myGroupsFolder))) {
-    myChildren.insert(aHasFields ? 4 : 3, myGroupsFolder);
+  if (aHasGroups) {
+    if (!myChildren.contains(myGroupsFolder)) {
+      myChildren.insert(aHasFields ? 4 : 3, myGroupsFolder);
+    }
+  } else if (myChildren.contains(myGroupsFolder)) {
+    myChildren.removeAll(myGroupsFolder);
   }
 
   // Update features content
@@ -947,7 +960,7 @@ QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const
 Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const
 {
   if (myObject->isDisabled())
-    return (theColumn == 2) ? Qt::ItemIsSelectable : aDefaultFlag;
+    return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag;
 
   SessionPtr aSession = ModelAPI_Session::get();
   DocumentPtr aActiveDoc = aSession->activeDocument();
@@ -960,7 +973,9 @@ ModuleBase_ITreeNode* PartSet_PartRootNode::createNode(const ObjectPtr& theObj)
 {
   if (theObj->groupName() == ModelAPI_Folder::group())
     return new PartSet_ObjectFolderNode(theObj, this);
-  return new PartSet_ObjectNode(theObj, this);
+  PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this);
+  aNode->update();
+  return aNode;
 }
 
 int PartSet_PartRootNode::numberOfFolders() const
@@ -1066,11 +1081,13 @@ void PartSet_ObjectFolderNode::update()
         if (aObj != myChildren.at(i)->object()) {
           aNode = new PartSet_ObjectNode(aObj, this);
           myChildren.insert(i, aNode);
+          aNode->update();
         }
       }
       else {
         aNode = new PartSet_ObjectNode(aObj, this);
         myChildren.append(aNode);
+        aNode->update();
       }
     }
   }
@@ -1098,11 +1115,13 @@ QTreeNodesList PartSet_ObjectFolderNode::objectCreated(const QObjectPtrList& the
         aNode = new PartSet_ObjectNode(aObj, this);
         myChildren.insert(i, aNode);
         aResult.append(aNode);
+        aNode->update();
       }
     } else {
       aNode = new PartSet_ObjectNode(aObj, this);
       myChildren.append(aNode);
       aResult.append(aNode);
+      aNode->update();
     }
   }
   return aResult;
@@ -1141,6 +1160,7 @@ QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& theDo
     }
     else {
       myChildren.removeAll(aNode);
+      aResult.removeAll(aNode);
       delete aNode;
       aRemoved = true;
       continue;
index 8714eb98d5d4fe387583b7772b3079bc3acd9585..14c7fbe576df29fc159cde3c618d86a771cc4900 100644 (file)
@@ -465,10 +465,11 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_View
       else {
         aSelAttr->setValue(aFeature, GeomShapePtr());
         GeomShapePtr aShape = aSelAttr->value();
-        if (!aShape.get() && aSelAttr->contextFeature()->firstResult().get()) {
+        if (!aShape.get() && aSelAttr->contextFeature().get() &&
+          aSelAttr->contextFeature()->firstResult().get()) {
           aShape = aSelAttr->contextFeature()->firstResult()->shape();
         }
-        if (aShape.get()) {
+        if (aShape.get() && aShape->isPlanar()) {
           const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
           setSketchPlane(aTDShape);
           isOwnerSet = true;
index efb5684259f67363c12e44a64fd159e985cd1651..6d08828f0fc84a4f9bc1157dc6836813ba95540d 100644 (file)
@@ -163,10 +163,11 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxA
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theBoxAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultBox->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultBox->generated((*it).second, (*it).first);
   }
 }
 
index 2c2916586faf73884dc1a01fe6be55f172f3d4ee..3f94a85d50dc54ac1f8bee2cec401c2562156514 100644 (file)
@@ -9,6 +9,7 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -82,21 +83,43 @@ void PrimitivesPlugin_Cone::execute()
   }
 
   // Getting axis.
-  std::shared_ptr<GeomAPI_Ax2> anAxis;
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+  GeomShapePtr aShape = anEdgeRef->value();
+  if (!aShape.get()) {
+    if (anEdgeRef->context().get()) {
+      aShape = anEdgeRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
-    selection(PrimitivesPlugin_Cone::AXIS_ID());
-  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
-  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
-             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
-                                                          anEdge->line()->direction()));
+  else
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+                                                      anEdge->line()->direction()));
+
   // Getting base radius, top radius and height
   double aBaseRadius = real(PrimitivesPlugin_Cone::BASE_RADIUS_ID())->value();
   double aTopRadius = real(PrimitivesPlugin_Cone::TOP_RADIUS_ID())->value();
@@ -145,26 +168,27 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cone> theCo
   theConeAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theConeAlgo->getCreatedFaces();
   int nbFaces = 0;
   for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
        it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultCone->generated(aFace, (*it).first, num++);
+    theResultCone->generated((*it).second, (*it).first);
     nbFaces++;
   }
 
   if (nbFaces == 2) {
     // Naming vertices
     GeomAPI_DataMapOfShapeShape aVertices;
-    GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
-    for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+    int anIndex = 1;
+    for (GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
+         aVertExp.more();
+         aVertExp.next())
+    {
       if (!aVertices.isBound(aVertExp.current())) {
         std::ostringstream aStream;
         aStream<<"Vertex_"<<anIndex++;
-        theResultCone->generated(aVertExp.current(), aStream.str(), num++);
+        theResultCone->generated(aVertExp.current(), aStream.str());
         aVertices.bind(aVertExp.current(), aVertExp.current());
       }
     }
index c3d5b82235327c599349018d31b12fb1d094574f..268c983f17f52c0ee8099d61be3875e54c06bd55 100644 (file)
@@ -23,6 +23,7 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -112,21 +113,44 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
   }
 
   // Getting axis.
-  std::shared_ptr<GeomAPI_Ax2> anAxis;
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+  GeomShapePtr aShape = anEdgeRef->value();
+  if (!aShape.get()) {
+    if (anEdgeRef->context().get()) {
+      aShape = anEdgeRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
-    selection(PrimitivesPlugin_Cylinder::AXIS_ID());
-  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
-  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
-             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
-                                                          anEdge->line()->direction()));
+  else
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+                                                      anEdge->line()->direction()));
+
+
   // Getting radius and height
   double aRadius = real(PrimitivesPlugin_Cylinder::RADIUS_ID())->value();
   double aHeight = real(PrimitivesPlugin_Cylinder::HEIGHT_ID())->value();
@@ -184,12 +208,12 @@ void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinde
   theCylinderAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theCylinderAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultCylinder->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultCylinder->generated((*it).second, (*it).first);
   }
 }
index c01d2b2fb73ba92e9b3c44427525b244a4dea460..df9fe3220e52dc42aafc23f587b7d3bf0c880e01 100644 (file)
@@ -106,23 +106,26 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> t
 
   // Insert to faces
   // Naming for faces and edges
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theSphereAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultSphere->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultSphere->generated((*it).second, (*it).first);
   }
 
   // Naming vertices
   GeomAPI_DataMapOfShapeShape aVertices;
-  GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
-  for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
+       aVertExp.more();
+       aVertExp.next())
+  {
     if (!aVertices.isBound(aVertExp.current())) {
       std::ostringstream aStream;
       aStream<<"Vertex_"<<anIndex++;
-      theResultSphere->generated(aVertExp.current(), aStream.str(), num++);
+      theResultSphere->generated(aVertExp.current(), aStream.str());
       aVertices.bind(aVertExp.current(), aVertExp.current());
     }
   }
index a086def17e8aa7171a97ac95766409bf36cd9883..0c000a8fe7f3d2ff14d9cc642841a1801a3f8d9f 100644 (file)
@@ -9,6 +9,7 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -80,21 +81,43 @@ void PrimitivesPlugin_Torus::execute()
   }
 
   // Getting axis.
-  std::shared_ptr<GeomAPI_Ax2> anAxis;
+  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+  GeomShapePtr aShape = anEdgeRef->value();
+  if (!aShape.get()) {
+    if (anEdgeRef->context().get()) {
+      aShape = anEdgeRef->context()->shape();
+    }
+  }
+  if (!aShape.get()) {
+    setError(aSelectionError);
+    return;
+  }
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
-    selection(PrimitivesPlugin_Torus::AXIS_ID());
-  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
-  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
-             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+  if (aShape->isEdge())
+  {
+    anEdge = aShape->edge();
+  }
+  else if (aShape->isCompound())
+  {
+    GeomAPI_ShapeIterator anIt(aShape);
+    anEdge = anIt.current()->edge();
   }
-  if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
-                                                          anEdge->line()->direction()));
+  else
+  {
+    setError(aSelectionError);
+    return;
   }
 
+  if (!anEdge.get())
+  {
+    setError(aSelectionError);
+    return;
+  }
+
+  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+                                                      anEdge->line()->direction()));
+
   // Getting radius and ring radius
   double aRadius = real(PrimitivesPlugin_Torus::RADIUS_ID())->value();
   double aRingRadius = real(PrimitivesPlugin_Torus::RING_RADIUS_ID())->value();
@@ -145,20 +168,24 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Torus> the
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theTorusAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultTorus->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultTorus->generated((*it).second, (*it).first);
   }
 
   // Naming of edges
   GeomAPI_DataMapOfShapeShape anEdges;
-  GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
-  for(int anIndex = 1; anEdgeExp.more(); anEdgeExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
+       anEdgeExp.more();
+       anEdgeExp.next())
+  {
     if (!anEdges.isBound(anEdgeExp.current())) {
       std::ostringstream aStream;
       aStream<<"Edge_"<<anIndex++;
-      theResultTorus->generated(anEdgeExp.current(), aStream.str(), num++);
+      theResultTorus->generated(anEdgeExp.current(), aStream.str());
       anEdges.bind(anEdgeExp.current(), anEdgeExp.current());
     }
   }
index 4f1acd5e45c350b7a1be4ff2c7abe9bb34097fb9..710134ca0badd3ed7b2062c3605ba7a31a2b8bc1 100644 (file)
@@ -16,6 +16,7 @@
       label="axis"
       default=""
       shape_types="edge"
+      geometrical_selection="true"
       icon="icons/Primitives/axis.png"
       tooltip="Select the axis of the cone">
     <validator id="GeomValidators_ConstructionComposite"/>
index 373bafb5f2a297d4a08a5e29fd19ef1cec793527..2474f8badd8912154304bc27e2616470fec13d42 100644 (file)
@@ -37,6 +37,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
           label="axis"
           default=""
           shape_types="edge"
+          geometrical_selection="true"
           icon="icons/Primitives/axis.png"
           tooltip="Select the axis of the cylinder">
         <validator id="GeomValidators_ConstructionComposite"/>
@@ -75,6 +76,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
           label="axis"
           default=""
           shape_types="edge"
+          geometrical_selection="true"
           icon="icons/Primitives/axis.png"
           tooltip="Select the axis of the cylinder">
         <validator id="GeomValidators_ConstructionComposite"/>
index 44d0ce6888dc7938dc2c514d867066e207108764..30f6489e429fbc8a002da4f0847511f15f9c6ce9 100644 (file)
@@ -16,6 +16,7 @@
       label="axis"
       default=""
       shape_types="edge"
+      geometrical_selection="true"
       icon="icons/Primitives/axis.png"
       tooltip="Select the axis of the torus">
     <validator id="GeomValidators_ConstructionComposite"/>
index 831c91fbd585b3e249e6065f736afbad82e62438..f39fb3f06d5ba1be532803a3657b157113d4eac0 100644 (file)
@@ -69,9 +69,9 @@ model.do()
 
 # Creating a cylinder on a face of the box
 
-thisface = "Extrusion_1_1/Generated_Face_2"
-thisxmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"
-thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1"
+thisface = "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"
+thisxmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"
+thiszmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"
 
 mystand = model.addSketch(mypart, thisface)
 
index 2172b850c2b7f1b553b6c9fb0f9fe9f185916ace..38466f94b7097deadab2fac5665aaa0e611ebd25 100644 (file)
@@ -67,9 +67,9 @@ model.do()
 
 # Creating a cylinder on a face of the box
 
-thisface = "Extrusion_1_1/Generated_Face_2"
-thisxmin = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"
-thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1"
+thisface = "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"
+thisxmin = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"
+thiszmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"
 
 mystand = model.addSketch(mypart, thisface)
 circle = mystand.addCircle(0, 25, 5)
index 25e45babf3944046ff05b24c50499ff5f7d204d6..795571074967838a58bd4fbc6b8c8213e8c13531 100644 (file)
@@ -78,7 +78,7 @@ def vertical_body():
 
 def bottom_body():
     # Create XOY sketch
-    sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face_5")
+    sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
 
     # Create base polygon
     points = [(0, 0), (0, L), (P, L), (P, 16 + 16), (P - 20, 16 + 16), (P - 20, 16), (P, 16), (P, 0)]
@@ -111,7 +111,7 @@ def bottom_body():
     sketch.setCoincident(arc.endPoint(), h1.startPoint())
 
     # Binding
-    left_e = sketch.addLine("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1_1")
+    left_e = sketch.addLine("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
     sketch.setCoincident(left_e.endPoint(), left.startPoint())
 
@@ -132,7 +132,7 @@ def bottom_body():
 
 def body_3():
     # Create XOZ sketch
-    sketch = model.addSketch(part, "Boolean_1_1/Modified_Face_3")
+    sketch = model.addSketch(part, "Boolean_1_1/Modified_Face&Sketch_1/SketchLine_3")
 
     # Create base polygon
     H, L, l, r = 28, 40, 8, 12
@@ -170,7 +170,7 @@ def body_3():
     sketch.setRadius(arc, r)
 
     # Binding
-    bottom_e = sketch.addLine("Boolean_1_1/Modified_Face_7&Extrusion_2_1/To_Face_1")
+    bottom_e = sketch.addLine("[Boolean_1_1/Modified_Face&Sketch_2/SketchLine_6][Extrusion_2_1/To_Face]")
     sketch.setCoincident(bottom_e, bottom.startPoint())
     sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
 
@@ -183,7 +183,7 @@ def body_3():
 
 def body_4():
     # Create XOZ 2nd sketch
-    sketch = model.addSketch(part, "Boolean_2_1/Modified_Face_4")
+    sketch = model.addSketch(part, "Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6")
 
     # Create base polygon
     points = [(0, 0), (0, 1), (1, 0)]
@@ -192,11 +192,11 @@ def body_4():
     left, diagonal, bottom = model.addPolygon(sketch, *geom_points)
 
     # Binding
-    bottom_e = sketch.addLine("Boolean_2_1/Modified_Face_2&Boolean_2_1/Modified_Face_4")
+    bottom_e = sketch.addLine("[Boolean_2_1/Modified_Face&Extrusion_2_1/To_Face][Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6]")
     sketch.setCoincident(bottom_e.endPoint(), bottom.startPoint())
     sketch.setCoincident(bottom_e.startPoint(), left.startPoint())
 
-    left_e = sketch.addLine("Boolean_2_1/Modified_Face_5&Extrusion_3_1/Generated_Face_2")
+    left_e = sketch.addLine("[Boolean_2_1/Modified_Face&Extrusion_3_1/From_Face][Extrusion_3_1/Generated_Face&Sketch_3/SketchLine_18]")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
 
     model.do()  #!!!
index fb276792dfedfbdaf0d7c7b29dfa0ae377b056b8..12020f85013a0e076d618d52cf3ad61a1b682cdb 100644 (file)
@@ -1,4 +1,4 @@
 """Package for Parameter plugin for the Parametric Geometry API of the Modeler.
 """
 
-from ParametersAPI import addParameter
\ No newline at end of file
+from ParametersAPI import addParameter, removeParameter
\ No newline at end of file
index 92ff8a609bc19296865ceed3a4436be036c3c0fd..f888453dd67830271a9915d73aa2fac00386f9b1 100644 (file)
@@ -130,7 +130,7 @@ def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDi
     aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0")
     anExpectedResultVolume = theExpectedResultsVolumes[anIndex]
     anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0")
-    assert math.fabs(aResultVolume - anExpectedResultVolume) < aTolerance * anExpectedResultVolume, "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits)
+    assert math.fabs(aResultVolume - anExpectedResultVolume) < aTolerance * math.fabs(anExpectedResultVolume), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits)
 
 def testHaveNamingFaces(theFeature, theModel, thePartDoc) :
   """ Tests if all faces of result have a name
@@ -263,6 +263,7 @@ def testHaveNamingSubshapes(theFeature, theModel, thePartDoc) :
   """ Tests if all vertices/edges/faces of result have a unique name
   :param theFeature: feature to test.
   """
+  assert(len(theFeature.results()) > 0)
   testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.VERTEX)
   testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.EDGE)
   testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.FACE)
index 304dc616c4b9652c432d99e6e65736658ce22567..a799ef0444b06d26ca63878f0fad4b4751fe8832 100644 (file)
@@ -78,20 +78,7 @@ bool SHAPERGUI_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStr
     QString aCurrentFile = SUIT_Tools::addSlash(aTmpDir) + aFileName;
     XGUI_Workshop* aWorkShop = myModule->workshop();
     aWorkShop->openFile(aCurrentFile);
-    //QString aNewFile = SUIT_Tools::addSlash(aNewTmpDir) + aFileName;
-    //if (!QFile::copy(aCurrentFile, aNewFile))
-    //  isDone = false;
   }
-  //if (isDone) {
-  //  myTmpDirectory = aNewTmpDir;
-  //}
-  //else {
-  //  removeDirectory(aNewTmpDir);
-  //  myTmpDirectory = "";
-  //}
-
-  //SessionPtr aMgr = ModelAPI_Session::get();
-  //aMgr->load(qPrintable(aNewTmpDir));
 
   myModule->setIsOpened(true);
   return true;
@@ -113,7 +100,6 @@ bool SHAPERGUI_DataModel::save(QStringList& theFiles)
   bool isMultiFile = aResMgr ? aResMgr->booleanValue("Study", "multi_file", false) : false;
 
   std::string aTmpDir = aStudy->GetTmpDir(qPrintable(myStudyPath), isMultiFile);
-  //std::string aTmpDir = aStudy->GetTmpDir("", false);//true );
   QString aTmp = QString(aTmpDir.c_str());
   theFiles.append(aTmp);
 
@@ -122,21 +108,13 @@ bool SHAPERGUI_DataModel::save(QStringList& theFiles)
     aMgr->blockAutoUpdate(false);
 
   //aWorkShop->saveDocument(QString(aTmpDir.c_str()), aFileNames);
-  aWorkShop->setCurrentDataFile(aTmp + "shaper.opp");
+  aWorkShop->setCurrentDataFile(aTmp + "shaper.shaper");
   aWorkShop->onSave();
   QString aName = aWorkShop->currentDataFile();
-  std::string aa = aName.toStdString();
   aName.replace(QChar('\\'), QChar('/'));
   int aN = aName.lastIndexOf('/');
   theFiles.append(aName.right(aName.length() - aN - 1));
 
-  //std::list<std::string>::iterator aIt;
-  //for (aIt = aFileNames.begin(); aIt != aFileNames.end(); ++aIt) {
-  //  QString aName((*aIt).c_str());
-  //  aName.replace(QChar('\\'), QChar('/'));
-  //  int aN = aName.lastIndexOf('/');
-  //  theFiles.append(aName.right(aName.length() - aN - 1));
-  //}
   return true;
 }
 
@@ -149,8 +127,6 @@ bool SHAPERGUI_DataModel::saveAs(const QString& thePath, CAM_Study* theStudy, QS
 bool SHAPERGUI_DataModel::close()
 {
   myModule->workshop()->closeDocument();
-  //removeDirectory(myTmpDirectory);
-  //myTmpDirectory = "";
   return LightApp_DataModel::close();
 }
 
diff --git a/src/Selector/CMakeLists.txt b/src/Selector/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cfc38fe
--- /dev/null
@@ -0,0 +1,66 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+    Selector.h
+    Selector_Selector.h
+    Selector_Algo.h
+    Selector_Primitive.h
+    Selector_AlgoWithSubs.h
+    Selector_Intersect.h
+    Selector_Container.h
+    Selector_Modify.h
+    Selector_FilterByNeighbors.h
+    Selector_WeakName.h
+    Selector_NameGenerator.h
+    Selector_NExplode.h
+)
+
+SET(PROJECT_SOURCES
+    Selector_Selector.cpp
+    Selector_Algo.cpp
+    Selector_Primitive.cpp
+    Selector_AlgoWithSubs.cpp
+    Selector_Intersect.cpp
+    Selector_Container.cpp
+    Selector_Modify.cpp
+    Selector_FilterByNeighbors.cpp
+    Selector_WeakName.cpp
+    Selector_NameGenerator.cpp
+    Selector_NExplode.cpp
+)
+
+SET(PROJECT_LIBRARIES
+    ${OpenCASCADE_ApplicationFramework_LIBRARIES}
+)
+SET(PROJECT_INCLUDES
+  ${OpenCASCADE_INCLUDE_DIR}
+)
+
+
+ADD_DEFINITIONS(-DSELECTOR_EXPORTS ${OpenCASCADE_DEFINITIONS})
+ADD_LIBRARY(Selector SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(Selector ${PROJECT_LIBRARIES})
+
+INCLUDE_DIRECTORIES(${PROJECT_INCLUDES})
+
+INSTALL(TARGETS Selector DESTINATION ${SHAPER_INSTALL_BIN})
diff --git a/src/Selector/Selector.h b/src/Selector/Selector.h
new file mode 100644 (file)
index 0000000..293da86
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef SELECTOR_H
+#define SELECTOR_H
+
+#if defined SELECTOR_EXPORTS
+#if defined WIN32
+#define SELECTOR_EXPORT              __declspec( dllexport )
+#else
+#define SELECTOR_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SELECTOR_EXPORT              __declspec( dllimport )
+#else
+#define SELECTOR_EXPORT
+#endif
+#endif
+
+#endif
diff --git a/src/Selector/Selector_Algo.cpp b/src/Selector/Selector_Algo.cpp
new file mode 100644 (file)
index 0000000..ee31d00
--- /dev/null
@@ -0,0 +1,495 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Algo.h>
+
+#include <Selector_Primitive.h>
+#include <Selector_Intersect.h>
+#include <Selector_Modify.h>
+#include <Selector_Container.h>
+#include <Selector_FilterByNeighbors.h>
+#include <Selector_WeakName.h>
+
+#include <TDF_Tool.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <Geom_Surface.hxx>
+#include <BRep_Tool.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
+#include <TDataStd_ReferenceArray.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_UAttribute.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Builder.hxx>
+
+
+/// type of the selection, integer keeps the Selector_Type value
+static const Standard_GUID kSEL_TYPE("db174d59-c2e3-4a90-955e-55544df090d6");
+// geometrical naming indicator
+static const Standard_GUID kGEOMETRICAL_NAMING("a5322d02-50fb-43ed-9255-75c7b93f6657");
+
+
+//  reference attribute that contains the reference to labels where the "from" or "base" shapes
+// of selection are located
+static const Standard_GUID kBASE_ARRAY("7c515b1a-9549-493d-9946-a4933a22f45f");
+// if the base array contains reference to the root label, this means that it refers to an
+// external document and this list contains a tag in the document
+static const Standard_GUID kBASE_LIST("7c515b1a-9549-493d-9946-a4933a22f45a");
+
+Selector_Algo::Selector_Algo()
+{
+  myGeometricalNaming = false; // default values
+  myAlwaysGeometricalNaming = false;
+}
+
+#define SET_ALGO_FLAGS(algo) \
+  algo->myLab = theAccess; \
+  algo->myBaseDocumentLab = theBaseDocument; \
+  algo->myGeometricalNaming = theGeometricalNaming; \
+  algo->myUseNeighbors = theUseNeighbors; \
+  algo->myUseIntersections = theUseIntersections; \
+  algo->myAlwaysGeometricalNaming = theAlwaysGeometricalNaming;
+
+Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+  const TDF_Label theAccess, const TDF_Label theBaseDocument,
+  const bool theGeometricalNaming, const bool theUseNeighbors, const bool theUseIntersections,
+  const bool theAlwaysGeometricalNaming)
+{
+  Selector_Algo* aResult = NULL;
+  if (theValue.IsNull() || theContext.IsNull())
+    return aResult;
+
+  // check the value shape can be named as it is, or it is needed to construct it from the
+  // higher level shapes (like a box vertex by faces that form this vertex)
+  bool aIsFound = TNaming_Tool::HasLabel(theAccess, theValue);
+  if (aIsFound) { // additional check for selection and delete evolution only: also could not use
+    aIsFound = false;
+    for(TNaming_SameShapeIterator aShapes(theValue, theAccess); aShapes.More(); aShapes.Next())
+    {
+      Handle(TNaming_NamedShape) aNS;
+      if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+        if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED ||
+          aNS->Evolution() == TNaming_PRIMITIVE) {
+          aIsFound = true;
+          break;
+        }
+      }
+    }
+  }
+  // searching in the base document
+  if (!aIsFound && !theBaseDocument.IsNull() && TNaming_Tool::HasLabel(theBaseDocument, theValue))
+  {
+    TNaming_SameShapeIterator aShapes(theValue, theBaseDocument);
+    for(; aShapes.More(); aShapes.Next())
+    {
+      Handle(TNaming_NamedShape) aNS;
+      if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+        if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED ||
+          aNS->Evolution() == TNaming_PRIMITIVE) {
+          aIsFound = true;
+          break;
+        }
+      }
+    }
+  }
+  if (!aIsFound) {
+    TopAbs_ShapeEnum aSelectionType = theValue.ShapeType();
+    if (aSelectionType == TopAbs_COMPOUND || aSelectionType == TopAbs_COMPSOLID ||
+      aSelectionType == TopAbs_SHELL || aSelectionType == TopAbs_WIRE)
+    {
+      Selector_Container* aContainer = new Selector_Container;
+      SET_ALGO_FLAGS(aContainer);
+      if (aContainer->select(theContext, theValue))
+        return aContainer;
+      delete aContainer;
+      return NULL;
+    }
+
+    Selector_Intersect* anIntersect = new Selector_Intersect;
+    SET_ALGO_FLAGS(anIntersect);
+    bool aGoodIntersector = anIntersect->select(theContext, theValue);
+    // weak intersector is bad for not use neighbors and has lower priority than neighbors
+    if (aGoodIntersector && anIntersect->myWeakIndex == -1) {
+      return anIntersect;
+    }
+    if (!theUseNeighbors) {
+      delete anIntersect;
+      return NULL;
+    }
+    // searching by neighbors
+    Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors;
+    SET_ALGO_FLAGS(aNBs);
+    if (aNBs->select(theContext, theValue)) {
+      delete anIntersect;
+      return aNBs;
+    }
+    delete aNBs;
+    if (aGoodIntersector) { // if neighbors are bad, use intersector with weak index
+      return anIntersect;
+    }
+    delete anIntersect;
+
+    // pure weak naming: there is no sense to use pure weak naming for neighbors selection
+    if (theUseNeighbors) {
+      Selector_WeakName* aWeak = new Selector_WeakName;
+      SET_ALGO_FLAGS(aWeak);
+      if (aWeak->select(theContext, theValue)) {
+        return aWeak;
+      }
+      delete aWeak;
+    }
+    return NULL; // not found value in the tree, not found context shape in the tree also
+  }
+  // searching for the base shapes of the value
+  Handle(TNaming_NamedShape) aPrimitiveNS;
+  NCollection_List<Handle(TNaming_NamedShape)> aModifList;
+  for(int aUseExternal = 0; aUseExternal < 2; aUseExternal++) {
+    TDF_Label aLab = aUseExternal == 0 ? theAccess : theBaseDocument;
+    if (aLab.IsNull() || !TNaming_Tool::HasLabel(aLab, theValue))
+      continue;
+    for(TNaming_SameShapeIterator aShapes(theValue, aLab); aShapes.More(); aShapes.Next())
+    {
+      Handle(TNaming_NamedShape) aNS;
+      if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+        TNaming_Evolution anEvolution = aNS->Evolution();
+        if (anEvolution == TNaming_PRIMITIVE) { // the value shape is declared as PRIMITIVE
+          aPrimitiveNS = aNS;
+          break;
+        } else if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+          // check this is a new shape
+          TNaming_Iterator aNSIter(aNS);
+          for(; aNSIter.More(); aNSIter.Next())
+            if (aNSIter.NewShape().IsSame(theValue))
+              break;
+          if (aNSIter.More()) // new was found
+            aModifList.Append(aNS);
+        }
+      }
+    }
+  }
+
+  if (!aPrimitiveNS.IsNull()) {
+    Selector_Primitive* aPrimitive = new Selector_Primitive;
+    SET_ALGO_FLAGS(aPrimitive);
+    aPrimitive->select(aPrimitiveNS->Label());
+    return aPrimitive;
+  } else {
+    Selector_Modify* aModify = new Selector_Modify;
+    SET_ALGO_FLAGS(aModify);
+    bool aGoodModify = aModify->select(aModifList, theContext, theValue);
+    // weak intersector is bad for not use neighbors and has lower priority than neighbors
+    if (aGoodModify && aModify->myWeakIndex == -1) {
+      return aModify;
+    }
+    if (!theUseNeighbors) {
+      delete aModify;
+      return NULL;
+    }
+    // searching by neighbors
+    Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors;
+    SET_ALGO_FLAGS(aNBs);
+    if (aNBs->select(theContext, theValue)) {
+      delete aModify;
+      return aNBs;
+    }
+    delete aNBs;
+
+    if (aGoodModify) { // if neighbors are bad, use modify algo with weak index
+      return aModify;
+    }
+    delete aModify;
+  }
+
+  return NULL; // invalid case
+}
+
+Selector_Algo* Selector_Algo::relesectWithAllGeometry(
+  Selector_Algo* theOldAlgo, const TopoDS_Shape theContext)
+{
+  return select(theContext, theOldAlgo->value(),
+    theOldAlgo->myLab, theOldAlgo->myBaseDocumentLab, true, true, true, true);
+}
+
+void Selector_Algo::storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast)
+{
+  Handle(TDataStd_ReferenceArray) anArray =
+    TDataStd_ReferenceArray::Set(myLab, kBASE_ARRAY, 0, theRef.Extent());
+  Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document
+  const TDF_Label aThisDocRoot = myLab.Root();
+  TDF_LabelList::Iterator aBIter(theRef);
+  for(int anIndex = 0; true; aBIter.Next(), anIndex++) {
+    const TDF_Label& aLab = aBIter.More() ? aBIter.Value() : theLast;
+    // check this is a label of this document
+    if (aLab.Root().IsEqual(aThisDocRoot)) {
+      anArray->SetValue(anIndex, aLab);
+    } else { // store reference to external document as an entry-string
+      if (anEntries.IsNull()) {
+        anEntries = TDataStd_ExtStringList::Set(myLab, kBASE_LIST);
+      }
+      TCollection_AsciiString anEntry;
+      TDF_Tool::Entry(aLab, anEntry);
+      anEntries->Append(anEntry);
+      anArray->SetValue(anIndex, aThisDocRoot); // stored root means it is external reference
+    }
+    if (!aBIter.More())
+      break;
+  }
+}
+
+bool Selector_Algo::restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast)
+{
+  const TDF_Label aThisDocRoot = myLab.Root();
+  Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document
+  TDataStd_ListOfExtendedString::Iterator anIter;
+  Handle(TDataStd_ReferenceArray) anArray;
+  if (myLab.FindAttribute(kBASE_ARRAY, anArray)) {
+    int anUpper = anArray->Upper();
+    for(int anIndex = anArray->Lower(); anIndex <= anUpper; anIndex++) {
+      TDF_Label aLab = anArray->Value(anIndex);
+      if (aLab.IsEqual(aThisDocRoot)) { // external document reference
+        if (myBaseDocumentLab.IsNull())
+          return false;
+        if (anEntries.IsNull()) {
+          if (!myLab.FindAttribute(kBASE_LIST, anEntries))
+            return false;
+          anIter.Initialize(anEntries->List());
+        }
+        if (!anIter.More())
+          return false;
+        TDF_Tool::Label(myBaseDocumentLab.Data(), anIter.Value(), aLab);
+        anIter.Next();
+      }
+      if (anIndex == anUpper) {
+        theLast = aLab;
+      } else {
+        theRef.Append(aLab);
+      }
+    }
+    return true;
+  }
+  return false;
+}
+
+void Selector_Algo::store(const TopoDS_Shape theShape)
+{
+  TNaming_Builder aBuilder(myLab);
+  aBuilder.Select(theShape, theShape);
+}
+
+bool Selector_Algo::sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2) {
+  if (!theShape1.IsNull() && !theShape2.IsNull() && theShape1.ShapeType() == theShape2.ShapeType())
+  {
+    if (theShape1.ShapeType() == TopAbs_FACE) { // check surfaces
+      TopLoc_Location aLoc1, aLoc2;
+      TopoDS_Face aFace1 = TopoDS::Face(theShape1);
+      Handle(Geom_Surface) aSurf1 = BRep_Tool::Surface(aFace1, aLoc1);
+      TopoDS_Face aFace2 = TopoDS::Face(theShape2);
+      Handle(Geom_Surface) aSurf2 = BRep_Tool::Surface(aFace2, aLoc2);
+      return aSurf1 == aSurf2 && aLoc1.IsEqual(aLoc2);
+    } else if (theShape1.ShapeType() == TopAbs_EDGE) { // check curves
+      TopLoc_Location aLoc1, aLoc2;
+      Standard_Real aFirst, aLast;
+      TopoDS_Edge anEdge1 = TopoDS::Edge(theShape1);
+      Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aLoc1, aFirst, aLast);
+      TopoDS_Edge anEdge2 = TopoDS::Edge(theShape2);
+      Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aLoc2, aFirst, aLast);
+      return aCurve1 == aCurve2 && aLoc1.IsEqual(aLoc2);
+    }
+  }
+  return false;
+}
+
+TopoDS_Shape Selector_Algo::value()
+{
+  Handle(TNaming_NamedShape) aNS;
+  if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+    return aNS->Get();
+  return TopoDS_Shape(); // empty, error shape
+}
+
+Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab)
+{
+  Handle(TDataStd_Integer) aTypeAttr;
+  if (!theLab.FindAttribute(kSEL_TYPE, aTypeAttr))
+    return NULL;
+  Selector_Type aType = Selector_Type(aTypeAttr->Get());
+  Selector_Algo* aResult = NULL;
+  switch (aType) {
+  case SELTYPE_CONTAINER: {
+    aResult = new Selector_Container;
+    break;
+  }
+  case SELTYPE_INTERSECT: {
+    aResult = new Selector_Intersect;
+    break;
+  }
+  case SELTYPE_MODIFICATION: {
+    aResult = new Selector_Modify;
+    break;
+  }
+  case SELTYPE_PRIMITIVE: {
+    aResult = new Selector_Primitive;
+    break;
+  }
+  case SELTYPE_FILTER_BY_NEIGHBOR: {
+    aResult = new Selector_FilterByNeighbors;
+    break;
+  }
+  case SELTYPE_WEAK_NAMING: {
+    aResult = new Selector_WeakName;
+    break;
+  }
+  default: { // unknown case
+  }
+  }
+  if (aResult) {
+    aResult->myLab = theLab;
+    aResult->myBaseDocumentLab = theBaseDocLab;
+    aResult->myGeometricalNaming = theLab.IsAttribute(kGEOMETRICAL_NAMING);
+    if (!aResult->restore()) {
+      delete aResult;
+      aResult = NULL;
+    }
+  }
+  return aResult;
+}
+
+Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab,
+  std::string theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+  Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab)
+{
+  Selector_Algo* aResult = NULL;
+  if (theName[0] == '[') { // intersection or container
+    switch(theShapeType) {
+    case TopAbs_COMPOUND:
+    case TopAbs_COMPSOLID:
+    case TopAbs_SHELL:
+    case TopAbs_WIRE:
+      aResult = new Selector_Container;
+      break;
+    case TopAbs_VERTEX:
+    case TopAbs_EDGE:
+    case TopAbs_FACE:
+      aResult = new Selector_Intersect;
+      break;
+    default:;
+    }
+  } else if (theName[0] == '(') { // filter by neighbors
+    aResult = new Selector_FilterByNeighbors;
+  } else if (theName.find(pureWeakNameID()) == 0) { // weak naming identifier
+    aResult = new Selector_WeakName;
+  } else if (theName.find('&') != std::string::npos) { // modification
+    aResult = new Selector_Modify;
+  } else { // primitive
+    aResult = new Selector_Primitive;
+  }
+  if (aResult) {
+    aResult->myLab = theLab;
+    aResult->myBaseDocumentLab = theBaseDocLab;
+    aResult->myGeometricalNaming = theGeomNaming;
+    theContextLab = aResult->restoreByName(theName, theShapeType, theNameGenerator);
+    if (theContextLab.IsNull()) {
+      delete aResult;
+      aResult = NULL;
+    }
+  }
+  return aResult;
+}
+
+void Selector_Algo::storeType(const Selector_Type theType)
+{
+  myLab.ForgetAllAttributes(true);
+  TDataStd_Integer::Set(myLab, kSEL_TYPE, (int)(theType));
+  if (myGeometricalNaming)
+    TDataStd_UAttribute::Set(myLab, kGEOMETRICAL_NAMING);
+}
+
+/// Returns true if theSub is in theContext shape
+static bool isInContext(const TopoDS_Shape& theContext, const TopoDS_Shape& theSub) {
+  for(TopExp_Explorer anExp(theContext, theSub.ShapeType()); anExp.More(); anExp.Next()) {
+    if (anExp.Current().IsSame(theSub))
+      return true;
+  }
+  return false;
+}
+
+bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const
+{
+  if (theResult.IsNull())
+    return false;
+  if (!TNaming_Tool::HasLabel(myLab, theResult)) {
+    if (theResult.ShapeType() == TopAbs_COMPOUND) { // do it for all elements of compound
+      BRep_Builder aBuilder;
+      TopoDS_Compound aResultingCompound;
+      aBuilder.MakeCompound(aResultingCompound);
+      bool aWasChanged = false;
+      for (TopoDS_Iterator anIter(theResult); anIter.More(); anIter.Next()) {
+        TopoDS_Shape aSub = anIter.Value();
+        if (findNewVersion(theContext, aSub))
+          aWasChanged = true;
+        aBuilder.Add(aResultingCompound, aSub);
+      }
+      if (aWasChanged)
+        theResult = aResultingCompound;
+      return aWasChanged;
+    }
+  } else {
+    // check theResult is in theContext
+    if (isInContext(theContext, theResult))
+      return false;
+    // searching the next modifications of the result shape in document
+    TopTools_MapOfShape aResultShapes;
+    for(TNaming_NewShapeIterator aBaseIter(theResult, myLab); aBaseIter.More(); aBaseIter.Next())
+    {
+      TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution();
+      if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+        TopoDS_Shape aNextModification = aBaseIter.Shape();
+        if (aNextModification.IsNull())
+          continue;
+        if (isInContext(theContext, aNextModification))
+          aResultShapes.Add(aNextModification);
+        else if (findNewVersion(theContext, aNextModification))
+          aResultShapes.Add(aNextModification);
+      }
+    }
+    if (aResultShapes.IsEmpty())
+      return false;
+    if (aResultShapes.Size() == 1) {
+      theResult = TopTools_MapIteratorOfMapOfShape(aResultShapes).Value();
+    } else { // make a compound of all results
+      BRep_Builder aBuilder;
+      TopoDS_Compound aResultingCompound;
+      aBuilder.MakeCompound(aResultingCompound);
+      for(TopTools_MapIteratorOfMapOfShape anIter(aResultShapes); anIter.More(); anIter.Next())
+        aBuilder.Add(aResultingCompound, anIter.Value());
+      theResult = aResultingCompound;
+    }
+    return true;
+  }
+  return false;
+}
diff --git a/src/Selector/Selector_Algo.h b/src/Selector/Selector_Algo.h
new file mode 100644 (file)
index 0000000..1492c46
--- /dev/null
@@ -0,0 +1,172 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Algo_H_
+#define Selector_Algo_H_
+
+#include "Selector.h"
+
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_LabelList.hxx>
+#include <TopoDS_Shape.hxx>
+
+class Selector_NameGenerator;
+
+/**\class Selector_Selector
+ * \ingroup DataModel
+ * \brief Base class for all kinds of selection algorithms.
+ */
+class Selector_Algo
+{
+  TopAbs_ShapeEnum myShapeType; ///< type of this shape
+
+  TDF_Label myLab; ///< label where this also may be located
+  TDF_Label myBaseDocumentLab; ///< an access-label of the document that may contain initial shapes
+  bool myGeometricalNaming; ///< flag that indicates that geometrical naming selection is enabled
+  bool myAlwaysGeometricalNaming; ///< to enable geometrical naming from beginning, at select
+  bool myUseNeighbors; ///< to use neighbors algorithms
+  bool myUseIntersections; ///< to use intersections algorithms
+
+public:
+  /// Type of a selector algorithm: on this type depends what is stored in this label and how to
+  /// restore it on update.
+  enum Selector_Type {
+    SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape type of container
+    SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects
+    SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label
+    SELTYPE_MODIFICATION, ///< modification of base shapes to the final label
+    SELTYPE_FILTER_BY_NEIGHBOR,  ///< identification by neighbor shapes in context
+    SELTYPE_WEAK_NAMING, ///< pure weak naming by weak index in context
+  };
+
+  /// Initializes the algorithm
+  SELECTOR_EXPORT Selector_Algo();
+
+  /// Initializes the selector structure on the label.
+  /// Stores the name data to restore after modification.
+  /// \param theContext whole shape that contains the selected sub-shape
+  /// \param theValue selected subshape
+  /// \param theGeometricalNaming treats selection with equal surfaces as one
+  /// \param theUseNeighbors enables searching algorithm by neighbors
+  /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes
+  SELECTOR_EXPORT static Selector_Algo* select(
+    const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+    const TDF_Label theAccess, const TDF_Label theBaseDocument,
+    const bool theGeometricalNaming = false,
+    const bool theUseNeighbors = true, const bool theUseIntersections = true,
+    const bool theAlwaysGeometricalNaming = false);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() = 0;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() = 0;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) = 0;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) = 0;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) = 0;
+  /// Returns the current sub-shape value (null if can not resolve)
+  SELECTOR_EXPORT TopoDS_Shape value();
+  /// Restores sub-algorithm of a given type by the storage-label
+  SELECTOR_EXPORT static Selector_Algo* restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab);
+  /// Restores the selected sub-algorithm by the naming name.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT static Selector_Algo* restoreByName(
+    TDF_Label theLab, TDF_Label theBaseDocLab, std::string theName,
+    const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+    Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab);
+
+  /// Returns true if the given shapes are based on the same geometry
+  static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2);
+
+  /// Creates a new selection algorithm for selection of all topology based on the same geometry
+  SELECTOR_EXPORT static Selector_Algo* relesectWithAllGeometry(
+    Selector_Algo* theOldAlgo, const TopoDS_Shape theContext);
+  /// Sets geometrical naming flag to true
+  void setGeometricalNaming()
+  {myGeometricalNaming = true;}
+
+protected:
+  /// Returns label where this algorithm is attached to, or just an access label to the document
+  const TDF_Label& label() const
+  {return myLab;}
+  /// Stores the array of references to theLab: references to elements of ref-list, then the last
+  void storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast);
+  /// Restores references to the labels: references to elements of ref-list, then the last
+  bool restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast);
+  /// Stores result of selection at the given label
+  void store(const TopoDS_Shape theShape);
+  /// Returns an access-label of the document that may contain initial shapes
+  const TDF_Label& baseDocument() const
+  {return myBaseDocumentLab;}
+  /// Returns the geometrical naming flag
+  bool geometricalNaming() const
+  {return myGeometricalNaming;}
+  /// Returns always geometrical naming flag
+  bool alwaysGeometricalNaming() const
+  {return myAlwaysGeometricalNaming;}
+  /// Returns use neighbors flag
+  bool useNeighbors() const
+  {return myUseNeighbors;}
+  /// Returns use intersections flag
+  bool useIntersections() const
+  {return myUseIntersections;}
+  /// Returns GUID for the weak index (integer attribute) of the sub-shape
+  static const Standard_GUID& weakID()
+  {
+    static const Standard_GUID kWEAK_INDEX("e9373a61-cabc-4ee8-aabf-aea47c62ed87");
+    return kWEAK_INDEX;
+  }
+  /// Returns GUID for the type of the shape, stored in case it is intersection or container
+  static const Standard_GUID& shapeTypeID()
+  {
+    static const Standard_GUID kSHAPE_TYPE("864b3267-cb9d-4107-bf58-c3ce1775b171");
+    return kSHAPE_TYPE;
+  }
+  /// string identifier of the weak name in modification or intersection types of algorithm
+  static const std::string& weakNameID()
+  {
+    static const std::string kWEAK_NAME_IDENTIFIER = "weak_name_";
+    return kWEAK_NAME_IDENTIFIER;
+  }
+  /// string identifier of the pure weak name
+  static const std::string& pureWeakNameID()
+  {
+    static const std::string kPURE_WEAK_NAME_IDENTIFIER = "_weak_name_";
+    return kPURE_WEAK_NAME_IDENTIFIER;
+  }
+  /// Stores the type of an algorithm in the data tree (in myLab)
+  void storeType(const Selector_Type theType);
+
+  /// Searches the newer version of the shape in the document if the base shape does not
+  /// belong to context. Returns it in theResult (if any). Returns true is theResult is changed.
+  bool findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const;
+};
+
+#endif
diff --git a/src/Selector/Selector_AlgoWithSubs.cpp b/src/Selector/Selector_AlgoWithSubs.cpp
new file mode 100644 (file)
index 0000000..c25014b
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_AlgoWithSubs.h>
+
+Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo()
+{}
+
+void Selector_AlgoWithSubs::clearSubAlgos()
+{
+  std::list<Selector_Algo*>::iterator anAlgo = mySubSelList.begin();
+  for(; anAlgo != mySubSelList.end(); anAlgo++) {
+    delete *anAlgo;
+  }
+  mySubSelList.clear();
+}
+
+Selector_AlgoWithSubs::~Selector_AlgoWithSubs()
+{
+  clearSubAlgos();
+}
+
+TDF_Label Selector_AlgoWithSubs::newSubLabel()
+{
+  return label().FindChild(int(mySubSelList.size() + 1));
+}
+
+bool Selector_AlgoWithSubs::append(Selector_Algo* theAlgo, const bool theEraseIfNull)
+{
+  if (theAlgo) {
+    mySubSelList.push_back(theAlgo);
+    return true;
+  }
+  if (theEraseIfNull)
+    clearSubAlgos();
+  return false;
+}
+
+std::list<Selector_Algo*>& Selector_AlgoWithSubs::list()
+{
+  return mySubSelList;
+}
diff --git a/src/Selector/Selector_AlgoWithSubs.h b/src/Selector/Selector_AlgoWithSubs.h
new file mode 100644 (file)
index 0000000..994953c
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_AlgoWithSubs_H_
+#define Selector_AlgoWithSubs_H_
+
+#include "Selector_Algo.h"
+
+#include <list>
+
+/**\class Selector_AlgoWithSubs
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: generic algorithm that contains sub-algorithms inside.
+ * It is base for Container, Intersection and FilterByNeighbours algorithms.
+ */
+class Selector_AlgoWithSubs: public Selector_Algo
+{
+  std::list<Selector_Algo*> mySubSelList; ///< list of sub-algorithms
+public:
+  /// Initializes selector
+  Selector_AlgoWithSubs();
+  /// Destructor
+  virtual ~Selector_AlgoWithSubs();
+  /// Erases the sub-algorithms stored
+  void clearSubAlgos();
+  /// Returns the next label for a new sub-selector created
+  TDF_Label newSubLabel();
+  /// Appends a new algorithm to the list, erases list if it is null (failed)
+  bool append(Selector_Algo* theAlgo, const bool theEraseIfNull = true);
+  /// Returns the stored list of sub-algorithms.
+  std::list<Selector_Algo*>& list();
+};
+
+#endif
diff --git a/src/Selector/Selector_Container.cpp b/src/Selector/Selector_Container.cpp
new file mode 100644 (file)
index 0000000..6ef129a
--- /dev/null
@@ -0,0 +1,192 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Container.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Container::Selector_Container() : Selector_AlgoWithSubs()
+{}
+
+bool Selector_Container::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+  myShapeType = theValue.ShapeType();
+
+  // iterate all sub-shapes and select them on sublabels
+  for(TopoDS_Iterator aSubIter(theValue); aSubIter.More(); aSubIter.Next()) {
+    Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aSubIter.Value(),
+      newSubLabel(), baseDocument(),
+      false, useNeighbors(), useIntersections()); //for subs no geometrical naming allowed
+    if (!append(aSubAlgo))
+      return false;
+  }
+  return true;
+}
+
+void Selector_Container::store()
+{
+  storeType(Selector_Algo::SELTYPE_CONTAINER);
+  // store all sub-selectors
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    (*aSubSel)->store();
+  }
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+}
+
+bool Selector_Container::restore()
+{
+  Handle(TDataStd_Integer) aShapeTypeAttr;
+  if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+    return false;
+  myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+  // restore sub-selectors
+  bool aSubResult = true;
+  for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+    Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+    if (!append(aSubSel, false)) {
+      break; // some empty label left in the end
+    }
+  }
+  return true;
+}
+
+TDF_Label Selector_Container::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  myShapeType = theShapeType;
+  TDF_Label aContext;
+  for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
+    size_t anEndPos = theName.find(']', aStart + 1);
+    if (anEndPos != std::string::npos) {
+      // there could be sub-intersections, so, [[...]] case; searching for other open-bracket
+      size_t aNextStart = theName.find('[', aStart + 1);
+      while(aNextStart != std::string::npos && aNextStart < anEndPos) {
+        anEndPos = theName.find(']', anEndPos + 1);
+        if (anEndPos == std::string::npos) {
+          return TDF_Label(); // invalid parentheses
+        }
+        aNextStart = theName.find('[', aNextStart + 1);
+      }
+      if (anEndPos == std::string::npos)
+        return TDF_Label(); // invalid parentheses
+      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
+      switch (myShapeType) {
+      case TopAbs_COMPSOLID: aSubShapeType = TopAbs_SOLID; break;
+      case TopAbs_WIRE: aSubShapeType = TopAbs_EDGE; break;
+      default:;
+      }
+      TDF_Label aSubContext;
+      Selector_Algo* aSubSel =
+        Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType,
+          geometricalNaming(), theNameGenerator, aSubContext);
+      if (!append(aSubSel))
+        return TDF_Label();
+
+      if (aSubContext.IsNull()) {
+        delete aSubSel;
+        clearSubAlgos();
+        return TDF_Label();
+      }
+      if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+        if (!theNameGenerator->isLater(aContext, aSubContext))
+          aContext = aSubContext;
+      } else {
+        aContext = aSubContext;
+      }
+    } else
+      return TDF_Label(); // invalid parentheses
+    aStart = anEndPos; // for recursive parenthesis set start on the current end
+  }
+  return aContext;
+}
+
+bool Selector_Container::solve(const TopoDS_Shape& theContext)
+{
+  TopoDS_Shape aResult;
+
+  TopoDS_Builder aBuilder;
+  switch(myShapeType) {
+  case TopAbs_COMPOUND: {
+    TopoDS_Compound aComp;
+    aBuilder.MakeCompound(aComp);
+    aResult = aComp;
+    break;
+  }
+  case TopAbs_COMPSOLID: {
+    TopoDS_CompSolid aComp;
+    aBuilder.MakeCompSolid(aComp);
+    aResult = aComp;
+    break;
+  }
+  case TopAbs_SHELL: {
+    TopoDS_Shell aShell;
+    aBuilder.MakeShell(aShell);
+    aResult = aShell;
+    break;
+  }
+  case TopAbs_WIRE: {
+    TopoDS_Wire aWire;
+    aBuilder.MakeWire(aWire);
+    aResult = aWire;
+    break;
+  }
+  }
+  TopoDS_ListOfShape aSubSelectorShapes;
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    if (!(*aSubSel)->solve(theContext)) {
+      return false;
+    }
+    aBuilder.Add(aResult, (*aSubSel)->value());
+  }
+  if (!aResult.IsNull()) {
+    Selector_Algo::store(aResult);
+    return true;
+  }
+  return false;
+}
+
+std::string Selector_Container::name(Selector_NameGenerator* theNameGenerator)
+{
+  std::string aResult;
+  // add names of sub-components one by one in "[]"
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    aResult += '[';
+    aResult += (*aSubSel)->name(theNameGenerator);
+    aResult += ']';
+  }
+  return aResult;
+}
diff --git a/src/Selector/Selector_Container.h b/src/Selector/Selector_Container.h
new file mode 100644 (file)
index 0000000..668b651
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Container_H_
+#define Selector_Container_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_Container
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: selected shape is a container of sub-shapes that must
+ * be named one by one.
+ */
+class Selector_Container: public Selector_AlgoWithSubs
+{
+  TopAbs_ShapeEnum myShapeType; ///< type of this container
+public:
+  /// Initializes the selection of this kind
+  SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+  /// Initializes selector
+  Selector_Container();
+
+  friend class Selector_Algo;
+};
+
+#endif
diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp
new file mode 100644 (file)
index 0000000..09e0ab3
--- /dev/null
@@ -0,0 +1,369 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_FilterByNeighbors.h>
+
+#include <Selector_NameGenerator.h>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDF_ChildIterator.hxx>
+
+// array of the neighbor levels
+static const Standard_GUID kLEVELS_ARRAY("ee4c4b45-e859-4e86-aa4f-6eac68e0ca1f");
+
+Selector_FilterByNeighbors::Selector_FilterByNeighbors() : Selector_AlgoWithSubs()
+{}
+
+/// Searches neighbor of theLevel of neighborhood to theValue in theContex
+static void findNeighbors(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+  const int theLevel, TopTools_MapOfShape& theResult)
+{
+  TopAbs_ShapeEnum aConnectorType = TopAbs_VERTEX; // type of the connector sub-shapes
+  if (theValue.ShapeType() == TopAbs_FACE)
+    aConnectorType = TopAbs_EDGE;
+  TopTools_MapOfShape aNBConnectors; // connector shapes that already belong to neighbors
+  for(TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); aValExp.Next()) {
+    aNBConnectors.Add(aValExp.Current());
+  }
+
+  TopTools_MapOfShape alreadyProcessed;
+  alreadyProcessed.Add(theValue);
+
+  for(int aLevel = 1; aLevel <= theLevel; aLevel++) {
+    TopoDS_ListOfShape aGoodCandidates;
+    TopExp_Explorer aCandidate(theContext, theValue.ShapeType());
+    for(; aCandidate.More(); aCandidate.Next()) {
+      if (alreadyProcessed.Contains(aCandidate.Current()))
+        continue;
+      TopExp_Explorer aCandConnector(aCandidate.Current(), aConnectorType);
+      for(; aCandConnector.More(); aCandConnector.Next()) {
+        if (aNBConnectors.Contains(aCandConnector.Current())) // candidate is neighbor
+          break;
+      }
+      if (aCandConnector.More()) {
+        if (aLevel == theLevel) { // add a NB into result: it is connected to other neighbors
+          theResult.Add(aCandidate.Current());
+        } else { // add to the NB of the current level
+          aGoodCandidates.Append(aCandidate.Current());
+        }
+      }
+    }
+    if (aLevel != theLevel) { // good candidates are added to neighbor of this level by connectors
+      for(TopoDS_ListOfShape::Iterator aGood(aGoodCandidates); aGood.More(); aGood.Next()) {
+        TopExp_Explorer aGoodConnector(aGood.Value(), aConnectorType);
+        for(; aGoodConnector.More(); aGoodConnector.Next()) {
+          aNBConnectors.Add(aGoodConnector.Current());
+        }
+        alreadyProcessed.Add(aGood.Value());
+      }
+    }
+  }
+}
+
+/// Searches the neighbor shape by neighbors defined in theNB in theContext shape
+static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext,
+  const std::list<std::pair<TopoDS_Shape, int> >& theNB, const bool theGeometrical)
+{
+  // searching for neighbors with minimum level
+  int aMinLevel = 0;
+  std::list<std::pair<TopoDS_Shape, int> >::const_iterator aNBIter = theNB.cbegin();
+  for(; aNBIter != theNB.cend(); aNBIter++) {
+    if (aMinLevel == 0 || aNBIter->second < aMinLevel) {
+      aMinLevel = aNBIter->second;
+    }
+  }
+  // collect all neighbors which are neighbors of sub-shapes with minimum level
+  bool aFirst = true;
+  TopoDS_ListOfShape aMatches;
+  for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) {
+    if (aNBIter->second == aMinLevel) {
+      TopTools_MapOfShape aThisNBs;
+      findNeighbors(theContext, aNBIter->first, aMinLevel, aThisNBs);
+      // aMatches must contain common part of all NBs lists
+      for(TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); aThisNB.Next()) {
+        if (aFirst) {
+          aMatches.Append(aThisNB.Value());
+        } else {
+          // remove all in aMatches which are not in this NBs
+          for(TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More(); ) {
+            if (aThisNBs.Contains(aMatch.Value())) {
+              aMatch.Next();
+            } else {
+              aMatches.Remove(aMatch);
+            }
+          }
+        }
+      }
+      aFirst = false;
+    }
+  }
+  if (aMatches.IsEmpty())
+    return TopoDS_Shape(); // not found any candidate
+  if (aMatches.Extent() == 1)
+    return aMatches.First(); // already found good candidate
+  TopoDS_Compound aResultCompound; // in case of geometrical name and many candidates
+  // iterate all matches to find by other (higher level) neighbors the best candidate
+  TopoDS_Shape aGoodCandidate;
+  TopTools_MapOfShape aGoodCandidates; // already added good candidates to the map
+  for(TopoDS_ListOfShape::Iterator aCandidate(aMatches); aCandidate.More(); aCandidate.Next()) {
+    bool aValidCadidate = true;
+    for(int aLevel = aMinLevel + 1; true; aLevel++) {
+      bool aFooundHigherLevel = false;
+      TopoDS_ListOfShape aLevelNBs;
+      for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) {
+        if (aNBIter->second == aLevel)
+          aLevelNBs.Append(aNBIter->first);
+        else if (aNBIter->second >= aLevel)
+          aFooundHigherLevel = true;
+      }
+      if (!aFooundHigherLevel && aLevelNBs.IsEmpty()) { // iterated all, so, good candidate
+        if (aGoodCandidate.IsNull()) {
+          aGoodCandidate = aCandidate.Value();
+        } else { // another good candidate
+          if (theGeometrical && Selector_Algo::sameGeometry(aGoodCandidate, aCandidate.Value())) {
+            if (!aGoodCandidates.Add(aCandidate.Value()))
+              break;
+            static TopoDS_Builder aBuilder;
+            if (aResultCompound.IsNull()) {
+              aBuilder.MakeCompound(aResultCompound);
+              aBuilder.Add(aResultCompound, aGoodCandidate);
+            }
+            aBuilder.Add(aResultCompound, aCandidate.Value());
+          } else
+            return TopoDS_Shape();
+        }
+      }
+      if (!aLevelNBs.IsEmpty()) {
+        TopTools_MapOfShape aNBsOfCandidate;
+        findNeighbors(theContext, aCandidate.Value(), aLevel, aNBsOfCandidate);
+        // check all stored neighbors are in the map of real neighbors
+        for(TopoDS_ListOfShape::Iterator aLevIter(aLevelNBs); aLevIter.More(); aLevIter.Next()) {
+          if (!aNBsOfCandidate.Contains(aLevIter.Value())) {
+            aValidCadidate = false;
+            break;
+          }
+        }
+      }
+      if (!aValidCadidate) // candidate is not valid, break the checking
+        break;
+    }
+  }
+  if (!aResultCompound.IsNull())
+    return aResultCompound;
+  return aGoodCandidate;
+}
+
+bool Selector_FilterByNeighbors::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+  myShapeType = theValue.ShapeType();
+  // searching by neighbors
+  std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
+  for(int aLevel = 1; true; aLevel++) {
+    TopTools_MapOfShape aNewNB;
+    findNeighbors(theContext, theValue, aLevel, aNewNB);
+    if (aNewNB.Extent() == 0) { // there are no neighbors of the given level, stop iteration
+      break;
+    }
+    // iterate by the order in theContext to keep same naming names
+    TopExp_Explorer anOrder(theContext, theValue.ShapeType());
+    TopTools_MapOfShape alreadyProcessed;
+    for (; anOrder.More(); anOrder.Next()) {
+      if (alreadyProcessed.Add(anOrder.Current()) && aNewNB.Contains(anOrder.Current())) {
+        TopoDS_Shape aNewNBShape = anOrder.Current();
+        // check which can be named correctly, without "by neighbors" type
+        Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNewNBShape,
+          newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections());
+        if (aSubAlgo) {
+          // add to list of good NBs
+          aNBs.push_back(std::pair<TopoDS_Shape, int>(aNewNBShape, aLevel));
+        }
+        delete aSubAlgo; // don't keep this sub-algo until all subs and whole validity are checked
+      }
+    }
+    TopoDS_Shape aResult = findNeighbor(theContext, aNBs, geometricalNaming());
+    if (!aResult.IsNull() && aResult.IsSame(theValue)) {
+      std::list<std::pair<TopoDS_Shape, int> >::iterator aNBIter = aNBs.begin();
+      for(; aNBIter != aNBs.end(); aNBIter++) {
+        Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNBIter->first,
+          newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections());
+        if (append(aSubAlgo)) {
+          myNBLevel.push_back(aNBIter->second);
+        } else {
+          delete aSubAlgo;
+        }
+      }
+      return true;
+    }
+  }
+  return false;
+}
+
+void Selector_FilterByNeighbors::store()
+{
+  storeType(Selector_Algo::SELTYPE_FILTER_BY_NEIGHBOR);
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+  // store numbers of levels corresponded to the neighbors in sub-selectors
+  Handle(TDataStd_IntegerArray) anArray =
+    TDataStd_IntegerArray::Set(label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1);
+  std::list<int>::iterator aLevel = myNBLevel.begin();
+  for(int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) {
+    anArray->SetValue(anIndex, Abs(*aLevel));
+  }
+  // store all sub-selectors
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    (*aSubSel)->store();
+  }
+}
+
+bool Selector_FilterByNeighbors::restore()
+{
+  Handle(TDataStd_Integer) aShapeTypeAttr;
+  if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+    return false;
+  myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+  // restore levels indices
+  Handle(TDataStd_IntegerArray) anArray;
+  if (!label().FindAttribute(kLEVELS_ARRAY, anArray))
+    return false;
+  for(int anIndex = 0; anIndex <= anArray->Upper(); anIndex++) {
+    myNBLevel.push_back(anArray->Value(anIndex));
+  }
+  // restore sub-selectors
+  bool aSubResult = true;
+  for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+    Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+    if (!append(aSubSel, false)) {
+      if (!aSub.Value().HasAttribute())
+        break; // some empty label left in the end
+      // some selector fails, try to use rest selectors, myNBLevel becomes negative: unused
+      if (myNBLevel.size() > list().size()) {
+        std::list<int>::iterator aListIter = myNBLevel.begin();
+        for(int a = 0; a < list().size(); a++)
+          aListIter++;
+        *aListIter = -*aListIter;
+        list().push_back(NULL);
+      }
+    }
+  }
+  return myNBLevel.size() == list().size() && !myNBLevel.empty();
+}
+
+TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  myShapeType = theShapeType;
+  TDF_Label aContext;
+  for (size_t aStart = 0; aStart != std::string::npos;
+    aStart = theName.find('(', aStart + 1)) {
+    size_t anEndPos = theName.find(')', aStart + 1);
+    if (anEndPos != std::string::npos) {
+      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      TDF_Label aSubContext;
+      Selector_Algo* aSubSel =
+        Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType,
+          geometricalNaming(), theNameGenerator, aSubContext);
+      if (!append(aSubSel))
+        return TDF_Label();
+
+      if (aSubContext.IsNull()) {
+        delete aSubSel;
+        clearSubAlgos();
+        return TDF_Label();
+      }
+      if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+        if (!theNameGenerator->isLater(aContext, aSubContext))
+          aContext = aSubContext;
+      } else {
+        aContext = aSubContext;
+      }
+      if (!aContext.IsNull()) // for filters by neighbor the latest context shape is vital
+        aContext = theNameGenerator->newestContext(aContext);
+
+      // searching for the level index
+      std::string aLevel;
+      for (anEndPos++; anEndPos != std::string::npos &&
+        theName[anEndPos] != '(' && theName[anEndPos] != 0;
+        anEndPos++) {
+        aLevel += theName[anEndPos];
+      }
+      if (aLevel.empty())
+        myNBLevel.push_back(1); // by default it is 1
+      else {
+        int aNum = atoi(aLevel.c_str());
+        if (aNum > 0)
+          myNBLevel.push_back(aNum);
+        else
+          return TDF_Label(); // invalid number
+      }
+    } else
+      return TDF_Label(); // invalid parentheses
+  }
+  return aContext;
+}
+
+bool Selector_FilterByNeighbors::solve(const TopoDS_Shape& theContext)
+{
+  TopoDS_Shape aResult;
+
+  std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
+  std::list<int>::iterator aLevel = myNBLevel.begin();
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++, aLevel++) {
+    if (*aLevel < 0)
+      continue; // skip because sub-selector is not good
+    if ((*aSubSel)->solve(theContext)) {
+      aNBs.push_back(std::pair<TopoDS_Shape, int>((*aSubSel)->value(), *aLevel));
+    }
+  }
+  if (!aNBs.empty()) {
+    aResult = findNeighbor(theContext, aNBs, geometricalNaming());
+    if (!aResult.IsNull()) {
+      Selector_Algo::store(aResult);
+      return true;
+    }
+  }
+  return false;
+}
+
+std::string Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGenerator)
+{
+  // (nb1)level_if_more_than_1(nb2)level_if_more_than_1(nb3)level_if_more_than_1
+  std::string aResult;
+  std::list<int>::iterator aLevel = myNBLevel.begin();
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++, aLevel++) {
+    if (!*aSubSel)
+      continue;
+    aResult += "(" + (*aSubSel)->name(theNameGenerator) + ")";
+    if (*aLevel > 1) {
+      std::ostringstream aLevelStr;
+      aLevelStr<<*aLevel;
+      aResult += aLevelStr.str();
+    }
+  }
+  return aResult;
+}
diff --git a/src/Selector/Selector_FilterByNeighbors.h b/src/Selector/Selector_FilterByNeighbors.h
new file mode 100644 (file)
index 0000000..721e4a9
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_FilterByNeighbors_H_
+#define Selector_FilterByNeighbors_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_FilterByNeighbors
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: selected shape is identified by neighbor faces of
+ * the same type. Or neighbors of neighbors are considered, etc.
+ * be named one by one.
+ */
+class Selector_FilterByNeighbors: public Selector_AlgoWithSubs
+{
+  TopAbs_ShapeEnum myShapeType; ///< type of this shape
+  std::list<int> myNBLevel; ///< list of integers corresponding to subs neighborhood level
+public:
+  /// Initializes the selection of this kind
+  SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+  /// Initializes selector
+  Selector_FilterByNeighbors();
+
+  friend class Selector_Algo;
+};
+
+#endif
diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp
new file mode 100644 (file)
index 0000000..5d9ab36
--- /dev/null
@@ -0,0 +1,308 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Intersect.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Intersect::Selector_Intersect() : Selector_AlgoWithSubs()
+{
+  myWeakIndex = -1; // no index by default
+}
+
+// returns the sub-shapes of theSubType which belong to all theShapes (so, common or intersection)
+static void commonShapes(const TopoDS_ListOfShape& theShapes, TopAbs_ShapeEnum theSubType,
+  TopoDS_ListOfShape& theResults)
+{
+  TopoDS_ListOfShape::iterator aSubSel = theShapes.begin();
+  for(; aSubSel != theShapes.end(); aSubSel++) {
+    TopTools_MapOfShape aCurrentMap;
+    for(TopExp_Explorer anExp(*aSubSel, theSubType); anExp.More(); anExp.Next()) {
+      if (aCurrentMap.Add(anExp.Current()) && aSubSel == theShapes.begin())
+        theResults.Append(anExp.Current());
+    }
+    if (aSubSel != theShapes.begin()) { // remove from common shapes not in aCurrentMap
+      for(TopoDS_ListOfShape::Iterator aComIter(theResults); aComIter.More(); ) {
+        if (aCurrentMap.Contains(aComIter.Value()))
+          aComIter.Next();
+        else
+          theResults.Remove(aComIter);
+      }
+    }
+  }
+}
+
+bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+  if (!useIntersections())
+    return false;
+  myShapeType = theValue.ShapeType();
+  TopAbs_ShapeEnum aSelectionType = myShapeType;
+  // try to find the shape of the higher level type in the context shape
+  bool aFacesTried = false; // for identification of vertices, faces are tried, then edges
+  TopoDS_ListOfShape aLastCommon; // store not good commons, but which may be used for weak naming
+  TopoDS_ListOfShape aLastIntersectors;
+  while(aSelectionType != TopAbs_FACE || !aFacesTried) {
+    if (aSelectionType == TopAbs_FACE) {
+      if (theValue.ShapeType() != TopAbs_VERTEX)
+        break;
+      aFacesTried = true;
+      aSelectionType = TopAbs_EDGE;
+    } else
+      aSelectionType = TopAbs_FACE;
+    TopTools_MapOfShape anIntersectors; // shapes of aSelectionType that contain theValue
+    TopoDS_ListOfShape anIntList; // same as anIntersectors
+    for(TopExp_Explorer aSelExp(theContext, aSelectionType); aSelExp.More(); aSelExp.Next()) {
+      if (aSelectionType == TopAbs_EDGE &&
+        BRep_Tool::Degenerated(TopoDS::Edge(aSelExp.Current())))
+        continue;
+      TopExp_Explorer aSubExp(aSelExp.Current(), theValue.ShapeType());
+      for(; aSubExp.More(); aSubExp.Next()) {
+        if (aSubExp.Current().IsSame(theValue)) {
+          if (anIntersectors.Add(aSelExp.Current()))
+            anIntList.Append(aSelExp.Current());
+          break;
+        }
+      }
+    }
+    // check that solution is only one
+    TopoDS_ListOfShape aCommon;
+    commonShapes(anIntList, theValue.ShapeType(), aCommon);
+    if (aCommon.Extent() == 1 && aCommon.First().IsSame(theValue)) {
+      // name the intersectors
+      TopoDS_ListOfShape::Iterator anInt(anIntList);
+      for (; anInt.More(); anInt.Next()) {
+        Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(),
+          newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false);
+        if (!append(aSubAlgo))
+          break; // if some selector is failed, stop and search another solution
+      }
+      if (!anInt.More()) { // all intersectors were correctly named
+        return true;
+      }
+    } else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty())  {
+      aLastCommon = aCommon;
+      aLastIntersectors = anIntList;
+    }
+  }
+  if (aLastCommon.Extent() > 1) {
+    if (alwaysGeometricalNaming()) {
+      TopoDS_ListOfShape::Iterator aCommonIter(aLastCommon);
+      TopoDS_Shape aFirst = aCommonIter.Value();
+      for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+        if (!sameGeometry(aFirst, aCommonIter.Value()))
+          break;
+      }
+      if (!aCommonIter.More()) { // all geometry is same, result is a compound
+        return true;
+      }
+    }
+    // weak naming to distinguish commons coming from intersection
+    Selector_NExplode aNexp(aLastCommon);
+    myWeakIndex = aNexp.index(theValue);
+    if (myWeakIndex != -1) {
+      // name the intersectors
+      TopoDS_ListOfShape::Iterator anInt(aLastIntersectors);
+      for (; anInt.More(); anInt.Next()) {
+        Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(),
+          newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false);
+        if (!append(aSubAlgo))
+          break; // if some selector is failed, stop and search another solution
+      }
+      if (!anInt.More()) { // all intersectors were correctly named
+        return true;
+      }
+    }
+  }
+  return false; // solution does not found
+}
+
+void Selector_Intersect::store()
+{
+  storeType(Selector_Algo::SELTYPE_INTERSECT);
+  // store all sub-selectors
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    (*aSubSel)->store();
+  }
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+  if (myWeakIndex != -1) {
+    TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+  }
+}
+
+bool Selector_Intersect::restore()
+{
+  Handle(TDataStd_Integer) aShapeTypeAttr;
+  if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+    return false;
+  myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+  // restore sub-selectors
+  bool aSubResult = true;
+  for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+    Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+    if (!append(aSubSel, false)) {
+      break; // some empty label left in the end
+    }
+  }
+  Handle(TDataStd_Integer) aWeakInt;
+  if (label().FindAttribute(weakID(), aWeakInt)) {
+    myWeakIndex = aWeakInt->Get();
+  }
+  return true;
+}
+
+TDF_Label Selector_Intersect::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  myShapeType = theShapeType;
+  TDF_Label aContext;
+  for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
+    size_t anEndPos = theName.find(']', aStart + 1);
+    if (anEndPos != std::string::npos) {
+      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
+        std::string aWeakIndex = aSubStr.substr(weakNameID().size());
+        myWeakIndex = atoi(aWeakIndex.c_str());
+        continue;
+      }
+      TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
+      if (anEndPos != std::string::npos && anEndPos + 1 < theName.size()) {
+        char aShapeChar = theName[anEndPos + 1];
+        if (theName[anEndPos + 1] != '[') {
+          switch(aShapeChar) {
+          case 'e': aSubShapeType = TopAbs_EDGE; break;
+          case 'v': aSubShapeType = TopAbs_VERTEX; break;
+          default:;
+          }
+        }
+      }
+      TDF_Label aSubContext;
+      Selector_Algo* aSubSel =
+        Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType,
+          geometricalNaming(), theNameGenerator, aSubContext);
+      if (!append(aSubSel))
+        return TDF_Label();
+
+      if (aSubContext.IsNull()) {
+        delete aSubSel;
+        clearSubAlgos();
+        return TDF_Label();
+      }
+      if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+        if (!theNameGenerator->isLater(aContext, aSubContext))
+          aContext = aSubContext;
+      } else {
+        aContext = aSubContext;
+      }
+    } else
+      return TDF_Label(); // invalid parentheses
+  }
+  return aContext;
+}
+
+bool Selector_Intersect::solve(const TopoDS_Shape& theContext)
+{
+  TopoDS_Shape aResult;
+  TopoDS_ListOfShape aSubSelectorShapes;
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    if (!(*aSubSel)->solve(theContext)) {
+      return false;
+    }
+    aSubSelectorShapes.Append((*aSubSel)->value());
+  }
+  TopoDS_ListOfShape aCommon; // common sub shapes in each sub-selector (a result)
+  commonShapes(aSubSelectorShapes, myShapeType, aCommon);
+  if (aCommon.Extent() != 1) {
+    if (myWeakIndex != -1) {
+      Selector_NExplode aNexp(aCommon);
+      aResult = aNexp.shape(myWeakIndex);
+    } else if (geometricalNaming() && aCommon.Extent() > 1) {
+      // check results are on the same geometry, create compound
+      TopoDS_ListOfShape::Iterator aCommonIter(aCommon);
+      TopoDS_Shape aFirst = aCommonIter.Value();
+      for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+        if (!sameGeometry(aFirst, aCommonIter.Value()))
+          break;
+      }
+      if (!aCommonIter.More()) { // all geometry is same, create a result compound
+        TopoDS_Builder aBuilder;
+        TopoDS_Compound aCompound;
+        aBuilder.MakeCompound(aCompound);
+        for(aCommonIter.Initialize(aCommon); aCommonIter.More(); aCommonIter.Next()) {
+          aBuilder.Add(aCompound, aCommonIter.Value());
+        }
+        aResult = aCompound;
+      }
+    } else {
+      return false;
+    }
+  } else {
+    aResult = aCommon.First();
+  }
+  if (!aResult.IsNull()) {
+    Selector_Algo::store(aResult);
+    return true;
+  }
+  return false;
+}
+
+std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator)
+{
+  std::string aResult;
+  // add names of sub-components one by one in "[]" +optionally [weak_name_1]
+  std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+  for(; aSubSel != list().cend(); aSubSel++) {
+    aResult += '[';
+    aResult += (*aSubSel)->name(theNameGenerator);
+    aResult += ']';
+    TopoDS_Shape aSubVal = (*aSubSel)->value();
+    if (!aSubVal.IsNull()) {
+      TopAbs_ShapeEnum aSubType = aSubVal.ShapeType();
+      if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored
+        switch(aSubType) {
+        case TopAbs_EDGE: aResult += "e"; break;
+        case TopAbs_VERTEX: aResult += "v"; break;
+        default:;
+        }
+      }
+    }
+  }
+  if (myWeakIndex != -1) {
+    std::ostringstream aWeakStr;
+    aWeakStr<<"["<<weakNameID()<<myWeakIndex<<"]";
+    aResult += aWeakStr.str();
+  }
+  return aResult;
+}
diff --git a/src/Selector/Selector_Intersect.h b/src/Selector/Selector_Intersect.h
new file mode 100644 (file)
index 0000000..e3e27ac
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Intersect_H_
+#define Selector_Intersect_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_Intersect
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: sub-shape is intersection of higher level objects.
+ */
+class Selector_Intersect: public Selector_AlgoWithSubs
+{
+  TopAbs_ShapeEnum myShapeType; ///< type of this shape
+  int myWeakIndex; ///< weak index in case intersection produces several shapes
+public:
+  /// Initializes the selection of this kind
+  SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+  /// Initializes selector
+  Selector_Intersect();
+
+  friend class Selector_Algo;
+};
+
+#endif
diff --git a/src/Selector/Selector_Modify.cpp b/src/Selector/Selector_Modify.cpp
new file mode 100644 (file)
index 0000000..d7d5d47
--- /dev/null
@@ -0,0 +1,339 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Modify.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
+#include <TNaming_Tool.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Modify::Selector_Modify() : Selector_Algo()
+{
+  myWeakIndex = -1; // no index by default
+}
+
+// adds to theResult all labels that contain initial shapes for theValue located in theFinal
+static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal,
+  const TopoDS_Shape& theValue,
+  bool aMustBeAtFinal, const TDF_Label& theAdditionalDocument, TDF_LabelList& theResult)
+{
+  bool aFoundAnyShape = false;
+  TNaming_SameShapeIterator aLabIter(theValue, theAccess);
+  for(; aLabIter.More(); aLabIter.Next()) {
+    Handle(TNaming_NamedShape) aNS;
+    if (aLabIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+      if (aMustBeAtFinal && aNS != theFinal)
+        continue; // looking for old at the same final label only
+      TNaming_Evolution anEvolution = aNS->Evolution();
+      if (anEvolution == TNaming_PRIMITIVE) {
+        // check that this is not in the results already
+        const TDF_Label aResult = aNS->Label();
+        TDF_LabelList::Iterator aResIter(theResult);
+        for(; aResIter.More(); aResIter.Next()) {
+          if (aResIter.Value().IsEqual(aResult))
+            break;
+        }
+        if (!aResIter.More()) // not found, so add this new
+          theResult.Append(aResult);
+        aFoundAnyShape = true;
+      }
+      if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+        for(TNaming_Iterator aThisIter(aNS); aThisIter.More(); aThisIter.Next()) {
+          if (aThisIter.NewShape().IsSame(theValue)) {
+            // continue recursively, null NS means that any NS are ok
+            findBases(theAccess, theFinal, aThisIter.OldShape(),
+              false, theAdditionalDocument, theResult);
+            aFoundAnyShape = true;
+          }
+        }
+      }
+    }
+  }
+  if (!aFoundAnyShape && !theAdditionalDocument.IsNull()) { // try to find in additional document
+    static TDF_Label anEmpty;
+    if (TNaming_Tool::HasLabel(theAdditionalDocument, theValue))
+      findBases(theAdditionalDocument, Handle(TNaming_NamedShape)(), theValue,
+        false, anEmpty, theResult);
+  }
+}
+
+/// Returns in theResults all shapes with history started in theBase and ended in theFinal
+static void findFinals(const TDF_Label& anAccess, const TopoDS_Shape& theBase,
+  const TDF_Label& theFinal,
+  const TDF_Label& theAdditionalDoc, TopTools_MapOfShape& theResults)
+{
+  if (TNaming_Tool::HasLabel(anAccess, theBase)) {
+    for(TNaming_NewShapeIterator aBaseIter(theBase, anAccess); aBaseIter.More(); aBaseIter.Next())
+    {
+      TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution();
+      if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+        if (aBaseIter.NamedShape()->Label().IsEqual(theFinal)) {
+          theResults.Add(aBaseIter.Shape());
+        } else {
+          findFinals(anAccess, aBaseIter.Shape(), theFinal, theAdditionalDoc, theResults);
+        }
+      }
+    }
+  }
+  if (!theAdditionalDoc.IsNull()) { // search additionally by the additional access label
+    static TDF_Label anEmpty;
+    findFinals(theAdditionalDoc, theBase, theFinal, anEmpty, theResults);
+  }
+}
+
+void Selector_Modify::findModificationResult(TopoDS_ListOfShape& theCommon) {
+  for(TDF_LabelList::Iterator aBase(myBases); aBase.More(); aBase.Next()) {
+    TDF_Label anAdditionalDoc; // this document if base is started in extra document
+    if (aBase.Value().Root() != label().Root()) {
+      anAdditionalDoc = label();
+    }
+    TopTools_MapOfShape aFinals;
+    for(TNaming_Iterator aBaseShape(aBase.Value()); aBaseShape.More(); aBaseShape.Next()) {
+      findFinals(aBase.Value(), aBaseShape.NewShape(), myFinal, anAdditionalDoc, aFinals);
+    }
+    if (!aFinals.IsEmpty()) {
+      if (theCommon.IsEmpty()) { // just copy all to common
+        for(TopTools_MapOfShape::Iterator aFinal(aFinals); aFinal.More(); aFinal.Next()) {
+          theCommon.Append(aFinal.Key());
+        }
+      } else { // keep only shapes presented in both lists
+        for(TopoDS_ListOfShape::Iterator aCommon(theCommon); aCommon.More(); ) {
+          if (aFinals.Contains(aCommon.Value())) {
+            aCommon.Next();
+          } else { // common is not found, remove it
+            theCommon.Remove(aCommon);
+          }
+        }
+      }
+    }
+  }
+}
+
+bool Selector_Modify::select(NCollection_List<Handle(TNaming_NamedShape)>& theModifList,
+  const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+  if (theModifList.Extent() > 1) { // searching for the best modification result: by context
+    Handle(TNaming_NamedShape) aCandidate;
+    NCollection_List<Handle(TNaming_NamedShape)>::Iterator aModIter(theModifList);
+    for (; !theModifList.IsEmpty() && aModIter.More(); aModIter.Next()) {
+      aCandidate = aModIter.Value();
+      TDF_Label aFatherLab = aCandidate->Label().Father();
+      Handle(TNaming_NamedShape) aFatherNS;
+      if (aFatherLab.FindAttribute(TNaming_NamedShape::GetID(), aFatherNS)) {
+        for (TNaming_Iterator anIter(aFatherNS); anIter.More(); anIter.Next()) {
+          if (theContext.IsSame(anIter.NewShape())) { // found the best modification
+            theModifList.Clear();
+            break;
+          }
+        }
+      }
+    }
+    // take the best candidate, or the last in the iteration
+    theModifList.Clear();
+    theModifList.Append(aCandidate);
+  }
+
+  if (!theModifList.IsEmpty()) {
+    // searching for all the base shapes of this modification
+    findBases(label(), theModifList.First(), theValue, true, baseDocument(), myBases);
+    if (!myBases.IsEmpty()) {
+      myFinal = theModifList.First()->Label();
+      TopoDS_ListOfShape aCommon;
+      findModificationResult(aCommon);
+      // trying to search by neighbors
+      if (aCommon.Extent() > 1) { // more complicated selection
+        if (alwaysGeometricalNaming()) {
+          TopoDS_ListOfShape::Iterator aCommonIter(aCommon);
+          TopoDS_Shape aFirst = aCommonIter.Value();
+          for (aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+            if (!sameGeometry(aFirst, aCommonIter.Value()))
+              break;
+          }
+          if (!aCommonIter.More()) { // all geometry is same, result is a compound
+            return true;
+          }
+        }
+      } else if (aCommon.Extent() == 1) {
+        return true; // simple modification
+      }
+      // weak naming between the common results
+      Selector_NExplode aNexp(aCommon);
+      myWeakIndex = aNexp.index(theValue);
+      return myWeakIndex != -1;
+    }
+    // weak naming case
+    TopoDS_ListOfShape aCommon;
+    myFinal = theModifList.First()->Label();
+    Handle(TNaming_NamedShape) aNS;
+    if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+      for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) {
+        const TopoDS_Shape& aNewShape = aFinalIter.NewShape();
+        if (!aNewShape.IsNull())
+          aCommon.Append(aNewShape);
+      }
+    }
+    Selector_NExplode aNexp(aCommon);
+    myWeakIndex = aNexp.index(theValue);
+    return myWeakIndex != -1;
+  }
+  return false;
+}
+
+void Selector_Modify::store()
+{
+  storeType(Selector_Algo::SELTYPE_MODIFICATION);
+  storeBaseArray(myBases, myFinal);
+  if (myWeakIndex != -1) {
+    TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+  }
+}
+
+bool Selector_Modify::restore()
+{
+  if (restoreBaseArray(myBases, myFinal)) {
+    Handle(TDataStd_Integer) aWeakInt;
+    if (label().FindAttribute(weakID(), aWeakInt)) {
+      myWeakIndex = aWeakInt->Get();
+    }
+    return true;
+  }
+  return false;
+}
+
+TDF_Label Selector_Modify::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  TDF_Label aContext;
+  for(size_t anEnd, aStart = 0; aStart != std::string::npos; aStart = anEnd) {
+    if (aStart != 0)
+      aStart++;
+    anEnd = theName.find('&', aStart);
+    std::string aSubStr =
+      theName.substr(aStart, anEnd == std::string::npos ? anEnd : anEnd - aStart);
+    if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
+      std::string aWeakIndex = aSubStr.substr(weakNameID().size());
+      myWeakIndex = atoi(aWeakIndex.c_str());
+      continue;
+    }
+    TDF_Label aSubContext, aValue;
+    if (!theNameGenerator->restoreContext(aSubStr, aSubContext, aValue))
+      return TDF_Label(); // can not restore
+    if(aSubContext.IsNull() || aValue.IsNull())
+      return TDF_Label(); // can not restore
+    if (myFinal.IsNull()) {
+      myFinal = aValue;
+      aContext = aSubContext;
+    } else
+      myBases.Append(aValue);
+  }
+  return aContext;
+}
+
+bool Selector_Modify::solve(const TopoDS_Shape& theContext)
+{
+  TopoDS_Shape aResult;
+  if (myBases.IsEmpty() && myWeakIndex > 0) { // weak name by the final shapes index
+    TopoDS_ListOfShape aCommon;
+    Handle(TNaming_NamedShape) aNS;
+    if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+      for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) {
+        const TopoDS_Shape& aNewShape = aFinalIter.NewShape();
+        if (!aNewShape.IsNull())
+          aCommon.Append(aNewShape);
+      }
+    }
+    Selector_NExplode aNexp(aCommon);
+    aResult = aNexp.shape(myWeakIndex);
+  } else { // standard case
+    TopoDS_ListOfShape aFinalsCommon; // final shapes presented in all results from bases
+    findModificationResult(aFinalsCommon);
+    if (aFinalsCommon.Extent() == 1) { // result is valid: found only one shape
+      aResult = aFinalsCommon.First();
+      findNewVersion(theContext, aResult);
+    } else if (aFinalsCommon.Extent() > 1 && myWeakIndex > 0) {
+      Selector_NExplode aNExp(aFinalsCommon);
+      aResult = aNExp.shape(myWeakIndex);
+      findNewVersion(theContext, aResult);
+    } else if (aFinalsCommon.Extent() > 1 && geometricalNaming()) {// if same geometry - compound
+      TopoDS_ListOfShape::Iterator aCommonIter(aFinalsCommon);
+      TopoDS_Shape aFirst = aCommonIter.Value();
+      for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+        if (!sameGeometry(aFirst, aCommonIter.Value()))
+          break;
+      }
+      if (!aCommonIter.More()) { // all geometry is same, create a result compound
+        TopoDS_Builder aBuilder;
+        TopoDS_Compound aCompound;
+        aBuilder.MakeCompound(aCompound);
+        for(aCommonIter.Initialize(aFinalsCommon); aCommonIter.More(); aCommonIter.Next()) {
+          TopoDS_Shape aSub = aCommonIter.Value();
+          findNewVersion(theContext, aSub);
+          aBuilder.Add(aCompound, aSub);
+        }
+        aResult = aCompound;
+      }
+
+    }
+  }
+
+  if (!aResult.IsNull()) {
+    Selector_Algo::store(aResult);
+    return true;
+  }
+  return false;
+}
+
+std::string Selector_Modify::name(Selector_NameGenerator* theNameGenerator)
+{
+  // final&base1&base2 +optionally: [weak_name_1]
+  std::string aResult;
+  Handle(TDataStd_Name) aName;
+  if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
+    return "";
+  aResult += theNameGenerator->contextName(myFinal) + "/" +
+    std::string(TCollection_AsciiString(aName->Get()).ToCString());
+  for(TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); aBase++) {
+    if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName))
+      return "";
+    aResult += "&";
+    aResult += theNameGenerator->contextName(*aBase) + "/" +
+      std::string(TCollection_AsciiString(aName->Get()).ToCString());
+  }
+  if (myWeakIndex != -1) {
+    std::ostringstream aWeakStr;
+    aWeakStr<<"&"<<weakNameID()<<myWeakIndex;
+    aResult += aWeakStr.str();
+  }
+  return aResult;
+}
diff --git a/src/Selector/Selector_Modify.h b/src/Selector/Selector_Modify.h
new file mode 100644 (file)
index 0000000..30bf737
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Modify_H_
+#define Selector_Modify_H_
+
+#include "Selector_Algo.h"
+
+#include <TNaming_NamedShape.hxx>
+
+#include <list>
+
+/**\class Selector_Modify
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: sub-shape is modification of primitive at some
+ * final stage.
+ */
+class Selector_Modify: public Selector_Algo
+{
+  TDF_Label myFinal; ///< final label of the primitive or generation, where the value is
+  TDF_LabelList myBases; ///< initial labels that contain shapes that produce the modification
+  int myWeakIndex; ///< weak index in case modification produces several shapes
+public:
+  /// Initializes the selection of this kind by list of named shapes where the modification results
+  /// are presented and the selected value.
+  SELECTOR_EXPORT bool select(NCollection_List<Handle(TNaming_NamedShape)>& theModifList,
+    const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+
+private:
+  /// Initializes selector
+  Selector_Modify();
+  /// Searches the final shapes presented in all results from bases basing on modification fields
+  void findModificationResult(TopoDS_ListOfShape& theCommon);
+
+  friend class Selector_Algo;
+};
+
+#endif
diff --git a/src/Selector/Selector_NExplode.cpp b/src/Selector/Selector_NExplode.cpp
new file mode 100644 (file)
index 0000000..5657a17
--- /dev/null
@@ -0,0 +1,196 @@
+// Copyright (C) 2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "Selector_NExplode.h"
+
+#include <TopoDS_Shape.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <GProp_GProps.hxx>
+#include <BRepGProp.hxx>
+#include <NCollection_DataMap.hxx>
+#include <Precision.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+#include <vector>
+#include <algorithm>
+
+static std::pair<double, double> ShapeToDouble (const TopoDS_Shape& S)
+{
+  // Computing of CentreOfMass
+  gp_Pnt GPoint;
+  double Len;
+
+  if (S.ShapeType() == TopAbs_VERTEX) {
+    GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
+    Len = (double)S.Orientation();
+  }
+  else {
+    GProp_GProps GPr;
+    if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
+      BRepGProp::LinearProperties(S, GPr);
+    }
+    else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
+      BRepGProp::SurfaceProperties(S, GPr);
+    }
+    else {
+      BRepGProp::VolumeProperties(S, GPr);
+    }
+    GPoint = GPr.CentreOfMass();
+    Len = GPr.Mass();
+  }
+
+  double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
+  return std::make_pair(dMidXYZ, Len);
+}
+
+/*!
+* \brief Sort shapes in the list by their coordinates.
+*/
+struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
+{
+  typedef NCollection_DataMap<TopoDS_Shape, std::pair<double, double> > DataMapOfShapeDouble;
+
+  CompareShapes(DataMapOfShapeDouble* theCashMap) : myMap(theCashMap) {}
+
+  bool operator() (const TopoDS_Shape& lhs, const TopoDS_Shape& rhs);
+
+  DataMapOfShapeDouble* myMap;
+};
+
+bool CompareShapes::operator() (const TopoDS_Shape& theShape1,
+  const TopoDS_Shape& theShape2)
+{
+  if (!myMap->IsBound(theShape1)) {
+    myMap->Bind(theShape1, ShapeToDouble(theShape1));
+  }
+
+  if (!myMap->IsBound(theShape2)) {
+    myMap->Bind(theShape2, ShapeToDouble(theShape2));
+  }
+
+  std::pair<double, double> val1 = myMap->Find(theShape1);
+  std::pair<double, double> val2 = myMap->Find(theShape2);
+
+  double tol = Precision::Confusion();
+  bool exchange = Standard_False;
+
+  double dMidXYZ = val1.first - val2.first;
+  if (dMidXYZ >= tol) {
+    exchange = Standard_True;
+  }
+  else if (Abs(dMidXYZ) < tol) {
+    double dLength = val1.second - val2.second;
+    if (dLength >= tol) {
+      exchange = Standard_True;
+    }
+    else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) {
+      // equal values possible on shapes such as two halves of a sphere and
+      // a membrane inside the sphere
+// LCOV_EXCL_START
+      // this part of code is taken from GEOM module, but can not reproduce in SHAPER
+      Bnd_Box box1,box2;
+      BRepBndLib::Add(theShape1, box1);
+      if (!box1.IsVoid()) {
+        BRepBndLib::Add(theShape2, box2);
+        Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
+        if (dSquareExtent >= tol) {
+          exchange = Standard_True;
+        }
+        else if (Abs(dSquareExtent) < tol) {
+          Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
+          box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+          val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+          box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+          val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+          if ((val1 - val2) >= tol) {
+            exchange = Standard_True;
+          }
+        }
+      }
+// LCOV_EXCL_STOP
+    } else // compare addresses if shapes are geometrically equal
+      return theShape1.TShape().get() > theShape2.TShape().get();
+  }
+
+  //return val1 < val2;
+  return !exchange;
+}
+
+Selector_NExplode::Selector_NExplode(const TopoDS_ListOfShape& theShapes)
+{
+  std::vector<TopoDS_Shape> aShapesVec;
+
+  for(TopoDS_ListOfShape::Iterator anIter(theShapes); anIter.More(); anIter.Next()) {
+      aShapesVec.push_back(anIter.Value());
+  }
+
+  CompareShapes::DataMapOfShapeDouble aCash;
+  CompareShapes shComp(&aCash);
+  std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+
+  std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
+  for (; anIter != aShapesVec.end(); ++anIter) {
+    mySorted.Append(*anIter);
+  }
+}
+
+Selector_NExplode::Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType)
+{
+  std::vector<TopoDS_Shape> aShapesVec;
+  TopTools_MapOfShape anAdded; // to avoid same shapes duplication
+  for(TopExp_Explorer anExp(theShape, theType); anExp.More(); anExp.Next()) {
+    if (anAdded.Add(anExp.Current()))
+     aShapesVec.push_back(anExp.Current());
+  }
+
+  CompareShapes::DataMapOfShapeDouble aCash;
+  CompareShapes shComp(&aCash);
+  std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+
+  std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
+  for (; anIter != aShapesVec.end(); ++anIter) {
+    mySorted.Append(*anIter);
+  }
+}
+
+
+int Selector_NExplode::index(const TopoDS_Shape& theSubShape)
+{
+  TopoDS_ListOfShape::Iterator anIter(mySorted);
+  for(int anIndex = 1; anIter.More(); anIter.Next(), anIndex++) {
+    if (anIter.Value().IsSame(theSubShape))
+      return anIndex;
+  }
+  return -1; // not found
+}
+
+TopoDS_Shape Selector_NExplode::shape(const int theIndex)
+{
+  TopoDS_ListOfShape::Iterator anIter(mySorted);
+  for(int anIndex = 1; anIter.More(); anIter.Next(), anIndex++) {
+    if (anIndex == theIndex)
+      return anIter.Value();
+  }
+  return TopoDS_Shape(); // not found
+}
diff --git a/src/Selector/Selector_NExplode.h b/src/Selector/Selector_NExplode.h
new file mode 100644 (file)
index 0000000..cb23b4d
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_NExplode_H_
+#define Selector_NExplode_H_
+
+#include "Selector.h"
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_ListOfShape.hxx>
+
+/// \class Selector_NExplode
+/// \ingroup DataModel
+/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9.
+/// Algorithm is copied from GEOM module, which uses nexplode Draw command from OCCT.
+/// Used for getting index of sub0shape in WeakNaming algorithm.
+class Selector_NExplode
+{
+ public:
+   /// \brief Initializes the sorted list of shapes by the shapes list.
+   SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape& theShapes);
+   /// \brief Initializes the sorted list of shapes by the context shape and type of sub-shapes.
+   SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType);
+
+   /// Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found.
+   SELECTOR_EXPORT int index(const TopoDS_Shape& theSubShape);
+   /// Returns a shape by an index (started from one). Returns null if not found.
+   SELECTOR_EXPORT TopoDS_Shape shape(const int theIndex);
+
+protected:
+  TopoDS_ListOfShape mySorted; ///< keep the ordered list of shapes
+};
+
+#endif
diff --git a/src/Selector/Selector_NameGenerator.cpp b/src/Selector/Selector_NameGenerator.cpp
new file mode 100644 (file)
index 0000000..0c4ed03
--- /dev/null
@@ -0,0 +1 @@
+#include <Selector_NameGenerator.h>
diff --git a/src/Selector/Selector_NameGenerator.h b/src/Selector/Selector_NameGenerator.h
new file mode 100644 (file)
index 0000000..6ac0f4c
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_NameGenerator_H_
+#define Selector_NameGenerator_H_
+
+#include "Selector.h"
+
+#include <TDF_Label.hxx>
+
+/**\class Selector_NameGenerator
+ * \ingroup DataModel
+ * \brief An interface for generation of the naming name basing on the current selection and
+ * document information. This requires higher-level data access, so, the caller of "name" method
+ * of Selector must implement this helper-class abstract methods.
+ */
+class Selector_NameGenerator
+{
+public:
+  /// empty constructor, nothing to add
+  Selector_NameGenerator() {};
+
+  /// This method returns the context name by the label of the sub-selected shape
+  virtual std::string contextName(const TDF_Label theSelectionLab) = 0;
+
+  /// This method restores by the context and value name the context label and
+  /// sub-label where the value is. Returns true if it is valid.
+  virtual bool restoreContext(std::string theName,
+    TDF_Label& theContext, TDF_Label& theValue) = 0;
+
+  /// Returns true if the first result is older than the second one in the tree of features
+  virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2) const = 0;
+
+  /// Returns the label of the newest context presented by the current one
+  virtual TDF_Label newestContext(const TDF_Label theCurrentContext) = 0;
+};
+
+#endif
diff --git a/src/Selector/Selector_Primitive.cpp b/src/Selector/Selector_Primitive.cpp
new file mode 100644 (file)
index 0000000..a2d1410
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Primitive.h>
+
+#include <Selector_NameGenerator.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+
+
+Selector_Primitive::Selector_Primitive() : Selector_Algo()
+{
+}
+
+void Selector_Primitive::select(const TDF_Label theFinalLabel)
+{
+  myFinal = theFinalLabel;
+}
+
+void Selector_Primitive::store()
+{
+  storeType(Selector_Algo::SELTYPE_PRIMITIVE);
+  static const TDF_LabelList anEmptyRefList;
+  storeBaseArray(anEmptyRefList, myFinal);
+}
+
+bool Selector_Primitive::restore()
+{
+  static TDF_LabelList anEmptyRefList;
+  return restoreBaseArray(anEmptyRefList, myFinal);
+}
+
+TDF_Label Selector_Primitive::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  TDF_Label aContext;
+  if (theNameGenerator->restoreContext(theName, aContext, myFinal)) {
+    if (myFinal.IsNull())
+      aContext.Nullify();
+  }
+  return aContext;
+}
+
+bool Selector_Primitive::solve(const TopoDS_Shape& theContext)
+{
+  Handle(TNaming_NamedShape) aNS;
+  if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+    TopoDS_Shape aResult = aNS->Get();
+    // if shape was modified and not exists in the context anymore, check evolution of this shape
+    // issue 2254 and similar (document CEA parametric first issue description)
+    findNewVersion(theContext, aResult);
+    Selector_Algo::store(aResult);
+    return true;
+  }
+  return false;
+}
+
+std::string Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
+{
+  Handle(TDataStd_Name) aName;
+  if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
+    return "";
+  std::string aResult = theNameGenerator->contextName(myFinal);
+  if (!aResult.empty())
+    aResult += "/" + std::string(TCollection_AsciiString(aName->Get()).ToCString());
+  return aResult;
+}
diff --git a/src/Selector/Selector_Primitive.h b/src/Selector/Selector_Primitive.h
new file mode 100644 (file)
index 0000000..ea8b23a
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Primitive_H_
+#define Selector_Primitive_H_
+
+#include "Selector_Algo.h"
+
+/**\class Selector_Primitive
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: exact referencing to alone shape in the data structure.
+ */
+class Selector_Primitive: public Selector_Algo
+{
+  TDF_Label myFinal; ///< final label of the where the value is
+public:
+  /// Initializes the selection of this kind
+  /// \param theLabel the final label with the primitive shape
+  SELECTOR_EXPORT void select(const TDF_Label theFinalLabel);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+  /// Initializes selector
+  Selector_Primitive();
+
+  friend class Selector_Algo;
+};
+
+#endif
diff --git a/src/Selector/Selector_Selector.cpp b/src/Selector/Selector_Selector.cpp
new file mode 100644 (file)
index 0000000..4ed6cae
--- /dev/null
@@ -0,0 +1,112 @@
+  // Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Selector.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_Algo.h>
+
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TNaming_NamedShape.hxx>
+
+Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab) :
+  myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL)
+{}
+
+Selector_Selector::~Selector_Selector()
+{
+  if (myAlgo)
+    delete myAlgo;
+}
+
+bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+  const bool theGeometricalNaming)
+{
+  if (theValue.IsNull() || theContext.IsNull())
+    return false;
+
+  myAlgo = Selector_Algo::select(theContext, theValue, myLab, myBaseDocumentLab,
+    theGeometricalNaming, true, true);
+
+  return myAlgo != NULL;
+}
+
+bool Selector_Selector::store(const TopoDS_Shape theContext)
+{
+  myAlgo->store();
+  return myAlgo->solve(theContext); // to update the selection shape on the label
+}
+
+bool Selector_Selector::restore(const TopoDS_Shape theContext)
+{
+  myAlgo = Selector_Algo::restoreByLab(myLab, myBaseDocumentLab);
+  if (myAlgo) {
+    return myAlgo->solve(theContext); // to update the selection shape on the label
+  }
+  return false;
+}
+
+TopoDS_Shape Selector_Selector::value()
+{
+  Handle(TNaming_NamedShape) aNS;
+  if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+    return aNS->Get();
+  return TopoDS_Shape(); // empty, error shape
+}
+
+std::string Selector_Selector::name(Selector_NameGenerator* theNameGenerator) {
+  return myAlgo->name(theNameGenerator);
+}
+
+TDF_Label Selector_Selector::restoreByName(
+  std::string theName, const TopAbs_ShapeEnum theShapeType,
+  Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming)
+{
+  TDF_Label aResult;
+  myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, theShapeType,
+    theGeometricalNaming, theNameGenerator, aResult);
+  if (myAlgo) {
+    return aResult;
+  }
+  return TDF_Label();
+}
+
+void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext)
+{
+  TopoDS_Shape aValue = value();
+  if (aValue.IsNull() || aValue.ShapeType() == TopAbs_COMPOUND)
+    return;
+
+  Selector_Algo* aNewAlgo = Selector_Algo::relesectWithAllGeometry(myAlgo, theContext);
+  if (aNewAlgo) {
+    aNewAlgo->store();
+    aNewAlgo->solve(theContext);
+    delete myAlgo;
+    myAlgo = aNewAlgo;
+  }
+}
+
+bool Selector_Selector::solve(const TopoDS_Shape theContext)
+{
+  return myAlgo->solve(theContext);
+}
diff --git a/src/Selector/Selector_Selector.h b/src/Selector/Selector_Selector.h
new file mode 100644 (file)
index 0000000..d3e5b8a
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Selector_H_
+#define Selector_Selector_H_
+
+#include "Selector.h"
+
+#include <TDF_Label.hxx>
+#include <TopoDS_Shape.hxx>
+
+class Selector_NameGenerator;
+class Selector_Algo;
+
+/**\class Selector_Selector
+ * \ingroup DataModel
+ * \brief Main object for selection of the sub-shapes in the parametrically updated
+ * shapes using topological naming mechanism.
+ */
+class Selector_Selector
+{
+  TDF_Label myLab; ///< main label where selector is performed
+  TDF_Label myBaseDocumentLab; ///< an access-label to the document that may contain initial shapes
+  Selector_Algo* myAlgo; ///< root algorithm of the selector
+
+public:
+  /// Initializes selector on the label
+  SELECTOR_EXPORT Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab = TDF_Label());
+
+  /// Destructor
+  SELECTOR_EXPORT ~Selector_Selector();
+
+  /// Initializes the selector structure on the label.
+  /// Stores the name data to restore after modification.
+  /// \param theContext whole shape that contains the selected sub-shape
+  /// \param theValue selected subshape
+  /// \param theGeometricalNaming treats selection with equal surfaces as one
+  /// \param theUseNeighbors enables searching algorithm by neighbors
+  /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes
+  SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+    const bool theGeometricalNaming = false);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT bool store(const TopoDS_Shape theContext);
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT bool restore(const TopoDS_Shape theContext);
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT TDF_Label restoreByName(
+    std::string theName, const TopAbs_ShapeEnum theShapeType,
+    Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming = false);
+
+  /// Returns the current sub-shape value (null if can not resolve)
+  SELECTOR_EXPORT TopoDS_Shape value();
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT std::string name(Selector_NameGenerator* theNameGenerator);
+
+  /// Makes the current local selection becomes all sub-shapes with same base geometry.
+  SELECTOR_EXPORT void combineGeometrical(const TopoDS_Shape theContext);
+
+  /// Stores the selected shape in he tree and returns true if shape found correctly
+  SELECTOR_EXPORT bool solve(const TopoDS_Shape theContext);
+};
+
+#endif
diff --git a/src/Selector/Selector_WeakName.cpp b/src/Selector/Selector_WeakName.cpp
new file mode 100644 (file)
index 0000000..6ede1c3
--- /dev/null
@@ -0,0 +1,139 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_WeakName.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TDataStd_Integer.hxx>
+
+Selector_WeakName::Selector_WeakName() : Selector_Algo()
+{
+}
+
+bool Selector_WeakName::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+  myShapeType = theValue.ShapeType();
+  Selector_NExplode aNexp(theContext, myShapeType);
+  myWeakIndex = aNexp.index(theValue);
+  if (myWeakIndex != -1) {
+    // searching for context shape label to store in myFinal
+    if (TNaming_Tool::HasLabel(label(), theContext)) {
+      for(TNaming_SameShapeIterator aShapes(theContext, label()); aShapes.More(); aShapes.Next())
+      {
+        Handle(TNaming_NamedShape) aNS;
+        if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+          TNaming_Evolution anEvolution = aNS->Evolution();
+          if (anEvolution == TNaming_PRIMITIVE || anEvolution == TNaming_GENERATED ||
+            anEvolution == TNaming_MODIFY) {
+            // check this is a new shape
+            for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+              if (aNSIter.NewShape().IsSame(theContext)) {
+                myContext = aNS->Label();
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+    return true;
+  }
+  return false;
+}
+
+void Selector_WeakName::store()
+{
+  static const TDF_LabelList anEmptyRefList;
+  storeType(Selector_Algo::SELTYPE_WEAK_NAMING);
+  storeBaseArray(anEmptyRefList, myContext);
+  TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+  TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+}
+
+bool Selector_WeakName::restore()
+{
+  Handle(TDataStd_Integer) aWeakInt;
+  if (!label().FindAttribute(weakID(), aWeakInt))
+    return false;
+  myWeakIndex = aWeakInt->Get();
+  Handle(TDataStd_Integer) aShapeTypeAttr;
+  if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+    return false;
+  myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+  static TDF_LabelList anEmptyRefList;
+  return restoreBaseArray(anEmptyRefList, myContext);
+}
+
+TDF_Label Selector_WeakName::restoreByName(std::string theName,
+  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+  std::string aWeakIndex = theName.substr(pureWeakNameID().size());
+  std::size_t aContextPosition = aWeakIndex.find("_");
+  myWeakIndex = atoi(aWeakIndex.c_str());
+  myShapeType = theShapeType;
+  TDF_Label aContext;
+  if (aContextPosition != std::string::npos) { // context is also defined
+    std::string aContextName = aWeakIndex.substr(aContextPosition + 1);
+    if (theNameGenerator->restoreContext(aContextName, aContext, myContext)) {
+      if (myContext.IsNull())
+        aContext.Nullify();
+    }
+  }
+  return aContext;
+}
+
+bool Selector_WeakName::solve(const TopoDS_Shape& theContext)
+{
+
+  TopoDS_Shape aContext;
+  if (myContext.IsNull()) {
+    aContext = theContext;
+  } else {
+    Handle(TNaming_NamedShape) aNS;
+    if (myContext.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+      aContext = aNS->Get();
+    }
+  }
+  if (!aContext.IsNull()) {
+    Selector_NExplode aNexp(aContext, myShapeType);
+    TopoDS_Shape aResult = aNexp.shape(myWeakIndex);
+    if (!aResult.IsNull()) {
+      Selector_Algo::store(aResult);
+      return true;
+    }
+  }
+  return false;
+}
+
+std::string Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
+{
+  // _weak_naming_1_Context
+  std::ostringstream aWeakStr;
+  aWeakStr<<pureWeakNameID()<<myWeakIndex;
+  std::string aResult = aWeakStr.str();
+  if (!myContext.IsNull())
+    aResult += "_" + theNameGenerator->contextName(myContext);
+  return aResult;
+}
diff --git a/src/Selector/Selector_WeakName.h b/src/Selector/Selector_WeakName.h
new file mode 100644 (file)
index 0000000..7f1016a
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_WeakName_H_
+#define Selector_WeakName_H_
+
+#include "Selector_Algo.h"
+
+/**\class Selector_WeakName
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: if other algorithms fail, this stores the geometrical
+ * index of the selected shape. Pure weak naming approach.
+ */
+class Selector_WeakName: public Selector_Algo
+{
+  TopAbs_ShapeEnum myShapeType; ///< type of this shape
+  int myWeakIndex; ///< weak index in case modification produces several shapes
+  TDF_Label myContext; ///< context shape label
+public:
+  /// Initializes the selection of this kind
+  SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+  /// Stores the name to the label and sub-labels tree
+  SELECTOR_EXPORT virtual void store() override;
+
+  /// Restores the selected shape by the topological naming kept in the data structure
+  /// Returns true if it can restore structure correctly
+  SELECTOR_EXPORT virtual bool restore() override;
+
+  /// Restores the selected shape by the topological name string.
+  /// Returns not empty label of the context.
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+    const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+  /// Updates the current shape by the stored topological name
+  SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+  /// Returns the naming name of the selection
+  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+  /// Initializes selector
+  Selector_WeakName();
+
+  friend class Selector_Algo;
+};
+
+#endif
index 82b5dfab474f323c0f1634ec230e4b25c5f98cfa..d9edb13de83dc5627dfa1da7dd8d2a830ddccd48 100644 (file)
@@ -66,6 +66,31 @@ bool SketchAPI_Constraint::initialize()
   return true;
 }
 
+void SketchAPI_Constraint::setEntityA(const ModelHighAPI_RefAttr& theEntity)
+{
+  fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_A()));
+}
+
+void SketchAPI_Constraint::setEntityB(const ModelHighAPI_RefAttr& theEntity)
+{
+  fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_B()));
+}
+
+void SketchAPI_Constraint::setEntityC(const ModelHighAPI_RefAttr& theEntity)
+{
+  fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_C()));
+}
+
+void SketchAPI_Constraint::setEntityD(const ModelHighAPI_RefAttr& theEntity)
+{
+  fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_D()));
+}
+
+void SketchAPI_Constraint::setValue(const ModelHighAPI_Double& theValue)
+{
+  fillAttribute(theValue, feature()->real(SketchPlugin_Constraint::VALUE()));
+}
+
 static const std::string& constraintTypeToSetter(const std::string& theType)
 {
   if (theType == SketchPlugin_ConstraintCoincidence::ID()) {
index 2ad1650650635f2ec363d3bc1b2dc98c2be918a7..958bbdae31c810b98bd36a9e4bfdc95ac3d11669 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <SketchPlugin_Constraint.h>
 
+class ModelHighAPI_Double;
+
 /**\class SketchAPI_Constraint
  * \ingroup CPPHighAPI
  * \brief Interface for Constraint feature
@@ -54,6 +56,13 @@ public:
   SKETCHAPI_EXPORT
   bool initialize();
 
+  SKETCHAPI_EXPORT void setEntityA(const ModelHighAPI_RefAttr& theEntity);
+  SKETCHAPI_EXPORT void setEntityB(const ModelHighAPI_RefAttr& theEntity);
+  SKETCHAPI_EXPORT void setEntityC(const ModelHighAPI_RefAttr& theEntity);
+  SKETCHAPI_EXPORT void setEntityD(const ModelHighAPI_RefAttr& theEntity);
+
+  SKETCHAPI_EXPORT void setValue(const ModelHighAPI_Double& theValue);
+
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
index bf4ffcb7652f21a5c91cf01f11a722b139f95558..4d399b188090ce51d567115fe91b4325d159a906 100644 (file)
@@ -66,6 +66,7 @@ SET(PROJECT_HEADERS
     SketchPlugin_Tools.h
     SketchPlugin_Trim.h
     SketchPlugin_Validators.h
+    SketchPlugin_SketchDrawer.h
 )
 
 SET(PROJECT_SOURCES
@@ -73,7 +74,6 @@ SET(PROJECT_SOURCES
     SketchPlugin_Circle.cpp
     SketchPlugin_Constraint.cpp
     SketchPlugin_ConstraintAngle.cpp
-    SketchPlugin_ConstraintBase.cpp
     SketchPlugin_ConstraintCoincidence.cpp
     SketchPlugin_ConstraintCollinear.cpp
     SketchPlugin_ConstraintDistance.cpp
@@ -111,6 +111,7 @@ SET(PROJECT_SOURCES
     SketchPlugin_Tools.cpp
     SketchPlugin_Trim.cpp
     SketchPlugin_Validators.cpp
+    SketchPlugin_SketchDrawer.cpp
 )
 
 SET(PROJECT_LIBRARIES
@@ -153,123 +154,135 @@ INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Sketch)
 INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 
-ADD_UNIT_TESTS(TestSketchPointLine.py
-               TestCreateArcByCenterStartEnd.py
-               TestCreateArcByThreePoints.py
-               TestCreateArcByTangentEdge.py
-               TestCreateArcChangeType.py
-               TestCreateCircleByCenterAndPassed.py
-               TestCreateCircleByThreePoints.py
-               TestCreateCircleChangeType.py
-               TestConstraintCoincidence.py
-               TestConstraintCollinear.py
-               TestConstraintLength.py
-               TestConstraintDistance.py
-               TestConstraintDistanceHorizontal.py
-               TestConstraintDistanceVertical.py
-               TestConstraintDistanceBehavior.py
-               TestConstraintParallel.py
-               TestConstraintPerpendicular.py
-               TestConstraintRadius.py
-               TestConstraintFixed.py
-               TestConstraintHorizontal.py
-               TestConstraintHorizontalValidator.py
-               TestConstraintVertical.py
-               TestConstraintEqual.py
-               TestConstraintTangent.py
-               TestConstraintAngle.py
-               TestConstraintMiddlePoint.py
-               TestEdgesOrder.py
-               TestMirror.py
-               TestMultiTranslation.py
-               TestMultiRotation.py
-               TestMultiRotationWithParameter.py
-               TestMultiRotation01.py
-               TestMultiRotation02.py
-               TestMultiRotation03.py
-               TestMultiRotation04.py
-               TestMultiRotation05.py
-               TestFillet.py
-               TestFilletAfterFolder.py
-               TestFilletInteracting.py
-               TestRectangle.py
-               TestProjection.py
-               TestProjectionIntoResult.py
-               TestSplit.py
-               TestHighload.py
-               TestSnowflake.py
-               TestArcBehavior.py
-               TestRemoveSketch.py
-               Test1061.py
-               Test1673.py
-               Test1924.py
-               Test1966.py
-               Test1967.py
-               Test2062.py
-               Test2095.py
-               Test2115.py
-               TestTrimArc01.py
-               TestTrimArc02.py
-               TestTrimArc03.py
-               TestTrimArc04.py
-               TestTrimArc05.py
-               TestTrimArc06.py
-               TestTrimArc07.py
-               TestTrimCircle01.py
-               TestTrimCircle02.py
-               TestTrimCircle03.py
-               TestTrimCircle04.py
-               TestTrimCircle05.py
-               TestTrimCircleAndArc01.py
-               TestTrimLine01.py
-               TestTrimLine02.py
-               Test2229.py
-               Test2239.py
-               TestDistanceDump.py
-               TestDistanceSignedVsUnsigned01.py
-               TestDistanceSignedVsUnsigned02.py
-               TestDistanceSignedVsUnsigned03.py
-               TestDistanceSignedVsUnsigned04.py
-               TestDistanceSignedVsUnsigned05.py
-               TestSignedDistancePointPoint.py
-               TestSignedDistancePointLine.py
-               TestIntersectionWithLine.py
-               TestIntersectionWithCircle.py
-               TestIntersectionWithSpline.py
-               TestIntersectionChangeEdge.py
-               Test2273.py
-               Test2280.py
-               Test2287.py
-               Test2341.py
-               Test2390.py
-               Test2393.py
-               Test2425.py
-               Test2440.py
-               Test2157.py
-               Test2157_2.py
-               Test2481.py
-               Test1963.py
-               Test2034_1.py
-               Test2034_2.py
-               Test2034_3.py
-               Test2134.py
-               TestDegeneratedGeometry.py
-               Test2119.py
-               Test2224.py
-               Test2427.py
-               Test1577.py
-               Test1578.py
-               Test2654.py
-               Test1779.py
-               Test2711.py
+ADD_UNIT_TESTS(
+  Test1061.py
+  Test1577.py
+  Test1578.py
+  Test1673.py
+  Test1779.py
+  Test1924.py
+  Test1963.py
+  Test1966.py
+  Test1967.py
+  Test2034_1.py
+  Test2034_2.py
+  Test2034_3.py
+  Test2062.py
+  Test2095.py
+  Test2115.py
+  Test2119.py
+  Test2134.py
+  Test2157.py
+  Test2157_2.py
+  Test2224.py
+  Test2229.py
+  Test2239.py
+  Test2273.py
+  Test2280.py
+  Test2287.py
+  Test2341.py
+  Test2390.py
+  Test2393.py
+  Test2425.py
+  Test2427.py
+  Test2440.py
+  Test2481.py
+  Test2654.py
+  Test2711.py
+  Test2741.py
+  Test2810.py
+  TestArcBehavior.py
+  TestConstraintAngle.py
+  TestConstraintCoincidence.py
+  TestConstraintCollinear.py
+  TestConstraintDistance.py
+  TestConstraintDistanceBehavior.py
+  TestConstraintDistanceHorizontal.py
+  TestConstraintDistanceVertical.py
+  TestConstraintEqual.py
+  TestConstraintFixed.py
+  TestConstraintHorizontal.py
+  TestConstraintHorizontalValidator.py
+  TestConstraintLength.py
+  TestConstraintMiddlePoint.py
+  TestConstraintParallel.py
+  TestConstraintPerpendicular.py
+  TestConstraintRadius.py
+  TestConstraintRadiusFailure.py
+  TestConstraintTangent.py
+  TestConstraintVertical.py
+  TestCreateArcByCenterStartEnd.py
+  TestCreateArcByTangentEdge.py
+  TestCreateArcByThreePoints.py
+  TestCreateArcChangeType.py
+  TestCreateCircleByCenterAndPassed.py
+  TestCreateCircleByThreePoints.py
+  TestCreateCircleChangeType.py
+  TestDegeneratedGeometry.py
+  TestDistanceDump.py
+  TestDistanceSignedVsUnsigned01.py
+  TestDistanceSignedVsUnsigned02.py
+  TestDistanceSignedVsUnsigned03.py
+  TestDistanceSignedVsUnsigned04.py
+  TestDistanceSignedVsUnsigned05.py
+  TestEdgesOrder.py
+  TestFillet.py
+  TestFilletAfterFolder.py
+  TestFilletInteracting.py
+  TestHighload.py
+  TestIntersectionChangeEdge.py
+  TestIntersectionWithCircle.py
+  TestIntersectionWithLine.py
+  TestIntersectionWithSpline.py
+  TestMirror.py
+  TestMultiRotation.py
+  TestMultiRotation01.py
+  TestMultiRotation02.py
+  TestMultiRotation03.py
+  TestMultiRotation04.py
+  TestMultiRotation05.py
+  TestMultiRotationWithParameter.py
+  TestMultiTranslation.py
+  TestPresentation.py
+  TestProjection.py
+  TestProjectionIntoResult.py
+  TestProjectionUpdate.py
+  TestRectangle.py
+  TestRemoveSketch.py
+  TestSignedDistancePointLine.py
+  TestSignedDistancePointPoint.py
+  TestSketchDrawer.py
+  TestSketchPointLine.py
+  TestSnowflake.py
+  TestSplit.py
+  TestSplitLine.py
+  TestSplitPreview.py
+  TestTrimArc01.py
+  TestTrimArc02.py
+  TestTrimArc03.py
+  TestTrimArc04.py
+  TestTrimArc05.py
+  TestTrimArc06.py
+  TestTrimArc07.py
+  TestTrimArc08.py
+  TestTrimCircle01.py
+  TestTrimCircle02.py
+  TestTrimCircle03.py
+  TestTrimCircle04.py
+  TestTrimCircle05.py
+  TestTrimCircleAndArc01.py
+  TestTrimLine01.py
+  TestTrimLine02.py
+  TestTrimLine03.py
+  TestTrimPreview.py
 )
 
 if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
   ADD_UNIT_TESTS(
-               TestMovePoint.py
-               TestMoveLine.py
-               TestMoveCircle.py
-               TestMoveArc.py
-               TestMovementComplex.py
+    TestMoveArc.py
+    TestMoveCircle.py
+    TestMoveLine.py
+    TestMovementComplex.py
+    TestMovePoint.py
   )
 endif()
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp b/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp
deleted file mode 100644 (file)
index 0a49944..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "SketchPlugin_ConstraintBase.h"
-
-AISObjectPtr SketchPlugin_ConstraintBase::getAISObject(AISObjectPtr thePrevious)
-{
-  return thePrevious;
-}
-
-const void SketchPlugin_ConstraintBase::addSub(const FeaturePtr& theFeature)
-{
-
-}
index 9c65757d6355809ed4a8a0c34fa11731b2302bc9..a435996073219301db235df1526e0daeb20e6526 100644 (file)
@@ -57,15 +57,7 @@ class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomA
                                     public GeomAPI_ICustomPrs
 {
  public:
-  /// Returns the AIS preview
-  SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
-
-  /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
-   *  \param theFeature sub-feature
-   */
-  SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
-
-      /// Customize presentation of the feature
+  /// Customize presentation of the feature
   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
   {
index ac7b9961b9837967f4913196db8f6d4bc8d6bf55..2c3bddf16e0ccde9c7f15148e6a0a96a039ec404 100644 (file)
@@ -56,51 +56,6 @@ AISObjectPtr SketchPlugin_ConstraintCoincidence::getAISObject(AISObjectPtr thePr
   return anAIS;
 }
 
-FeaturePtr SketchPlugin_ConstraintCoincidence::findCoincidenceFeature(const FeaturePtr& theFeature1,
-                                                                      const FeaturePtr& theFeature2)
-{
-  FeaturePtr aResultFeature;
-
-  std::list<AttributePtr> anAttrList;
-  if (theFeature1->getKind() == SketchPlugin_Circle::ID() ||
-      theFeature2->getKind() == SketchPlugin_Circle::ID())
-    return aResultFeature;
-
-  if (theFeature2->getKind() == SketchPlugin_Line::ID()) {
-    anAttrList.push_back(theFeature2->attribute(SketchPlugin_Line::START_ID()));
-    anAttrList.push_back(theFeature2->attribute(SketchPlugin_Line::END_ID()));
-  } else if (theFeature2->getKind() == SketchPlugin_Arc::ID()) {
-    anAttrList.push_back(theFeature2->attribute(SketchPlugin_Arc::START_ID()));
-    anAttrList.push_back(theFeature2->attribute(SketchPlugin_Arc::END_ID()));
-  }
-
-  const std::set<AttributePtr>& aRefsList = theFeature1->data()->refsToMe();
-  std::set<AttributePtr>::const_iterator aRefIt = aRefsList.begin();
-  for (; aRefIt != aRefsList.end() && !aResultFeature.get(); ++aRefIt) {
-    FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
-    if (aConstrFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
-      continue;
-    AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*aRefIt);
-    AttributePtr anAttr = aRefAttr->attr();
-    if (anAttr->id() == SketchPlugin_Arc::CENTER_ID())
-      continue;
-
-    anAttr = aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_A());
-    if (anAttr == *aRefIt)
-      anAttr = aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_B());
-
-    aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttr);
-    if (!aRefAttr)
-      continue;
-    anAttr = aRefAttr->attr();
-    for (std::list<AttributePtr>::const_iterator anIt = anAttrList.begin();
-         anIt != anAttrList.end() && !aResultFeature.get(); ++anIt)
-      if (*anIt == anAttr)
-        aResultFeature = aConstrFeature;
-  }
-  return aResultFeature;
-}
-
 AttributePoint2DPtr SketchPlugin_ConstraintCoincidence::getPoint(const FeaturePtr& theFeature)
 {
   AttributePoint2DPtr aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(),
index db5f5e3ca028517e7e04b17ecad613954d85754e..5e2ba1668ecab376cf79a442d6f39ab7aef34f41 100644 (file)
@@ -60,12 +60,6 @@ class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase
   /// \brief Request for initialization of data model of the feature: adding all attributes
   SKETCHPLUGIN_EXPORT virtual void initAttributes();
 
-  /// Returns coincident feature if there is a coincidence built on the given features
-  /// \param theFeature1 the first feature
-  /// \param theFeature2 the second feature
-  static FeaturePtr findCoincidenceFeature(const FeaturePtr& theFeature1,
-                                           const FeaturePtr& theFeature2);
-
   /// Creates a constraint on two points
   /// \param theSketch a sketch feature
   /// \param thePoint1 the first point
index a9823830700559907394b85759940a911e842a53..20a98e32746a791e4f45682b3822035870cc8e3d 100644 (file)
@@ -65,9 +65,6 @@ class SketchPlugin_Feature : public ModelAPI_Feature
     return true;
   }
 
-  /// Construction result is allways recomuted on the fly
-  SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
-
   /// Returns true is sketch element is under the rigid constraint
   SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;}
 
index 3373df8c6df0504ea4a39d8531c6cb8e5c534a10..852d006e5b3c8969e777d6d5140fbb52b0232cd1 100644 (file)
@@ -104,6 +104,10 @@ void SketchPlugin_Fillet::execute()
 
   // create feature for fillet arc
   FeaturePtr aFilletArc = createFilletArc();
+  if (!aFilletArc) {
+    setError("Error: unable to create a fillet arc.");
+    return;
+  }
 
   // collect features referred to the edges participating in fillet
   AttributePoint2DPtr aFilletPoints[2];
@@ -308,6 +312,10 @@ FeaturePtr SketchPlugin_Fillet::createFilletArc()
   if (!myBaseFeatures[0] || !myBaseFeatures[1])
     calculateFilletParameters();
 
+  // fix for issue #2810 (sometimes, myCenterXY is NULL, fillet should report an error)
+  if (!myCenterXY)
+    return FeaturePtr();
+
   // Create arc feature.
   FeaturePtr aFilletArc = sketch()->addFeature(SketchPlugin_Arc::ID());
 
index 23cbe266674cfd4cc376d113f1d9807341e8a32b..f04cf47d7740718cca99c19a355ed01295fe5f64 100644 (file)
@@ -92,6 +92,7 @@ void SketchPlugin_Line::execute()
   }
 }
 
+// LCOV_EXCL_START
 std::string SketchPlugin_Line::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
   std::string aFilledAttributeName;
@@ -113,6 +114,7 @@ std::string SketchPlugin_Line::processEvent(const std::shared_ptr<Events_Message
   }
   return aFilledAttributeName;
 }
+// LCOV_EXCL_STOP
 
 double SketchPlugin_Line::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
index d51c6608f79225a3944b8d74e107f113627a32b7..11444e0ef521be034f79e39931065af07641a2c7 100644 (file)
@@ -77,7 +77,7 @@ class SketchPlugin_Line : public SketchPlugin_SketchEntity,
   SKETCHPLUGIN_EXPORT virtual void execute();
 
   /// Apply information of the message to current object. It fills start attribute of
-  /// the currrent feature by last attribute of the message feature, build coincidence
+  /// the current feature by last attribute of the message feature, build coincidence
   /// if message has selected object
   virtual std::string processEvent(const std::shared_ptr<Events_Message>& theMessage);
 
@@ -92,7 +92,7 @@ class SketchPlugin_Line : public SketchPlugin_SketchEntity,
   SketchPlugin_Line();
 
 private:
-  /// Calculates the lenght of the line and fill the lenght attribute with the value
+  /// Calculates the length of the line and fill the length attribute with the value
   void updateLenghtValue();
 
 protected:
index b6a09bde6af0dcd820b36d2ff88b344ef7856607..f50e225543e9ff2eb00671365d3e0aeb5bca8794 100644 (file)
@@ -373,6 +373,7 @@ void SketchPlugin_MacroArc::execute()
   Events_Loop::loop()->send(aMessage);
 }
 
+// LCOV_EXCL_START
 std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
   std::string aFilledAttributeName;
@@ -450,6 +451,7 @@ std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptr<Events_Mes
   }
   return aFilledAttributeName;
 }
+// LCOV_EXCL_STOP
 
 FeaturePtr SketchPlugin_MacroArc::createArcFeature()
 {
@@ -491,6 +493,9 @@ void SketchPlugin_MacroArc::fillByCenterAndTwoPassed()
     return;
 
   GeomAPI_Circ2d aCircleForArc(myCenter, myStart);
+  // avoid degerated arc, when the center and the start points are equal
+  if (!aCircleForArc.implPtr<void*>())
+    return;
 
   bool aWasBlocked = data()->blockSendAttributeUpdated(true);
   // check the end point is referred to another feature
index 3b8049b5777f16462b2aff6f7c81c063a8ff8ae9..5a3c14cb936796202f3eb7663883ff68bea606e3 100644 (file)
@@ -119,6 +119,7 @@ void SketchPlugin_MacroCircle::execute()
   Events_Loop::loop()->send(aMessage);
 }
 
+// LCOV_EXCL_START
 std::string SketchPlugin_MacroCircle::processEvent(
                                               const std::shared_ptr<Events_Message>& theMessage)
 {
@@ -180,6 +181,7 @@ std::string SketchPlugin_MacroCircle::processEvent(
   }
   return aFilledAttributeName;
 }
+// LCOV_EXCL_STOP
 
 void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature)
 {
index 6a47d8539057fdbf43ae8913aaddeb4671550b55..d3a8a43e2be0e167ac6100d99113b193de91b117 100644 (file)
@@ -54,6 +54,7 @@
 #include <SketchPlugin_ExternalValidator.h>
 #include <SketchPlugin_Ellipse.h>
 #include <SketchPlugin_MacroEllipse.h>
+#include <SketchPlugin_SketchDrawer.h>
 
 #include <SketcherPrs_Tools.h>
 
@@ -244,11 +245,14 @@ FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID)
     return FeaturePtr(new SketchPlugin_Ellipse);
   } else if (theFeatureID == SketchPlugin_MacroEllipse::ID()) {
     return FeaturePtr(new SketchPlugin_MacroEllipse);
+  } else if (theFeatureID == SketchPlugin_SketchDrawer::ID()) {
+    return FeaturePtr(new SketchPlugin_SketchDrawer);
   }
   // feature of such kind is not found
   return FeaturePtr();
 }
 
+// LCOV_EXCL_START
 void SketchPlugin_Plugin::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
   const Events_ID kRequestEvent =
@@ -318,3 +322,4 @@ std::shared_ptr<ModelAPI_FeatureStateMessage> SketchPlugin_Plugin
   }
   return aMsg;
 }
+// LCOV_EXCL_STOP
index 252ecf18118b57f82eda9f600e73a45ba5b1639c..d2f727f7163af635bfa357999f9fcf135413e668 100644 (file)
@@ -67,7 +67,7 @@ bool SketchPlugin_Point::isFixed() {
 }
 
 void SketchPlugin_Point::attributeChanged(const std::string& theID) {
-  // the second condition for unability to move external point anywhere
+  // the second condition for inability to move external point anywhere
   if (theID == EXTERNAL_ID() || isFixed()) {
     std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
     if (!aSelection) {
index d23ad07d0118e0c581692eef8bca4e006d6d9d26..92fb4fcc53581ca4a3e94fe6911410509eee3060 100755 (executable)
@@ -25,6 +25,7 @@
 
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_PlanarEdges.h>
+#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 
 #include <GeomDataAPI_Point2D.h>
@@ -255,38 +256,46 @@ void SketchPlugin_Sketch::attributeChanged(const std::string& theID) {
       std::shared_ptr<GeomAPI_Shape> aSelection = aSelAttr->value();
       if (!aSelection.get()) aSelection = aSelAttr->context()->shape();
       // update the sketch plane
-      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aSelection));
-      std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
-      if (aPlane) {
-        double anA, aB, aC, aD;
-        aPlane->coefficients(anA, aB, aC, aD);
-
-        // calculate attributes of the sketch
-        std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
-        std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
-        std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
-        aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
-        std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
-        // X axis is preferable to be dirX on the sketch
-        // here can not be very small value to avoid very close to X normal axis (issue 595)
-        static const double tol = 0.1;
-        bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
-        std::shared_ptr<GeomAPI_Dir> aTempDir(
-          isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
-        std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
-        std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
-
-        // update position of the sketch
-        std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast
-          <GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-        anOrigin->setValue(anOrigPnt);
-        std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-          data()->attribute(SketchPlugin_Sketch::NORM_ID()));
-        aNormal->setValue(aNormDir);
-        std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-          data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
-        aDirX->setValue(aXDir);
-        std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+      std::shared_ptr<GeomAPI_Face> aFace;
+      if (aSelection->isFace()) {
+        aFace = aSelection->face();
+      } else if (aSelection->isCompound()) {
+        GeomAPI_ShapeIterator anIt(aSelection);
+        aFace = anIt.current()->face();
+      }
+      if (aFace.get()) {
+        std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
+        if (aPlane.get()) {
+          double anA, aB, aC, aD;
+          aPlane->coefficients(anA, aB, aC, aD);
+
+          // calculate attributes of the sketch
+          std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
+          std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
+          std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
+          aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
+          std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
+          // X axis is preferable to be dirX on the sketch
+          // here can not be very small value to avoid very close to X normal axis (issue 595)
+          static const double tol = 0.1;
+          bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
+          std::shared_ptr<GeomAPI_Dir> aTempDir(
+            isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
+          std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
+          std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
+
+          // update position of the sketch
+          std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast
+            <GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+          anOrigin->setValue(anOrigPnt);
+          std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+            data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+          aNormal->setValue(aNormDir);
+          std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+            data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
+          aDirX->setValue(aXDir);
+          std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+        }
       }
     }
   } else if (theID == NORM_ID() || theID == DIRX_ID() || theID == ORIGIN_ID()) {
@@ -361,9 +370,3 @@ std::shared_ptr<GeomAPI_Ax3> SketchPlugin_Sketch::plane(SketchPlugin_Sketch* the
 
   return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
 }
-
-void SketchPlugin_Sketch::exchangeIDs(
-  std::shared_ptr<ModelAPI_Feature> theFeature1, std::shared_ptr<ModelAPI_Feature> theFeature2)
-{
-  reflist(SketchPlugin_Sketch::FEATURES_ID())->exchange(theFeature1, theFeature2);
-}
index 3e7328e77cc15623cdfb930d5964e25228331bf6..310001a81fcf2014302abe6450d1dd97fa050b6a 100644 (file)
@@ -204,16 +204,8 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature, public GeomAPI_ICu
   /// Returns true if feature or reuslt belong to this composite feature as subs
   SKETCHPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
 
-  /// Construction result is allways recomuted on the fly
-  SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
-
   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
-  /// Exchanges IDs of two given features: needed for fillet feature better naming (issue 769)
-  SKETCHPLUGIN_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
-    std::shared_ptr<ModelAPI_Feature> theFeature2);
-
-
   /// \brief Create a result for the point in the attribute if the attribute is initialized
   /// \param theFeature a source feature
   /// \param theSketch a sketch intance
diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp b/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp
new file mode 100644 (file)
index 0000000..fd4deed
--- /dev/null
@@ -0,0 +1,217 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "SketchPlugin_SketchDrawer.h"
+
+#include "SketchPlugin_Arc.h"
+#include "SketchPlugin_Line.h"
+#include "SketchPlugin_Circle.h"
+#include "SketchPlugin_Point.h"
+#include "SketchPlugin_Sketch.h"
+#include "SketchPlugin_ConstraintDistance.h"
+#include "SketchPlugin_ConstraintCoincidence.h"
+#include "SketchPlugin_ConstraintLength.h"
+#include "SketchPlugin_ConstraintRadius.h"
+#include "SketchPlugin_ConstraintVertical.h"
+#include "SketchPlugin_ConstraintHorizontal.h"
+#include "SketchPlugin_ConstraintDistanceVertical.h"
+#include "SketchPlugin_ConstraintDistanceHorizontal.h"
+#include "SketchPlugin_Tools.h"
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_Edge.h>
+#include <GeomAPI_Circ.h>
+#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_DataMapOfShapeShape.h>
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_ResultConstruction.h>
+
+#include <cmath>
+
+static const double kTOL = 1.e-6;
+
+SketchPlugin_SketchDrawer::SketchPlugin_SketchDrawer() : ModelAPI_Feature()
+{}
+
+void SketchPlugin_SketchDrawer::initAttributes()
+{
+  data()->addAttribute(BASE_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(PLANE_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(ADD_DIMENSIONS_ID(), ModelAPI_AttributeBoolean::typeId());
+}
+
+// sets a point attribute of the feature by 3D point on the sketch
+static void setPoint(FeaturePtr theFeature, const std::string& theAttrID,
+  std::shared_ptr<SketchPlugin_Sketch> theSketch, GeomPointPtr thePoint,
+  std::list<std::pair<GeomPnt2dPtr, std::string> >& aPoints)
+{
+  GeomPnt2dPtr aPnt2D = theSketch->to2D(thePoint);
+  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+    theFeature->attribute(theAttrID))->setValue(aPnt2D);
+  aPoints.push_back(std::pair<GeomPnt2dPtr, std::string>(aPnt2D, theAttrID));
+}
+
+void SketchPlugin_SketchDrawer::execute()
+{
+  GeomShapePtr aBase = selection(BASE_ID())->value();
+  if (!aBase.get() && selection(BASE_ID())->context().get())
+    aBase = selection(BASE_ID())->context()->shape();
+  if (!aBase.get()) {
+    setError("Error: a base shape can not be obtained");
+    return; // invalid case
+  }
+
+  ObjectPtr aPlaneContext = selection(PLANE_ID())->contextObject();
+  GeomShapePtr aPlaneShape = selection(PLANE_ID())->value();
+  if (!aPlaneShape.get() && aPlaneContext.get())
+    aPlaneShape = selection(PLANE_ID())->context()->shape();
+  if (!aPlaneShape.get() || aPlaneShape->shapeType() != GeomAPI_Shape::FACE) {
+    setError("Error: a sketch plane can not be obtained");
+    return; // invalid case
+  }
+  GeomFacePtr aPlaneFace(new GeomAPI_Face(aPlaneShape));
+  GeomPlanePtr aPlane = aPlaneFace->getPlane();
+
+  // create and initialize sketch
+  DocumentPtr aMyDoc = document();
+  std::shared_ptr<SketchPlugin_Sketch> aSketch =
+    std::dynamic_pointer_cast<SketchPlugin_Sketch>(aMyDoc->addFeature(SketchPlugin_Sketch::ID()));
+  // by selection of plane
+  aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->
+    setValue(selection(PLANE_ID())->context(), aPlaneShape);
+  // remove reference, but keep the sketch position
+  aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->
+    setValue(ResultPtr(), GeomShapePtr());
+
+  bool addDimensions = boolean(ADD_DIMENSIONS_ID())->value();
+  // iterate all edges of the base to find all edges that belong to this plane
+  GeomAPI_DataMapOfShapeShape alreadyProcessed;
+  std::list<AttributePoint2DPtr> aCreatedPoints;// points to check and set coincidence
+  for(GeomAPI_ShapeExplorer anEdges(aBase, GeomAPI_Shape::EDGE); anEdges.more(); anEdges.next()) {
+    if (!alreadyProcessed.bind(anEdges.current(), anEdges.current()))
+      continue; // skip duplicated edges
+    GeomEdgePtr anEdge(new GeomAPI_Edge(anEdges.current()));
+    if (anEdge->isDegenerated())
+      continue; // skip degenerated edges
+    GeomPointPtr aStart = anEdge->firstPoint();
+    GeomPointPtr anEnd = anEdge->lastPoint();
+    if (aPlane->distance(aStart) >= kTOL || aPlane->distance(anEnd) >= kTOL)
+      continue; // skip edges not in plane
+
+    FeaturePtr anItem;
+    std::list<std::pair<GeomPnt2dPtr, std::string> > aPoints; // created point to attribute ID
+    if (anEdge->isLine()) { // line is already in the plane: create by two points
+      anItem = aSketch->addFeature(SketchPlugin_Line::ID());
+      setPoint(anItem, SketchPlugin_Line::START_ID(), aSketch, aStart, aPoints);
+      setPoint(anItem, SketchPlugin_Line::END_ID(), aSketch, anEnd, aPoints);
+      anItem->execute(); // for constraints setting on result
+      // add a vertical or horizontal constraints
+      bool isHorVertConstr = true;
+      if (fabs(aPoints.front().first->x() - aPoints.back().first->x()) < kTOL) {
+        FeaturePtr aVert = aSketch->addFeature(SketchPlugin_ConstraintVertical::ID());
+        aVert->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult());
+      } else if (fabs(aPoints.front().first->y() - aPoints.back().first->y()) < kTOL) {
+        FeaturePtr aHor = aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID());
+        aHor->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult());
+      } else {
+        isHorVertConstr = false;
+      }
+      if (addDimensions) {
+        if (isHorVertConstr) { // only length constraint is enough
+          FeaturePtr aLen = aSketch->addFeature(SketchPlugin_ConstraintLength::ID());
+          aLen->refattr(SketchPlugin_ConstraintLength::ENTITY_A())
+            ->setObject(anItem->firstResult());
+          aLen->real(SketchPlugin_ConstraintLength::VALUE())->setValue(anEdge->length());
+        } else { // set horizontal and vertical distance constraints
+          FeaturePtr aVDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceVertical::ID());
+          aVDist->refattr(SketchPlugin_Constraint::ENTITY_A())
+            ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID()));
+          aVDist->refattr(SketchPlugin_Constraint::ENTITY_B())
+            ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID()));
+          aVDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE())
+            ->setValue(aPoints.back().first->y() - aPoints.front().first->y());
+          FeaturePtr aHDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceHorizontal::ID());
+          aHDist->refattr(SketchPlugin_Constraint::ENTITY_A())
+            ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID()));
+          aHDist->refattr(SketchPlugin_Constraint::ENTITY_B())
+            ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID()));
+          aHDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE())
+            ->setValue(aPoints.back().first->x() - aPoints.front().first->x());
+        }
+      }
+    } else if (anEdge->isArc()) { // check also center
+      GeomPointPtr aCenter = anEdge->circle()->center();
+      if (aPlane->distance(aCenter) >= kTOL)
+        continue;
+      // create arc by 3 points
+      anItem = aSketch->addFeature(SketchPlugin_Arc::ID());
+      setPoint(anItem, SketchPlugin_Arc::CENTER_ID(), aSketch, aCenter, aPoints);
+      setPoint(anItem, SketchPlugin_Arc::START_ID(), aSketch, aStart, aPoints);
+      setPoint(anItem, SketchPlugin_Arc::END_ID(), aSketch, anEnd, aPoints);
+      anItem->execute(); // for constraints setting on result
+      // set radius constraint
+      if (addDimensions) {
+        FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID());
+        aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult());
+      }
+    } else if (anEdge->isCircle()) { // check also center and middle (at value 2.)
+      GeomPointPtr aCenter = anEdge->circle()->center();
+      if (aPlane->distance(aCenter) >= kTOL || aPlane->distance(anEdge->middlePoint()) >= kTOL)
+        continue;
+      // circle by center and radius
+      anItem = aSketch->addFeature(SketchPlugin_Circle::ID());
+      setPoint(anItem, SketchPlugin_Circle::CENTER_ID(), aSketch, aCenter, aPoints);
+      anItem->real(SketchPlugin_Circle::RADIUS_ID())->setValue(anEdge->circle()->radius());
+      anItem->execute(); // for constraints setting on result
+      // set radius constraint
+      if (addDimensions) {
+        FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID());
+        aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult());
+      }
+    } else {
+      continue; // other types of edges are not supported, only lines, circles and arcs
+    }
+    // check some resulting points are coincident to existing
+    std::list<std::pair<GeomPnt2dPtr, std::string> >::iterator aPIter = aPoints.begin();
+    for(; aPIter != aPoints.end(); aPIter++) {
+      AttributePoint2DPtr aPointAttr =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anItem->attribute(aPIter->second));
+      std::list<AttributePoint2DPtr>::iterator aCoincIter = aCreatedPoints.begin();
+      for(; aCoincIter != aCreatedPoints.end(); aCoincIter++) {
+        double aDX = (*aCoincIter)->x() - aPIter->first->x();
+        if (fabs(aDX) >= kTOL)
+          continue;
+        double aDY = (*aCoincIter)->y() - aPIter->first->y();
+        if (fabs(aDY) >= kTOL)
+          continue;
+        // create a coincidence constraint
+        FeaturePtr aCoinc = aSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID());
+        aCoinc->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(aPointAttr);
+        aCoinc->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(*aCoincIter);
+        break; // only one coincidence per point
+      }
+      aCreatedPoints.push_back(aPointAttr);
+    }
+  }
+  aMyDoc->setCurrentFeature(aSketch, false);
+}
diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.h b/src/SketchPlugin/SketchPlugin_SketchDrawer.h
new file mode 100644 (file)
index 0000000..62c1ed1
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef SketchPlugin_SketchDrawer_H_
+#define SketchPlugin_SketchDrawer_H_
+
+#include "SketchPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// \class SketchPlugin_SketchDrawer
+/// \ingroup Plugins
+/// \brief Feature for creation of a sketch on selected base object and plane. It tries
+///  to make sketch elements equal to edges and vertices of the objects that belong to
+///  the selected plane.
+class SketchPlugin_SketchDrawer: public ModelAPI_Feature
+{
+ public:
+  /// A constructor
+  SketchPlugin_SketchDrawer();
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_FEATURE_ID("SketchDrawer");
+    return MY_FEATURE_ID;
+  }
+
+  /// Attribute name of the base shape selected.
+  inline static const std::string& BASE_ID()
+  {
+    static const std::string ID("base_shape");
+    return ID;
+  }
+  /// Attribute name of the plane selected.
+  inline static const std::string& PLANE_ID()
+  {
+    static const std::string ID("plane");
+    return ID;
+  }
+  /// Attribute name of the add-dimensions flag.
+  inline static const std::string& ADD_DIMENSIONS_ID()
+  {
+    static const std::string ID("add_dimensions");
+    return ID;
+  }
+
+  /// \return the kind of a feature.
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_SketchDrawer::ID();
+    return MY_KIND;
+  }
+
+  /// Creates a new sketch.
+  SKETCHPLUGIN_EXPORT virtual void execute();
+
+  /// Request for initialization of data model of the feature: adding all attributes.
+  SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is removed on apply.
+  /// \returns true
+  SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
+
+  /// No preview is generated until it is applied.
+  SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
+};
+
+#endif
index baa37b9d8f5ba1ba3ca64aea7924c8e670e10b07..4e984c0a1a9b8e9b8cd82c59750074cd9aaada79 100644 (file)
@@ -112,6 +112,7 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC
     return false;
   }
 
+// LCOV_EXCL_START
   /// Customize presentation of the feature
   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
@@ -192,6 +193,7 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC
     }
     return isCustomized;
   }
+// LCOV_EXCL_STOP
 
 protected:
   /// initializes mySketch
index d9e0cc2527b5b0814f4d5ab6cc42468d4ebade37..c90b10cc05d952340a0cc6602d477f79e2860d17 100644 (file)
@@ -421,6 +421,7 @@ void SketchPlugin_Split::execute()
 #endif
 }
 
+// LCOV_EXCL_START
 std::string SketchPlugin_Split::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
 #ifdef DEBUG_SPLIT
@@ -484,6 +485,7 @@ std::string SketchPlugin_Split::processEvent(const std::shared_ptr<Events_Messag
   }
   return aFilledAttributeName;
 }
+// LCOV_EXCL_STOP
 
 AISObjectPtr SketchPlugin_Split::getAISObject(AISObjectPtr thePrevious)
 {
@@ -713,23 +715,6 @@ GeomShapePtr SketchPlugin_Split::getSubShape(const std::string& theObjectAttribu
   return aBaseShape;
 }
 
-std::shared_ptr<GeomDataAPI_Point2D> SketchPlugin_Split::getPointOfRefAttr(
-                                                      const AttributePtr& theAttribute)
-{
-  AttributePoint2DPtr aPointAttribute;
-
-  if (theAttribute->attributeType() == ModelAPI_AttributeRefAttr::typeId()) {
-    AttributeRefAttrPtr aRefAttr =
-      std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
-    if (aRefAttr.get() && aRefAttr->isInitialized()) {
-      AttributePtr anAttribute = aRefAttr->attr();
-      if (anAttribute.get() && anAttribute->attributeType() == GeomDataAPI_Point2D::typeId())
-        aPointAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttribute);
-    }
-  }
-  return aPointAttribute;
-}
-
 void SketchPlugin_Split::getFeaturePoints(const FeaturePtr& theFeature,
                                                     AttributePoint2DPtr& theStartPointAttr,
                                                     AttributePoint2DPtr& theEndPointAttr)
@@ -1566,6 +1551,7 @@ std::shared_ptr<ModelAPI_Result> SketchPlugin_Split::getFeatureResult(
   return aResult;
 }
 
+#ifdef _DEBUG
 std::set<std::shared_ptr<ModelAPI_Attribute> > SketchPlugin_Split::getEdgeAttributes(
                                            const std::shared_ptr<ModelAPI_Feature>& theFeature)
 {
@@ -1585,6 +1571,7 @@ std::set<std::shared_ptr<ModelAPI_Attribute> > SketchPlugin_Split::getEdgeAttrib
 
   return anAttributes;
 }
+#endif
 
 std::shared_ptr<GeomDataAPI_Point2D> SketchPlugin_Split::getPointAttribute
                                                               (const bool isFirstAttribute)
index 363db36458a37f3051af9524741a864d2d490eec..a52428b797427d45c75dc060ba86bccba3fc823a 100644 (file)
@@ -149,11 +149,6 @@ private:
                         std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
                         std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr);
 
-  /// Returns cast of attribute to geometrical point if the attribute is a ref attr attribute
-  /// \param theAttribute an attribute
-  /// \param geom point 2D or NULL
-  std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(const AttributePtr& theAttribute);
-
   /// Obtains those constraints of the feature that should be modified. output maps contain
   /// point of coincidence and attribute id to be modified after split
   /// \param theFeaturesToDelete [out] constrains that will be deleted after split
index 387f3a8b4e9edaf2ccfcffc9263c3f0b0066b81d..5346feda8e78971c7b434e47781bbd0588e5c56a 100644 (file)
@@ -478,6 +478,7 @@ void SketchPlugin_Trim::execute()
 #endif
 }
 
+// LCOV_EXCL_START
 std::string SketchPlugin_Trim::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
 #ifdef DEBUG_TRIM_METHODS
@@ -529,6 +530,7 @@ std::string SketchPlugin_Trim::processEvent(const std::shared_ptr<Events_Message
   }
   return aFilledAttributeName;
 }
+// LCOV_EXCL_STOP
 
 bool SketchPlugin_Trim::setCoincidenceToAttribute(const AttributePtr& theAttribute,
                                 const std::set<AttributePoint2DPtr>& theFurtherCoincidences,
@@ -1197,20 +1199,6 @@ void SketchPlugin_Trim::fillAttribute(const AttributePtr& theModifiedAttribute,
     if (aModifiedAttribute.get() && aSourceAttribute.get())
       aModifiedAttribute->setValue(aSourceAttribute->value());
   }
-  else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
-    AttributeRefAttrPtr aRefAttributeToFill = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-                                                                             theModifiedAttribute);
-    AttributeRefAttrPtr aSourceRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-                                         theSourceAttribute);
-    if (!aSourceRefAttr.get())
-      aRefAttributeToFill->setAttr(theSourceAttribute);
-    else {
-      if (aSourceRefAttr->isObject())
-        aRefAttributeToFill->setObject(aSourceRefAttr->object());
-      else
-        aRefAttributeToFill->setAttr(aSourceRefAttr->attr());
-    }
-  }
 }
 
 FeaturePtr SketchPlugin_Trim::createLineFeature(const FeaturePtr& theBaseFeature,
index 632db037c6b225aebda41172df6c9586703c3458..99f21766c8ebd0e2d9ad242ccf89d0b89dfe5426 100644 (file)
@@ -48,14 +48,14 @@ SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 10)
 model.do()
 Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False)
 SketchPoint_1 = SketchProjection_3.createdFeature()
 SketchArc_1 = Sketch_2.addArc(0, 5, -5, 0, 5, 0, False)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_1.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
 SketchPoint_2 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_1e"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
 SketchPoint_3 = SketchProjection_5.createdFeature()
 model.do()
 
index 1c949e8cba47e9caa9f21aa80158980df7fe944b..e9f70c2c6a9c834836af55e7c0ac6a38a36e67b1 100644 (file)
@@ -86,24 +86,24 @@ SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 10)
 SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.coordinates())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchArc_1_2r-SketchArc_2_2r")], model.selection(), "b/2", "b/2")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchLine_10f")], model.selection(), "b/2", "b/2")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), False)
 SketchPoint_2 = SketchProjection_1.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(-15, 35, 25)
 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_2.result())
 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "50/2")
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
-SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Vertex&ExtrusionCut_1_1/From_Face"), False)
 SketchPoint_3 = SketchProjection_2.createdFeature()
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_2"), False)
 SketchLine_11 = SketchProjection_3.createdFeature()
 SketchArc_3 = Sketch_3.addArc(-15, 35, -15, 46.0103340429751, -17.02045759563166, 24.17663606626138, True)
 SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchPoint_3.result(), SketchArc_3.center())
 SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_1"), False)
 SketchArc_4 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
 SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35)
index d96bf8aac6a035c5b99511cd97451698e7b98f14..980d684ee871de34f9fb150fd46d4f88da7c33c2 100644 (file)
@@ -32,7 +32,7 @@ Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True)
 SketchCircle_1 = SketchProjection_1.createdFeature()
 SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0)
 model.do()
index 1049f7d1c64a3bd1d07b5f231ad2fe150eaadb31..f812ec934d158d9b0048dc8259c641e8ae7fae4d 100644 (file)
@@ -28,13 +28,13 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchLine_1 = Sketch_1.addLine(-20, -62, 81, 60)
 model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), True)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), True)
 SketchLine_2 = SketchProjection_1.createdFeature()
 model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchProjection_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchProjection_1")])
 model.end()
 
 # before bug fix it was "Sketch_2"
-assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/Edge-SketchProjection_1")
+assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/SketchProjection_1")
 
 assert(model.checkPythonDump())
index a621443605caceef3affcf469e66f4b7100b2702..337a82cb9281a74b932ab7948b7c643dcc6dec95 100644 (file)
@@ -112,13 +112,13 @@ SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_3.endPoint(), Sketch
 SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_9.result(), 20)
 SketchConstraintLength_6.setName("SketchConstraintLength_8")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2r-SketchLine_11f-SketchLine_12r")], model.selection(), 3.5, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2f-SketchLine_11f-SketchArc_3_2r-SketchLine_12r-SketchLine_7r-SketchLine_6r-SketchLine_8f-SketchArc_1_2f")], model.selection(), 3.5, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"))
 SketchLine_14 = Sketch_2.addLine(6, 0, -6, 0)
-SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_7s-SketchLine_6e"), False)
+SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_EndVertex"), False)
 SketchPoint_7 = SketchProjection_8.createdFeature()
 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_7.result())
-SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_8s"), False)
+SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_StartVertex"), False)
 SketchPoint_8 = SketchProjection_9.createdFeature()
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_8.result())
 SketchLine_15 = Sketch_2.addLine(-6, 0, -6, -3.5)
@@ -126,14 +126,14 @@ SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint()
 SketchLine_16 = Sketch_2.addLine(-6, -3.5, -6, -10.5)
 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
 SketchLine_17 = Sketch_2.addLine(5.978225648847096, 0.08643259872215214, 6, -3.5)
-SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False)
 SketchPoint_9 = SketchProjection_10.createdFeature()
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchPoint_9.result())
 SketchLine_18 = Sketch_2.addLine(6, -3.5, 6, -10.5)
 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
 SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_18.result(), 7)
 SketchConstraintLength_7.setName("SketchConstraintLength_9")
-SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), False)
 SketchPoint_10 = SketchProjection_11.createdFeature()
 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_15.endPoint())
 SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_18.result())
index 1739cbe66c0d369d97a4c934e79cbe040c798e64..d0f4b6f675ad324fa23c2c7b74034056811be516 100644 (file)
@@ -93,11 +93,11 @@ SketchConstraintVertical_15 = Sketch_4.setVertical(SketchLine_52.result())
 SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_55.result())
 SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_58.result())
 SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result())
-SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5e"), False)
+SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"), False)
 SketchPoint_4 = SketchProjection_13.createdFeature()
 SketchConstraintDistanceHorizontal_17 = Sketch_4.setHorizontalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_52.endPoint(), "Drill2_Loc")
 SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_54.result(), "Drill2_InnerRadius")
-SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
 SketchLine_59 = SketchProjection_14.createdFeature()
 SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45)
 SketchConstraintLength_4 = Sketch_4.setLength(SketchLine_56.result(), "Drill2_Radius")
@@ -111,7 +111,7 @@ SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_57.endPoint(), Ske
 SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1])
 model.do()
 
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_9r-SketchLine_10r-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f-SketchLine_10r-SketchLine_9r-SketchLine_7r")], model.selection("EDGE", "Sketch_2/SketchLine_7"), 360, 0)
 model.do()
 
 from GeomAPI import GeomAPI_Shape
@@ -157,4 +157,4 @@ model.testResultsVolumes(Revolution_1, [41.691543241529835484016075497], SIGNIFI
 model.end()
 
 # TODO: uncomment following line when issue #2389 is fixed
-#assert(model.checkPythonDump())
\ No newline at end of file
+#assert(model.checkPythonDump())
index 0fc461049a11eb36ba46bde8f1be52731f1468ce..09a22455716e424b3cc95455206ea951c3d2539e 100644 (file)
@@ -38,7 +38,7 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Top"), 10,
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), True)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), True)
 SketchLine_1 = SketchProjection_2.createdFeature()
 SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3)
 [SketchLine_1, SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated()
@@ -54,4 +54,4 @@ model.checkSketch(Sketch_1, 0)
 
 model.end()
 
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
index eb4077a58aa7982d88ac726a95b843d8b0699a01..0197e4ab878a68e327312087b4f206e9cca9412e 100644 (file)
@@ -44,7 +44,7 @@ Import_1.result().setName("profile_top_1")
 
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_1 = Sketch_1.addLine(-0.5, 0, -0.1, 0.5)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape2"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape_2"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 model.do()
 
index 066d5e292a4a67ff288e1e2925bc6d6171a3dbb9..f78931992358f506b5a7b1a570838788eda7f0cb 100644 (file)
@@ -113,13 +113,13 @@ SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_1.startPoint(
 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_23")
 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_11.result(), SketchArc_2.startPoint(), 7.37, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchArc_1_2r-SketchArc_2_2f-SketchArc_3_2f")], model.selection(), "h", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_3_2f-SketchLine_10r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchArc_2_2f")], model.selection(), "h", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/From_Face]"), False)
 SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False)
 SketchPoint_3 = SketchProjection_4.createdFeature()
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False)
 SketchPoint_4 = SketchProjection_5.createdFeature()
 SketchLine_13 = Sketch_2.addLine(6.005577592461473, 0, -5.994422407538528, 0)
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_13.startPoint())
@@ -129,7 +129,7 @@ SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_26")
 SketchLine_14 = Sketch_2.addLine(-5.994422407538528, 0, -5.994422407538528, -3.5)
 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
 SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_27")
-SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False)
 SketchPoint_5 = SketchProjection_6.createdFeature()
 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_28")
@@ -161,7 +161,7 @@ SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_17.result())
 SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_17.result(), 7)
 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_17.result(), SketchLine_15.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16r-SketchLine_17r-SketchArc_5_2f")], model.selection(), "h", 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchArc_5_2f-SketchLine_17r-SketchLine_16r")], model.selection(), "h", 0)
 model.do()
 
 
diff --git a/src/SketchPlugin/Test/Test2741.py b/src/SketchPlugin/Test/Test2741.py
new file mode 100644 (file)
index 0000000..549f5af
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    Test2741.py
+    Test case for issue #2741 "Undo of distance argument change produces crash"
+"""
+
+from salome.shaper import model
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-34.48932587013569, -5.994823429605995, -23.03828378136105, 27.99739301876914)
+SketchLine_2 = Sketch_1.addLine(-23.03828378136105, 27.99739301876914, -14.34307552407934, -3.849202930145424)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), 20, True)
+model.do()
+
+# Change point-line distance constraint to point-point distance
+SketchAPI_Constraint(SketchConstraintDistance_1).setEntityB(SketchLine_2.endPoint())
+model.do()
+model.end()
+
+# Check no crash on undo distance changing
+model.undo()
diff --git a/src/SketchPlugin/Test/Test2810.py b/src/SketchPlugin/Test/Test2810.py
new file mode 100644 (file)
index 0000000..4131533
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    Test2810.py
+    Test case for issue #2810 "crash creating arc fillet"
+"""
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchArc_1 = Sketch_1.addArc(10, 10, 11, 10, 10, 11, False)
+SketchLine_1 = Sketch_1.addLine(12, 10, 12, 9)
+model.do()
+
+Sketch_1.setFixed(SketchArc_1.results()[1])
+Sketch_1.setFixed(SketchLine_1.result())
+
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint())
+model.do()
+
+SketchFillet = Sketch_1.setFillet(SketchArc_1.startPoint())
+model.do()
+
+assert(Sketch_1.feature().error() != "")
+
+model.end()
index 46ce2e4d1cba0c4bf6125b3f467242c37fda21dd..a36c178353a9361934a68e79014a50e6157ce53f 100644 (file)
@@ -171,6 +171,25 @@ assert (refattrB.isInitialized())
 assert (aDistance.isInitialized())
 assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
 assert (model.dof(aSketchFeature) == 5)
+
+#=========================================================================
+# Swap point and line in the distance
+#=========================================================================
+aSession.startOperation()
+refattrA.setAttr(aSketchPointCoords)
+refattrB.setObject(aLineResult)
+aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
+# set flyout point then abort operation, after that check the Distance is correct
+aSession.startOperation()
+aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt"))
+aFlyoutPoint.setValue(100.0, 100.0)
+aSession.abortOperation()
+assert (refattrA.isInitialized())
+assert (refattrB.isInitialized())
+assert (aDistance.isInitialized())
+assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
+assert (model.dof(aSketchFeature) == 5)
 #=========================================================================
 # Change distance value
 #=========================================================================
index cd5bf4b684f7fb72746e3a45cc32ab846fe663b7..1251e564ec8e12e971778828035d243f50007e01 100644 (file)
@@ -147,7 +147,7 @@ anExtCircleCenter = geomDataAPI_Point2D(anExtCircle.attribute("circle_center"))
 anExtCircleRadius = anExtCircle.real("circle_radius")
 anExtCircleCenter.setValue(-50., 50.)
 anExtCircleRadius.setValue(10.)
-anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2")
+anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2")
 aSession.finishOperation()
 assert (model.dof(aSketchFeature) == 7)
 aSession.startOperation()
@@ -212,7 +212,7 @@ anExtLineStart = geomDataAPI_Point2D(anExtLine.attribute("StartPoint"))
 anExtLineEnd = geomDataAPI_Point2D(anExtLine.attribute("EndPoint"))
 anExtLineStart.setValue(-40., 35.)
 anExtLineEnd.setValue(-60., 25.)
-anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1")
+anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
 anExtLineLen = lineLength(anExtLine)
 aSession.finishOperation()
 assert (model.dof(aSketchFeature) == 13)
diff --git a/src/SketchPlugin/Test/TestConstraintRadiusFailure.py b/src/SketchPlugin/Test/TestConstraintRadiusFailure.py
new file mode 100644 (file)
index 0000000..c989fc9
--- /dev/null
@@ -0,0 +1,34 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-30, 0, -10, 0)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchLine_1.result(), 20)
+model.do()
+
+assert(SketchConstraintRadius_1.feature().error() != "")
+
+model.end()
index 0e44647749bcb621f235025a4c94a29aa0ccf221..92666b17849f2f0b38a5a43d9ef6d06fae8c7485 100644 (file)
@@ -272,6 +272,116 @@ verifyPointOnCircle(aStart, aPrevArc)
 model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 6)
 model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
 
+#=========================================================================
+# Test 5. Create another arc by center and points coincident to other features
+#=========================================================================
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+aCenterRef.setObject(aLine.lastResult())
+aCenter.setValue(aLineStartPoint.pnt())
+aStartRef.setObject(aLine.lastResult())
+aStart.setValue(aLineEndPoint.pnt())
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcStart.pnt())
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 16), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# check connected features do not change their positions
+model.assertArc(aPrevArc, aPrevArcCenterXY, aPrevArcStartXY, aPrevArcEndXY)
+model.assertLine(aLine, aLineStart, aLineEnd)
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnLine(aCenter, aLine)
+verifyPointOnLine(aStart, aLine)
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 9)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
+#=========================================================================
+# Test 6. Create one more arc by center and points coincident to other features
+#=========================================================================
+# get previous arc
+aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aPrevArcCenter = geomDataAPI_Point2D(aPrevArc.attribute("center_point"))
+aPrevArcStart = geomDataAPI_Point2D(aPrevArc.attribute("start_point"))
+aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point"))
+aPrevArcCenterXY = [aPrevArcCenter.x(), aPrevArcCenter.y()]
+aPrevArcStartXY = [aPrevArcStart.x(), aPrevArcStart.y()]
+aPrevArcEndXY = [aPrevArcEnd.x(), aPrevArcEnd.y()]
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+delta = [aPrevArcEndXY[0] - aPrevArcCenterXY[0], aPrevArcEndXY[1] - aPrevArcCenterXY[1]]
+aCenter.setValue(aPrevArcCenterXY[0] + 2 * delta[0], aPrevArcCenterXY[1] + 2 * delta[1])
+aStart.setValue(aPrevArcCenterXY[0] + 2 * delta[0] - 0.9 * delta[1], aPrevArcCenterXY[1] + 2 * delta[1] + 0.9 * delta[0])
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcCenterXY[0] + 1.1 * delta[0], aPrevArcCenterXY[1] + 1.1 * delta[1])
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 18), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 10)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
+#=========================================================================
+# Test 7. Create one more arc by center and points coincident to other features
+#=========================================================================
+aPrevArcCenterXY = [aPrevArcCenter.x(), aPrevArcCenter.y()]
+aPrevArcStartXY = [aPrevArcStart.x(), aPrevArcStart.y()]
+aPrevArcEndXY = [aPrevArcEnd.x(), aPrevArcEnd.y()]
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+delta = [aPrevArcEndXY[0] - aPrevArcCenterXY[0], aPrevArcEndXY[1] - aPrevArcCenterXY[1]]
+aCenter.setValue(aPrevArcCenterXY[0] + 2 * delta[0], aPrevArcCenterXY[1] + 2 * delta[1])
+aStart.setValue(aPrevArcCenterXY[0] + 2 * delta[0] - delta[1], aPrevArcCenterXY[1] + 2 * delta[1] + delta[0])
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcCenterXY[0] + delta[0], aPrevArcCenterXY[1] + delta[1])
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 20), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 11)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
 #=========================================================================
 # End of test
 #=========================================================================
index cc8ae38a72902b8a03c6994c1faa3a5891534cbc..5a53a81f04aca9d2397923c54ee429a342187e9d 100644 (file)
@@ -55,26 +55,26 @@ Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
 Sketch_1.setLength(SketchLine_1.result(), 20)
 Sketch_1.setLength(SketchLine_2.result(), 40)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection(), 10, 0)
 
 # Extrude all lateral faces to check their area
 Extrusion_2 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
 SketchLine_5 = Sketch_2.addLine(0.7346748749771982, 2.736245541082907e-015, 0.7346748749771982, 10.00000000000001)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
 SketchPoint_1 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result())
 SketchLine_6 = Sketch_2.addLine(0.7346748749771982, 10.00000000000001, -19.2653251250228, 10.00000000000001)
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
 SketchPoint_3 = SketchProjection_3.createdFeature()
 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchPoint_3.result())
 SketchLine_7 = Sketch_2.addLine(-19.2653251250228, 10.00000000000001, -19.2653251250228, 2.775557561562891e-015)
 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
 SketchPoint_4 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_4.result())
 SketchLine_8 = Sketch_2.addLine(-19.2653251250228, 2.775557561562891e-015, 0.7346748749771974, 3.386180225106727e-015)
@@ -83,22 +83,22 @@ SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_5.startPoint(
 Extrusion_2.setNestedSketch(Sketch_2)
 
 Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
 SketchLine_9 = Sketch_3.addLine(36.86324678550901, 2.286454635368208e-015, 36.86324678550901, 10)
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
 SketchPoint_5 = SketchProjection_5.createdFeature()
 SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchPoint_5.result())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
 SketchPoint_6 = SketchProjection_6.createdFeature()
 SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchPoint_6.result())
 SketchLine_10 = Sketch_3.addLine(36.86324678550901, 10, -3.136753214490995, 10)
 SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
 SketchPoint_7 = SketchProjection_7.createdFeature()
 SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchPoint_7.result())
 SketchLine_11 = Sketch_3.addLine(-3.136753214490995, 10, -3.136753214490995, 2.275957200481571e-015)
 SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False)
 SketchPoint_8 = SketchProjection_8.createdFeature()
 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_8.result())
 SketchLine_12 = Sketch_3.addLine(-3.136753214490995, 2.275957200481571e-015, 36.86324678550902, 1.387778780781446e-015)
@@ -107,22 +107,22 @@ SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_9.startPoint(
 Extrusion_3.setNestedSketch(Sketch_3)
 
 Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"))
 SketchLine_13 = Sketch_4.addLine(22.60959895285982, 4.420942808558057e-016, 22.60959895285982, 10)
-SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False)
 SketchPoint_9 = SketchProjection_9.createdFeature()
 SketchConstraintCoincidence_21 = Sketch_4.setCoincident(SketchLine_13.startPoint(), SketchPoint_9.result())
-SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
 SketchPoint_10 = SketchProjection_10.createdFeature()
 SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchPoint_10.result())
 SketchLine_14 = Sketch_4.addLine(22.60959895285982, 10, -7.390401047140179, 10)
 SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
-SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
 SketchPoint_11 = SketchProjection_11.createdFeature()
 SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchPoint_11.result())
 SketchLine_15 = Sketch_4.addLine(-7.390401047140179, 10, -7.390401047140179, 8.881784197001252e-016)
 SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
-SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False)
 SketchPoint_12 = SketchProjection_12.createdFeature()
 SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchPoint_12.result())
 SketchLine_16 = Sketch_4.addLine(-7.390401047140179, 8.881784197001252e-016, 22.60959895285983, 0)
@@ -131,22 +131,22 @@ SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_13.startPoint
 Extrusion_4.setNestedSketch(Sketch_4)
 
 Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
 SketchLine_17 = Sketch_5.addLine(-10.64977324988603, -1.185841873934692e-016, -10.64977324988603, -10)
-SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False)
 SketchPoint_13 = SketchProjection_13.createdFeature()
 SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_17.startPoint(), SketchPoint_13.result())
-SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
 SketchPoint_14 = SketchProjection_14.createdFeature()
 SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchPoint_14.result())
 SketchLine_18 = Sketch_5.addLine(-10.64977324988603, -10, 39.35022675011398, -10)
 SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
-SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
 SketchPoint_15 = SketchProjection_15.createdFeature()
 SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchPoint_15.result())
 SketchLine_19 = Sketch_5.addLine(39.35022675011398, -10, 39.35022675011398, 4.440892098500626e-016)
 SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
-SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
 SketchPoint_16 = SketchProjection_16.createdFeature()
 SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_19.endPoint(), SketchPoint_16.result())
 SketchLine_20 = Sketch_5.addLine(39.35022675011398, 4.440892098500626e-016, -10.64977324988603, 0)
index 557b74daa5b9af69c92028b2fb4f4e0dd69cf239..27f2ff5f14683a8cb43901d72c92d03c940f0796 100644 (file)
@@ -48,7 +48,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Size")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Size")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Size", 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Size", 0)
 
 Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
 model.do()
index b6ef8dc27ca89ee4f179c75e6aa33f37955e2bc8..07f2831cd0004fd663e6db79d54edbf470bc86ab 100644 (file)
@@ -51,11 +51,11 @@ SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.center(), Ske
 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 60)
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchArc_2_2f-SketchLine_1f-SketchLine_2r")], model.selection(), 50, 50)
-Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_2_2f-SketchLine_2r-SketchArc_1_2r")], model.selection(), 50, 50)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/From_Face]"), False)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1-SketchArc_2-SketchProjection_1-SketchPoint_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchLine_3 = Sketch_2.addLine(-70, 60, 70, 60)
 SketchLine_4 = Sketch_2.addLine(70, 60, 70, -60)
@@ -74,19 +74,19 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2)
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 70, True)
 SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 70, True)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
 Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")])
 
 # set different edges used for intersection and check reference data: number of intersection points and their coordinates
-REF_DATA = [("Sketch_1/Edge-SketchArc_1_2", 1, [[30, 0]]),
-            ("Sketch_1/Edge-SketchLine_2", 1, [[-36.024358588836, 0]]),
-            ("Sketch_1/Edge-SketchArc_2_2", 2, [[60, 0], [-60, 0]]),
-            ("Sketch_1/Edge-SketchLine_1", 0, []),
-            ("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1", 1, [[30, 50]]),
-            ("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1", 1, [[-36.024358588836, 50]]),
-            ("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1", 2, [[60, 50], [-60, 50]]),
-            ("Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1", 0, []),
-            ("Intersection_1_1", 2, [[-0.0515933488223, -11.6181750315], [41.6438615258, -11.6181750315]])]
+REF_DATA = [("Sketch_1/SketchArc_1_2", 1, [[30, 0]]),
+            ("Sketch_1/SketchLine_2", 1, [[-36.024358588836, 0]]),
+            ("Sketch_1/SketchArc_2_2", 2, [[60, 0], [-60, 0]]),
+            ("Sketch_1/SketchLine_1", 0, []),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]", 1, [[30, 50]]),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", 1, [[-36.024358588836, 50]]),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]", 2, [[60, 50], [-60, 50]]),
+            ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]", 0, []),
+            ("Intersection_1_1", 2, [[41.6438615258, -11.6181750315], [-0.0515933488223, -11.6181750315]])]
 TOLERANCE = 1.e-7
 
 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
index 47237e813efcc58ca049df377190d3b244541223..22f0dfc0bfef0d53cf49514177a9af3f87778465 100644 (file)
@@ -56,10 +56,10 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 50)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10)
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_2.result(), 19, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), "D", True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), "D", True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), True)
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), True)
 SketchIntersectionPoint_1.result().setName("SketchIntersectionPoint_1")
 [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
 SketchCircle_1 = Sketch_2.addCircle(38.14142842854285, 10, 1)
@@ -83,7 +83,7 @@ SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_2.endPoint(),
 SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_2.startPoint(), 5)
 SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_6.result())
 model.do()
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchArc_2_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchArc_2_2f-SketchLine_5r")], model.selection("EDGE", "Sketch_2/SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")])
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), 5, 5, [model.selection("SOLID", "RevolutionCut_1_1")])
 model.do()
 
index a6b163ca27158b2c99eb24e46481286d03fce789..36bcc53ae3981e1e255a7d162be39191f493b4d6 100644 (file)
@@ -67,10 +67,10 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_2.result(), 10)
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_4.startPoint(), "D")
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_7.startPoint(), 40, True)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0)
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_5"))
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"))
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False)
 [SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints()
 SketchCircle_1 = Sketch_2.addCircle(40, 10, 5)
 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center())
index a3f39656611fda9bfcfc348ce20b15ed63e9aa6d..44e1eda7b0e919e15bb038270586bb2c0ea7f86a 100644 (file)
@@ -50,9 +50,9 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 65)
 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_3).startPoint(), 20)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 55)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25)
-Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")])
 Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")])
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchLine_4 = Sketch_2.addLine(-34.11217447219568, 40, 20, -37.28019411294778)
@@ -70,9 +70,9 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1)
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "D", True)
 SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_5.result(), SketchLine_4.result(), 35)
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10)
 ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), 10, 0, [model.selection("SOLID", "Extrusion_2_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face_3"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_4"))
 SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "Intersection_1_1"), False)
 [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
 SketchCircle_1 = Sketch_3.addCircle(-33.22640570408476, 0, 5)
@@ -115,12 +115,12 @@ model.do();
 assert(SketchIntersectionPoint_1.feature().results().size() == 1)
 
 model.testNbResults(ExtrusionFuse_1, 1)
-model.testNbSubResults(ExtrusionFuse_1, [1])
+model.testNbSubResults(ExtrusionFuse_1, [0])
 model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.SOLID, [1])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [11])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [42])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [84])
-model.testResultsVolumes(ExtrusionFuse_1, [89224.362837261898675933480262756])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [9])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [30])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [60])
+model.testResultsVolumes(ExtrusionFuse_1, [89638.890852351003559306263923645])
 
 # change parameter and check intersection is NOT valid now
 ParamD.setValue(50)
index 228f50427183247bc3af5d276d732706eeb46633..d0db233b2b0ac48fb17d2722e5a3cd856379f6b8 100644 (file)
@@ -202,7 +202,7 @@ for i in range(1, 10):
 assert(model.dof(Sketch_1) == 0)
 
 # Extrude main part of clamp
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2f-SketchCircle_1_2r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchArc_1_2f-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-SketchCircle_1_2r")], model.selection(), 10, 0)
 model.do()
 
 
@@ -210,7 +210,7 @@ model.do()
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchRectangle_1 = Sketch_2.addRectangle(20, 0, 100, 50)
 [SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchRectangle_1.lines()
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_10 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_7).startPoint(), SketchAPI_Line(SketchLine_10).startPoint())
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_8.result(), SketchLine_10.result())
@@ -337,12 +337,12 @@ SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 6.5)
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 30)
 model.do()
 
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchCircle_2_2r-SketchArc_2_2r-SketchLine_13r-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchLine_16r")], model.selection(), -165, 155)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_14f-SketchLine_16r-SketchArc_3_2r-SketchLine_15f-SketchLine_13r-SketchArc_2_2r-SketchCircle_2_2r")], model.selection(), -165, 155)
 Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
 
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)"))
 SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0)
-SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "Fuse_1_1/Modified_Face_divided_6_1&Fuse_1_1/Modified_Face_3&Fuse_1_1/Modified_Face_divided_5_1"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Extrusion_1_1/From_Face&Sketch_2/SketchLine_6][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_1&Extrusion_2_1/To_Face][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7]"))
 SketchPoint_2 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result())
 SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20)
@@ -365,12 +365,12 @@ SketchArc_5 = Sketch_3.addArc(145, -20, 155, -20, 145, -10, False)
 SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_5.center())
 SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_20.result(), SketchArc_5.endPoint())
 SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_5.startPoint(), SketchLine_19.result())
-SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "Fuse_1_1/Modified_Face_4&Fuse_1_1/Modified_Face_divided_2_1"))
+SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face][(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)]"))
 SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result())
 model.do()
 
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_17r-SketchLine_18r-SketchArc_4_2r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face_divided_1_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_20r-SketchArc_4_2f-SketchArc_5_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2f-SketchLine_20r-SketchArc_5_2r-SketchLine_19r")], model.selection(), model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchArc_4_2)(ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
 model.do()
 
 model.end()
index d69ce986b282e9ba8f8076acc38cb14766747966..9acedebaa53f3cd1a84cee065088ae698d38a220 100644 (file)
@@ -47,7 +47,7 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O
 SketchPoint_1 = SketchProjection_1.createdFeature()
 model.do()
 SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_2.result()], SketchAPI_Point(SketchPoint_1).coordinates(), "360/N", "N")
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
 model.do()
 
 # change parameters
diff --git a/src/SketchPlugin/Test/TestPresentation.py b/src/SketchPlugin/Test/TestPresentation.py
new file mode 100644 (file)
index 0000000..f4ebf9e
--- /dev/null
@@ -0,0 +1,130 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    TestPresentation.py
+    Test AIS presentations for constraints and macro-features
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16")
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-1.492165138365909, 9.860293583877349, 21.86930170264727, 26.80555863006795)
+SketchLine_2 = Sketch_1.addLine(21.86930170264727, 26.80555863006795, 23.42558840321396, 11.88651135131589)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 60)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.endPoint(), 25, True)
+SketchLine_3 = Sketch_1.addLine(23.50783486163409, 27.99407041552052, 34.45590553653152, 35.9352652297464)
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_3.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_3.startPoint(), 25)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 15)
+SketchLine_4 = Sketch_1.addLine(53.74716193144771, -7.706985565972583, 35.95905823005196, -7.706985565972583)
+SketchLine_5 = Sketch_1.addLine(35.95905823005196, -7.706985565972583, 35.95905823005196, 16.71916358123427)
+SketchLine_6 = Sketch_1.addLine(35.95905823005196, 16.71916358123427, 53.74716193144771, 16.71916358123427)
+SketchLine_7 = Sketch_1.addLine(53.74716193144771, 16.71916358123427, 53.74716193144771, -7.706985565972583)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_5.result(), SketchLine_7.result())
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_6.result(), SketchLine_7.result())
+SketchCircle_1 = Sketch_1.addCircle(20.43340729011699, -17.26699099051272, 10)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchConstraintRigid_1 = Sketch_1.setFixed(SketchCircle_1.center())
+SketchArc_1 = Sketch_1.addArc(44.85311008074984, -7.706985565972585, 49.46781809225963, -16.57853954306742, 34.85430557643821, -7.861609252895618, False)
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchArc_1.results()[1])
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchArc_1.center(), SketchLine_4.result())
+SketchLine_8 = Sketch_1.addLine(49.46781809225963, -16.57853954306742, 32.21747944141746, -25.55163221418553)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result())
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchLine_2.result()])
+SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchLine_2.result()], SketchLine_3.startPoint(), SketchLine_3.endPoint(), 3, True)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_3.result()], SketchLine_3.endPoint(), 360, 4, True)
+model.do()
+
+assert(featureToPresentation(SketchConstraintAngle_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintCoincidence_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintCollinear_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintDistance_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintDistanceHorizontal_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintEqual_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintHorizontal_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintLength_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintMiddle_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintParallel_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintPerpendicular_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintRadius_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintRigid_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintTangent_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintVertical_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintMirror_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchMultiTranslation_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchMultiRotation_1.feature()).getAISObject(None) is not None)
+
+# Test presentation for Fillet on low-level
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch_1.feature())
+aSession.startOperation()
+aFillet = aSketchFeature.addFeature("SketchFillet")
+aFillet.refattr("fillet_point").setAttr(SketchLine_1.endPoint());
+assert(featureToPresentation(aFillet).getAISObject(None) is not None)
+aSession.finishOperation()
+
+# Test presentation for MacroCircle on low-level
+aSession.startOperation()
+aCircle = aSketchFeature.addFeature("SketchMacroCircle")
+aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point"))
+aCirclePnt2 = geomDataAPI_Point2D(aCircle.attribute("second_point"))
+aCirclePnt3 = geomDataAPI_Point2D(aCircle.attribute("third_point"))
+aCircleType = aCircle.string("circle_type")
+aCircleType.setValue("circle_type_by_three_points")
+aCirclePnt1.setValue(10, 0)
+aCirclePnt2.setValue(-10, 0)
+aCirclePnt3.setValue(0, 10)
+assert(featureToPresentation(aCircle).getAISObject(None) is not None)
+aSession.finishOperation()
+
+# Test presentation for MacroArc on low-level
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2"))
+anArcPnt2 = geomDataAPI_Point2D(anArc.attribute("end_point_2"))
+anArcPnt3 = geomDataAPI_Point2D(anArc.attribute("passed_point"))
+anArcType = anArc.string("arc_type")
+anArcType.setValue("by_three_points")
+anArcPnt1.setValue(5, 0)
+anArcPnt2.setValue(-5, 0)
+anArcPnt3.setValue(0, 5)
+assert(featureToPresentation(anArc).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.end()
index 7e24e3ed5b3916a2794bcabc919992dafb416b42..d8dc75f50601848f9626809e65d326cd15004616 100644 (file)
@@ -94,17 +94,17 @@ aSession.finishOperation()
 #=========================================================================
 aSession.startOperation()
 aLineProjector = aSketchFeature.addFeature("SketchProjection")
-aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1")
+aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
 aLineProjector.boolean("IncludeToResult").setValue(False)
 aLineProjector.execute()
 
 aCircleProjector = aSketchFeature.addFeature("SketchProjection")
-aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2")
+aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2")
 aCircleProjector.boolean("IncludeToResult").setValue(False)
 aCircleProjector.execute()
 
 anArcProjector = aSketchFeature.addFeature("SketchProjection")
-anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchArc_1_2")
+anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2")
 anArcProjector.boolean("IncludeToResult").setValue(False)
 anArcProjector.execute()
 aSession.finishOperation()
index adfd8ebcc316eeaec98e351e605599b44e3e00ae..d5f43d158c135b3fe22eaac4817547d544fcdd02 100644 (file)
@@ -1,3 +1,28 @@
+## Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    TestProjectionIntoResult.py
+    Unit test of SketchPlugin_Projection class
+"""
+
 from salome.shaper import model
 from GeomAPI import *
 
@@ -66,75 +91,75 @@ SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(),
 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_7.endPoint())
 SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_2r")], model.selection(), 100, 0)
 model.do()
 
 #==============================================================================
 # Tests
 #==============================================================================
 
-aProjectedList = [("EDGE", "Sketch_1/Edge-SketchCircle_1_2"),
-                  ("EDGE", "Sketch_1/Edge-SketchArc_1_2"),
-                  ("EDGE", "Sketch_1/Edge-SketchLine_1"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchPoint_1"),
+aProjectedList = [("EDGE", "Sketch_1/SketchCircle_1_2"),
+                  ("EDGE", "Sketch_1/SketchArc_1_2"),
+                  ("EDGE", "Sketch_1/SketchLine_1"),
+                  ("VERTEX", "Sketch_1/SketchPoint_1"),
                   #
-                  ("VERTEX", "Sketch_1/Vertex-SketchCircle_1"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchLine_1e"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchLine_1s"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2s"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2e"),
-                  ("VERTEX", "Sketch_1/Vertex-SketchArc_1"),
+                  ("VERTEX", "Sketch_1/SketchCircle_1_2__cc"),
+                  ("VERTEX", "Sketch_1/SketchLine_1_EndVertex"),
+                  ("VERTEX", "Sketch_1/SketchLine_1_StartVertex"),
+                  ("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"),
+                  ("VERTEX", "Sketch_1/SketchArc_1_2_EndVertex"),
+                  ("VERTEX", "Sketch_1/SketchArc_1"),
                   #
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"),
-                  ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]"),
+                  ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"),
                   #
-                  ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"),
                   #
-                  ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/Generated_Face_2"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6]"),
                   #
-                  ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"),
-                  ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1")
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/To_Face]"),
+                  ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]")
                   ]
 
 # Test projection to the same plane
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5"))
 aFailedIDs = set([21, 29])
 testProjections(Part_1_doc, Sketch_3, aProjectedList, aFailedIDs)
 
 # Test projection to parallel plane
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"))
 testProjections(Part_1_doc, Sketch_4, aProjectedList, aFailedIDs)
 
 # Test projection to lower base of the prism
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
 aFailedIDs = set([0, 1, 22, 23, 24, 25])
 testProjections(Part_1_doc, Sketch_5, aProjectedList, aFailedIDs)
 
 # Test projection to upper base of the prism
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 testProjections(Part_1_doc, Sketch_6, aProjectedList, aFailedIDs)
 
 # Test projection to orthogonal side face of the prism
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"))
 aFailedIDs = set([0, 1, 18, 20, 26, 28])
 testProjections(Part_1_doc, Sketch_7, aProjectedList, aFailedIDs)
 
 # Test projection to slope side face of the prism
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2"))
 aFailedIDs = set([0, 1])
 testProjections(Part_1_doc, Sketch_8, aProjectedList, aFailedIDs)
 
diff --git a/src/SketchPlugin/Test/TestSketchDrawer.py b/src/SketchPlugin/Test/TestSketchDrawer.py
new file mode 100644 (file)
index 0000000..b90c948
--- /dev/null
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-14.48008258397498, -13.79591274114419, 5.519917416025022, -13.79591274114419)
+SketchLine_2 = Sketch_1.addLine(10.51991741602502, -8.795912741144186, 10.51991741602502, 18.20408725885581)
+SketchLine_3 = Sketch_1.addLine(10.51991741602502, 18.20408725885581, -14.48008258397498, 13.79591274114419)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchLine_4 = Sketch_1.addLine(-14.48008258397498, 13.79591274114419, -14.48008258397498, -13.79591274114419)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4")
+SketchArc_1 = Sketch_1.addArc(5.519917416025022, -8.795912741144186, 5.519917416025022, -13.79591274114419, 10.51991741602502, -8.795912741144186, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result())
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 5)
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), 100)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 27)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), 25, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5)
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), 20, True)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchCircle_1.center(), 20, True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")], model.selection(), 10, 0)
+model.do()
+# create a drawer feature of the extrusion and upper face
+Drawer = Part_1_doc.addFeature("SketchDrawer")
+Drawer.selection("base_shape").setValue(Extrusion_1.feature(), None)
+PlaneSelection = model.selection("FACE", "Extrusion_1_1/To_Face")
+PlaneSelection.fillAttribute(Drawer.selection("plane"))
+model.end()
+
+# check that a sketch is created with valid elements
+assert(Part_1_doc.size("Construction") == 2) # two sketches: base of extrusion and this new one
+
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+
+Sketch = objectToFeature(Part_1_doc.object("Features", 2)) # created sketch feature
+assert(aFactory.validate(Sketch))
+assert(len(Sketch.results()) == 1)
diff --git a/src/SketchPlugin/Test/TestSplitLine.py b/src/SketchPlugin/Test/TestSplitLine.py
new file mode 100644 (file)
index 0000000..bdabae1
--- /dev/null
@@ -0,0 +1,59 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+from salome.shaper import model
+from salome.shaper import geom
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-38.2842712474619, 18.28427124746191, -10, -10)
+SketchLine_2 = Sketch_1.addLine(-10, -10, -10, 20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-10, 20, -25, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()])
+[SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1)
+
+#perform split
+SketchSplit = Sketch_1.addSplit(SketchLine_1, geom.Pnt2d(-12, -8))
+SketchSplit.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0)
+
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/SketchPlugin/Test/TestSplitPreview.py b/src/SketchPlugin/Test/TestSplitPreview.py
new file mode 100644 (file)
index 0000000..6cfdf58
--- /dev/null
@@ -0,0 +1,93 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "operation_remove_feature_color", "Color of removed feature in operation", Config_Prop.Color, "255, 174, 201")
+
+# base sketch
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch.addLine(0, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(20, 0, 20, 40)
+SketchLine_3 = Sketch.addLine(80, 0, 80, 40)
+SketchCircle_1 = Sketch.addCircle(50, 50, 50)
+SketchPoint_1 = Sketch.addPoint(20, 20)
+SketchConstraintCoincidence_1 = Sketch.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result())
+SketchConstraintCoincidence_2 = Sketch.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
+SketchPoint_2 = Sketch.addPoint(80, 20)
+SketchConstraintCoincidence_3 = Sketch.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
+SketchConstraintCoincidence_4 = Sketch.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result())
+SketchPoint_3 = Sketch.addPoint(20, 10)
+SketchConstraintCoincidence_5 = Sketch.setCoincident(SketchPoint_3.coordinates(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_6 = Sketch.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result())
+SketchPoint_4 = Sketch.addPoint(80, 10)
+SketchConstraintCoincidence_7 = Sketch.setCoincident(SketchPoint_4.coordinates(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_8 = Sketch.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result())
+model.do()
+model.end()
+
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch.feature())
+
+# Create Split feature for a line
+aSession.startOperation()
+aSplit = aSketchFeature.addFeature("SketchSplit")
+aSelectedObj = aSplit.reference("SelectedObject")
+aSelectedObj.setValue(SketchLine_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aSplit.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 20)
+aPreviewObj = aSplit.reference("PreviewObject")
+aPreviewObj.setValue(SketchLine_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aSplit.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aSplit).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 0)
+model.testNbSubFeatures(Sketch, "SketchCircle", 1)
+model.testNbSubFeatures(Sketch, "SketchLine", 5)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 12)
+
+# Create Split feature for a circle to perform its substitution by an arc
+aSession.startOperation()
+aSplit = aSketchFeature.addFeature("SketchSplit")
+aSelectedObj = aSplit.reference("SelectedObject")
+aSelectedObj.setValue(SketchCircle_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aSplit.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 0)
+aPreviewObj = aSplit.reference("PreviewObject")
+aPreviewObj.setValue(SketchCircle_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aSplit.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aSplit).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 2)
+model.testNbSubFeatures(Sketch, "SketchCircle", 0)
+model.testNbSubFeatures(Sketch, "SketchLine", 5)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 16)
diff --git a/src/SketchPlugin/Test/TestTrimArc08.py b/src/SketchPlugin/Test/TestTrimArc08.py
new file mode 100644 (file)
index 0000000..fbf2584
--- /dev/null
@@ -0,0 +1,68 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from salome.shaper import geom
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(12, -8, -12, -8)
+SketchLine_2 = Sketch_1.addLine(-12, -8, -12, 20)
+SketchLine_3 = Sketch_1.addLine(-12, 20, 12, 20)
+SketchLine_4 = Sketch_1.addLine(12, 20, 12, -8)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchArc_1 = Sketch_1.addArc(0, -3, 20, -3, -20, -3, False)
+SketchLine_5 = Sketch_1.addLine(20, -3, 20, -30)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(20, 17, 50, 17)
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_1.results()[1])
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_1.results()[1])
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchArc", 1)
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintEqual", 0)
+
+# perform trim
+SketchTrim = Sketch_1.addTrim(SketchArc_1, geom.Pnt2d(0, 17))
+SketchTrim.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchArc", 2)
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 8)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintEqual", 1)
+
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/SketchPlugin/Test/TestTrimLine03.py b/src/SketchPlugin/Test/TestTrimLine03.py
new file mode 100644 (file)
index 0000000..acc9201
--- /dev/null
@@ -0,0 +1,59 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+from salome.shaper import model
+from salome.shaper import geom
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-38.2842712474619, 18.28427124746191, -10, -10)
+SketchLine_2 = Sketch_1.addLine(-10, -10, -10, 20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-10, 20, -25, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()])
+[SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1)
+
+#perform trim
+SketchTrim = Sketch_1.addTrim(SketchLine_1, geom.Pnt2d(-12, -8))
+SketchTrim.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0)
+
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/SketchPlugin/Test/TestTrimPreview.py b/src/SketchPlugin/Test/TestTrimPreview.py
new file mode 100644 (file)
index 0000000..2361d36
--- /dev/null
@@ -0,0 +1,81 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "operation_remove_feature_color", "Color of removed feature in operation", Config_Prop.Color, "255, 174, 201")
+
+# base sketch
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch.addLine(0, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(20, 0, 20, 40)
+SketchLine_3 = Sketch.addLine(80, 0, 80, 40)
+SketchCircle_1 = Sketch.addCircle(50, 50, 50)
+model.do()
+model.end()
+
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch.feature())
+
+# Create Trim feature for a line
+aSession.startOperation()
+aTrim = aSketchFeature.addFeature("SketchTrim")
+aSelectedObj = aTrim.reference("SelectedObject")
+aSelectedObj.setValue(SketchLine_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aTrim.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 20)
+aPreviewObj = aTrim.reference("PreviewObject")
+aPreviewObj.setValue(SketchLine_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aTrim.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aTrim).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 0)
+model.testNbSubFeatures(Sketch, "SketchCircle", 1)
+model.testNbSubFeatures(Sketch, "SketchLine", 4)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 2)
+
+# Create Trim feature for a circle to perform its substitution by an arc
+aSession.startOperation()
+aTrim = aSketchFeature.addFeature("SketchTrim")
+aSelectedObj = aTrim.reference("SelectedObject")
+aSelectedObj.setValue(SketchCircle_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aTrim.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 0)
+aPreviewObj = aTrim.reference("PreviewObject")
+aPreviewObj.setValue(SketchCircle_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aTrim.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aTrim).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 1)
+model.testNbSubFeatures(Sketch, "SketchCircle", 0)
+model.testNbSubFeatures(Sketch, "SketchLine", 4)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 4)
index fd95d68e97bc450310b7a027f0f2bc4b4db0b0ea..627ca479a579a2cbff2b742226fa3d06b2be60db 100644 (file)
@@ -154,3 +154,4 @@ The plug-in includes the following operations:
    mirrorFeature.rst
    translationFeature.rst
    rotationFeature.rst
+   sketchDrawer.rst
diff --git a/src/SketchPlugin/doc/images/SketchDrawer.png b/src/SketchPlugin/doc/images/SketchDrawer.png
new file mode 100644 (file)
index 0000000..e3f53d1
Binary files /dev/null and b/src/SketchPlugin/doc/images/SketchDrawer.png differ
diff --git a/src/SketchPlugin/doc/images/SketchDrawer_panel.png b/src/SketchPlugin/doc/images/SketchDrawer_panel.png
new file mode 100644 (file)
index 0000000..8b78650
Binary files /dev/null and b/src/SketchPlugin/doc/images/SketchDrawer_panel.png differ
diff --git a/src/SketchPlugin/doc/images/SketchDrawer_res.png b/src/SketchPlugin/doc/images/SketchDrawer_res.png
new file mode 100644 (file)
index 0000000..b746e4e
Binary files /dev/null and b/src/SketchPlugin/doc/images/SketchDrawer_res.png differ
diff --git a/src/SketchPlugin/doc/sketchDrawer.rst b/src/SketchPlugin/doc/sketchDrawer.rst
new file mode 100644 (file)
index 0000000..20bb2eb
--- /dev/null
@@ -0,0 +1,53 @@
+  .. _create_sketch_drawer:
+
+Sketch Drawer
+=========
+
+Sketch Drawer featrure is a macro-feature, i.e. it is removed after its execution.
+It allows simplify creation of sketches basing on existing models without referencing to
+these models.
+
+For an example, to create a sketch on exising STEP file model planar face
+and then remove the original model, to keep only the sketch with copy of contour. So, to be
+able to remove the initial model, there are no references created by this feature.
+
+To add a new Sketch Drawing:
+
+#. select in the Main Menu *Macros - > Sketch drawer* item  or
+#. click **Sketch drawer** button in Macros toolbar:
+
+.. image:: images/SketchDrawer.png
+   :align: center
+
+.. centered::
+   **Sketch drawer**  button
+
+The following property panel appears:
+
+.. image:: images/SketchDrawer_panel.png
+  :align: center
+
+.. centered::
+   Sketch drawer
+
+Click in the view once to set the whole original model, then click a second time to set the
+plane or planar face - a base of sketch. This can be plane on the original model.
+On Apply button press the new sketch will be created in the Object Browser tree.
+
+Result
+""""""
+
+A resulting sketch will contain linear and circular edges as well as circular arcs corresponding to the
+original model edges that lay in the sketch plane. Other types of edges are not supported.
+
+Radius, length, vertical, horizontal and points-coincidence constraints will be created
+automatically where it is possible. The resulting sketch may be overconstrained or not fully
+constrained. So, it is just a helper for the sketch creation, not universal tool. After this
+sketch creation normally user must edit this sketch to input reasonable constraints and
+parametrization, or remove not needed constraints or sketch lements.
+
+.. image:: images/SketchDrawer_res.png
+          :align: center
+
+.. centered::
+   Drawn sketch
diff --git a/src/SketchPlugin/icons/drawer.png b/src/SketchPlugin/icons/drawer.png
new file mode 100644 (file)
index 0000000..e3f53d1
Binary files /dev/null and b/src/SketchPlugin/icons/drawer.png differ
index f901724080e90d661af4e81cb636b60f16cdc364..3fdd8c0ce36c7b9f7becc2b5d543a947d737b2c2 100644 (file)
@@ -1057,4 +1057,19 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     </group>
 
   </workbench>
+  <workbench id="Macros" document="Part">
+    <group id="Samples">
+
+      <feature id="SketchDrawer" title="Sketch drawer" tooltip="Creates sketch using elements of selected shape belonging to selected plane"
+            icon="icons/Sketch/drawer.png"
+            helpfile="sketchDrawer.html">
+        <shape_selector id="base_shape" label="Shape:" tooltip="Select a shape for extraction to sketch."
+            shape_types="objects" concealment="false"/>
+        <shape_selector id="plane" label="Plane:" tooltip="Select plane for sketch" shape_types="face">
+          <validator id="GeomValidators_Face" parameters="plane"/>
+        </shape_selector>
+        <boolvalue id="add_dimensions" label="Create dimensions" default="true" tooltip="To add dimensions into created sketch" obligatory="0"/>
+      </feature>
+    </group>
+  </workbench>
 </plugin>
index 44daa41fa087f4bc2ca6f908497ea2bdb69a7be5..1f827a3c637b279b4b2ea6bfa56a99ea96897757 100644 (file)
@@ -167,8 +167,12 @@ void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign()
   aParams.insert(myOddPoint->y);
   aStorage->removeParameters(aParams);
 
-  aGCSConstraints.pop_back();
-  aGCSConstraints.pop_back();
+  // remove constraints keeping sign of point-line distance,
+  // not more than 2 additional constraints is possible
+  if (!aGCSConstraints.empty())
+    aGCSConstraints.pop_back();
+  if (!aGCSConstraints.empty())
+    aGCSConstraints.pop_back();
   aConstraint->setConstraints(aGCSConstraints);
   aStorage->addConstraint(myBaseConstraint, aConstraint);
 
index d4b96d1c50691e49bdce16004ee617d8d9b57d9c..fc3e6e78ae6bccb36cb2a323825e17006b64cf63 100644 (file)
@@ -333,7 +333,7 @@ void SketchSolver_Group::computeDoF()
 
   if (aDoF > 0 && myDOF <= 0)
     sendMessage(EVENT_SKETCH_UNDER_CONSTRAINED, mySketch, aDoF);
-  else if (aDoF == 0/* && myDOF > 0*/)
+  else if (aDoF == 0 && myDOF != 0)
     sendMessage(EVENT_SKETCH_FULLY_CONSTRAINED, mySketch, aDoF);
   else if (aDoF < 0)
     sendMessage(EVENT_SKETCH_OVER_CONSTRAINED, mySketch, aDoF);
index 33fea2149611d6a8e910979e0824d0b4e8ee41b5..55ef5f31b44f59ebbd629704b6dcd20cb43599f2 100644 (file)
@@ -94,41 +94,12 @@ void SketchSolver_Storage::addConstraint(ConstraintPtr        theConstraint,
     theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
 }
 
-static std::list<AttributePtr> pointAttributes(FeaturePtr theFeature)
-{
-  std::list<AttributePtr> aPoints;
-  if (!theFeature->data() || !theFeature->data()->isValid())
-    return aPoints;
-  if (theFeature->getKind() == SketchPlugin_Arc::ID()) {
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::START_ID()));
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::END_ID()));
-  }
-  else if (theFeature->getKind() == SketchPlugin_Circle::ID())
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Circle::CENTER_ID()));
-  else if (theFeature->getKind() == SketchPlugin_Line::ID()) {
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Line::START_ID()));
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Line::END_ID()));
-  }
-  else if (theFeature->getKind() == SketchPlugin_Point::ID() ||
-           theFeature->getKind() == SketchPlugin_IntersectionPoint::ID())
-    aPoints.push_back(theFeature->attribute(SketchPlugin_Point::COORD_ID()));
-  return aPoints;
-}
-
 void SketchSolver_Storage::addEntity(FeaturePtr       theFeature,
                                      EntityWrapperPtr theSolverEntity)
 {
   if (theSolverEntity) {
     myFeatureMap[theFeature] = theSolverEntity;
     setNeedToResolve(true);
-  } else {
-    // feature links to the empty entity, add its attributes
-    std::list<AttributePtr> aPntAttrs = pointAttributes(theFeature);
-    std::list<AttributePtr>::const_iterator anAttrIt = aPntAttrs.begin();
-    for (; anAttrIt != aPntAttrs.end(); ++anAttrIt)
-      addEntity(*anAttrIt, EntityWrapperPtr());
-    myFeatureMap[theFeature] = theSolverEntity;
   }
 
   // block events if necessary
index acf5d24a7d3a93df5e5b9582523b5c81c5b89178..c123960a59a9cc91c36655a5f4ef54ffb485fe61 100644 (file)
@@ -124,7 +124,8 @@ void SketcherPrs_Coincident::Compute(
     std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincidencePoint(myConstraint);
     std::shared_ptr<GeomAPI_Pnt2d> aP;
     FeaturePtr aSub;
-    for (int i = 0; i < mySketch->numberOfSubs(); i++) {
+    int aNumberOfSubs = mySketch->numberOfSubs();
+    for (int i = 0; i < aNumberOfSubs; i++) {
       aSub = mySketch->subFeature(i);
       if (aSub->getKind() == SketchPlugin_ConstraintCoincidence::ID() &&
         aSub.get() != myConstraint) {
index ee7f934575be45e96d283c0059cd48470785725e..a574c035332be147695d3b3f949daf78e229125a 100644 (file)
@@ -73,13 +73,21 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
     ModuleBase_ITreeNode* aParent;
     int aRow = 0;
     QModelIndex aParentIndex1, aParentIndex2;
+    ObjectPtr aObj;
     foreach(ModuleBase_ITreeNode* aNode, aNodes) {
+      aObj = aNode->object();
       aParent = aNode->parent();
-      aRow = aParent->nodeRow(aNode);
-      aParentIndex1 = getParentIndex(aNode, 0);
-      aParentIndex2 = getParentIndex(aNode, 2);
-      insertRows(aRow, 1, aParentIndex1);
-      dataChanged(aParentIndex1, aParentIndex2);
+      if (aObj.get() && (aObj->groupName() == ModelAPI_Folder::group())) {
+        aParent->update();
+        rebuildDataTree();
+      }
+      else {
+        aRow = aParent->nodeRow(aNode);
+        aParentIndex1 = getParentIndex(aNode, 0);
+        aParentIndex2 = getParentIndex(aNode, 2);
+        insertRows(aRow, 1, aParentIndex1);
+        dataChanged(aParentIndex1, aParentIndex2);
+      }
     }
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
@@ -92,7 +100,14 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
     for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) {
       aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str()));
     }
+    // Remove obsolete nodes
+    QTreeNodesList aRemaining;
     foreach(ModuleBase_ITreeNode* aNode, aList) {
+      if (myRoot->hasSubNode(aNode))
+        aRemaining.append(aNode);
+    }
+    // Update remaining nodes
+    foreach(ModuleBase_ITreeNode* aNode, aRemaining) {
       if (aNode->parent())
         aNode->parent()->update();
     }
@@ -124,28 +139,27 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
       rebuildDataTree();
     }
     else {
+      QSet<ModuleBase_ITreeNode*> aParents;
       foreach(ObjectPtr aObj, aCreated) {
         ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj);
         if (aNode) {
-          int aOldNb = aNode->childrenCount();
-          aNode->update();
-          int aNewNb = aNode->childrenCount();
-
-          QModelIndex aFirstIdx = getIndex(aNode, 0);
-          QModelIndex aLastIdx = getIndex(aNode, 2);
-
-          if (aNewNb > aOldNb) {
-            insertRows(aOldNb - 1, aNewNb - aOldNb, aFirstIdx);
-          }
-          else if (aNewNb < aOldNb) {
-            if (aNewNb)
-              removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx);
-            else if (aOldNb)
-              removeRows(0, aOldNb, aFirstIdx);
+          if (aNode->parent()) {
+            if (aNode->parent() == myRoot) {
+              aParents.clear();
+              aParents.insert(myRoot);
+              break;
+            }
+            else {
+              aNode = aNode->parent();
+            }
           }
-          dataChanged(aFirstIdx, aLastIdx);
+          aParents.insert(aNode);
         }
       }
+      foreach(ModuleBase_ITreeNode* aNode, aParents) {
+        aNode->update();
+      }
+      rebuildDataTree();
     }
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) {
index 7910ec06a677458604f8f7decec0eb1604e80ffb..202afd6b2c7d6253e1a0075e0ec7f1825162bd37 100644 (file)
@@ -454,8 +454,9 @@ bool XGUI_Displayer::isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& th
     if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultBody::group()) {
       ResultBodyPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
       if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
-        bool anAllSubsVisible = aCompsolidResult->numberOfSubs() > 0;
-        for(int i = 0; i < aCompsolidResult->numberOfSubs() && anAllSubsVisible; i++) {
+        int aNumberOfSubs = aCompsolidResult->numberOfSubs();
+        bool anAllSubsVisible = aNumberOfSubs > 0;
+        for(int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) {
           anAllSubsVisible = theDisplayer->isVisible(aCompsolidResult->subResult(i));
         }
         aVisible = anAllSubsVisible;
index 5c67a3d5037b62d454236c5de5ec2b8b403b1c11..0c7dcd6beba771096d0057cad314e8df2af0a0c4 100644 (file)
@@ -137,9 +137,7 @@ void XGUI_ModuleConnector::setSelected(const QList<ModuleBase_ViewerPrsPtr>& the
     foreach(ModuleBase_ViewerPrsPtr aVal, theValues) {
       anObjects.append(aVal->object());
     }
-    bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
     aBrowser->setObjectsSelected(anObjects);
-    myWorkshop->objectBrowser()->blockSignals(aBlocked);
   }
 }
 
index b08ccc36e8fd56b2ca403aef51190fc6f529b660..1862244a5c0a463866ca13a9a063089d063c399f 100644 (file)
@@ -40,6 +40,7 @@
 #include <QAction>
 #include <QStyledItemDelegate>
 #include <QMessageBox>
+#include <QApplication>
 
 #ifdef DEBUG_INDXES
 #include <QToolTip>
@@ -488,10 +489,12 @@ void XGUI_ObjectsBrowser::onEditItem()
       // Find index which corresponds the feature
       QModelIndex aIndex;
       foreach(QModelIndex aIdx, selectedIndexes()) {
-        ObjectPtr aFea = dataModel()->object(aIdx);
-        if (dataModel()->object(aIdx)->isSame(anObject)) {
-          aIndex = aIdx;
-          break;
+        if (aIdx.column() == 1) {
+          ObjectPtr aFea = dataModel()->object(aIdx);
+          if (dataModel()->object(aIdx)->isSame(anObject)) {
+            aIndex = aIdx;
+            break;
+          }
         }
       }
       if (aIndex.isValid()) {
@@ -533,17 +536,61 @@ void XGUI_ObjectsBrowser::rebuildDataTree()
 //***************************************************
 void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
 {
-  QList<QModelIndex> theIndexes;
   QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
-  aSelectModel->clear();
+  QModelIndexList aIndexes = aSelectModel->selectedIndexes();
+  if (theObjects.size() == 0) {
+    bool aIsBlock = aSelectModel->blockSignals(true);
+    aSelectModel->clear();
+    aSelectModel->blockSignals(aIsBlock);
+    foreach(QModelIndex aIdx, aIndexes) {
+      myTreeView->update(aIdx);
+    }
+    return;
+  }
 
-  foreach(ObjectPtr aFeature, theObjects)
-  {
-    QModelIndex aIndex = myDocModel->objectIndex(aFeature);
-    if (aIndex.isValid()) {
-      aSelectModel->select(aIndex, QItemSelectionModel::Select);
+  ObjectPtr aObject;
+  QModelIndexList aUnselect;
+  QObjectPtrList aToSelect = theObjects;
+  QHash<qint64, ObjectPtr> aNotChanged;
+  foreach(QModelIndex aIdx, aIndexes) {
+    aObject = myDocModel->object(aIdx);
+    if (aObject.get()) {
+      if (aToSelect.contains(aObject)) {
+        aNotChanged.insert((qint64)aObject.get(), aObject);
+      } else {
+        aUnselect.append(aIdx);
+      }
+    }
+    else {
+      aUnselect.append(aIdx);
     }
   }
+
+  foreach(ObjectPtr aObj, aNotChanged)
+    aToSelect.removeAll(aObj);
+
+  bool aIsBlock = aSelectModel->blockSignals(true);
+  foreach(QModelIndex aIdx, aUnselect) {
+    aSelectModel->select(aIdx, QItemSelectionModel::Deselect);
+    myTreeView->update(aIdx);
+  }
+
+  QModelIndex aIndex0, aIndex1, aIndex2, aCurrent;
+  foreach(ObjectPtr aFeature, aToSelect) {
+    aIndex1 = myDocModel->objectIndex(aFeature, 1);
+    if (aIndex1.isValid()) {
+      if (!aCurrent.isValid())
+        aCurrent = aIndex1;
+      aIndex0 = myDocModel->objectIndex(aFeature, 0);
+      aIndex2 = myDocModel->objectIndex(aFeature, 2);
+      aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+      myTreeView->update(aIndex0);
+      myTreeView->update(aIndex1);
+      myTreeView->update(aIndex2);
+    }
+  }
+  aSelectModel->setCurrentIndex(aCurrent, QItemSelectionModel::NoUpdate);
+  aSelectModel->blockSignals(aIsBlock);
 }
 
 //***************************************************
@@ -585,14 +632,14 @@ QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes)
   QObjectPtrList aList;
   QModelIndexList aIndexes = selectedIndexes();
   XGUI_DataModel* aModel = dataModel();
-  QModelIndexList::const_iterator aIt;
-  for (aIt = aIndexes.constBegin(); aIt != aIndexes.constEnd(); ++aIt) {
-    if ((*aIt).column() == 1) {
-      ObjectPtr aObject = aModel->object(*aIt);
+
+  foreach(QModelIndex aIdx, aIndexes) {
+    if (aIdx.column() == 1) {
+      ObjectPtr aObject = aModel->object(aIdx);
       if (aObject) {
         aList.append(aObject);
         if (theIndexes)
-          theIndexes->append(*aIt);
+          theIndexes->append(aIdx);
       }
     }
   }
index 6ea539481fbdd6393a7beae474a4bea4c8e0153f..a4cf3bbcbd1f766e7ec1e897518294f8e7b78845 100755 (executable)
@@ -146,10 +146,7 @@ void XGUI_SelectionMgr::onViewerSelection()
 
   QObjectPtrList anObjects;
   convertToObjectBrowserSelection(aValues, anObjects);
-
-  bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
   myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
-  myWorkshop->objectBrowser()->blockSignals(aBlocked);
 
   emit selectionChanged();
 }
@@ -191,9 +188,7 @@ void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::Selection
 void XGUI_SelectionMgr::clearSelection()
 {
   QObjectPtrList aFeatures;
-  bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
   myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
-  myWorkshop->objectBrowser()->blockSignals(aBlocked);
 
   QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
              myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
@@ -211,12 +206,9 @@ void XGUI_SelectionMgr::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theVal
   aDisplayer->setSelected(theValues);
 
   // update selection in Object Browser
-  bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
   QObjectPtrList anObjects;
   convertToObjectBrowserSelection(theValues, anObjects);
-
   myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
-  myWorkshop->objectBrowser()->blockSignals(aBlocked);
 }
 
 //**************************************************************
index e5bc7a30829b394cd07d8a7159c7a814285b77b0..aafafbfce01a3fc3916387ac4122e507cedc0c1e 100644 (file)
@@ -36,6 +36,8 @@
 #include <ModelAPI_ResultPart.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultBody.h>
 #include <Events_InfoMessage.h>
 
 #include <GeomAPI_Shape.h>
@@ -149,14 +151,31 @@ bool canRemoveOrRename(QWidget* theParent, const std::set<FeaturePtr>& theFeatur
 //******************************************************************
 bool canRename(const ObjectPtr& theObject, const QString& theName)
 {
-  if (std::dynamic_pointer_cast<ModelAPI_ResultParameter>(theObject).get()) {
+  std::string aType = theObject->groupName();
+  if (aType == ModelAPI_ResultParameter::group()) {
     double aValue;
     ResultParameterPtr aParam;
     if (ModelAPI_Tools::findVariable(theObject->document(),
           FeaturePtr(), qPrintable(theName), aValue, aParam)) {
       const char* aKeyStr = "Selected parameter can not be renamed to: %1. "
                             "There is a parameter with the same name. Its value is: %2.";
-      QString aErrMsg(QObject::tr(aKeyStr).arg(qPrintable(theName)).arg(aValue));
+      QString aErrMsg(QObject::tr(aKeyStr).arg(theName).arg(aValue));
+      // We can not use here a dialog box for message -
+      // it will crash editing process in ObjectBrowser
+      Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
+      return false;
+    }
+  }
+  else if ((aType == ModelAPI_ResultConstruction::group()) ||
+           (aType == ModelAPI_ResultBody::group())) {
+    DocumentPtr aDoc = theObject->document();
+    ObjectPtr aObj =
+      aDoc->objectByName(ModelAPI_ResultConstruction::group(), theName.toStdString());
+    if (!aObj.get())
+      aObj = aDoc->objectByName(ModelAPI_ResultBody::group(), theName.toStdString());
+
+    if (aObj.get()) {
+      QString aErrMsg(QObject::tr("Object with name %1 already exists.").arg(theName));
       // We can not use here a dialog box for message -
       // it will crash editing process in ObjectBrowser
       Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
index 2e135c8d93d7a3c9417f0a3c2e99568756fe1559..95901d380987392a59cd42a32c827724ce8bb646 100755 (executable)
@@ -170,8 +170,15 @@ QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end");
 //#define DEBUG_FEATURE_NAME
 //#define DEBUG_CLEAN_HISTORY
 
-
-static QString MyFilter(QObject::tr("OpenParts files (*.opp)"));
+#ifdef HAVE_SALOME
+static QString MyFilter(QObject::tr("SHAPER files (*.shaper *.opp)"));
+static QString MyFilter2(QObject::tr("SHAPER files (*.shaper)"));
+static QString MyExtension(".shaper");
+#else
+static QString MyFilter(QObject::tr("OpenParts files (*.opp);;All files (*.*)"));
+static QString MyFilter2(QObject::tr("OpenParts files (*.opp)"));
+static QString MyExtension(".opp");
+#endif
 
 
 //******************************************************
@@ -303,6 +310,8 @@ XGUI_Workshop::~XGUI_Workshop(void)
 
   delete myDisplayer;
   delete myDataModelXMLReader;
+  delete mySelectionActivate;
+  delete myMenuMgr;
   clearTemporaryDir();
 }
 
@@ -1082,10 +1091,10 @@ bool XGUI_Workshop::onSaveAs()
   if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
     return false;
   myCurrentFile = QFileDialog::getSaveFileName(desktop(), tr("Select name to save file..."),
-    QString(), MyFilter);
+    QString(), MyFilter2);
   if (!myCurrentFile.isNull()) {
-    if (!myCurrentFile.endsWith(".opp")) {
-      myCurrentFile += ".opp";
+    if (!myCurrentFile.endsWith(MyExtension)) {
+      myCurrentFile += MyExtension;
     }
   }
   else
@@ -2207,6 +2216,9 @@ void setColor(ResultPtr theResult, const std::vector<int>& theColor)
     aColorAttr->setValue(1, theColor[1]);
     aColorAttr->setValue(2, theColor[2]);
   }
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2285,6 +2297,9 @@ void setDeflection(ResultPtr theResult, const double theDeflection)
   AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
   if (aDeflectionAttr.get() != NULL)
     aDeflectionAttr->setValue(theDeflection);
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2296,6 +2311,9 @@ void setTransparency(ResultPtr theResult, double theTransparency)
   AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
   if (anAttribute.get() != NULL)
     anAttribute->setValue(theTransparency);
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2714,9 +2732,7 @@ void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects)
   }
   if (aSelList.count() > theObjects.count()) {
     // if something was found
-    bool aBlocked = objectBrowser()->blockSignals(true);
     objectBrowser()->setObjectsSelected(aSelList);
-    objectBrowser()->blockSignals(aBlocked);
     objectBrowser()->ensureVisible(aNewSel.first());
   }
   if (aHasHidden)
@@ -2743,9 +2759,7 @@ void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects)
   }
   if (aSelList.count() > theObjects.count()) {
     // if something was found
-    bool aBlocked = objectBrowser()->blockSignals(true);
     objectBrowser()->setObjectsSelected(aSelList);
-    objectBrowser()->blockSignals(aBlocked);
     objectBrowser()->ensureVisible(aNewSel.first());
   }
 }
index 772056c0a4731b86c15ddd631a455f69598adbed..1bd767d8a21bbd1804b516b6f5daf1e94ab35601 100644 (file)
@@ -54,8 +54,8 @@ SketchLine_7 = Sketch_2.addLine(40, 20, 20, 20)
 SketchLine_8 = Sketch_2.addLine(20, 20, 20, 10)
 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint())
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_4e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_7s-SketchLine_6e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchLine_6_EndVertex")])
 
 # Extrusion
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
@@ -81,8 +81,8 @@ Box_11 = model.addBox(Part_1_doc, Point_1, Point_4)
 Box_12 = model.addBox(Part_1_doc, Point_1, Point_5)
 Box_13 = model.addBox(Part_1_doc, Vertex_3, Point_2)
 Box_14 = model.addBox(Part_1_doc, Point_2, Vertex_3)
-Box_15 = model.addBox(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_4e"), model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_7s-SketchLine_6e"))
-Box_16 = model.addBox(Part_1_doc, model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"))
+Box_15 = model.addBox(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_2/SketchLine_6_EndVertex"))
+Box_16 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_2_1/To_Face]"))
 Box_17 = model.addBox(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1"))
 Box_18 = model.addBox(Part_1_doc, "dx", "dy", "dz")
 model.do()
index 850ce6733b0b66a0de2ab75bc687f1dcf57192c8..630afeb7490e58c55f4a3da5e4bebeff5f863d6e 100644 (file)
@@ -46,12 +46,12 @@ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint()
 model.do()
 
 # Extrusion
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection(), 100, 0)
 
 # Edge
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3")])
 
 # Axis
 Axis_1 = model.addAxis(Part_1_doc, 0, 10, 0)
@@ -74,9 +74,9 @@ Cylinder_6 = model.addCylinder(Part_1_doc, 5, 0)
 Cylinder_7 = model.addCylinder(Part_1_doc, 5, -10)
 Cylinder_8 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "InvalidName"), model.selection("EDGE", "PartSet/OX"), 5, 10)
 Cylinder_9 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "InvalidName"), 5, 10)
-Cylinder_10 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 50, 120)
+Cylinder_10 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), model.selection("EDGE", "Sketch_1/SketchLine_3"), 50, 120)
 Cylinder_11 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), 60, 100)
-Cylinder_12 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), 5, 10)
+Cylinder_12 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), 5, 10)
 Cylinder_13 = model.addCylinder(Part_1_doc, "r", "h")
 Cylinder_14 = model.addCylinder(Part_1_doc, 5, 10, 45)
 Cylinder_15 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OX"), 5, 10, 90)
@@ -91,9 +91,9 @@ Cylinder_23 = model.addCylinder(Part_1_doc, 5, 10, -45)
 Cylinder_24 = model.addCylinder(Part_1_doc, 5, 10, 450)
 Cylinder_25 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "InvalidName"), model.selection("EDGE", "PartSet/OX"), 5, 10, 90)
 Cylinder_26 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "InvalidName"), 5, 10, 90)
-Cylinder_27 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 50, 120, 90)
+Cylinder_27 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("EDGE", "Sketch_1/SketchLine_3"), 50, 120, 90)
 Cylinder_28 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_2_1"), 60, 100, 180)
-Cylinder_29 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"), model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"), 5, 10, 120)
+Cylinder_29 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_2_1/To_Face]"), model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_2_1/To_Face]"), 5, 10, 120)
 Cylinder_30 = model.addCylinder(Part_1_doc, "r2", "h2", "angle")
 
 model.do()
index bcfd1db29febc7eb1e6b7b78168e2d363a8d683e..8c8f9271f2f872e4a391311adcab68ebe2101faf 100644 (file)
@@ -55,11 +55,11 @@ SketchCircle_1 = Sketch_2.addCircle(3.420516499282639, 6.702654232424678, 2.6604
 model.do()
 
 # Create Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_3")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), 50, 0)
 
 # Revolution of the circle
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 
 # Create MultiTranslations
 MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15, 5)
@@ -175,4 +175,4 @@ assert(MultiTranslation_8.feature().error() == 'Attribute "axis_second_dir" is n
 #model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.SOLID, [0])
 #model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.SHELL, [10])
 #model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.FACE, [30])
-#model.testHaveNamingFaces(MultiTranslation_9, model, Part_1_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(MultiTranslation_9, model, Part_1_doc)
index 0df7c1b982a197ba3227ac2923d5de54369320e8..6d38e273d1b43f364d1b2a6f43401f03533f7cd7 100644 (file)
@@ -70,25 +70,25 @@ model.do()
 Point_1 = model.addPoint(Part_1_doc, -10, -10, -10)
 
 # Create Vertexes
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
 
 # Create Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f_wire")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
 
 # Create Scales
 Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2)
 Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_2_1")] , model.selection("VERTEX", "Point_1"), 2)
-Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_3_1")] , model.selection("VERTEX", "Box_3_1/Back&Box_3_1/Left&Box_3_1/Top"), 2)
-Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_4_1")] , model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), 2)
+Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_3_1")] , model.selection("VERTEX", "[Box_3_1/Back][Box_3_1/Left][Box_3_1/Top]"), 2)
+Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_4_1")] , model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), 2)
 Scale_5 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_5_1")] , model.selection("VERTEX", "Vertex_1_1"), 2)
 Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_6_1")] , model.selection("VERTEX", "PartSet/Origin"), 0)
 Scale_7 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_7_1")] , model.selection("VERTEX", "PartSet/Origin"), -3)
 Scale_8 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_8_1")] , model.selection("VERTEX", "InvalidName"), 2)
 Scale_9 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_9_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 3, 1)
 Scale_10 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_10_1")] , model.selection("VERTEX", "Point_1"), 2 , 3, 1)
-Scale_11 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_11_1")] , model.selection("VERTEX", "Box_11_1/Back&Box_11_1/Right&Box_11_1/Top"), 2 , 3, 1)
-Scale_12 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_12_1")] , model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), 2 , 3, 1)
+Scale_11 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_11_1")] , model.selection("VERTEX", "[Box_11_1/Back][Box_11_1/Right][Box_11_1/Top]"), 2 , 3, 1)
+Scale_12 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_12_1")] , model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), 2 , 3, 1)
 Scale_13 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_13_1")] , model.selection("VERTEX", "Vertex_1_1"), 2 , 3, 1)
 Scale_14 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_14_1")] , model.selection("VERTEX", "PartSet/Origin"), 0 , 3, 1)
 Scale_15 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_15_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 0, 1)
@@ -201,4 +201,4 @@ assert(Scale_18.feature().error() == 'Attribute "center_point" is not initialize
 #model.testNbSubShapes(Scale_19, GeomAPI_Shape.SHELL, [1])
 #model.testNbSubShapes(Scale_19, GeomAPI_Shape.SOLID, [0])
 #model.testNbSubShapes(Scale_19, GeomAPI_Shape.FACE, [5])
-#model.testHaveNamingFaces(Scale_19, model, Part_1_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(Scale_19, model, Part_1_doc)
index e32052e06835f161a7497853b346354d793df1c6..bb1bbc6237da1ec03a1a562dd154f6777dc3e958 100644 (file)
@@ -89,13 +89,13 @@ SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_6.startPoint()
 model.do()
 
 # Vertexes
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
 
 # Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
 
 # Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f_wire")])
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
 
 # Planes
@@ -103,22 +103,22 @@ Plane_1 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_14_1/Top"), 10
 Plane_2 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 40, False)
 
 # Faces
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f_wire")])
 
 
 # Symmetries
 Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "PartSet/Origin"))
 Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Point_1"))
-Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "Box_3_1/Front&Box_3_1/Right&Box_3_1/Top"))
-Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"))
+Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "[Box_3_1/Front][Box_3_1/Right][Box_3_1/Top]"))
+Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
 Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("VERTEX", "Vertex_1_1"))
 Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("VERTEX", "InvalidName"))
 Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("VERTEX", "PartSet/Origin"), False)
 
 Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "PartSet/OZ"))
 Symmetry_9 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "Axis_1"))
-Symmetry_10 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("EDGE", "Box_9_1/Front&Box_9_1/Top"))
-Symmetry_11 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Symmetry_10 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("EDGE", "[Box_9_1/Front][Box_9_1/Top]"))
+Symmetry_11 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"))
 Symmetry_12 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_12_1")], model.selection("EDGE", "Edge_1_1"))
 Symmetry_13 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("EDGE", "InvalidName"))
 Symmetry_14 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_14_1")], model.selection("EDGE", "PartSet/OZ"), False)
@@ -185,7 +185,11 @@ model.testNbSubShapes(Symmetry_9, GeomAPI_Shape.SOLID, [2])
 model.testNbSubShapes(Symmetry_9, GeomAPI_Shape.FACE, [12])
 model.testHaveNamingFaces(Symmetry_9, model, Part_1_doc)
 
-model.testNbResults(Symmetry_10, 0)
+model.testNbResults(Symmetry_10, 1)
+model.testNbSubResults(Symmetry_10, [2])
+model.testNbSubShapes(Symmetry_10, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Symmetry_10, GeomAPI_Shape.FACE, [12])
+model.testHaveNamingFaces(Symmetry_10, model, Part_1_doc)
 
 model.testNbResults(Symmetry_11, 1)
 model.testNbSubResults(Symmetry_11, [2])
@@ -217,7 +221,11 @@ model.testNbSubShapes(Symmetry_16, GeomAPI_Shape.SOLID, [2])
 model.testNbSubShapes(Symmetry_16, GeomAPI_Shape.FACE, [12])
 model.testHaveNamingFaces(Symmetry_16, model, Part_1_doc)
 
-model.testNbResults(Symmetry_17, 0)
+model.testNbResults(Symmetry_17, 1)
+model.testNbSubResults(Symmetry_17, [2])
+model.testNbSubShapes(Symmetry_17, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Symmetry_17, GeomAPI_Shape.FACE, [12])
+model.testHaveNamingFaces(Symmetry_17, model, Part_1_doc)
 
 model.testNbResults(Symmetry_18, 1)
 model.testNbSubResults(Symmetry_18, [2])
index fcd1406ab78bcd4e861c805a1b7bf62230a992c1..d164a9ee277e845d6f9350eddf5770fbd19b7f8c 100644 (file)
@@ -140,19 +140,19 @@ SketchLine_12 = Sketch_10.addLine(2.442711482557598, 6.454964041059345, 8.035432
 model.do()
 
 # Extrusions
-Extrusion_1 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_3 = model.addExtrusion(Part_3_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_4 = model.addExtrusion(Part_4_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_5 = model.addExtrusion(Part_5_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_6 = model.addExtrusion(Part_6_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_7 = model.addExtrusion(Part_7_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_8 = model.addExtrusion(Part_8_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_9 = model.addExtrusion(Part_9_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
+Extrusion_1 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_3 = model.addExtrusion(Part_3_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_4 = model.addExtrusion(Part_4_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_5 = model.addExtrusion(Part_5_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_6 = model.addExtrusion(Part_6_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_7 = model.addExtrusion(Part_7_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_8 = model.addExtrusion(Part_8_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_9 = model.addExtrusion(Part_9_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
 
 # Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_7_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_7_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
 
 # Axis
 Axis_1 = model.addAxis(partSet, 10, 10, 10)
@@ -177,19 +177,18 @@ Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_
 Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_5 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_6 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 15)
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_3"), 15)
 Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("EDGE", "Edge_1_1"), 15)
-Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "Box_8_1/Right&Box_8_1/Top"), 15)
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "[Box_8_1/Right][Box_8_1/Top]"), 15)
 Translation_9 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "PartSet/Axis_4"), 15)
 Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), 15)
 Translation_11 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_2_1")], model.selection("EDGE", "PartSet/OZ"), 0)
 Translation_12 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1")], model.selection("EDGE", "PartSet/OZ"), -15)
 Translation_13 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_4_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_14 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_5_1")], model.selection("EDGE", "PartSet/OZ"), "d")
-Translation_15 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 50)
+Translation_15 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 50)
 Translation_16 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_7_1")], model.selection("EDGE", "Edge_1_1"), 50)
-#Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "LinearCopy_8_1/Translated_Edge_8_8"), 50)
-Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "LinearCopy_8_1/Translated_Face_3_4&LinearCopy_8_1/Translated_Face_3_1"), 50)
+Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "[LinearCopy_8_1_3/MF:Translated_Face&Box_17_1/Left][LinearCopy_8_1_3/MF:Translated_Face&Box_17_1/Top]"), 50)
 Translation_18 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_9_1")], model.selection("EDGE", "PartSet/Axis_4"), 50)
 Translation_19 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OX"), 15)
 Translation_20 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_3/")], model.selection("EDGE", "OX"), 0)
@@ -197,7 +196,7 @@ Translation_21 = model.addTranslation(partSet, [model.selection("COMPOUND", "Par
 Translation_22 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_5/")], model.selection("EDGE", "InvalidName"), 15)
 Translation_23 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_6/")], model.selection("EDGE", "OX"), "d")
 Translation_24 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_7/")], model.selection("EDGE", "Part_7/Edge_1_1"), 15)
-Translation_25 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_8/")], model.selection("EDGE", "Part_8/Box_1_1/Front&Box_1_1/Left"), 15)
+Translation_25 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_8/")], model.selection("EDGE", "Part_8/[Box_1_1/Front][Box_1_1/Left]"), 15)
 Translation_26 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_9/")], model.selection("EDGE", "Axis_4"), 15)
 model.do()
 model.end()
@@ -376,4 +375,4 @@ model.testNbResults(Translation_26, 1)
 #model.testNbSubShapes(Translation_26, GeomAPI_Shape.COMPOUND, [1])
 #model.testNbSubShapes(Translation_26, GeomAPI_Shape.SOLID, [2])
 #model.testNbSubShapes(Translation_26, GeomAPI_Shape.FACE, [9])
-#model.testHaveNamingFaces(Translation_26, model, Part_9_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(Translation_26, model, Part_9_doc)
index 152f759ac6b5aaba12244b175c038c62255cb274..1379bd93152c12e8a55833fee160e41901c9a28a 100644 (file)
@@ -81,7 +81,7 @@ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint()
 model.do()
 
 # Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
 
 # Axis
 Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10)
@@ -117,7 +117,7 @@ Translation_31 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "
 # Translation 32
 Translation_32_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "PartSet/OX"), 5)
 Intersection_6 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_12_1"), model.selection("SOLID", "Translation_11_1")])
-Translation_32 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 15)
+Translation_32 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 15)
 
 # Translation 33
 Translation_33_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("EDGE", "PartSet/OX"), 5)
@@ -162,7 +162,7 @@ Translation_40 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID",
 # Translation 41
 Translation_41_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_29_1")], model.selection("EDGE", "PartSet/OX"), 5)
 Partition_6 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_30_1"), model.selection("SOLID", "Translation_29_1")])
-Translation_41 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 15)
+Translation_41 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 15)
 
 # Translation 42
 Translation_42_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_31_1")], model.selection("EDGE", "PartSet/OX"), 5)
index 0a089ea94c30a8f1da5c6609c2a17913c2291129..7bc34a775973a00091babd8a447d6f2012bfe888 100644 (file)
@@ -103,62 +103,62 @@ SketchCircle_2 = Sketch_8.addCircle(5.043472022955523, 6.180989956958394, 2.6548
 model.do()
 
 # Extrusions
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_8/Wire-SketchCircle_2_2f")], model.selection(), 15, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_8/Face-SketchCircle_2_2r_wire")], model.selection(), 15, 0)
 
 # Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_3 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_4 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_5 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_6 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_7 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_8 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_6")])
-Edge_9 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_10 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_11 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_5/Edge-SketchLine_11")])
-Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/Edge-SketchLine_22")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_3 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_4 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_5 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_6 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_7 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_8 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_6")])
+Edge_9 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_10 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_11 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_5/SketchLine_11")])
+Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLine_22")])
 
 # Axis
 Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10)
 
 # Vertex
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_9 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_9 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
 
 # Wires
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_5 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_6 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Wire_7 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Wire_8 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_9 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_5 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_6 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Wire_7 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Wire_8 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_9 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
 
 # Faces
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_6 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Face_7 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Face_8 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_9 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_10 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
-Face_11 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchLine_14r-SketchLine_15r-SketchLine_16r")])
-Face_12 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchLine_17f-SketchLine_18f-SketchLine_19f")])
-Face_13 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchLine_19r-SketchLine_20r-SketchLine_21r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_6 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Face_7 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Face_8 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_9 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_10 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_12r-SketchLine_13f-SketchLine_14f_wire")])
+Face_11 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r_wire")])
+Face_12 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_17r-SketchLine_18f-SketchLine_19f_wire")])
+Face_13 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_21r-SketchLine_20r-SketchLine_19r_wire")])
 
 # Shells
 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_10_1"), model.selection("FACE", "Face_11_1")])
@@ -203,45 +203,45 @@ Translation_46 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Ve
 Translation_47 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_48 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_4_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_49 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_50 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_6_1")], model.selection("EDGE", "Sketch_3/Edge-SketchLine_5"), 15)
+Translation_50 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_6_1")], model.selection("EDGE", "Sketch_3/SketchLine_5"), 15)
 Translation_51 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_7_1")], model.selection("EDGE", "Edge_2_1"), 15)
-Translation_52 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_8_1")], model.selection("EDGE", "Box_1_1/Back&Box_1_1/Right"), 15)
+Translation_52 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
 Translation_53 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_9_1")], model.selection("EDGE", "Axis_1"), 15)
 Translation_54 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_2_1")], model.selection("EDGE", "PartSet/OX"), 15)
 Translation_55 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_3_1")], model.selection("EDGE", "PartSet/OX"), 0)
 Translation_56 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_4_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_57 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_5_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_58 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_6_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_59 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_7_1")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_6"), 15)
+Translation_59 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_7_1")], model.selection("EDGE", "Sketch_4/SketchLine_6"), 15)
 Translation_60 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_8_1")], model.selection("EDGE", "Edge_9_1"), 15)
-Translation_61 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_9_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_61 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_9_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
 Translation_62 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_10_1")], model.selection("EDGE", "Axis_1"), 15)
 Translation_63 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
 Translation_64 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
 Translation_65 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_66 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_4_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_67 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_5_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_68 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_6_1")], model.selection("EDGE", "Sketch_5/Edge-SketchLine_11"), 15)
+Translation_68 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
 Translation_69 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
-Translation_70 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_8_1")], model.selection("EDGE", "Box_1_1/Back&Box_1_1/Right"), 15)
+Translation_70 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
 Translation_71 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_9_1")], model.selection("EDGE", "Axis_1"), 15)
 Translation_72 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
 Translation_73 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
 Translation_74 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_75 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_4_1")], model.selection("EDGE", "InvalidName"), -15)
 Translation_76 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_77 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_6_1")], model.selection("EDGE", "Sketch_5/Edge-SketchLine_11"), 15)
+Translation_77 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
 Translation_78 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
-Translation_79 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_8_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_79 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
 Translation_80 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_9_1")], model.selection("EDGE", "Axis_1"), 15)
 Translation_81 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
 Translation_82 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
 Translation_83 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
 Translation_84 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_4_1")], model.selection("EDGE", "InvalidName"), 15)
 Translation_85 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_86 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_6_1")], model.selection("EDGE", "Sketch_7/Edge-SketchLine_22"), 15)
+Translation_86 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_6_1")], model.selection("EDGE", "Sketch_7/SketchLine_22"), 15)
 Translation_87 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_7_1")], model.selection("EDGE", "Edge_12_1"), 15)
-Translation_88 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_8_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_88 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
 Translation_89 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_9_1")], model.selection("EDGE", "Axis_1"), 15)
 Translation_90 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OY"), 15)
 model.do()
index a903dc4772d13b335cbc10daadfbb55e7ffb5a98..3b654a72ed52de3646495a4905a5144f8ef0e9d1 100644 (file)
@@ -50,17 +50,17 @@ Point_1 = model.addPoint(Part_1_doc, 10, 0, 0)
 Point_2 = model.addPoint(Part_1_doc, 10, 10, 0)
 
 # Vertex
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_3e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
 
 # Translations
 Translation_99 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"))
-Translation_100 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_1"))
-Translation_101 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_1"))
-Translation_102 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "InvalidName"))
-Translation_103 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_3e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"))
+Translation_100 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_1"))
+Translation_101 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_1"))
+Translation_102 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "InvalidName"))
+Translation_103 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
 Translation_104 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1"))
-Translation_105 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Box_4_1/Back&Box_4_1/Left&Box_4_1/Bottom"), model.selection("VERTEX", "Box_4_1/Front&Box_4_1/Right&Box_4_1/Top"))
+Translation_105 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "[Box_4_1/Back][Box_4_1/Left][Box_4_1/Bottom]"), model.selection("VERTEX", "[Box_4_1/Front][Box_4_1/Right][Box_4_1/Top]"))
 model.do()
 model.end()
 
@@ -99,4 +99,4 @@ model.testNbResults(Translation_101, 0)
 assert(Translation_101.feature().error() == 'Attribute "start_point" is not initialized.')
 
 model.testNbResults(Translation_102, 0)
-assert(Translation_102.feature().error() == 'Attribute "end_point" is not initialized.')
\ No newline at end of file
+assert(Translation_102.feature().error() == 'Attribute "end_point" is not initialized.')
index b1f5181dc90fe3882d6641dc27e0fd7cd969422a..98409756f9d8b1a39edce0b915ae71427c32e4b1 100644 (file)
@@ -93,24 +93,24 @@ SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.coordinates())
 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchArc_1_2r-SketchArc_2_2r")], model.selection(), "b/2", "b/2")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchLine_10f")], model.selection(), "b/2", "b/2")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"))
 SketchCircle_1 = Sketch_2.addCircle(-15, 35.00000000000001, 25)
 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_1.center())
 SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16")
 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "50/2")
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
-SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"))
-SketchLine_11 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face"))
+SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Vertex&ExtrusionCut_1_1/From_Face"))
+SketchLine_11 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_2"))
 SketchArc_3 = Sketch_3.addArc(-15, 35.00000000000001, -15, 46.0103340429751, -17.02045759563166, 24.17663606626138, True)
 SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchPoint_3.result(), SketchArc_3.center())
 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
 SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
-SketchArc_4 = Sketch_3.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"))
+SketchArc_4 = Sketch_3.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_1"))
 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_19")
 SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35.00000000000001)
@@ -127,20 +127,20 @@ SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchArc_3.results()[1]
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24")
 model.do()
 ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_3_2f-SketchLine_12f-SketchArc_5_2r")], model.selection(), 5, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face_1"))
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "ExtrusionFuse_1_1/Modfied_4&ExtrusionFuse_1_1/Modfied_5&ExtrusionFuse_1_1/To_Face_1"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face"))
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[ExtrusionFuse_1_1/Generated_Face&Sketch_3/SketchArc_5_2][ExtrusionFuse_1_1/Generated_Face&Sketch_3/SketchLine_12][ExtrusionFuse_1_1/To_Face]"))
 SketchCircle_2 = Sketch_4.addCircle(-15, 35.00000000000001, 5)
 SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchPoint_4.result(), SketchCircle_2.center())
 SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25")
 SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_2.results()[1], "10/2")
 model.do()
 ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_2_2f")], model.selection(), 8, 0, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
-SketchArc_6 = Sketch_5.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionFuse_1_1/Modfied_3"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
+SketchArc_6 = Sketch_5.addArc(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]"))
 SketchArc_7 = Sketch_5.addArc(-45, 35, -45, 5, -25.41666666666737, 12.27351642784166, False)
 SketchConstraintCoincidence_25 = Sketch_5.setCoincident(SketchArc_6.result(), SketchArc_7.center())
 SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26")
-SketchCircle_3 = Sketch_5.addCircle(model.selection("EDGE", "ExtrusionFuse_2_1/Modfied_5&ExtrusionFuse_2_1/To_Face_1"))
+SketchCircle_3 = Sketch_5.addCircle(model.selection("EDGE", "[ExtrusionFuse_2_1/Generated_Face&Sketch_4/SketchCircle_2_2][ExtrusionFuse_2_1/To_Face]"))
 SketchArc_8 = Sketch_5.addArc(-15, 35.00000000000001, -25.41666666666737, 12.27351642784166, -30.00000000000075, 14.99999999999944, True)
 SketchConstraintCoincidence_26 = Sketch_5.setCoincident(SketchCircle_3.result(), SketchArc_8.center())
 SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27")
@@ -163,53 +163,53 @@ SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_33")
 SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchArc_9.startPoint(), SketchLine_13.endPoint())
 SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_34")
 model.do()
-ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_7_2f-SketchArc_8_2r-SketchLine_13r-SketchArc_9_2r")], model.selection(), 0, 8, [model.selection("SOLID", "ExtrusionFuse_2_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1/Modfied_3"))
-SketchLine_14 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_7"))
+ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_7_2f-SketchArc_8_2r-SketchArc_9_2r-SketchLine_13r")], model.selection(), 0, 8, [model.selection("SOLID", "ExtrusionFuse_2_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face"))
+SketchLine_14 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
 SketchArc_10 = Sketch_6.addArc(55, 35, 55, 15, 35, 35, True)
 SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_14.result(), SketchArc_10.center())
 SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_35")
 SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchLine_14.result(), SketchArc_10.startPoint())
 SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_36")
-SketchLine_15 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_8"))
-SketchConstraintDistance_8 = Sketch_6.setDistance(SketchArc_10.center(), SketchLine_15.result(), 35)
-SketchLine_16 = Sketch_6.addLine(35, 35, 35, 48)
+SketchLine_15 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"))
+SketchConstraintDistance_8 = Sketch_6.setDistance(SketchArc_10.center(), SketchLine_15.result(), 35, False)
+SketchLine_16 = Sketch_6.addLine(35, 35, 35, 47.99999999999999)
 SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchArc_10.endPoint(), SketchLine_16.startPoint())
 SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_37")
-SketchLine_17 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6"))
+SketchLine_17 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
 SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_17.result())
 SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_38")
 SketchConstraintVertical_6 = Sketch_6.setVertical(SketchLine_16.result())
 SketchConstraintTangent_4 = Sketch_6.setTangent(SketchLine_16.result(), SketchArc_10.results()[1])
 SketchConstraintRadius_5 = Sketch_6.setRadius(SketchArc_10.results()[1], 20)
-SketchLine_18 = Sketch_6.addLine(55, 15, 55, 48)
+SketchLine_18 = Sketch_6.addLine(55, 15, 55, 47.99999999999999)
 SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchArc_10.startPoint(), SketchLine_18.startPoint())
 SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_39")
 SketchConstraintCoincidence_39 = Sketch_6.setCoincident(SketchLine_14.endPoint(), SketchLine_18.endPoint())
 SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_40")
-SketchLine_19 = Sketch_6.addLine(35, 48, 55, 48)
+SketchLine_19 = Sketch_6.addLine(35, 47.99999999999999, 55, 47.99999999999999)
 SketchConstraintCoincidence_40 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_19.startPoint())
 SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_41")
 SketchConstraintCoincidence_41 = Sketch_6.setCoincident(SketchLine_14.endPoint(), SketchLine_19.endPoint())
 SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_42")
 model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchArc_10_2f-SketchLine_16r-SketchLine_18f-SketchLine_19r")], model.selection(), 0, 9, [model.selection("SOLID", "ExtrusionFuse_3_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/From_Face_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchArc_10_2f-SketchLine_18f-SketchLine_19r-SketchLine_16r_wire")], model.selection(), 0, 9, [model.selection("SOLID", "ExtrusionFuse_3_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/From_Face"))
 SketchCircle_4 = Sketch_7.addCircle(45, -35, 5)
-SketchLine_20 = Sketch_7.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/From_Face_1"))
-SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10)
+SketchLine_20 = Sketch_7.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/From_Face]"))
+SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10, False)
 SketchConstraintRadius_6 = Sketch_7.setRadius(SketchCircle_4.results()[1], "10/2")
 SketchLine_21 = Sketch_7.addLine(35, -35, 45, -35)
 SketchLine_21.setAuxiliary(True)
-SketchPoint_5 = Sketch_7.addPoint(model.selection("VERTEX", "ExtrusionCut_2_1/Generated_Face_1&ExtrusionCut_2_1/Generated_Face_4&ExtrusionCut_2_1/From_Face_1"))
+SketchPoint_5 = Sketch_7.addPoint(model.selection("VERTEX", "[ExtrusionCut_2_1/Generated_Face&Sketch_6/SketchLine_16][ExtrusionCut_2_1/Generated_Face&Sketch_6/SketchArc_10_2][ExtrusionCut_2_1/From_Face]"))
 SketchConstraintCoincidence_42 = Sketch_7.setCoincident(SketchLine_21.startPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43")
 SketchConstraintCoincidence_43 = Sketch_7.setCoincident(SketchCircle_4.center(), SketchLine_21.endPoint())
 SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_44")
 SketchConstraintHorizontal_4 = Sketch_7.setHorizontal(SketchLine_21.result())
 model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/From_Face_1"), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/From_Face"), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
 SketchLine_22 = Sketch_8.addLine(55, 25, 5.000000000000002, 25)
 SketchLine_23 = Sketch_8.addLine(5.000000000000002, 25, 5.000000000000002, 13)
 SketchLine_24 = Sketch_8.addLine(5.000000000000002, 13, 55, 13)
@@ -228,26 +228,26 @@ SketchConstraintHorizontal_6 = Sketch_8.setHorizontal(SketchLine_24.result())
 SketchConstraintVertical_8 = Sketch_8.setVertical(SketchLine_25.result())
 SketchConstraintLength_2 = Sketch_8.setLength(SketchLine_22.result(), 50)
 SketchConstraintLength_3 = Sketch_8.setLength(SketchLine_25.result(), 12)
-SketchProjection_1 = Sketch_8.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_1"))
+SketchProjection_1 = Sketch_8.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_6]"), False)
 SketchLine_26 = SketchProjection_1.createdFeature()
 SketchConstraintCoincidence_48 = Sketch_8.setCoincident(SketchLine_22.startPoint(), SketchLine_26.result())
 SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49")
-SketchLine_27 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Extrusion_1_1/Generated_Face_4"))
+SketchLine_27 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
 SketchConstraintCoincidence_49 = Sketch_8.setCoincident(SketchLine_22.startPoint(), SketchLine_27.result())
 SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50")
 model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchLine_25f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/Modfied_2"))
-SketchLine_28 = Sketch_9.addLine(25, -45, 18.44853578320836, -63)
-SketchLine_29 = Sketch_9.addLine(model.selection("EDGE", "ExtrusionFuse_1_1/Modfied_2&ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_22r-SketchLine_23f-SketchLine_24f-SketchLine_25f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9"))
+SketchLine_28 = Sketch_9.addLine(25, -45, 18.44853578320833, -63)
+SketchLine_29 = Sketch_9.addLine(model.selection("EDGE", "[ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_8]"))
 SketchConstraintCoincidence_50 = Sketch_9.setCoincident(SketchLine_28.endPoint(), SketchLine_29.result())
 SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_51")
-SketchLine_30 = Sketch_9.addLine(model.selection("EDGE", "ExtrusionCut_4_1/Modfied_9&ExtrusionFuse_1_1/Modfied_2"))
+SketchLine_30 = Sketch_9.addLine(model.selection("EDGE", "[ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9]"))
 SketchConstraintCoincidence_51 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_30.result())
 SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52")
-SketchConstraintAngle_3 = Sketch_9.setAngle(SketchLine_28.result(), SketchLine_30.result(), 20)
-SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18)
-SketchLine_31 = Sketch_9.addLine(18.44853578320836, -63, 25, -63)
+SketchConstraintAngle_3 = Sketch_9.setAngle(SketchLine_28.result(), SketchLine_30.result(), 20.00000000000009)
+SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18, False)
+SketchLine_31 = Sketch_9.addLine(18.44853578320833, -63, 25, -63)
 SketchConstraintCoincidence_52 = Sketch_9.setCoincident(SketchLine_28.endPoint(), SketchLine_31.startPoint())
 SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53")
 SketchConstraintCoincidence_53 = Sketch_9.setCoincident(SketchLine_29.startPoint(), SketchLine_31.endPoint())
@@ -258,16 +258,16 @@ SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55")
 SketchConstraintCoincidence_55 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_32.endPoint())
 SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56")
 model.do()
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_28f-SketchLine_31f-SketchLine_32f")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_4_1/Modfied_3"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modfied_1"))
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_28r-SketchLine_31f-SketchLine_32f")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_5"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8"))
 SketchCircle_5 = Sketch_10.addCircle(-6.000000000000002, 4.999999999999997, 5)
-SketchLine_33 = Sketch_10.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_5_1/Modfied_1"))
-SketchConstraintDistance_11 = Sketch_10.setDistance(SketchCircle_5.center(), SketchLine_33.result(), 30)
-SketchLine_34 = Sketch_10.addLine(model.selection("EDGE", "ExtrusionCut_5_1/Modfied_2&ExtrusionCut_5_1/Modfied_1"))
-SketchConstraintDistance_12 = Sketch_10.setDistance(SketchCircle_5.result(), SketchLine_34.result(), 9)
+SketchLine_33 = Sketch_10.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8]"))
+SketchConstraintDistance_11 = Sketch_10.setDistance(SketchCircle_5.center(), SketchLine_33.result(), 30, False)
+SketchLine_34 = Sketch_10.addLine(model.selection("EDGE", "[ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8]"))
+SketchConstraintDistance_12 = Sketch_10.setDistance(SketchCircle_5.result(), SketchLine_34.result(), 9, False)
 SketchConstraintRadius_7 = Sketch_10.setRadius(SketchCircle_5.results()[1], "10/2")
 model.do()
-ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchCircle_5_2f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchCircle_5_2r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
 model.do()
 
 # Test reexecution after parameter change
index 5a37ad7d3c84fffc18e3e81c3b41eeab2a0dcd10..020917c8afd6aa823c7a0c03f3f6f022ba60fdcd 100644 (file)
@@ -129,7 +129,7 @@ SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_13.startPoint
 SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_16.result())
 SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_15.result())
 SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_13.result())
-SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
 SketchConstraintParallel_2 = Sketch_3.setParallel(SketchLine_14.result(), SketchLine_17.result())
 SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_14.endPoint(), SketchLine_17.result(), 1, False)
 SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ"))
@@ -138,7 +138,7 @@ SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_13.startPoint(), Sk
 SketchLine_19 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY"))
 SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_15.endPoint(), SketchLine_19.result(), 70, False)
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 75, 45)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r-SketchCircle_2_2r_wire")], model.selection(), 75, 45)
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22)
 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
 Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
@@ -298,7 +298,7 @@ SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_36.startPoint
 SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_57")
 SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_34.endPoint())
 SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_58")
-SketchCircle_3 = Sketch_4.addCircle(model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"))
+SketchCircle_3 = Sketch_4.addCircle(model.selection("EDGE", "Sketch_2/SketchCircle_1_2"))
 SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_22.startPoint(), SketchCircle_3.results()[1])
 SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_59")
 SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchCircle_3.results()[1])
@@ -379,18 +379,18 @@ Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchLine_38 = Sketch_5.addLine(44, 3.464101615137744, 16.50000000000003, 51.09549882328188)
 SketchLine_38.setName("SketchLine_41")
 SketchLine_38.result().setName("SketchLine_41")
-SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"))
+SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
 SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_73")
-SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
 SketchLine_39.setName("SketchLine_42")
 SketchLine_39.result().setName("SketchLine_42")
 SketchConstraintPerpendicular_2 = Sketch_5.setPerpendicular(SketchLine_38.result(), SketchLine_39.result())
 SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_38.result(), 55)
 SketchConstraintLength_1.setName("SketchConstraintLength_6")
 model.do()
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_11r-SketchLine_8r-SketchLine_3r-SketchLine_9r-SketchLine_6r-SketchArc_1_2r-SketchArc_2_2f"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"))
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_41e"), False)
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_8r-SketchArc_1_2r-SketchLine_9r-SketchLine_3r-SketchLine_11r-SketchArc_2_2f-SketchLine_10r"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Sketch_5/SketchLine_41_EndVertex"), False)
 Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_40 = Sketch_6.addLine(3.999999999999999, 13.00000000002605, 4, 12.89999999999998)
 SketchLine_40.setName("SketchLine_55")
@@ -459,7 +459,7 @@ SketchConstraintDistance_20 = Sketch_6.setDistance(SketchLine_48.startPoint(), S
 SketchConstraintDistance_20.setName("SketchConstraintDistance_20")
 SketchConstraintDistance_21 = Sketch_6.setDistance(SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False)
 SketchConstraintDistance_21.setName("SketchConstraintDistance_21")
-SketchLine_52 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_41"))
+SketchLine_52 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_41"))
 SketchLine_52.setName("SketchLine_51")
 SketchLine_52.result().setName("SketchLine_51")
 SketchConstraintDistance_22 = Sketch_6.setDistance(SketchLine_45.startPoint(), SketchLine_52.result(), 4, False)
@@ -517,23 +517,23 @@ SketchLine_53.result().setName("SketchLine_56")
 SketchConstraintCoincidence_90 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_53.result())
 SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_94")
 model.do()
-Extrusion_7 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_55r-SketchLine_44r-SketchLine_52r-SketchLine_53r-SketchLine_54r-SketchLine_47r-SketchLine_48r-SketchLine_49r-SketchArc_12_2r-SketchArc_13_2r")], model.selection(), 0, 40)
+Extrusion_7 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchArc_13_2r-SketchLine_54r-SketchLine_49r-SketchLine_48r-SketchLine_47r-SketchLine_53r-SketchArc_12_2r-SketchLine_52r-SketchLine_44r-SketchLine_55r")], model.selection(), 0, 40)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Common_1_1")], [model.selection("SOLID", "Common_2_1")])
 Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fuse_1_1")], [model.selection("SOLID", "Extrusion_7_1")])
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Common_3_1")])
-Extrusion_8 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_10r-SketchLine_11r-SketchLine_8r-SketchLine_3r-SketchLine_9r-SketchLine_6r-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), 55, 55)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face_1"))
+Extrusion_8 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_6r-SketchLine_8r-SketchArc_1_2r-SketchLine_9r-SketchLine_3r-SketchLine_11r-SketchArc_2_2f-SketchLine_10r_wire")], model.selection(), 55, 55)
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10"))
 SketchLine_54 = Sketch_7.addLine(55, -9.237604307034024, 55, -60)
 SketchLine_54.setName("SketchLine_66")
 SketchLine_54.result().setName("SketchLine_66")
-SketchPoint_6 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/To_Face_1"))
+SketchPoint_6 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]"))
 SketchLine_55 = Sketch_7.addLine(55, -9.237604307034024, 55, -70)
 SketchLine_55.setName("SketchLine_57")
 SketchLine_55.result().setName("SketchLine_57")
 SketchLine_55.setAuxiliary(True)
 SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchPoint_6.result())
 SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_95")
-SketchPoint_7 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_8&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/To_Face_1"))
+SketchPoint_7 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]"))
 SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchPoint_7.result())
 SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_96")
 SketchLine_56 = Sketch_7.addLine(45.00000000000001, -70, -45.00000000000001, -70)
@@ -545,7 +545,7 @@ SketchLine_57.result().setName("SketchLine_58")
 SketchLine_57.setAuxiliary(True)
 SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchLine_57.startPoint())
 SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_97")
-SketchPoint_8 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_8&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/From_Face_1"))
+SketchPoint_8 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/From_Face]"))
 SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchPoint_8.result())
 SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_98")
 SketchLine_58 = Sketch_7.addLine(-55.00000000000001, -59.99999999999999, -55, -9.237604307034024)
@@ -557,7 +557,7 @@ SketchLine_59.result().setName("SketchLine_59")
 SketchLine_59.setAuxiliary(True)
 SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_59.startPoint())
 SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_99")
-SketchPoint_9 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/From_Face_1"))
+SketchPoint_9 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/From_Face]"))
 SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchPoint_9.result())
 SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_100")
 SketchLine_60 = Sketch_7.addLine(-55, -9.237604307034024, -60.00000000000001, -9.237604307034024)
@@ -654,7 +654,7 @@ SketchCircle_7 = Sketch_7.addCircle(-44, -20.23760430703402, 5)
 SketchConstraintRadius_16 = Sketch_7.setRadius(SketchCircle_7.results()[1], 5)
 SketchConstraintDistance_31 = Sketch_7.setDistance(SketchCircle_6.center(), SketchLine_54.result(), 11, False)
 SketchConstraintDistance_31.setName("SketchConstraintDistance_31")
-SketchLine_66 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1"))
+SketchLine_66 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10]"))
 SketchLine_66.setName("SketchLine_69")
 SketchLine_66.result().setName("SketchLine_69")
 SketchConstraintDistance_32 = Sketch_7.setDistance(SketchCircle_6.center(), SketchLine_66.result(), 11, False)
@@ -669,20 +669,20 @@ SketchConstraintLength_3 = Sketch_7.setLength(SketchLine_61.result(), 70)
 SketchConstraintLength_3.setName("SketchConstraintLength_8")
 SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance(SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5)
 model.do()
-ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_7/Wire-SketchLine_66f-SketchLine_67f-SketchLine_68f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f-SketchArc_14_2r-SketchArc_15_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_6_2f")]
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_7/Face-SketchLine_66r-SketchArc_14_2r-SketchLine_67f-SketchArc_15_2r-SketchLine_68f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f_wire"), model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_6_2f")]
 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_8_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face_3"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11"))
 SketchLine_67 = Sketch_8.addLine(55, -34.06366588218793, 55, 66.69872981077805)
 SketchLine_67.setName("SketchLine_79")
 SketchLine_67.result().setName("SketchLine_79")
-SketchPoint_10 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&Extrusion_8_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_13"))
+SketchPoint_10 = Sketch_8.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_66)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)]"))
 SketchLine_68 = Sketch_8.addLine(55, -34.06366588218793, 55, 76.69872981077803)
 SketchLine_68.setName("SketchLine_70")
 SketchLine_68.result().setName("SketchLine_70")
 SketchLine_68.setAuxiliary(True)
 SketchConstraintCoincidence_116 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchPoint_10.result())
 SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_120")
-SketchPoint_11 = Sketch_8.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_13&Extrusion_8_1/Generated_Face_4"))
+SketchPoint_11 = Sketch_8.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_66)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3]"))
 SketchConstraintCoincidence_117 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchPoint_11.result())
 SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_121")
 SketchLine_69 = Sketch_8.addLine(45, 76.69872981077805, -44.9999999570576, 76.69872981077805)
@@ -694,7 +694,7 @@ SketchLine_70.result().setName("SketchLine_71")
 SketchLine_70.setAuxiliary(True)
 SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint())
 SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_122")
-SketchPoint_12 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_1&Extrusion_8_1/Generated_Face_3&Extrusion_8_1/Generated_Face_4"))
+SketchPoint_12 = Sketch_8.addPoint(model.selection("VERTEX", "[(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_68)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3]"))
 SketchConstraintCoincidence_119 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchPoint_12.result())
 SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_123")
 SketchLine_71 = Sketch_8.addLine(-55, 66.69872976783566, -55, -34.06366588218793)
@@ -706,7 +706,7 @@ SketchLine_72.result().setName("SketchLine_72")
 SketchLine_72.setAuxiliary(True)
 SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint())
 SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_124")
-SketchPoint_13 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_1&Extrusion_8_1/Generated_Face_3"))
+SketchPoint_13 = Sketch_8.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2][(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_68)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11]"))
 SketchConstraintCoincidence_121 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchPoint_13.result())
 SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_125")
 SketchLine_73 = Sketch_8.addLine(-55, -34.06366588218793, -83.25521566485324, -34.06366588218793)
@@ -846,7 +846,7 @@ SketchConstraintDistance_43.setName("SketchConstraintDistance_45")
 SketchConstraintDistance_44 = Sketch_8.setDistance(SketchArc_18.startPoint(), SketchLine_69.result(), 25, False)
 SketchConstraintDistance_44.setName("SketchConstraintDistance_46")
 model.do()
-ExtrusionCut_2_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_79r-SketchLine_80r-SketchLine_81r-SketchLine_73r-SketchLine_74r-SketchLine_75r-SketchLine_76r-SketchLine_77r-SketchArc_16_2r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_8/Wire-SketchCircle_8_2f"), model.selection("WIRE", "Sketch_8/Wire-SketchCircle_9_2f"), model.selection("WIRE", "Sketch_8/Wire-SketchArc_19_2f-SketchArc_18_2f-SketchLine_82f-SketchLine_83r")]
+ExtrusionCut_2_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_77r-SketchLine_76r-SketchLine_75r-SketchLine_74r-SketchLine_73r-SketchLine_81r-SketchArc_17_2r-SketchLine_80r-SketchArc_16_2r-SketchLine_79r"), model.selection("WIRE", "Sketch_8/Face-SketchCircle_8_2f_wire"), model.selection("WIRE", "Sketch_8/Face-SketchCircle_9_2f_wire"), model.selection("WIRE", "Sketch_8/Face-SketchArc_19_2f-SketchLine_82f-SketchArc_18_2f-SketchLine_83r_wire")]
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")])
 Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "ExtrusionCut_2_1")])
 model.do()
@@ -864,8 +864,9 @@ model.testNbResults(Fuse_3, 1)
 model.testNbSubResults(Fuse_3, [0])
 model.testNbSubShapes(Fuse_3, GeomAPI_Shape.SOLID, [1])
 model.testNbSubShapes(Fuse_3, GeomAPI_Shape.FACE, [50])
-model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266])
-model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532])
+# unstable numbers
+#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266])
+#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532])
 model.testResultsVolumes(Fuse_3, [156999.209584889642428606748580933])
 
 assert(model.checkPythonDump())
index 5a20aecd31e6bb88580ce41ec6c45385229da554..ce59dc0f9f1cd53f9286c1ca8e4956e6cbb105c0 100644 (file)
@@ -98,15 +98,15 @@ SketchLine_7.result().setName("SketchLine_30")
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.result())
 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_35")
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_4r-SketchArc_1_2f-SketchArc_2_2f-SketchLine_28r-SketchLine_29r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_2"))
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_2_2f-SketchArc_1_2f-SketchLine_4r-SketchLine_29r-SketchLine_28r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"))
 SketchLine_8 = Sketch_2.addLine(0, 0, 25, 43.30127018922193)
 SketchLine_8.setName("SketchLine_5")
 SketchLine_8.result().setName("SketchLine_5")
 SketchLine_8.setAuxiliary(True)
 SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchPoint_3.result())
-SketchCircle_1 = Sketch_2.addCircle(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1"))
+SketchCircle_1 = Sketch_2.addCircle(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1])
 SketchLine_9 = Sketch_2.addLine(39.43375672974064, -43.30127018922192, 15.87711932209923, -2.499977343709401)
 SketchLine_9.setName("SketchLine_10")
@@ -116,7 +116,7 @@ SketchLine_10.setName("SketchLine_6")
 SketchLine_10.result().setName("SketchLine_6")
 SketchLine_10.setAuxiliary(True)
 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchPoint_3.result())
-SketchCircle_2 = Sketch_2.addCircle(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1"))
+SketchCircle_2 = Sketch_2.addCircle(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchCircle_2.results()[1])
 SketchLine_11 = Sketch_2.addLine(15.87713238415337, 2.499999967850816, 39.43375672974065, 43.30127018922192)
 SketchLine_11.setName("SketchLine_11")
@@ -229,10 +229,10 @@ SketchLine_22.result().setName("SketchLine_19")
 SketchConstraintDistance_9 = Sketch_2.setDistance(SketchArc_9.center(), SketchPoint_3.coordinates(), 21)
 SketchConstraintDistance_9.setName("SketchConstraintDistance_8")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_10r-SketchLine_11r-SketchArc_3_2f-SketchArc_4_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_14r-SketchArc_7_2f-SketchLine_15r-SketchArc_8_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12r-SketchArc_5_2f-SketchLine_13r-SketchArc_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchArc_9_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchArc_11_2f")], model.selection(), model.selection(), 10, model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_4_2f-SketchLine_11r-SketchArc_3_2f-SketchLine_10r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchArc_7_2f-SketchLine_15r-SketchArc_8_2f-SketchLine_14r_wire"), model.selection("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_13r-SketchArc_6_2f-SketchLine_12r"), model.selection("FACE", "Sketch_2/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchArc_9_2f"), model.selection("WIRE", "Sketch_2/Face-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchArc_11_2f_wire")], model.selection(), model.selection(), 10, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), 10)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_5")])
 Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_6")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cut_2_1/Modified_Face_7"), model.selection("FACE", "Cut_2_1/Modified_Face_9"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_21"), model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_19"))
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchCircle_3 = Sketch_3.addCircle(25, -10, 4)
 SketchCircle_4 = Sketch_3.addCircle(40, -10, 4)
@@ -245,7 +245,7 @@ SketchConstraintDistance_10 = Sketch_3.setDistance(SketchCircle_3.center(), Sket
 SketchConstraintDistance_10.setName("SketchConstraintDistance_9")
 SketchConstraintDistance_11 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_28.result(), 40)
 SketchConstraintDistance_11.setName("SketchConstraintDistance_10")
-SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "Cut_2_1/Modified_Face_divided_20_e_15_1"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_2/SketchLine_21&Sketch_1/SketchLine_2"), False)
 SketchLine_29 = SketchProjection_1.createdFeature()
 SketchLine_29.setName("SketchLine_26")
 SketchLine_29.result().setName("SketchLine_26")
@@ -254,7 +254,7 @@ SketchConstraintDistance_12.setName("SketchConstraintDistance_11")
 SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_29.result(), 10)
 SketchConstraintDistance_13.setName("SketchConstraintDistance_12")
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2f"), model.selection("WIRE", "Sketch_3/Wire-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Cut_1_1/Modified_Face_6"), 5, model.selection("FACE", "Cut_1_1/Modified_Face_8"), 5)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2r"), model.selection("WIRE", "Sketch_3/Face-SketchCircle_4_2f_wire")], model.selection(), model.selection("FACE", "Cut_1_1/Modified_Face&Sketch_2/SketchLine_11"), 5, model.selection("FACE", "Cut_1_1/Modified_Face&Sketch_2/SketchLine_13"), 5)
 Cut_3 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_2_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
 Recover_1 = model.addRecover(Part_1_doc, Cut_3, [Extrusion_2.results()[1], Extrusion_2.result()])
 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1"), model.selection("SOLID", "Recover_1_2")], model.selection("EDGE", "PartSet/OZ"), 120)
@@ -496,15 +496,15 @@ SketchConstraintCoincidence_97 = Sketch_5.setCoincident(SketchLine_49.endPoint()
 SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_75")
 SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_49.endPoint(), SketchLine_41.result(), 10)
 model.do()
-Face_1 = model.addFace(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchArc_4_2f-SketchArc_5_2f-SketchArc_6_2f-SketchArc_7_2f-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2f")])
-Axis_4 = model.addAxis(Part_2_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("VERTEX", "Sketch_2/Vertex-SketchArc_3-SketchLine_20s"))
+Face_1 = model.addFace(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_7_2f-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2f-SketchArc_6_2f-SketchArc_5_2f-SketchArc_4_2f_wire")])
+Axis_4 = model.addAxis(Part_2_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("VERTEX", "Sketch_2/SketchArc_3"))
 Rotation_3 = model.addRotation(Part_2_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "Axis_1"), -43.8752)
-Pipe_1 = model.addPipe(Part_2_doc, [model.selection("FACE", "Rotation_1_1")], model.selection("EDGE", "Sketch_2/Edge-SketchArc_3_2"))
-Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_2_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_14r-SketchLine_15r-SketchLine_16r-SketchLine_17r")], model.selection(), "Gap/2", "Gap/2")
+Pipe_1 = model.addPipe(Part_2_doc, [model.selection("FACE", "Rotation_1_1")], model.selection("EDGE", "Sketch_2/SketchArc_3_2"))
+Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_2_2f-SketchCircle_3_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_14r_wire")], model.selection(), "Gap/2", "Gap/2")
 Fuse_1 = model.addFuse(Part_2_doc, [model.selection("SOLID", "Pipe_1_1")], [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
 Extrusion_4 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), "Gap", "Gap")
 Cut_1 = model.addCut(Part_2_doc, [model.selection("SOLID", "Fuse_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
-Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Cut_1_1")], model.selection("VERTEX", "Sketch_2/Edge-SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_21e"))
+Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Cut_1_1")], model.selection("VERTEX", "Sketch_2/SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/SketchLine_21_EndVertex"))
 model.do()
 Part_3 = model.duplicatePart(Part_2)
 Part_3.setName("Arm 2")
@@ -547,11 +547,11 @@ SketchConstraintCoincidence_238 = Sketch_10.setCoincident(SketchPoint_7.coordina
 SketchLine_99 = Sketch_10.addLine(model.selection("EDGE", "PartSet/OY"))
 SketchConstraintDistance_35 = Sketch_10.setDistance(SketchLine_98.endPoint(), SketchLine_99.result(), "Thickness")
 model.do()
-Revolution_2 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), 360, 0)
-Sketch_11 = model.addSketch(Part_5_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
+Revolution_2 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "Sketch_1/SketchLine_6"), 360, 0)
+Sketch_11 = model.addSketch(Part_5_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
 SketchCircle_14 = Sketch_11.addCircle(0, 0, 8.5)
 SketchCircle_14.setAuxiliary(True)
-SketchPoint_8 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_6e"))
+SketchPoint_8 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
 SketchConstraintCoincidence_239 = Sketch_11.setCoincident(SketchCircle_14.center(), SketchPoint_8.result())
 SketchConstraintRadius_18 = Sketch_11.setRadius(SketchCircle_14.results()[1], "(Rod+5)/2")
 SketchLine_100 = Sketch_11.addLine(-8.5, -4.907477288111821, -8.5, 4.907477288111821)
@@ -579,7 +579,7 @@ SketchConstraintEqual_8 = Sketch_11.setEqual(SketchLine_101.result(), SketchLine
 SketchConstraintEqual_9 = Sketch_11.setEqual(SketchLine_102.result(), SketchLine_103.result())
 SketchConstraintEqual_10 = Sketch_11.setEqual(SketchLine_103.result(), SketchLine_104.result())
 model.do()
-Extrusion_9 = model.addExtrusion(Part_5_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), 25, 0)
+Extrusion_9 = model.addExtrusion(Part_5_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 25, 0)
 Sketch_12 = model.addSketch(Part_5_doc, model.standardPlane("YOZ"))
 SketchLine_106 = Sketch_12.addLine(9.814954576223595, 48.99999999999999, 9.814954576223595, 52.35726558990813)
 SketchLine_107 = Sketch_12.addLine(9.814954576223595, 52.35726558990813, 4, 52.35726558990813)
@@ -590,15 +590,15 @@ SketchConstraintCoincidence_248 = Sketch_12.setCoincident(SketchLine_106.startPo
 SketchConstraintHorizontal_20 = Sketch_12.setHorizontal(SketchLine_107.result())
 SketchConstraintVertical_20 = Sketch_12.setVertical(SketchLine_106.result())
 SketchConstraintAngle_8 = Sketch_12.setAngle(SketchLine_108.result(), SketchLine_107.result(), 30)
-SketchLine_109 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_109 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_9]"))
 SketchConstraintCoincidence_249 = Sketch_12.setCoincident(SketchLine_108.endPoint(), SketchLine_109.result())
-SketchProjection_2 = Sketch_12.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchProjection_2 = Sketch_12.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10][Extrusion_1_1/To_Face]"), False)
 SketchLine_110 = SketchProjection_2.createdFeature()
 SketchConstraintDistance_36 = Sketch_12.setDistance(SketchLine_110.result(), SketchLine_108.endPoint(), 1)
 SketchLine_111 = Sketch_12.addLine(model.selection("EDGE", "PartSet/OZ"))
 SketchConstraintDistance_37 = Sketch_12.setDistance(SketchLine_108.startPoint(), SketchLine_111.result(), 4)
 model.do()
-Revolution_3 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_14f-SketchLine_15f-SketchLine_16f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_3 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_14r-SketchLine_15f-SketchLine_16f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Cut_12 = model.addCut(Part_5_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
 Cut_13 = model.addFuse(Part_5_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Revolution_1_1")], [])
 
index 1fade828ad5129607a1e9c72efa72e487c634b93..5a9600e24e3d48a9597805c3c5e19e79249d8b9f 100644 (file)
@@ -43,8 +43,8 @@ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates
 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_2 = SketchProjection_1.createdFeature()
 SketchCircle_2 = Sketch_2.addCircle(0, 0, 33.5)
 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2")
@@ -53,16 +53,16 @@ SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_14")
 model.do()
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), "h2", 0)
 Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2*3", 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face"))
 SketchCircle_3 = Sketch_3.addCircle(0, 0, 28.25)
 SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 28.25)
-SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_3 = SketchProjection_2.createdFeature()
 SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint())
 Extrusion_3.setNestedSketch(Sketch_3)
 Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
-SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face"))
+SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_4 = SketchProjection_3.createdFeature()
 SketchCircle_4 = Sketch_4.addCircle(0, 0, 25.9)
 SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_4.results()[1], "R3")
@@ -70,8 +70,8 @@ SketchConstraintCoincidence_7 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine
 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_15")
 Extrusion_4.setNestedSketch(Sketch_4)
 Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face_1"))
-SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face"))
+SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_5 = SketchProjection_4.createdFeature()
 SketchCircle_5 = Sketch_5.addCircle(0, 0, 8)
 SketchConstraintRadius_5 = Sketch_5.setRadius(SketchCircle_5.results()[1], 8)
@@ -79,15 +79,15 @@ SketchConstraintCoincidence_8 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine
 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_16")
 Extrusion_5.setNestedSketch(Sketch_5)
 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1"), model.selection("SOLID", "Extrusion_5_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_3_1")], [])
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
 SketchCircle_6 = Sketch_6.addCircle(0, 0, 4.2)
 SketchConstraintRadius_6 = Sketch_6.setRadius(SketchCircle_6.results()[1], 4.2)
 SketchPoint_2 = Sketch_6.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchPoint_2.coordinates(), SketchCircle_6.center())
 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_17")
 ExtrusionCut_1.setNestedSketch(Sketch_6)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"))
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"))
 SketchCircle_7 = Sketch_7.addCircle(0, -85, 66)
 SketchLine_6 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OY"))
 SketchConstraintCoincidence_10 = Sketch_7.setCoincident(SketchCircle_7.center(), SketchLine_6.result())
@@ -96,8 +96,8 @@ SketchConstraintDistance_1 = Sketch_7.setDistance(SketchCircle_7.center(), Sketc
 SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3)
 [SketchCircle_8, SketchCircle_9] = SketchMultiRotation_1.rotated()
 model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_5_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face"))
 SketchLine_7 = Sketch_8.addLine(-2.320957096353877e-016, 11.00000001704673, -7, 11.00000001704673)
 SketchConstraintHorizontal_1 = Sketch_8.setHorizontal(SketchLine_7.result())
 SketchLine_8 = Sketch_8.addLine(-7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673)
@@ -126,7 +126,8 @@ SketchLine_14.result().setName("SketchLine_13")
 SketchLine_13.setName("SketchLine_16")
 SketchLine_13.result().setName("SketchLine_16")
 model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f-SketchLine_11f"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_17f-SketchLine_18r-SketchLine_19r"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_13f-SketchLine_14r-SketchLine_15r")], model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_10f-SketchLine_11f-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_18r-SketchLine_19r-SketchLine_17f"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_14r-SketchLine_15r-SketchLine_13f")]
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_3_objects_1, model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Extrusion_4_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
 
 # Test reexecution after parameter change
 Parameter_R.setValue(50)
index de8e95449249c619e68918aa0d7faee55711bcef..cc5b65b011f6890ebbd3a9cd3f9d03052a605e7c 100644 (file)
@@ -389,7 +389,7 @@ SketchConstraintRadius_8 = Sketch_3.setRadius(SketchCircle_2.results()[1], "TDE/
 SketchConstraintRadius_8.setName("SketchConstraintRadius_2")
 SketchConstraintDistance_15 = Sketch_3.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 30)
 SketchConstraintDistance_15.setName("SketchConstraintDistance_9")
-SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_36.setName("SketchLine_25")
 SketchLine_36.result().setName("SketchLine_25")
 SketchConstraintDistance_16 = Sketch_3.setDistance(SketchCircle_1.center(), SketchLine_36.result(), 85)
@@ -398,10 +398,10 @@ model.do()
 Sketch_4 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchCircle_3 = Sketch_4.addCircle(0, 85, 7)
 SketchCircle_4 = Sketch_4.addCircle(0, 55, 7)
-SketchPoint_1 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/Edge-SketchCircle_1_2__cc"))
+SketchPoint_1 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/SketchCircle_1_2__cc"))
 SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center())
 SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_19")
-SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/Edge-SketchCircle_2_2__cc"))
+SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/SketchCircle_2_2__cc"))
 SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_2.coordinates(), SketchCircle_4.center())
 SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_20")
 SketchConstraintRadius_9 = Sketch_4.setRadius(SketchCircle_3.results()[1], "TDI/2")
@@ -436,7 +436,7 @@ SketchConstraintMirror_2.setName("SketchConstraintMirror_3")
 model.do()
 Sketch_6 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
 SketchCircle_9 = Sketch_6.addCircle(30, -41, 4)
-SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Edge-SketchCircle_5_2__cc"))
+SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchCircle_5_2__cc"))
 SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchPoint_3.coordinates(), SketchCircle_9.center())
 SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_21")
 SketchConstraintRadius_12 = Sketch_6.setRadius(SketchCircle_9.results()[1], "BHD/2")
@@ -457,7 +457,7 @@ model.do()
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
 Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_41 = Sketch_7.addLine(-41, 0, -41, 8)
-SketchPoint_4 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_5/Edge-SketchCircle_5_2__cc"))
+SketchPoint_4 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_5/SketchCircle_5_2__cc"))
 SketchConstraintCoincidence_64 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result())
 SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_34")
 SketchLine_42 = Sketch_7.addLine(-41, 8, -34, 8)
@@ -538,7 +538,7 @@ SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_47")
 SketchConstraintRadius_13 = Sketch_7.setRadius(SketchArc_7.results()[1], "BHPFR")
 SketchConstraintRadius_13.setName("SketchConstraintRadius_8")
 model.do()
-RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "Sketch_7/Edge-SketchLine_41"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "Sketch_7/SketchLine_41"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
 Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_49 = Sketch_8.addLine(32, 6, 32.50001476412091, 6.000000000000001)
 SketchLine_49.setName("SketchLine_55")
@@ -546,7 +546,7 @@ SketchLine_49.result().setName("SketchLine_55")
 SketchLine_50 = Sketch_8.addLine(32, 0, 41, 0)
 SketchLine_50.setName("SketchLine_49")
 SketchLine_50.result().setName("SketchLine_49")
-SketchPoint_5 = Sketch_8.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_10_2__cc"))
+SketchPoint_5 = Sketch_8.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_10_2__cc"))
 SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_50")
 SketchLine_51 = Sketch_8.addLine(41, 0, 41, 8)
@@ -634,7 +634,7 @@ SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_66")
 SketchConstraintRadius_14 = Sketch_8.setRadius(SketchArc_8.results()[1], 1.5)
 SketchConstraintRadius_14.setName("SketchConstraintRadius_9")
 model.do()
-RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_55r-SketchLine_49f-SketchLine_50f-SketchLine_56r-SketchLine_52f-SketchLine_53f-SketchArc_7_2r")], model.selection("EDGE", "Sketch_8/Edge-SketchLine_50"), 360, 0, [model.selection("SOLID", "RevolutionFuse_1_1")])
+RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_52f-SketchLine_49f-SketchLine_50f-SketchLine_53f-SketchLine_56r-SketchArc_7_2r-SketchLine_55r")], model.selection("EDGE", "Sketch_8/SketchLine_50"), 360, 0, [model.selection("SOLID", "RevolutionFuse_1_1")])
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, True)
 Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
 SketchLine_57 = Sketch_9.addLine(-32.50001494742042, 5.999999999999998, -32, 6)
@@ -643,7 +643,7 @@ SketchLine_57.result().setName("SketchLine_63")
 SketchLine_58 = Sketch_9.addLine(-32, 0, -41, 0)
 SketchLine_58.setName("SketchLine_57")
 SketchLine_58.result().setName("SketchLine_57")
-SketchPoint_8 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_11_2__cc"))
+SketchPoint_8 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_11_2__cc"))
 SketchConstraintCoincidence_95 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchPoint_8.result())
 SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_67")
 SketchLine_59 = Sketch_9.addLine(-41, 0, -41, 7.999999999999999)
@@ -738,7 +738,7 @@ SketchLine_65.result().setName("SketchLine_71")
 SketchLine_66 = Sketch_10.addLine(32, 0, 41, 0)
 SketchLine_66.setName("SketchLine_65")
 SketchLine_66.result().setName("SketchLine_65")
-SketchPoint_11 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_12_2__cc"))
+SketchPoint_11 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_12_2__cc"))
 SketchConstraintCoincidence_112 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchPoint_11.result())
 SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_84")
 SketchLine_67 = Sketch_10.addLine(41, 0, 41, 7.999999999999999)
@@ -826,9 +826,9 @@ SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_100")
 SketchConstraintRadius_16 = Sketch_10.setRadius(SketchArc_10.results()[1], 1.5)
 SketchConstraintRadius_16.setName("SketchConstraintRadius_11")
 model.do()
-RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/Edge-SketchLine_58"), 360, 0, [model.selection("SOLID", "RevolutionFuse_2_1")])
-RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_10")], model.selection("EDGE", "Sketch_10/Edge-SketchLine_66"), 360, 0, [model.selection("SOLID", "RevolutionFuse_3_1")])
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2f"), model.selection("WIRE", "Sketch_6/Wire-SketchCircle_10_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_12_2f")], model.selection("EDGE", "PartSet/OZ"), "BPS+5", 5, [model.selection("SOLID", "RevolutionFuse_4_1")])
+RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/SketchLine_58"), 360, 0, [model.selection("SOLID", "RevolutionFuse_2_1")])
+RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_10")], model.selection("EDGE", "Sketch_10/SketchLine_66"), 360, 0, [model.selection("SOLID", "RevolutionFuse_3_1")])
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2r"), model.selection("WIRE", "Sketch_6/Face-SketchCircle_10_2f_wire"), model.selection("FACE", "Sketch_6/Face-SketchCircle_12_2f")], model.selection("EDGE", "PartSet/OZ"), "BPS+5", 5, [model.selection("SOLID", "RevolutionFuse_4_1")])
 
 # Test reexecution after parameter change
 Parameter_BPS.setValue(3)
index c3f15e14d3cbfec2b8143491fa3061e678a68028..ed283108527484194f82408dbe2575f27ae3b6ca 100644 (file)
@@ -582,9 +582,9 @@ SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_55")
 SketchLine_379 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY"))
 SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_379.result(), 15)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_8f-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")], model.selection("EDGE", "PartSet/OX"), 360, 0)
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2r-SketchLine_382f-SketchLine_383f-SketchLine_20f-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchLine_25f-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f-SketchLine_36f-SketchLine_37f-SketchLine_38f-SketchLine_39f-SketchLine_40f-SketchLine_41f-SketchLine_42f-SketchLine_43f-SketchLine_44f-SketchLine_45f-SketchLine_46f-SketchLine_47f-SketchLine_48f-SketchLine_49f-SketchLine_50f-SketchLine_51f-SketchLine_52f-SketchLine_53f-SketchLine_54f-SketchLine_55f-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchLine_59f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f-SketchLine_65f-SketchLine_66f-SketchLine_67f-SketchLine_68f-SketchLine_69f-SketchLine_70f-SketchLine_71f-SketchLine_72f-SketchLine_73f-SketchLine_74f-SketchLine_75f-SketchLine_76f-SketchLine_77f-SketchLine_78f-SketchLine_79f-SketchLine_80f-SketchLine_81f-SketchLine_82f-SketchLine_83f-SketchLine_84f-SketchLine_85f-SketchLine_86f-SketchLine_87f-SketchLine_88f-SketchLine_89f-SketchLine_90f-SketchLine_91f-SketchLine_92f-SketchLine_93f-SketchLine_94f-SketchLine_95f-SketchLine_96f-SketchLine_97f-SketchLine_98f-SketchLine_99f-SketchLine_100f-SketchLine_101f-SketchLine_102f-SketchLine_103f-SketchLine_104f-SketchLine_105f-SketchLine_106f-SketchLine_107f-SketchLine_108f-SketchLine_109f-SketchLine_110f-SketchLine_111f-SketchLine_112f-SketchLine_113f-SketchLine_114f-SketchLine_115f-SketchLine_116f-SketchLine_117f-SketchLine_118f-SketchLine_119f-SketchLine_120f-SketchLine_121f-SketchLine_122f-SketchLine_123f-SketchLine_124f-SketchLine_125f-SketchLine_126f-SketchLine_127f-SketchLine_128f-SketchLine_129f-SketchLine_130f-SketchLine_131f-SketchLine_132f-SketchLine_133f-SketchLine_134f-SketchLine_135f-SketchLine_136f-SketchLine_137f-SketchLine_138f-SketchLine_139f-SketchLine_140f-SketchLine_141f-SketchLine_142f-SketchLine_143f-SketchLine_144f-SketchLine_145f-SketchLine_146f-SketchLine_147f-SketchLine_148f-SketchLine_149f-SketchLine_150f-SketchLine_151f-SketchLine_152f-SketchLine_153f-SketchLine_154f-SketchLine_155f-SketchLine_156f-SketchLine_157f-SketchLine_158f-SketchLine_159f-SketchLine_160f-SketchLine_161f-SketchLine_162f-SketchLine_163f-SketchLine_164f-SketchLine_165f-SketchLine_166f-SketchLine_167f-SketchLine_168f-SketchLine_169f-SketchLine_170f-SketchLine_171f-SketchLine_172f-SketchLine_173f-SketchLine_174f-SketchLine_175f-SketchLine_176f-SketchLine_177f-SketchLine_178f-SketchLine_179f-SketchLine_180f-SketchLine_181f-SketchLine_182f-SketchLine_183f-SketchLine_184f-SketchLine_185f-SketchLine_186f-SketchLine_187f-SketchLine_188f-SketchLine_189f-SketchLine_190f-SketchLine_191f-SketchLine_192f-SketchLine_193f-SketchLine_194f-SketchLine_195f-SketchLine_196f-SketchLine_197f-SketchLine_198f-SketchLine_199f-SketchArc_2_2r-SketchArc_3_2r-SketchArc_4_2r-SketchArc_5_2r-SketchArc_6_2r-SketchArc_7_2r-SketchArc_8_2r-SketchArc_9_2r-SketchArc_10_2r-SketchArc_11_2r-SketchArc_12_2r-SketchArc_13_2r-SketchArc_14_2r-SketchArc_15_2r-SketchArc_16_2r-SketchArc_17_2r-SketchArc_18_2r-SketchArc_19_2r-SketchArc_20_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_23_2r-SketchArc_24_2r-SketchArc_25_2r-SketchArc_26_2r-SketchArc_27_2r-SketchArc_28_2r-SketchArc_29_2r-SketchArc_30_2r-SketchArc_31_2r-SketchArc_32_2r-SketchArc_33_2r-SketchArc_34_2r-SketchArc_35_2r-SketchArc_36_2r-SketchArc_37_2r-SketchArc_38_2r-SketchArc_39_2r-SketchArc_40_2r-SketchArc_41_2r-SketchArc_42_2r-SketchArc_43_2r-SketchArc_44_2r-SketchArc_45_2r-SketchArc_46_2r-SketchArc_47_2r-SketchArc_48_2r-SketchArc_49_2r-SketchArc_50_2r-SketchArc_51_2r-SketchArc_52_2r-SketchArc_53_2r-SketchArc_54_2r-SketchArc_55_2r-SketchArc_56_2r-SketchArc_57_2r-SketchArc_58_2r-SketchArc_59_2r-SketchArc_60_2r-SketchArc_61_2r-SketchArc_62_2r-SketchArc_63_2r-SketchArc_64_2r-SketchArc_65_2r-SketchArc_66_2r-SketchArc_67_2r-SketchArc_68_2r-SketchArc_69_2r-SketchArc_70_2r-SketchArc_71_2r-SketchArc_72_2r-SketchArc_73_2r-SketchArc_74_2r-SketchArc_75_2r-SketchArc_76_2r-SketchArc_77_2r-SketchArc_78_2r-SketchArc_79_2r-SketchArc_80_2r-SketchArc_81_2r-SketchArc_82_2r-SketchArc_83_2r-SketchArc_84_2r-SketchArc_85_2r-SketchArc_86_2r-SketchArc_87_2r-SketchArc_88_2r-SketchArc_89_2r-SketchArc_90_2r-SketchArc_91_2r-SketchArc_92_2r-SketchArc_93_2r-SketchArc_94_2r-SketchArc_95_2r-SketchArc_96_2r-SketchArc_97_2r-SketchArc_98_2r-SketchArc_99_2r-SketchArc_100_2r-SketchArc_101_2r-SketchArc_102_2r-SketchArc_103_2r-SketchArc_104_2r-SketchArc_105_2r-SketchArc_106_2r-SketchArc_107_2r-SketchArc_108_2r-SketchArc_109_2r-SketchArc_110_2r-SketchArc_111_2r-SketchArc_112_2r-SketchArc_113_2r-SketchArc_114_2r-SketchArc_115_2r-SketchArc_116_2r-SketchArc_117_2r-SketchArc_118_2r-SketchArc_119_2r-SketchArc_120_2r-SketchArc_121_2r-SketchArc_122_2r-SketchArc_123_2r-SketchArc_124_2r-SketchArc_125_2r-SketchArc_126_2r-SketchArc_127_2r-SketchArc_128_2r-SketchArc_129_2r-SketchArc_130_2r-SketchArc_131_2r-SketchArc_132_2r-SketchArc_133_2r-SketchArc_134_2r-SketchArc_135_2r-SketchArc_136_2r-SketchArc_137_2r-SketchArc_138_2r-SketchArc_139_2r-SketchArc_140_2r-SketchArc_141_2r-SketchArc_142_2r-SketchArc_143_2r-SketchArc_144_2r-SketchArc_145_2r-SketchArc_146_2r-SketchArc_147_2r-SketchArc_148_2r-SketchArc_149_2r-SketchArc_150_2r-SketchArc_151_2r-SketchArc_152_2r-SketchArc_153_2r-SketchArc_154_2r-SketchArc_155_2r-SketchArc_156_2r-SketchArc_157_2r-SketchArc_158_2r-SketchArc_159_2r-SketchArc_160_2r-SketchArc_161_2r-SketchArc_162_2r-SketchArc_163_2r-SketchArc_164_2r-SketchArc_165_2r-SketchArc_166_2r-SketchArc_167_2r-SketchArc_168_2r-SketchArc_169_2r-SketchArc_170_2r-SketchArc_171_2r-SketchArc_172_2r-SketchArc_173_2r-SketchArc_174_2r-SketchArc_175_2r-SketchArc_176_2r-SketchArc_177_2r-SketchArc_178_2r-SketchArc_179_2r-SketchArc_180_2r-SketchLine_21f-SketchLine_200f-SketchLine_201f-SketchLine_202f-SketchLine_203f-SketchLine_204f-SketchLine_205f-SketchLine_206f-SketchLine_207f-SketchLine_208f-SketchLine_209f-SketchLine_210f-SketchLine_211f-SketchLine_212f-SketchLine_213f-SketchLine_214f-SketchLine_215f-SketchLine_216f-SketchLine_217f-SketchLine_218f-SketchLine_219f-SketchLine_220f-SketchLine_221f-SketchLine_222f-SketchLine_223f-SketchLine_224f-SketchLine_225f-SketchLine_226f-SketchLine_227f-SketchLine_228f-SketchLine_229f-SketchLine_230f-SketchLine_231f-SketchLine_232f-SketchLine_233f-SketchLine_234f-SketchLine_235f-SketchLine_236f-SketchLine_237f-SketchLine_238f-SketchLine_239f-SketchLine_240f-SketchLine_241f-SketchLine_242f-SketchLine_243f-SketchLine_244f-SketchLine_245f-SketchLine_246f-SketchLine_247f-SketchLine_248f-SketchLine_249f-SketchLine_250f-SketchLine_251f-SketchLine_252f-SketchLine_253f-SketchLine_254f-SketchLine_255f-SketchLine_256f-SketchLine_257f-SketchLine_258f-SketchLine_259f-SketchLine_260f-SketchLine_261f-SketchLine_262f-SketchLine_263f-SketchLine_264f-SketchLine_265f-SketchLine_266f-SketchLine_267f-SketchLine_268f-SketchLine_269f-SketchLine_270f-SketchLine_271f-SketchLine_272f-SketchLine_273f-SketchLine_274f-SketchLine_275f-SketchLine_276f-SketchLine_277f-SketchLine_278f-SketchLine_279f-SketchLine_280f-SketchLine_281f-SketchLine_282f-SketchLine_283f-SketchLine_284f-SketchLine_285f-SketchLine_286f-SketchLine_287f-SketchLine_288f-SketchLine_289f-SketchLine_290f-SketchLine_291f-SketchLine_292f-SketchLine_293f-SketchLine_294f-SketchLine_295f-SketchLine_296f-SketchLine_297f-SketchLine_298f-SketchLine_299f-SketchLine_300f-SketchLine_301f-SketchLine_302f-SketchLine_303f-SketchLine_304f-SketchLine_305f-SketchLine_306f-SketchLine_307f-SketchLine_308f-SketchLine_309f-SketchLine_310f-SketchLine_311f-SketchLine_312f-SketchLine_313f-SketchLine_314f-SketchLine_315f-SketchLine_316f-SketchLine_317f-SketchLine_318f-SketchLine_319f-SketchLine_320f-SketchLine_321f-SketchLine_322f-SketchLine_323f-SketchLine_324f-SketchLine_325f-SketchLine_326f-SketchLine_327f-SketchLine_328f-SketchLine_329f-SketchLine_330f-SketchLine_331f-SketchLine_332f-SketchLine_333f-SketchLine_334f-SketchLine_335f-SketchLine_336f-SketchLine_337f-SketchLine_338f-SketchLine_339f-SketchLine_340f-SketchLine_341f-SketchLine_342f-SketchLine_343f-SketchLine_344f-SketchLine_345f-SketchLine_346f-SketchLine_347f-SketchLine_348f-SketchLine_349f-SketchLine_350f-SketchLine_351f-SketchLine_352f-SketchLine_353f-SketchLine_354f-SketchLine_355f-SketchLine_356f-SketchLine_357f-SketchLine_358f-SketchLine_359f-SketchLine_360f-SketchLine_361f-SketchLine_362f-SketchLine_363f-SketchLine_364f-SketchLine_365f-SketchLine_366f-SketchLine_367f-SketchLine_368f-SketchLine_369f-SketchLine_370f-SketchLine_371f-SketchLine_372f-SketchLine_373f-SketchLine_374f-SketchLine_375f-SketchLine_376f-SketchLine_377f-SketchCircle_3_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2f")], model.selection(), 30, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_8f-SketchLine_9f-SketchLine_11f")], model.selection("EDGE", "PartSet/OX"), 360, 0)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_383f-SketchLine_199f-SketchArc_180_2r-SketchLine_377f-SketchLine_198f-SketchArc_179_2r-SketchLine_376f-SketchLine_197f-SketchArc_178_2r-SketchLine_375f-SketchLine_196f-SketchArc_177_2r-SketchLine_374f-SketchLine_195f-SketchArc_176_2r-SketchLine_373f-SketchLine_194f-SketchArc_175_2r-SketchLine_372f-SketchLine_193f-SketchArc_174_2r-SketchLine_371f-SketchLine_192f-SketchArc_173_2r-SketchLine_370f-SketchLine_191f-SketchArc_172_2r-SketchLine_369f-SketchLine_190f-SketchArc_171_2r-SketchLine_368f-SketchLine_189f-SketchArc_170_2r-SketchLine_367f-SketchLine_188f-SketchArc_169_2r-SketchLine_366f-SketchLine_187f-SketchArc_168_2r-SketchLine_365f-SketchLine_186f-SketchArc_167_2r-SketchLine_364f-SketchLine_185f-SketchArc_166_2r-SketchLine_363f-SketchLine_184f-SketchArc_165_2r-SketchLine_362f-SketchLine_183f-SketchArc_164_2r-SketchLine_361f-SketchLine_182f-SketchArc_163_2r-SketchLine_360f-SketchLine_181f-SketchArc_162_2r-SketchLine_359f-SketchLine_180f-SketchArc_161_2r-SketchLine_358f-SketchLine_179f-SketchArc_160_2r-SketchLine_357f-SketchLine_178f-SketchArc_159_2r-SketchLine_356f-SketchLine_177f-SketchArc_158_2r-SketchLine_355f-SketchLine_176f-SketchArc_157_2r-SketchLine_354f-SketchLine_175f-SketchArc_156_2r-SketchLine_353f-SketchLine_174f-SketchArc_155_2r-SketchLine_352f-SketchLine_173f-SketchArc_154_2r-SketchLine_351f-SketchLine_172f-SketchArc_153_2r-SketchLine_350f-SketchLine_171f-SketchArc_152_2r-SketchLine_349f-SketchLine_170f-SketchArc_151_2r-SketchLine_348f-SketchLine_169f-SketchArc_150_2r-SketchLine_347f-SketchLine_168f-SketchArc_149_2r-SketchLine_346f-SketchLine_167f-SketchArc_148_2r-SketchLine_345f-SketchLine_166f-SketchArc_147_2r-SketchLine_344f-SketchLine_165f-SketchArc_146_2r-SketchLine_343f-SketchLine_164f-SketchArc_145_2r-SketchLine_342f-SketchLine_163f-SketchArc_144_2r-SketchLine_341f-SketchLine_162f-SketchArc_143_2r-SketchLine_340f-SketchLine_161f-SketchArc_142_2r-SketchLine_339f-SketchLine_160f-SketchArc_141_2r-SketchLine_338f-SketchLine_159f-SketchArc_140_2r-SketchLine_337f-SketchLine_158f-SketchArc_139_2r-SketchLine_336f-SketchLine_157f-SketchArc_138_2r-SketchLine_335f-SketchLine_156f-SketchArc_137_2r-SketchLine_334f-SketchLine_155f-SketchArc_136_2r-SketchLine_333f-SketchLine_154f-SketchArc_135_2r-SketchLine_332f-SketchLine_153f-SketchArc_134_2r-SketchLine_331f-SketchLine_152f-SketchArc_133_2r-SketchLine_330f-SketchLine_151f-SketchArc_132_2r-SketchLine_329f-SketchLine_150f-SketchArc_131_2r-SketchLine_328f-SketchLine_149f-SketchArc_130_2r-SketchLine_327f-SketchLine_148f-SketchArc_129_2r-SketchLine_326f-SketchLine_147f-SketchArc_128_2r-SketchLine_325f-SketchLine_146f-SketchArc_127_2r-SketchLine_324f-SketchLine_145f-SketchArc_126_2r-SketchLine_323f-SketchLine_144f-SketchArc_125_2r-SketchLine_322f-SketchLine_143f-SketchArc_124_2r-SketchLine_321f-SketchLine_142f-SketchArc_123_2r-SketchLine_320f-SketchLine_141f-SketchArc_122_2r-SketchLine_319f-SketchLine_140f-SketchArc_121_2r-SketchLine_318f-SketchLine_139f-SketchArc_120_2r-SketchLine_317f-SketchLine_138f-SketchArc_119_2r-SketchLine_316f-SketchLine_137f-SketchArc_118_2r-SketchLine_315f-SketchLine_136f-SketchArc_117_2r-SketchLine_314f-SketchLine_135f-SketchArc_116_2r-SketchLine_313f-SketchLine_134f-SketchArc_115_2r-SketchLine_312f-SketchLine_133f-SketchArc_114_2r-SketchLine_311f-SketchLine_132f-SketchArc_113_2r-SketchLine_310f-SketchLine_131f-SketchArc_112_2r-SketchLine_309f-SketchLine_130f-SketchArc_111_2r-SketchLine_308f-SketchLine_129f-SketchArc_110_2r-SketchLine_307f-SketchLine_128f-SketchArc_109_2r-SketchLine_306f-SketchLine_127f-SketchArc_108_2r-SketchLine_305f-SketchLine_126f-SketchArc_107_2r-SketchLine_304f-SketchLine_125f-SketchArc_106_2r-SketchLine_303f-SketchLine_124f-SketchArc_105_2r-SketchLine_302f-SketchLine_123f-SketchArc_104_2r-SketchLine_301f-SketchLine_122f-SketchArc_103_2r-SketchLine_300f-SketchLine_121f-SketchArc_102_2r-SketchLine_299f-SketchLine_120f-SketchArc_101_2r-SketchLine_298f-SketchLine_119f-SketchArc_100_2r-SketchLine_297f-SketchLine_118f-SketchArc_99_2r-SketchLine_296f-SketchLine_117f-SketchArc_98_2r-SketchLine_295f-SketchLine_116f-SketchArc_97_2r-SketchLine_294f-SketchLine_115f-SketchArc_96_2r-SketchLine_293f-SketchLine_114f-SketchArc_95_2r-SketchLine_292f-SketchLine_113f-SketchArc_94_2r-SketchLine_291f-SketchLine_112f-SketchArc_93_2r-SketchLine_290f-SketchLine_111f-SketchArc_92_2r-SketchLine_289f-SketchLine_110f-SketchArc_91_2r-SketchLine_288f-SketchLine_109f-SketchArc_90_2r-SketchLine_287f-SketchLine_108f-SketchArc_89_2r-SketchLine_286f-SketchLine_107f-SketchArc_88_2r-SketchLine_285f-SketchLine_106f-SketchArc_87_2r-SketchLine_284f-SketchLine_105f-SketchArc_86_2r-SketchLine_283f-SketchLine_104f-SketchArc_85_2r-SketchLine_282f-SketchLine_103f-SketchArc_84_2r-SketchLine_281f-SketchLine_102f-SketchArc_83_2r-SketchLine_280f-SketchLine_101f-SketchArc_82_2r-SketchLine_279f-SketchLine_100f-SketchArc_81_2r-SketchLine_278f-SketchLine_99f-SketchArc_80_2r-SketchLine_277f-SketchLine_98f-SketchArc_79_2r-SketchLine_276f-SketchLine_97f-SketchArc_78_2r-SketchLine_275f-SketchLine_96f-SketchArc_77_2r-SketchLine_274f-SketchLine_95f-SketchArc_76_2r-SketchLine_273f-SketchLine_94f-SketchArc_75_2r-SketchLine_272f-SketchLine_93f-SketchArc_74_2r-SketchLine_271f-SketchLine_92f-SketchArc_73_2r-SketchLine_270f-SketchLine_91f-SketchArc_72_2r-SketchLine_269f-SketchLine_90f-SketchArc_71_2r-SketchLine_268f-SketchLine_89f-SketchArc_70_2r-SketchLine_267f-SketchLine_88f-SketchArc_69_2r-SketchLine_266f-SketchLine_87f-SketchArc_68_2r-SketchLine_265f-SketchLine_86f-SketchArc_67_2r-SketchLine_264f-SketchLine_85f-SketchArc_66_2r-SketchLine_263f-SketchLine_84f-SketchArc_65_2r-SketchLine_262f-SketchLine_83f-SketchArc_64_2r-SketchLine_261f-SketchLine_82f-SketchArc_63_2r-SketchLine_260f-SketchLine_81f-SketchArc_62_2r-SketchLine_259f-SketchLine_80f-SketchArc_61_2r-SketchLine_258f-SketchLine_79f-SketchArc_60_2r-SketchLine_257f-SketchLine_78f-SketchArc_59_2r-SketchLine_256f-SketchLine_77f-SketchArc_58_2r-SketchLine_255f-SketchLine_76f-SketchArc_57_2r-SketchLine_254f-SketchLine_75f-SketchArc_56_2r-SketchLine_253f-SketchLine_74f-SketchArc_55_2r-SketchLine_252f-SketchLine_73f-SketchArc_54_2r-SketchLine_251f-SketchLine_72f-SketchArc_53_2r-SketchLine_250f-SketchLine_71f-SketchArc_52_2r-SketchLine_249f-SketchLine_70f-SketchArc_51_2r-SketchLine_248f-SketchLine_69f-SketchArc_50_2r-SketchLine_247f-SketchLine_68f-SketchArc_49_2r-SketchLine_246f-SketchLine_67f-SketchArc_48_2r-SketchLine_245f-SketchLine_66f-SketchArc_47_2r-SketchLine_244f-SketchLine_65f-SketchArc_46_2r-SketchLine_243f-SketchLine_64f-SketchArc_45_2r-SketchLine_242f-SketchLine_63f-SketchArc_44_2r-SketchLine_241f-SketchLine_62f-SketchArc_43_2r-SketchLine_240f-SketchLine_61f-SketchArc_42_2r-SketchLine_239f-SketchLine_60f-SketchArc_41_2r-SketchLine_238f-SketchLine_59f-SketchArc_40_2r-SketchLine_237f-SketchLine_58f-SketchArc_39_2r-SketchLine_236f-SketchLine_57f-SketchArc_38_2r-SketchLine_235f-SketchLine_56f-SketchArc_37_2r-SketchLine_234f-SketchLine_55f-SketchArc_36_2r-SketchLine_233f-SketchLine_54f-SketchArc_35_2r-SketchLine_232f-SketchLine_53f-SketchArc_34_2r-SketchLine_231f-SketchLine_52f-SketchArc_33_2r-SketchLine_230f-SketchLine_51f-SketchArc_32_2r-SketchLine_229f-SketchLine_50f-SketchArc_31_2r-SketchLine_228f-SketchLine_49f-SketchArc_30_2r-SketchLine_227f-SketchLine_48f-SketchArc_29_2r-SketchLine_226f-SketchLine_47f-SketchArc_28_2r-SketchLine_225f-SketchLine_46f-SketchArc_27_2r-SketchLine_224f-SketchLine_45f-SketchArc_26_2r-SketchLine_223f-SketchLine_44f-SketchArc_25_2r-SketchLine_222f-SketchLine_43f-SketchArc_24_2r-SketchLine_221f-SketchLine_42f-SketchArc_23_2r-SketchLine_220f-SketchLine_41f-SketchArc_22_2r-SketchLine_219f-SketchLine_40f-SketchArc_21_2r-SketchLine_218f-SketchLine_39f-SketchArc_20_2r-SketchLine_217f-SketchLine_38f-SketchArc_19_2r-SketchLine_216f-SketchLine_37f-SketchArc_18_2r-SketchLine_215f-SketchLine_36f-SketchArc_17_2r-SketchLine_214f-SketchLine_35f-SketchArc_16_2r-SketchLine_213f-SketchLine_34f-SketchArc_15_2r-SketchLine_212f-SketchLine_33f-SketchArc_14_2r-SketchLine_211f-SketchLine_32f-SketchArc_13_2r-SketchLine_210f-SketchLine_31f-SketchArc_12_2r-SketchLine_209f-SketchLine_30f-SketchArc_11_2r-SketchLine_208f-SketchLine_29f-SketchArc_10_2r-SketchLine_207f-SketchLine_28f-SketchArc_9_2r-SketchLine_206f-SketchLine_27f-SketchArc_8_2r-SketchLine_205f-SketchLine_26f-SketchArc_7_2r-SketchLine_204f-SketchLine_25f-SketchArc_6_2r-SketchLine_203f-SketchLine_24f-SketchArc_5_2r-SketchLine_202f-SketchLine_23f-SketchArc_4_2r-SketchLine_201f-SketchLine_22f-SketchArc_3_2r-SketchLine_200f-SketchLine_20f-SketchArc_2_2r-SketchLine_21f-SketchLine_382f-SketchArc_1_2r")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2r")], model.selection(), 30, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
 
 # Test reexecution after parameter change
 Parameter_H.setValue(14)
index 5db96a7f2679dbf0a1e8438310306d6bd2db7273..3c003a303b5e66aaeca71923720462bb7cf83d68 100644 (file)
@@ -30,7 +30,7 @@ Parameter_R = model.addParameter(Part_1_doc, "R", "3")
 model.addParameter(Part_1_doc, "DBody", "65")
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 89, False)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchLine_1 = Sketch_1.addLine(0, 20, 16.99998550401508, 20)
+SketchLine_1 = Sketch_1.addLine(0, 20, 17, 20)
 SketchLine_1.setName("SketchLine_7")
 SketchLine_1.result().setName("SketchLine_7")
 SketchLine_2 = Sketch_1.addLine(20, 0, 0, 0)
@@ -39,7 +39,7 @@ SketchLine_2.result().setName("SketchLine_1")
 SketchLine_3 = Sketch_1.addLine(0, 0, 0, 20)
 SketchLine_3.setName("SketchLine_2")
 SketchLine_3.result().setName("SketchLine_2")
-SketchLine_4 = Sketch_1.addLine(20, 16.99999846116062, 20, 0)
+SketchLine_4 = Sketch_1.addLine(20, 17, 20, 0)
 SketchLine_4.setName("SketchLine_8")
 SketchLine_4.result().setName("SketchLine_8")
 SketchLine_5 = Sketch_1.addLine(20, 20, 20, 0)
@@ -66,7 +66,7 @@ SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"
 SketchLine_8 = SketchProjection_2.createdFeature()
 SketchLine_8.setName("SketchLine_6")
 SketchLine_8.result().setName("SketchLine_6")
-SketchArc_1 = Sketch_1.addArc(17, 17, 20, 16.99999846116062, 16.99998550401508, 20, False)
+SketchArc_1 = Sketch_1.addArc(17, 17, 20, 17, 17, 20, False)
 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
@@ -80,21 +80,21 @@ SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_3.result(), 20)
 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_2.result(), 20)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_1r-SketchLine_2r-SketchLine_8r-SketchArc_1_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 0, 180)
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_1r-SketchLine_2r-SketchLine_8r-SketchArc_1_2f")], model.selection(), 0, 25, [model.selection("SOLID", "Revolution_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_1r-SketchLine_8r-SketchArc_1_2f-SketchLine_7r")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 0, 180)
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_1r-SketchLine_8r-SketchArc_1_2f-SketchLine_7r")], model.selection(), 0, 25, [model.selection("SOLID", "Revolution_1_1")])
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchLine_9 = Sketch_2.addLine(0, 20, -17.00000285538278, 20)
+SketchLine_9 = Sketch_2.addLine(0, 20, -17, 20)
 SketchLine_9.setName("SketchLine_13")
 SketchLine_9.result().setName("SketchLine_13")
 SketchLine_10 = Sketch_2.addLine(-20, 0, 0, 0)
 SketchLine_10.setName("SketchLine_9")
 SketchLine_10.result().setName("SketchLine_9")
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchProjection_1s-SketchLine_5s-SketchProjection_2s-SketchLine_6s-SketchLine_1e"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_1.result())
 SketchLine_11 = Sketch_2.addLine(0, 0, 0, 20)
 SketchLine_11.setName("SketchLine_10")
 SketchLine_11.result().setName("SketchLine_10")
-SketchLine_12 = Sketch_2.addLine(-20, 17.00000633266883, -20, 0)
+SketchLine_12 = Sketch_2.addLine(-20, 17, -20, 0)
 SketchLine_12.setName("SketchLine_14")
 SketchLine_12.result().setName("SketchLine_14")
 SketchLine_13 = Sketch_2.addLine(-20, 20, -20, 0)
@@ -113,7 +113,7 @@ SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_10.result())
 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_11.result())
 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_14.result())
 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_13.result())
-SketchArc_2 = Sketch_2.addArc(-17, 17, -17.00000285538278, 20, -20, 17.00000633266883, False)
+SketchArc_2 = Sketch_2.addArc(-17, 17, -17, 20, -20, 17, False)
 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_9.endPoint())
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_12.startPoint())
 SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_9.result())
@@ -126,20 +126,20 @@ SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], 3)
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_10.startPoint(), SketchLine_11.result(), 20)
 SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 20)
 model.do()
-ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_9f-SketchLine_10f-SketchLine_14f-SketchArc_2_2f")], model.selection(), 0, 25, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1/Modfied_8"))
+ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchArc_2_2f-SketchLine_14f-SketchLine_9f-SketchLine_10f")], model.selection(), 0, 25, [model.selection("SOLID", "ExtrusionFuse_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_2_1/From_Face"))
 SketchLine_15 = Sketch_3.addLine(0, -20, -17.00000002635728, -20)
 SketchLine_15.setName("SketchLine_19")
 SketchLine_15.result().setName("SketchLine_19")
 SketchLine_16 = Sketch_3.addLine(-20, 0, 0, 0)
 SketchLine_16.setName("SketchLine_15")
 SketchLine_16.result().setName("SketchLine_15")
-SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_9&ExtrusionFuse_2_1/Modfied_5&ExtrusionFuse_2_1/Modfied_8&ExtrusionFuse_2_1/Modfied_2"))
+SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "[ExtrusionFuse_2_1/Generated_Face&Sketch_2/SketchLine_9][(ExtrusionFuse_2_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionFuse_1_1/Generated_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_1_1/From_Face)][ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_2_1/From_Face][ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_1_1/From_Face]"))
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchPoint_2.result())
 SketchLine_17 = Sketch_3.addLine(0, 0, 0, -20)
 SketchLine_17.setName("SketchLine_16")
 SketchLine_17.result().setName("SketchLine_16")
-SketchLine_18 = Sketch_3.addLine(-20, -16.99998301947517, -20, 0)
+SketchLine_18 = Sketch_3.addLine(-20, -17, -20, 0)
 SketchLine_18.setName("SketchLine_20")
 SketchLine_18.result().setName("SketchLine_20")
 SketchLine_19 = Sketch_3.addLine(-20, -20, -20, 0)
@@ -158,7 +158,7 @@ SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_16.result())
 SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_17.result())
 SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_20.result())
 SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_19.result())
-SketchArc_3 = Sketch_3.addArc(-17, -17, -20, -16.99998301947517, -17.00000002635728, -20, False)
+SketchArc_3 = Sketch_3.addArc(-17, -17, -20, -17, -17.00000002635728, -20, False)
 SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchArc_3.startPoint(), SketchLine_18.startPoint())
 SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchLine_15.endPoint())
 SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_3.results()[1], SketchLine_15.result())
@@ -174,9 +174,9 @@ SketchLine_21 = Sketch_3.addLine(-23, -0.01462093666115485, -23, -19.98755081419
 SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_17.result(), SketchLine_21.result())
 SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_18.result(), 3)
 model.do()
-RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "Sketch_3/Edge-SketchLine_21"), 71, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "RevolutionFuse_1_1/Modfied_4"))
-SketchLine_22 = Sketch_4.addLine(-3, -20, 17.00000452949485, -20)
+RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "Sketch_3/SketchLine_21"), 71, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "RevolutionFuse_1_1/Modified_Face&ExtrusionFuse_1_1/From_Face"))
+SketchLine_22 = Sketch_4.addLine(-3, -20, 17, -20)
 SketchLine_22.setName("SketchLine_26")
 SketchLine_22.result().setName("SketchLine_26")
 SketchLine_23 = Sketch_4.addLine(20, 0, -3, 0)
@@ -185,7 +185,7 @@ SketchLine_23.result().setName("SketchLine_22")
 SketchLine_24 = Sketch_4.addLine(-3, 0, -3, -20)
 SketchLine_24.setName("SketchLine_23")
 SketchLine_24.result().setName("SketchLine_23")
-SketchLine_25 = Sketch_4.addLine(20, -17.00001580618423, 20, 0)
+SketchLine_25 = Sketch_4.addLine(20, -17, 20, 0)
 SketchLine_25.setName("SketchLine_27")
 SketchLine_25.result().setName("SketchLine_27")
 SketchLine_26 = Sketch_4.addLine(20, -20, 20, 0)
@@ -204,7 +204,7 @@ SketchConstraintHorizontal_7 = Sketch_4.setHorizontal(SketchLine_23.result())
 SketchConstraintVertical_7 = Sketch_4.setVertical(SketchLine_24.result())
 SketchConstraintHorizontal_8 = Sketch_4.setHorizontal(SketchLine_27.result())
 SketchConstraintVertical_8 = Sketch_4.setVertical(SketchLine_26.result())
-SketchArc_4 = Sketch_4.addArc(17, -17, 17.00000452949485, -20, 20, -17.00001580618423, False)
+SketchArc_4 = Sketch_4.addArc(17, -17, 17, -20, 20, -17, False)
 SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchArc_4.startPoint(), SketchLine_22.endPoint())
 SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchLine_25.startPoint())
 SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_4.results()[1], SketchLine_22.result())
@@ -214,7 +214,7 @@ SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_26.endPoint()
 SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_27.result())
 SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_26.result())
 SketchConstraintRadius_4 = Sketch_4.setRadius(SketchArc_4.results()[1], 3)
-SketchLine_28 = Sketch_4.addLine(model.selection("EDGE", "Sketch_3/Edge-SketchLine_15"))
+SketchLine_28 = Sketch_4.addLine(model.selection("EDGE", "Sketch_3/SketchLine_15"))
 SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_28.result())
 SketchConstraintDistance_8 = Sketch_4.setDistance(SketchLine_22.endPoint(), SketchLine_23.result(), 20)
 SketchConstraintDistance_9 = Sketch_4.setDistance(SketchLine_28.endPoint(), SketchLine_25.result(), 20)
@@ -223,12 +223,12 @@ SketchLine_29 = Sketch_4.addLine(23, -0.2448405100241045, 23, -19.61338093143246
 SketchConstraintParallel_2 = Sketch_4.setParallel(SketchLine_25.result(), SketchLine_29.result())
 SketchConstraintDistance_11 = Sketch_4.setDistance(SketchLine_23.startPoint(), SketchLine_29.result(), 3)
 model.do()
-RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_26f-SketchLine_22f-SketchLine_23f-SketchLine_27f-SketchArc_4_2f")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_29"), 0, 71, [model.selection("SOLID", "RevolutionFuse_1_1")])
+RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_26r-SketchArc_4_2f-SketchLine_27f-SketchLine_22f-SketchLine_23f")], model.selection("EDGE", "Sketch_4/SketchLine_29"), 0, 71, [model.selection("SOLID", "RevolutionFuse_1_1")])
 Sketch_5 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_30 = Sketch_5.addLine(0, 0, 0, 82)
 SketchLine_31 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OZ"))
 SketchConstraintCoincidence_45 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.result())
-SketchLine_32 = Sketch_5.addLine(27.41618692363446, 77.00000000000001, 58.99998109391454, 77.00000000000001)
+SketchLine_32 = Sketch_5.addLine(27.41618692363446, 77, 58.99998109391454, 77)
 SketchLine_32.setName("SketchLine_39")
 SketchLine_32.result().setName("SketchLine_39")
 SketchLine_33 = Sketch_5.addLine(0, 82, 20, 82)
@@ -238,7 +238,7 @@ SketchConstraintCoincidence_46 = Sketch_5.setCoincident(SketchLine_30.endPoint()
 SketchLine_34 = Sketch_5.addLine(65, 70.99999917134223, 65, 0)
 SketchLine_34.setName("SketchLine_40")
 SketchLine_34.result().setName("SketchLine_40")
-SketchLine_35 = Sketch_5.addLine(27.41618692363446, 77.00000000000001, 65, 77.00000000000001)
+SketchLine_35 = Sketch_5.addLine(27.41618692363446, 77, 65, 77)
 SketchLine_35.setName("SketchLine_34")
 SketchLine_35.result().setName("SketchLine_34")
 SketchLine_35.setAuxiliary(True)
@@ -263,7 +263,7 @@ SketchConstraintDistance_12 = Sketch_5.setDistance(SketchLine_33.endPoint(), Ske
 SketchConstraintDistance_12.setName("SketchConstraintDistance_14")
 SketchConstraintDistance_13 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_37.result(), 82)
 SketchConstraintDistance_13.setName("SketchConstraintDistance_15")
-SketchArc_5 = Sketch_5.addArc(59, 70.99999999999999, 65, 70.99999917134223, 58.99998109391454, 77.00000000000001, False)
+SketchArc_5 = Sketch_5.addArc(59, 70.99999999999999, 65, 70.99999917134223, 58.99998109391454, 77, False)
 SketchArc_5.setName("SketchArc_6")
 SketchArc_5.result().setName("SketchArc_6")
 SketchArc_5.results()[1].setName("SketchArc_6_2")
@@ -285,7 +285,7 @@ SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_34.startPoint
 SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_62")
 SketchConstraintRadius_5 = Sketch_5.setRadius(SketchArc_5.results()[1], 6)
 SketchConstraintRadius_5.setName("SketchConstraintRadius_6")
-SketchArc_6 = Sketch_5.addArc(27.41619848709567, 84.99999999999999, 27.41618692363446, 77.00000000000001, 20, 82, True)
+SketchArc_6 = Sketch_5.addArc(27.41619848709567, 84.99999999999999, 27.41618692363446, 77, 20, 82, True)
 SketchArc_6.setName("SketchArc_7")
 SketchArc_6.result().setName("SketchArc_7")
 SketchArc_6.results()[1].setName("SketchArc_7_2")
@@ -304,7 +304,7 @@ SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_66")
 SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_37.startPoint(), SketchLine_30.result(), "DBody")
 SketchConstraintDistance_15.setName("SketchConstraintDistance_16")
 model.do()
-RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30r-SketchLine_39r-SketchLine_32r-SketchLine_40r-SketchLine_38r-SketchArc_6_2f-SketchArc_7_2r")], model.selection("EDGE", "PartSet/OZ"), 45, 315, [model.selection("SOLID", "RevolutionFuse_2_1")])
+RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_38r-SketchLine_40r-SketchArc_6_2f-SketchLine_39r-SketchArc_7_2r-SketchLine_32r-SketchLine_30r_wire")], model.selection("EDGE", "PartSet/OZ"), 45, 315, [model.selection("SOLID", "RevolutionFuse_2_1")])
 Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
 SketchLine_38 = Sketch_6.addLine(19.99999999999999, 60, -20, 60)
 SketchLine_38.setName("SketchLine_48")
@@ -318,11 +318,11 @@ SketchLine_40.result().setName("SketchLine_51")
 SketchLine_41 = Sketch_6.addLine(20, 30, 19.99999999999999, 60)
 SketchLine_41.setName("SketchLine_50")
 SketchLine_41.result().setName("SketchLine_50")
-SketchLine_43 = Sketch_6.addLine(-19.99999999999998, 30.00000000000001, 20, 30.00000000000001)
+SketchLine_43 = Sketch_6.addLine(-20, 30, 20, 30)
 SketchLine_43.setName("SketchLine_41")
 SketchLine_43.result().setName("SketchLine_41")
 SketchLine_43.setAuxiliary(True)
-SketchLine_42 = Sketch_6.addLine(-19.99999999999999, 60, -19.99999999999998, 30.00000000000001)
+SketchLine_42 = Sketch_6.addLine(-20, 60, -20, 30)
 SketchLine_42.setName("SketchLine_44")
 SketchLine_42.result().setName("SketchLine_44")
 SketchLine_42.setAuxiliary(True)
@@ -394,7 +394,7 @@ SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchLine_40.endPoint()
 SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_93")
 SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchLine_39.startPoint(), SketchLine_49.result())
 SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_94")
-SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_30s-SketchLine_31s-SketchLine_38e"))
+SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex"))
 SketchConstraintDistance_16 = Sketch_6.setDistance(SketchLine_40.result(), SketchPoint_3.coordinates(), 20)
 SketchConstraintDistance_16.setName("SketchConstraintDistance_18")
 SketchConstraintDistance_17 = Sketch_6.setDistance(SketchPoint_3.coordinates(), SketchLine_41.result(), 20)
@@ -417,7 +417,7 @@ Sketch_7 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchLine_50 = Sketch_7.addLine(65, 23.09999999999939, 65, 23.00000523211526)
 SketchLine_50.setName("SketchLine_61")
 SketchLine_50.result().setName("SketchLine_61")
-SketchLine_51 = Sketch_7.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_35"))
+SketchLine_51 = Sketch_7.addLine(model.selection("EDGE", "Sketch_5/SketchLine_35"))
 SketchLine_51.setName("SketchLine_54")
 SketchLine_51.result().setName("SketchLine_54")
 SketchLine_52 = Sketch_7.addLine(65, 23.09999999999939, 65, 20)
@@ -435,7 +435,7 @@ SketchLine_54.result().setName("SketchLine_55")
 SketchLine_54.setAuxiliary(True)
 SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint())
 SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_96")
-SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "RevolutionFuse_3_1/Modfied_6&RevolutionFuse_3_1/Modfied_5"))
+SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "[RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_13][RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_7]"))
 SketchLine_55.setName("SketchLine_56")
 SketchLine_55.result().setName("SketchLine_56")
 SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_55.result())
@@ -498,12 +498,12 @@ model.do()
 RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "PartSet/OZ"), 14.4, 14.4, [model.selection("SOLID", "ExtrusionCut_1_1")])
 Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchCircle_1 = Sketch_8.addCircle(0, 45, 12.5)
-SketchLine_60 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_30"))
+SketchLine_60 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/SketchLine_30"))
 SketchLine_60.setName("SketchLine_63")
 SketchLine_60.result().setName("SketchLine_63")
 SketchConstraintCoincidence_99 = Sketch_8.setCoincident(SketchCircle_1.center(), SketchLine_60.result())
 SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_109")
-SketchLine_61 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_38"))
+SketchLine_61 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/SketchLine_38"))
 SketchLine_61.setName("SketchLine_64")
 SketchLine_61.result().setName("SketchLine_64")
 SketchConstraintDistance_22 = Sketch_8.setDistance(SketchCircle_1.center(), SketchLine_61.result(), 45)
@@ -511,7 +511,7 @@ SketchConstraintDistance_22.setName("SketchConstraintDistance_24")
 SketchConstraintRadius_8 = Sketch_8.setRadius(SketchCircle_1.results()[1], 12.5)
 SketchConstraintRadius_8.setName("SketchConstraintRadius_13")
 model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_1_2f")], model.selection(), 100, 100, [model.selection("SOLID", "RevolutionFuse_4_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_1_2r")], model.selection(), 100, 100, [model.selection("SOLID", "RevolutionFuse_4_1")])
 Sketch_9 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchLine_62 = Sketch_9.addLine(0, 84, 0, -2)
 SketchLine_62.setName("SketchLine_65")
@@ -596,7 +596,7 @@ SketchConstraintDistance_26 = Sketch_9.setDistance(SketchLine_71.endPoint(), Ske
 SketchConstraintDistance_26.setName("SketchConstraintDistance_28")
 SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_72.endPoint(), SketchLine_63.result(), 15)
 SketchConstraintDistance_27.setName("SketchConstraintDistance_29")
-SketchLine_76 = Sketch_9.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_32"))
+SketchLine_76 = Sketch_9.addLine(model.selection("EDGE", "Sketch_5/SketchLine_32"))
 SketchLine_76.setName("SketchLine_75")
 SketchLine_76.result().setName("SketchLine_75")
 SketchConstraintDistance_28 = Sketch_9.setDistance(SketchLine_62.startPoint(), SketchLine_76.result(), 2)
@@ -652,22 +652,22 @@ Sketch_10 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_77 = Sketch_10.addLine(64, 20, 89, 20)
 SketchLine_77.setName("SketchLine_76")
 SketchLine_77.result().setName("SketchLine_76")
-SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_9&RevolutionFuse_2_1/Modfied_6&RevolutionFuse_3_1/Modfied_divided_22_1&RevolutionFuse_2_1/Modfied_11"))
+SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_1&weak_name_2][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchLine_22&weak_name_2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27]"))
 SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchLine_77.startPoint(), SketchPoint_4.result())
 SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_120")
-SketchPoint_5 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_8e-SketchLine_4e"))
+SketchPoint_5 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
 SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_121")
 SketchLine_78 = Sketch_10.addLine(64, -20, 89, -20)
 SketchLine_78.setName("SketchLine_77")
 SketchLine_78.result().setName("SketchLine_77")
-SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_10&RevolutionFuse_1_1/Modfied_5&RevolutionFuse_3_1/Modfied_divided_21_1&RevolutionFuse_1_1/Modfied_10"))
+SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_9&weak_name_2][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchLine_15&weak_name_2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20]"))
 SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchLine_78.startPoint(), SketchPoint_6.result())
 SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_122")
-SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_7&ExtrusionFuse_2_1/Modfied_6&RevolutionFuse_3_1/Modfied_10&RevolutionFuse_1_1/Modfied_5"))
+SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "[ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_1&weak_name_2][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_9&weak_name_2][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14]"))
 SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_78.endPoint(), SketchPoint_7.result())
 SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_123")
-SketchArc_10 = Sketch_10.addArc(89.00000104846708, 1.669244441022778e-015, 89, -20, 89, 20, False)
+SketchArc_10 = Sketch_10.addArc(89, 0, 89, -20, 89, 20, False)
 SketchArc_10.setName("SketchArc_13")
 SketchArc_10.result().setName("SketchArc_13")
 SketchArc_10.results()[1].setName("SketchArc_13_2")
@@ -687,7 +687,7 @@ SketchConstraintCoincidence_129 = Sketch_10.setCoincident(SketchArc_11.startPoin
 SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_127")
 SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_11.results()[1], SketchLine_78.result())
 SketchConstraintTangent_19.setName("SketchConstraintTangent_24")
-SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_divided_21_1&RevolutionFuse_1_1/Modfied_10&RevolutionFuse_3_1/Modfied_8"))
+SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchLine_15&weak_name_2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20][RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face]"))
 SketchConstraintCoincidence_130 = Sketch_10.setCoincident(SketchArc_11.endPoint(), SketchPoint_8.result())
 SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_128")
 SketchArc_12 = Sketch_10.addArc(64.00001789135865, 23.01137360115889, 64, 20, 61.15622559702543, 22.02080994708722, True)
@@ -698,7 +698,7 @@ SketchConstraintCoincidence_131 = Sketch_10.setCoincident(SketchArc_12.startPoin
 SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_129")
 SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_12.results()[1], SketchLine_77.result())
 SketchConstraintTangent_20.setName("SketchConstraintTangent_25")
-SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_divided_22_1&RevolutionFuse_2_1/Modfied_11&RevolutionFuse_3_1/Modfied_7"))
+SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchLine_22&weak_name_2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27][RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face]"))
 SketchConstraintCoincidence_132 = Sketch_10.setCoincident(SketchArc_12.endPoint(), SketchPoint_9.result())
 SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_130")
 SketchLine_79 = Sketch_10.addLine(61.15622559702543, 22.02080994708722, 59.81204392543111, 22.0208099470871)
@@ -725,7 +725,7 @@ SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_136")
 SketchConstraintParallel_3 = Sketch_10.setParallel(SketchLine_78.result(), SketchLine_81.result())
 SketchConstraintParallel_4 = Sketch_10.setParallel(SketchLine_77.result(), SketchLine_79.result())
 SketchConstraintPerpendicular_1 = Sketch_10.setPerpendicular(SketchLine_80.result(), SketchLine_77.result())
-SketchPoint_10 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchPoint_3"))
+SketchPoint_10 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/SketchPoint_3"))
 SketchMultiRotation_1_objects = [SketchArc_10.results()[1], SketchLine_77.result(), SketchLine_78.result(), SketchArc_12.results()[1], SketchLine_79.result(), SketchLine_80.result(), SketchLine_81.result(), SketchArc_11.results()[1]]
 SketchMultiRotation_1 = Sketch_10.addRotation(SketchMultiRotation_1_objects, SketchPoint_10.coordinates(), 120, 3)
 [SketchArc_13, SketchArc_14, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchArc_15, SketchArc_16, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchArc_17, SketchArc_18] = SketchMultiRotation_1.rotated()
@@ -768,10 +768,10 @@ SketchArc_13.setName("SketchArc_16")
 SketchArc_13.result().setName("SketchArc_16")
 SketchArc_13.results()[1].setName("SketchArc_16_2")
 model.do()
-ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchArc_16_2f-SketchLine_81r-SketchLine_82f-SketchArc_17_2r-SketchLine_83f-SketchLine_84f-SketchLine_85r-SketchArc_18_2r"), model.selection("FACE", "Sketch_10/Face-SketchArc_19_2f-SketchLine_86r-SketchLine_87f-SketchArc_20_2r-SketchLine_88f-SketchLine_89f-SketchLine_90r-SketchArc_21_2r")], model.selection(), 20, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchArc_16_2f-SketchLine_81r-SketchArc_17_2r-SketchLine_83f-SketchLine_84f-SketchLine_85r-SketchArc_18_2r-SketchLine_82f"), model.selection("FACE", "Sketch_10/Face-SketchArc_19_2f-SketchLine_86r-SketchArc_20_2r-SketchLine_88f-SketchLine_89f-SketchLine_90r-SketchArc_21_2r-SketchLine_87f")], model.selection(), 20, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
 Sketch_11 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchCircle_2 = Sketch_11.addCircle(89, 0, 6)
-SketchPoint_11 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_1-SketchLine_10s-SketchLine_9e"))
+SketchPoint_11 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_2/SketchLine_90_EndVertex"))
 SketchConstraintCoincidence_139 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchPoint_11.result())
 SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_137")
 SketchConstraintRadius_11 = Sketch_11.setRadius(SketchCircle_2.results()[1], 6)
@@ -788,8 +788,10 @@ SketchMultiRotation_2 = Sketch_11.addRotation([SketchCircle_3.results()[1], Sket
 [SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_2.rotated()
 model.do()
 RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "PartSet/OZ"), 0, 360, [model.selection("SOLID", "ExtrusionFuse_3_1")])
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_4_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_3_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_5_2f")], model.selection(), 30, -15, [model.selection("SOLID", "RevolutionCut_1_1")])
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_2_2f"), model.selection("FACE", "Sketch_11/Face-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_7_2f")], model.selection(), 30, 2, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_3_objects_1 = [model.selection("WIRE", "Sketch_11/Face-SketchCircle_4_2f-SketchCircle_6_2r_wire"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_3_2f-SketchCircle_2_2r_wire"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_5_2f-SketchCircle_7_2r_wire")]
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_3_objects_1, model.selection(), 30, -15, [model.selection("SOLID", "RevolutionCut_1_1")])
+ExtrusionCut_4_objects_1 = [model.selection("WIRE", "Sketch_11/Face-SketchCircle_2_2r_wire"), model.selection("FACE", "Sketch_11/Face-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_7_2f_wire")]
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_4_objects_1, model.selection(), 30, 2, [model.selection("SOLID", "ExtrusionCut_3_1")])
 
 # Test reexecution after parameter change
 Parameter_R.setValue(5)
index f69307ae2dc8c60964a7d60e3823d10a103914b7..aa54079666dfdcb0d1c0b058ebab77f867682bde 100644 (file)
@@ -133,20 +133,20 @@ SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_9")
 SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_2.result(), 32, False)
 SketchConstraintDistance_7.setName("SketchConstraintDistance_9")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r")], model.selection(), 12, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r_wire")], model.selection(), 12, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
 SketchArc_3 = Sketch_2.addArc(54, 6, 54, 12, 54, 0, True)
-SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/To_Face_1"))
+SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
 SketchLine_13.setName("SketchLine_15")
 SketchLine_13.result().setName("SketchLine_15")
 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_13.result())
 SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23")
-SketchLine_14 = Sketch_2.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_14 = Sketch_2.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_14.setName("SketchLine_16")
 SketchLine_14.result().setName("SketchLine_16")
 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_14.result())
 SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24")
-SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/Generated_Face_12"))
+SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"))
 SketchLine_15.setName("SketchLine_17")
 SketchLine_15.result().setName("SketchLine_17")
 SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_15.result())
@@ -180,13 +180,13 @@ SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_20.endPoint())
 SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30")
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_3_2r-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_9"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_22r-SketchLine_21r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_3_2r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"))
 SketchLine_21 = Sketch_3.addLine(28, -6, -4.270492394552598, -6)
 SketchLine_21.setName("SketchLine_23")
 SketchLine_21.result().setName("SketchLine_23")
 SketchLine_21.setAuxiliary(True)
-SketchLine_22 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_9"))
+SketchLine_22 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]"))
 SketchLine_22.setName("SketchLine_24")
 SketchLine_22.result().setName("SketchLine_24")
 SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_22.result())
@@ -304,26 +304,26 @@ SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_55")
 SketchConstraintMiddle_2 = Sketch_3.setMiddlePoint(SketchLine_34.result(), SketchPoint_4.coordinates())
 SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_21.result())
 SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_56")
-SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]"))
 SketchLine_35.setName("SketchLine_37")
 SketchLine_35.result().setName("SketchLine_37")
 SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_35.result())
 SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_57")
 SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_24.result(), 31)
 SketchConstraintLength_10.setName("SketchConstraintLength_11")
-SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_5"))
+SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]"))
 SketchLine_36.setName("SketchLine_38")
 SketchLine_36.result().setName("SketchLine_38")
 SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_36.result())
 SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_58")
 SketchConstraintEqual_2 = Sketch_3.setEqual(SketchLine_30.result(), SketchLine_25.result())
 model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchLine_37 = Sketch_4.addLine(0.4324637622511017, 3.581086955422081, 1.55585595716119, 2.812450190483599)
 SketchLine_37.setName("SketchLine_39")
 SketchLine_37.result().setName("SketchLine_39")
-SketchLine_38 = Sketch_4.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_38 = Sketch_4.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]"))
 SketchLine_38.setName("SketchLine_40")
 SketchLine_38.result().setName("SketchLine_40")
 SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_37.startPoint(), SketchLine_38.result())
@@ -369,8 +369,8 @@ SketchLine_42.result().setName("SketchLine_44")
 SketchLine_41.setName("SketchLine_43")
 SketchLine_41.result().setName("SketchLine_43")
 model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_1"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_7"), model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_2_1/Modfied_5&ExtrusionCut_3_1/Modfied_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), model.selection("VERTEX", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face]"))
 Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchArc_4 = Sketch_5.addArc(25, -7.50002056854448, 22, -7.5, 28, -7.5, True)
 SketchPoint_5 = Sketch_5.addPoint(22, -7.5)
@@ -410,11 +410,11 @@ SketchConstraintVertical_11 = Sketch_5.setVertical(SketchLine_52.result())
 SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_51.result())
 SketchConstraintHorizontal_11.setName("SketchConstraintHorizontal_12")
 model.do()
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), 6, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face"), 6, True)
 Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 3, True)
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchArc_5 = Sketch_6.addArc(46, 0, 45.5, 0, 46.5, 0, False)
 SketchLine_53 = Sketch_6.addLine(0, 0, 54, 0)
 SketchLine_53.setName("SketchLine_55")
@@ -464,8 +464,8 @@ SketchLine_57.result().setName("SketchLine_59")
 SketchLine_56.setName("SketchLine_58")
 SketchLine_56.result().setName("SketchLine_58")
 model.do()
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"))
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_27)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_26)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_28)"))
 SketchLine_64 = Sketch_7.addLine(50.25, -4.5, 31.25, -4.5)
 SketchLine_64.setName("SketchLine_76")
 SketchLine_64.result().setName("SketchLine_76")
@@ -639,7 +639,7 @@ SketchConstraintRadius_7 = Sketch_7.setRadius(SketchArc_17.results()[1], 0.25)
 SketchConstraintRadius_7.setName("SketchConstraintRadius_10")
 model.do()
 ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_10"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_76)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_15_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_80)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_17_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_79)(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)"))
 SketchPoint_12 = Sketch_8.addPoint(54, 0)
 SketchPoint_13 = Sketch_8.addPoint(54, 0)
 SketchConstraintRigid_7 = Sketch_8.setFixed(SketchPoint_13.result())
@@ -788,7 +788,7 @@ SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchPoint_21.coordina
 SketchConstraintCoincidence_142.setName("SketchConstraintCoincidence_145")
 model.do()
 ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_6_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_7_1/Modfied_14"))
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchLine_94 = Sketch_9.addLine(21, 4.163450069699051, 21, 0)
 SketchLine_94.setName("SketchLine_107")
 SketchLine_94.result().setName("SketchLine_107")
@@ -931,7 +931,7 @@ model.do()
 Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 4, False)
 Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 4, True)
 ExtrusionCut_8 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection(), model.selection("FACE", "Plane_5"), 0, model.selection("FACE", "Plane_4"), 0, [model.selection("SOLID", "ExtrusionCut_7_1")])
-Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_8_1/Modfied_5"))
+Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_8_1/Modified_Face&Sketch_1/SketchLine_1"))
 SketchCircle_1 = Sketch_10.addCircle(12, 6, 1)
 SketchConstraintRadius_9 = Sketch_10.setRadius(SketchCircle_1.results()[1], 1)
 SketchPoint_24 = Sketch_10.addPoint(0, 6)
@@ -956,7 +956,7 @@ SketchConstraintCoincidence_174 = Sketch_10.setCoincident(SketchCircle_1.center(
 SketchConstraintCoincidence_174.setName("SketchConstraintCoincidence_178")
 SketchConstraintDistance_17 = Sketch_10.setDistance(SketchLine_105.result(), SketchCircle_1.center(), 12, False)
 model.do()
-ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_10/Wire-SketchCircle_1_2f")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
+ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_10/Face-SketchCircle_1_2r_wire")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
 model.do()
 Part_2 = model.addPart(partSet)
 Part_2_doc = Part_2.document()
@@ -1068,20 +1068,20 @@ SketchConstraintHorizontal_26.setName("SketchConstraintHorizontal_9")
 SketchConstraintDistance_24 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_108.result(), 32, False)
 SketchConstraintDistance_24.setName("SketchConstraintDistance_9")
 model.do()
-Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r")], model.selection(), 12, 0)
+Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r_wire")], model.selection(), 12, 0)
 Sketch_12 = model.addSketch(Part_2_doc, model.standardPlane("XOZ"))
 SketchArc_26 = Sketch_12.addArc(54, 6, 54, 12, 54, 0, True)
-SketchLine_119 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/To_Face_1"))
+SketchLine_119 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
 SketchLine_119.setName("SketchLine_15")
 SketchLine_119.result().setName("SketchLine_15")
 SketchConstraintCoincidence_193 = Sketch_12.setCoincident(SketchArc_26.startPoint(), SketchLine_119.result())
 SketchConstraintCoincidence_193.setName("SketchConstraintCoincidence_23")
-SketchLine_120 = Sketch_12.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_120 = Sketch_12.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
 SketchLine_120.setName("SketchLine_16")
 SketchLine_120.result().setName("SketchLine_16")
 SketchConstraintCoincidence_194 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_120.result())
 SketchConstraintCoincidence_194.setName("SketchConstraintCoincidence_24")
-SketchLine_121 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/Generated_Face_12"))
+SketchLine_121 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"))
 SketchLine_121.setName("SketchLine_17")
 SketchLine_121.result().setName("SketchLine_17")
 SketchConstraintTangent_16 = Sketch_12.setTangent(SketchArc_26.results()[1], SketchLine_121.result())
@@ -1115,13 +1115,13 @@ SketchConstraintCoincidence_199.setName("SketchConstraintCoincidence_29")
 SketchConstraintCoincidence_200 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_126.endPoint())
 SketchConstraintCoincidence_200.setName("SketchConstraintCoincidence_30")
 model.do()
-ExtrusionCut_10 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_3_2r-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_13 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_9"))
+ExtrusionCut_10 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_22r-SketchLine_21r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_3_2r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_13 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"))
 SketchLine_127 = Sketch_13.addLine(28, -6, -4.270492394552598, -6)
 SketchLine_127.setName("SketchLine_23")
 SketchLine_127.result().setName("SketchLine_23")
 SketchLine_127.setAuxiliary(True)
-SketchLine_128 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_9"))
+SketchLine_128 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]"))
 SketchLine_128.setName("SketchLine_24")
 SketchLine_128.result().setName("SketchLine_24")
 SketchConstraintCoincidence_201 = Sketch_13.setCoincident(SketchLine_127.startPoint(), SketchLine_128.result())
@@ -1239,26 +1239,26 @@ SketchConstraintCoincidence_225.setName("SketchConstraintCoincidence_55")
 SketchConstraintMiddle_10 = Sketch_13.setMiddlePoint(SketchLine_140.result(), SketchPoint_28.coordinates())
 SketchConstraintCoincidence_226 = Sketch_13.setCoincident(SketchPoint_28.coordinates(), SketchLine_127.result())
 SketchConstraintCoincidence_226.setName("SketchConstraintCoincidence_56")
-SketchLine_141 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_141 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]"))
 SketchLine_141.setName("SketchLine_37")
 SketchLine_141.result().setName("SketchLine_37")
 SketchConstraintCoincidence_227 = Sketch_13.setCoincident(SketchLine_131.startPoint(), SketchLine_141.result())
 SketchConstraintCoincidence_227.setName("SketchConstraintCoincidence_57")
 SketchConstraintLength_27 = Sketch_13.setLength(SketchLine_130.result(), 31)
 SketchConstraintLength_27.setName("SketchConstraintLength_11")
-SketchLine_142 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_5"))
+SketchLine_142 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]"))
 SketchLine_142.setName("SketchLine_38")
 SketchLine_142.result().setName("SketchLine_38")
 SketchConstraintCoincidence_228 = Sketch_13.setCoincident(SketchLine_136.startPoint(), SketchLine_142.result())
 SketchConstraintCoincidence_228.setName("SketchConstraintCoincidence_58")
 SketchConstraintEqual_5 = Sketch_13.setEqual(SketchLine_136.result(), SketchLine_131.result())
 model.do()
-ExtrusionCut_11 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_14 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+ExtrusionCut_11 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_14 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchLine_143 = Sketch_14.addLine(0.4324637622511017, 3.581086955422081, 1.55585595716119, 2.812450190483599)
 SketchLine_143.setName("SketchLine_39")
 SketchLine_143.result().setName("SketchLine_39")
-SketchLine_144 = Sketch_14.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_144 = Sketch_14.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]"))
 SketchLine_144.setName("SketchLine_40")
 SketchLine_144.result().setName("SketchLine_40")
 SketchConstraintCoincidence_229 = Sketch_14.setCoincident(SketchLine_143.startPoint(), SketchLine_144.result())
@@ -1304,8 +1304,8 @@ SketchLine_148.result().setName("SketchLine_44")
 SketchLine_147.setName("SketchLine_43")
 SketchLine_147.result().setName("SketchLine_43")
 model.do()
-ExtrusionCut_12 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Plane_9 = model.addPlane(Part_2_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_1"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_7"), model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_2_1/Modfied_5&ExtrusionCut_3_1/Modfied_3"))
+ExtrusionCut_12 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Plane_9 = model.addPlane(Part_2_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), model.selection("VERTEX", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face]"))
 Sketch_15 = model.addSketch(Part_2_doc, model.selection("FACE", "Plane_1"))
 SketchArc_27 = Sketch_15.addArc(25, -7.50002056854448, 22, -7.5, 28, -7.5, True)
 SketchPoint_29 = Sketch_15.addPoint(22, -7.5)
@@ -1345,11 +1345,11 @@ SketchConstraintVertical_30 = Sketch_15.setVertical(SketchLine_158.result())
 SketchConstraintHorizontal_33 = Sketch_15.setHorizontal(SketchLine_157.result())
 SketchConstraintHorizontal_33.setName("SketchConstraintHorizontal_12")
 model.do()
-Plane_10 = model.addPlane(Part_2_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), 6, True)
+Plane_10 = model.addPlane(Part_2_doc, model.selection("FACE", "ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face"), 6, True)
 Plane_11 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 3, True)
-ExtrusionCut_13 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-ExtrusionCut_14 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_16 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_13 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_14 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_16 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchArc_28 = Sketch_16.addArc(46, 0, 45.5, 0, 46.5, 0, False)
 SketchLine_159 = Sketch_16.addLine(0, 0, 54, 0)
 SketchLine_159.setName("SketchLine_55")
@@ -1399,8 +1399,8 @@ SketchLine_163.result().setName("SketchLine_59")
 SketchLine_162.setName("SketchLine_58")
 SketchLine_162.result().setName("SketchLine_58")
 model.do()
-ExtrusionFuse_2 = model.addExtrusionFuse(Part_2_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_17 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"))
+ExtrusionFuse_2 = model.addExtrusionFuse(Part_2_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+Sketch_17 = model.addSketch(Part_2_doc, model.selection("FACE", "(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_27)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_26)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_28)"))
 SketchLine_170 = Sketch_17.addLine(50.25, -4.5, 31.25, -4.5)
 SketchLine_170.setName("SketchLine_76")
 SketchLine_170.result().setName("SketchLine_76")
@@ -1574,7 +1574,7 @@ SketchConstraintRadius_16 = Sketch_17.setRadius(SketchArc_40.results()[1], 0.25)
 SketchConstraintRadius_16.setName("SketchConstraintRadius_10")
 model.do()
 ExtrusionCut_15 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_18 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_10"))
+Sketch_18 = model.addSketch(Part_2_doc, model.selection("FACE", "(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_76)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_15_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_80)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_17_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_79)(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)"))
 SketchPoint_36 = Sketch_18.addPoint(54, 0)
 SketchPoint_37 = Sketch_18.addPoint(54, 0)
 SketchConstraintRigid_20 = Sketch_18.setFixed(SketchPoint_37.result())
@@ -1723,7 +1723,7 @@ SketchConstraintCoincidence_316 = Sketch_18.setCoincident(SketchPoint_45.coordin
 SketchConstraintCoincidence_316.setName("SketchConstraintCoincidence_145")
 model.do()
 ExtrusionCut_16 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_6_1")])
-Sketch_19 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_7_1/Modfied_14"))
+Sketch_19 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/To_Face"))
 SketchLine_200 = Sketch_19.addLine(21, 4.163450069699051, 21, 0)
 SketchLine_200.setName("SketchLine_107")
 SketchLine_200.result().setName("SketchLine_107")
@@ -1866,7 +1866,7 @@ model.do()
 Plane_12 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 4, False)
 Plane_13 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 4, True)
 ExtrusionCut_17 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection(), model.selection("FACE", "Plane_5"), 0, model.selection("FACE", "Plane_4"), 0, [model.selection("SOLID", "ExtrusionCut_7_1")])
-Sketch_20 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_8_1/Modfied_5"))
+Sketch_20 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_8_1/Modified_Face&Sketch_1/SketchLine_1"))
 SketchCircle_2 = Sketch_20.addCircle(12, 6, 1)
 SketchConstraintRadius_18 = Sketch_20.setRadius(SketchCircle_2.results()[1], 1)
 SketchPoint_48 = Sketch_20.addPoint(0, 6)
@@ -1891,11 +1891,11 @@ SketchConstraintCoincidence_348 = Sketch_20.setCoincident(SketchCircle_2.center(
 SketchConstraintCoincidence_348.setName("SketchConstraintCoincidence_178")
 SketchConstraintDistance_34 = Sketch_20.setDistance(SketchLine_211.result(), SketchCircle_2.center(), 12, False)
 model.do()
-ExtrusionCut_18 = model.addExtrusionCut(Part_2_doc, [model.selection("WIRE", "Sketch_10/Wire-SketchCircle_1_2f")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
+ExtrusionCut_18 = model.addExtrusionCut(Part_2_doc, [model.selection("WIRE", "Sketch_10/Face-SketchCircle_1_2r_wire")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
 model.do()
-Rotation_1 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "Part_1/ExtrusionCut_9_1/Modfied_1&ExtrusionCut_7_1/Modfied_19"), 180)
-Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Rotation_1/")], model.selection("FACE", "Rotation_1/ExtrusionCut_5_1/Modfied_5"), model.selection("FACE", "Part_1/ExtrusionCut_5_1/Modfied_5"), False, True)
-Rotation_2 = model.addRotation(partSet, [model.selection("COMPOUND", "Placement_1/")], model.selection("EDGE", "Part_1/ExtrusionCut_5_1/Modfied_5&ExtrusionCut_8_1/Modfied_3"), 7)
+Rotation_1 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "Part_1/[ExtrusionCut_9_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/From_Face]"), 180)
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Rotation_1/")], model.selection("FACE", "Rotation_1/ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Part_1/ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9"), False, True)
+Rotation_2 = model.addRotation(partSet, [model.selection("COMPOUND", "Placement_1/")], model.selection("EDGE", "Part_1/[ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_8_1/Modified_Face&Sketch_3/SketchLine_35]"), 7)
 Rotation_2.result().setColor(255, 85, 0)
 model.end()
 
index 1a0dc5ac09075c39b010914b4e2f810bf8045d8b..597228c542b737a26b39d66656cdd9ec63822824 100644 (file)
@@ -115,12 +115,12 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 2)
 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 2.3)
 SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_9.startPoint())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_4f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), "307/2.", "307/2.")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_10f-SketchArc_1_2r-SketchLine_11f-SketchLine_4f-SketchLine_13f-SketchArc_2_2f-SketchLine_12f-SketchLine_8f-SketchLine_9f_wire")], model.selection(), "307/2.", "307/2.")
 Extrusion_1.setName("Profil")
 Extrusion_1.result().setName("Extrusion_1_1")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12"))
 SketchLine_14 = Sketch_2.addLine(149.5, -2.3, 153.5, -2.3)
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/To_Face]"))
 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_1.result())
 SketchLine_15 = Sketch_2.addLine(153.5, -2.3, 153.5, 7.7)
 SketchLine_16 = Sketch_2.addLine(153.5, 7.7, 149.5, 7.7)
@@ -150,25 +150,25 @@ SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_21.result(), 10)
 SketchConstraintLength_5.setName("SketchConstraintLength_6")
 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_16.endPoint(), SketchLine_21.result(), 299)
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_16.result(), SketchLine_20.result())
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/From_Face]"))
 SketchPoint_2.setName("SketchPoint_4")
 SketchPoint_2.result().setName("SketchPoint_4")
 SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_19.startPoint(), SketchPoint_2.coordinates())
 SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_39")
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
 ExtrusionCut_1.setName("Decoupe_Angle")
 ExtrusionCut_1.result().setName("ExtrusionCut_1_1")
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
 SketchLine_22 = Sketch_3.addLine(153.5, -10.3, 153.5, -8.3)
 SketchLine_22.setName("SketchLine_29")
 SketchLine_22.result().setName("SketchLine_29")
-SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
 SketchPoint_3.setName("SketchPoint_5")
 SketchPoint_3.result().setName("SketchPoint_5")
 SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchPoint_3.result())
 SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_40")
-SketchLine_23 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_23 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
 SketchLine_23.setName("SketchLine_30")
 SketchLine_23.result().setName("SketchLine_30")
 SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.result())
@@ -193,7 +193,7 @@ SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_25.result(), 2)
 SketchConstraintLength_6.setName("SketchConstraintLength_8")
 SketchConstraintAngle_1 = Sketch_3.setAngleBackward(SketchLine_24.result(), SketchLine_25.result(), 45)
 SketchConstraintAngle_1.setName("SketchConstraintAngle_2")
-SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"))
+SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_8"))
 SketchLine_26.setName("SketchLine_34")
 SketchLine_26.result().setName("SketchLine_34")
 SketchConstraintMirror_1_objects = [SketchLine_22.result(), SketchLine_25.result(), SketchLine_24.result()]
@@ -207,16 +207,16 @@ Sketch_3.result().setName("Sketch_4")
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")])
 ExtrusionCut_2.setName("Chamfrein_1")
 ExtrusionCut_2.result().setName("ExtrusionCut_2_1")
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13"))
 SketchLine_30 = Sketch_4.addLine(-149.5, 10.3, -149.5, 8.3)
 SketchLine_30.setName("SketchLine_35")
 SketchLine_30.result().setName("SketchLine_35")
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_11&ExtrusionCut_1_1/Modfied_5&ExtrusionCut_1_1/Modfied_6"))
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"))
 SketchPoint_4.setName("SketchPoint_6")
 SketchPoint_4.result().setName("SketchPoint_6")
 SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchPoint_4.result())
 SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43")
-SketchLine_31 = Sketch_4.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_11&ExtrusionCut_1_1/Modfied_5"))
+SketchLine_31 = Sketch_4.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13]"))
 SketchLine_31.setName("SketchLine_36")
 SketchLine_31.result().setName("SketchLine_36")
 SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.result())
@@ -260,7 +260,7 @@ SketchLine_38.setName("SketchLine_43")
 SketchLine_38.result().setName("SketchLine_43")
 SketchLine_38.setAuxiliary(True)
 SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_38.result())
-SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_2"))
+SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), False)
 SketchLine_39 = SketchProjection_1.createdFeature()
 SketchLine_39.setName("SketchLine_44")
 SketchLine_39.result().setName("SketchLine_44")
@@ -291,15 +291,15 @@ SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_59")
 model.do()
 Sketch_4.setName("Sketch_5")
 Sketch_4.result().setName("Sketch_5")
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_5")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_5")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_11"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12"))
 SketchLine_40 = Sketch_5.addLine(152.2999838762584, -21.04999053274691, 153.5, -21.04999053274714)
 SketchLine_40.setName("SketchLine_58")
 SketchLine_40.result().setName("SketchLine_58")
 SketchLine_41 = Sketch_5.addLine(152.2999838292651, -45.04999053274704, 153.5, -45.04999053274702)
 SketchLine_41.setName("SketchLine_57")
 SketchLine_41.result().setName("SketchLine_57")
-SketchLine_42 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_42 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12]"))
 SketchLine_42.setName("SketchLine_46")
 SketchLine_42.result().setName("SketchLine_46")
 SketchLine_43 = Sketch_5.addLine(150.8, -45.04999053274702, 153.5, -45.04999053274702)
@@ -385,7 +385,7 @@ SketchLine_55.result().setName("SketchLine_54")
 SketchLine_55.setAuxiliary(True)
 SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_55.startPoint())
 SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_71")
-SketchLine_56 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_1_1/Modfied_9"))
+SketchLine_56 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_10]"))
 SketchLine_56.setName("SketchLine_55")
 SketchLine_56.result().setName("SketchLine_55")
 SketchConstraintCoincidence_67 = Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_56.result())
@@ -509,8 +509,9 @@ SketchLine_68.result().setName("SketchLine_73")
 model.do()
 Sketch_5.setName("Sketch_6")
 Sketch_5.result().setName("Sketch_6")
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchArc_9_2f-SketchArc_10_2f-SketchLine_73r-SketchLine_74r-SketchLine_75r-SketchLine_76r"), model.selection("WIRE", "Sketch_6/Wire-SketchLine_58f-SketchLine_61f-SketchLine_60f-SketchLine_51f-SketchArc_4_2f-SketchArc_5_2f"), model.selection("WIRE", "Sketch_6/Wire-SketchLine_57f-SketchLine_47f-SketchLine_62f-SketchLine_63f-SketchArc_3_2f-SketchArc_6_2f")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_3_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_1"))
+ExtrusionCut_4_objects_1 = [model.selection("WIRE", "Sketch_6/Face-SketchArc_9_2f-SketchLine_74r-SketchArc_10_2f-SketchLine_75r-SketchLine_73r-SketchLine_76r_wire"), model.selection("WIRE", "Sketch_6/Face-SketchLine_58r-SketchLine_51f-SketchLine_60f-SketchArc_5_2f-SketchLine_61f-SketchArc_4_2f_wire"), model.selection("WIRE", "Sketch_6/Face-SketchLine_57f-SketchLine_47f-SketchLine_62f-SketchArc_6_2f-SketchLine_63f-SketchArc_3_2f_wire")]
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_4_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_3_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_12"))
 SketchArc_11 = Sketch_6.addArc(44.89, -23.55, 43.89, -23.55, 44.89, -22.55, False)
 SketchArc_12 = Sketch_6.addArc(44.89, -13.55, 44.89, -14.55, 43.89, -13.55, False)
 SketchArc_13 = Sketch_6.addArc(5.89, -13.55, 6.89, -13.55, 5.89, -14.55, False)
@@ -567,7 +568,7 @@ SketchLine_80 = Sketch_6.addLine(model.selection("EDGE", "PartSet/OY"))
 SketchLine_80.setName("SketchLine_85")
 SketchLine_80.result().setName("SketchLine_85")
 SketchConstraintDistance_12 = Sketch_6.setDistance(SketchLine_79.startPoint(), SketchLine_80.result(), 5.89)
-SketchLine_81 = Sketch_6.addLine(model.selection("EDGE", "Sketch_6/Edge-SketchLine_54"))
+SketchLine_81 = Sketch_6.addLine(model.selection("EDGE", "Sketch_6/SketchLine_54"))
 SketchLine_81.setName("SketchLine_86")
 SketchLine_81.result().setName("SketchLine_86")
 SketchConstraintDistance_13 = Sketch_6.setDistance(SketchLine_76.endPoint(), SketchLine_81.result(), 5.3)
@@ -845,15 +846,16 @@ SketchArc_35.results()[1].setName("SketchArc_36_2")
 model.do()
 Sketch_6.setName("Sketch_7")
 Sketch_6.result().setName("Sketch_7")
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchArc_20_2f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_23_2f-SketchLine_91r-SketchLine_92f-SketchLine_93r-SketchLine_94f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_52_2f-SketchArc_53_2f-SketchArc_56_2f-SketchArc_57_2f-SketchLine_114r-SketchLine_115f-SketchLine_116r-SketchLine_121f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_44_2f-SketchArc_45_2f-SketchArc_48_2f-SketchArc_49_2f-SketchLine_107f-SketchLine_113f-SketchLine_117r-SketchLine_123r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_16_2f-SketchArc_17_2f-SketchArc_18_2f-SketchArc_19_2f-SketchLine_87f-SketchLine_88f-SketchLine_89r-SketchLine_90r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_11_2f-SketchArc_12_2f-SketchArc_14_2f-SketchLine_81f-SketchLine_82r-SketchLine_83f-SketchLine_84r-SketchArc_15_2f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_36_2f-SketchArc_38_2f-SketchArc_40_2f-SketchArc_41_2f-SketchLine_108r-SketchLine_119r-SketchLine_127f-SketchLine_129f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_37_2f-SketchArc_39_2f-SketchArc_42_2f-SketchArc_43_2f-SketchLine_118r-SketchLine_120f-SketchLine_122r-SketchLine_130f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_27_2f-SketchLine_98f-SketchLine_100r-SketchLine_101f-SketchLine_103r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_30_2f-SketchArc_31_2f-SketchArc_34_2f-SketchArc_35_2f-SketchLine_95f-SketchLine_96r-SketchLine_97f-SketchLine_105r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_46_2f-SketchArc_47_2f-SketchArc_50_2f-SketchArc_51_2f-SketchLine_124f-SketchLine_125r-SketchLine_126f-SketchLine_128r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_54_2f-SketchArc_55_2f-SketchArc_58_2f-SketchArc_59_2f-SketchLine_109f-SketchLine_110r-SketchLine_111r-SketchLine_112f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_28_2f-SketchArc_29_2f-SketchArc_32_2f-SketchArc_33_2f-SketchLine_99r-SketchLine_102f-SketchLine_104f-SketchLine_106r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modfied_1"))
+ExtrusionCut_5_objects_1 = [model.selection("WIRE", "Sketch_7/Face-SketchArc_20_2f-SketchLine_93r-SketchArc_21_2f-SketchLine_91r-SketchArc_23_2f-SketchLine_94f-SketchArc_22_2f-SketchLine_92f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_52_2f-SketchLine_116r-SketchArc_53_2f-SketchLine_115f-SketchArc_57_2f-SketchLine_121f-SketchArc_56_2f-SketchLine_114r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_44_2f-SketchLine_117r-SketchArc_45_2f-SketchLine_113f-SketchArc_49_2f-SketchLine_107f-SketchArc_48_2f-SketchLine_123r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_16_2f-SketchLine_90r-SketchArc_17_2f-SketchLine_88f-SketchArc_19_2f-SketchLine_87f-SketchArc_18_2f-SketchLine_89r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_11_2r-SketchLine_83f-SketchArc_12_2f-SketchLine_82r-SketchArc_14_2f-SketchLine_84r-SketchArc_15_2f-SketchLine_81f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_36_2f-SketchLine_119r-SketchArc_38_2f-SketchLine_129f-SketchArc_41_2f-SketchLine_127f-SketchArc_40_2f-SketchLine_108r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_37_2f-SketchLine_130f-SketchArc_42_2f-SketchLine_122r-SketchArc_43_2f-SketchLine_118r-SketchArc_39_2f-SketchLine_120f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_24_2f-SketchLine_103r-SketchArc_26_2f-SketchLine_98f-SketchArc_27_2f-SketchLine_101f-SketchArc_25_2f-SketchLine_100r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_30_2f-SketchLine_105r-SketchArc_34_2f-SketchLine_97f-SketchArc_35_2f-SketchLine_95f-SketchArc_31_2f-SketchLine_96r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_46_2f-SketchLine_124f-SketchArc_50_2f-SketchLine_125r-SketchArc_51_2f-SketchLine_128r-SketchArc_47_2f-SketchLine_126f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_54_2f-SketchLine_112f-SketchArc_58_2f-SketchLine_110r-SketchArc_59_2f-SketchLine_111r-SketchArc_55_2f-SketchLine_109f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_28_2f-SketchLine_102f-SketchArc_29_2f-SketchLine_104f-SketchArc_33_2f-SketchLine_99r-SketchArc_32_2f-SketchLine_106r_wire")]
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_5_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_12"))
 SketchLine_126 = Sketch_7.addLine(-153.5, -37.05, -152.3, -37.05)
 SketchLine_126.setName("SketchLine_135")
 SketchLine_126.result().setName("SketchLine_135")
 SketchLine_127 = Sketch_7.addLine(-150.8, -38.55, -150.8, -43.55)
 SketchLine_127.setName("SketchLine_138")
 SketchLine_127.result().setName("SketchLine_138")
-SketchPoint_10 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchLine_67s-SketchLine_68e-SketchLine_69e"))
+SketchPoint_10 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/SketchLine_67_StartVertex"))
 SketchPoint_10.setName("SketchPoint_12")
 SketchPoint_10.result().setName("SketchPoint_12")
 SketchLine_128 = Sketch_7.addLine(-150.8, -45.05, -153.5, -45.05)
@@ -888,7 +890,7 @@ SketchConstraintHorizontal_18 = Sketch_7.setHorizontal(SketchLine_128.result())
 SketchConstraintVertical_15 = Sketch_7.setVertical(SketchLine_129.result())
 SketchConstraintHorizontal_19 = Sketch_7.setHorizontal(SketchLine_132.result())
 SketchConstraintVertical_16 = Sketch_7.setVertical(SketchLine_131.result())
-SketchPoint_11 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchLine_70s-SketchLine_72s-SketchLine_71e"))
+SketchPoint_11 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/SketchLine_70_StartVertex"))
 SketchPoint_11.setName("SketchPoint_13")
 SketchPoint_11.result().setName("SketchPoint_13")
 SketchConstraintCoincidence_118 = Sketch_7.setCoincident(SketchLine_132.endPoint(), SketchPoint_11.result())
@@ -939,7 +941,7 @@ model.do()
 Sketch_7.setName("Sketch_8")
 Sketch_7.result().setName("Sketch_8")
 ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_2"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10"))
 SketchLine_134 = Sketch_8.addLine(0.85, 50.75, -0.85, 50.75)
 SketchLine_134.setName("SketchLine_139")
 SketchLine_134.result().setName("SketchLine_139")
@@ -1019,7 +1021,7 @@ SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_158")
 SketchConstraintCoincidence_149 = Sketch_8.setCoincident(SketchArc_62.startPoint(), SketchLine_134.endPoint())
 SketchConstraintCoincidence_149.setName("SketchConstraintCoincidence_159")
 SketchConstraintCoincidence_150 = Sketch_8.setCoincident(SketchArc_62.center(), SketchLine_137.result())
-SketchLine_140 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_6_1/Modfied_2"))
+SketchLine_140 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10]"))
 SketchLine_140.setName("SketchLine_145")
 SketchLine_140.result().setName("SketchLine_145")
 SketchConstraintDistance_18 = Sketch_8.setDistance(SketchLine_140.result(), SketchPoint_12.coordinates(), 6)
@@ -1061,7 +1063,7 @@ SketchArc_65.results()[1].setName("SketchArc_66_2")
 model.do()
 Sketch_8.setName("Sketch_9")
 Sketch_8.result().setName("Sketch_9")
-ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_147f-SketchLine_148f-SketchArc_64_2f-SketchArc_65_2f"), model.selection("FACE", "Sketch_9/Face-SketchLine_139f-SketchLine_141f-SketchArc_63_2f-SketchArc_62_2f"), model.selection("FACE", "Sketch_9/Face-SketchArc_66_2f-SketchArc_67_2f-SketchLine_149r-SketchLine_150r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_6_1")])
+ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_147f-SketchArc_65_2f-SketchLine_148f-SketchArc_64_2f"), model.selection("FACE", "Sketch_9/Face-SketchLine_139r-SketchArc_62_2f-SketchLine_141f-SketchArc_63_2f"), model.selection("FACE", "Sketch_9/Face-SketchArc_66_2f-SketchLine_150r-SketchArc_67_2f-SketchLine_149r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_6_1")])
 model.do()
 
 # Test reexecution after parameter change
index bf7d9362d22089748f75a6cce33a0715b7450e94..256e55d5ca5a4b3724efa274434781695f8f48b3 100644 (file)
@@ -65,7 +65,7 @@ SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConst
 [SketchArc_5, SketchArc_6, SketchLine_6, SketchLine_7, SketchLine_8, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored()
 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "dint/2")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2r-SketchArc_3_2r-SketchArc_4_2f-SketchArc_5_2r-SketchArc_6_2f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_7_2r-SketchArc_8_2f")], model.selection(), 35, 35)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_3_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_4_2f-SketchArc_2_2r-SketchArc_5_2r-SketchArc_6_2f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_7_2r-SketchArc_8_2f")], model.selection(), 35, 35)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchArc_9 = Sketch_2.addArc(0, 106, 0, 78, 0, 134, True)
 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_9.results()[1], 28)
@@ -79,7 +79,7 @@ SketchLine_11 = Sketch_2.addLine(0, 78, 0, 134)
 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_11.startPoint())
 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_11.endPoint())
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_9_2f-SketchLine_11f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_9_2r-SketchLine_11f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_1_1")])
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
 SketchLine_12 = Sketch_3.addLine(0, 106, -4, 106)
@@ -110,9 +110,9 @@ SketchLine_16.setName("SketchLine_17")
 SketchLine_16.result().setName("SketchLine_17")
 SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_12f-SketchLine_13f-SketchArc_10_2f-SketchLine_17r-SketchLine_18r")], model.selection(), "172/2", "172/2")
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_12r-SketchLine_13f-SketchArc_10_2f-SketchLine_17r-SketchLine_18r_wire")], model.selection(), "172/2", "172/2")
 Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_10"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
 SketchLine_18 = Sketch_4.addLine(-65, 16, -65, -16)
 SketchLine_18.setName("SketchLine_19")
 SketchLine_18.result().setName("SketchLine_19")
@@ -149,8 +149,8 @@ SketchConstraintTangent_5 = Sketch_4.setTangent(SketchLine_20.result(), SketchAr
 SketchConstraintTangent_6 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_11.results()[1])
 SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_12.results()[1], SketchLine_20.result())
 model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchArc_11_2f-SketchArc_12_2f-SketchLine_21f-SketchLine_22r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 0)
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], model.selection("EDGE", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_12"), -130, 2)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchArc_11_2f-SketchLine_21f-SketchArc_12_2f-SketchLine_22r_wire")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], model.selection("EDGE", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"), -130, 2)
 Cut_3 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_2_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
 model.do()
 
index 217e25a83edf60e96a938dc7054cccacd692e710..3b0a64de96fc7a103a268f8be0be3d73ea1e1b92 100644 (file)
@@ -162,8 +162,8 @@ SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_83.result())
 SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_84.result(), "2*R_fillet")
 SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_83.result(), "2*R_fillet")
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), 360, 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), 360, 0)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_8"))
 SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchLine_86 = Sketch_4.addLine(0, -13.49999999999519, 3.1, -13.49999999999519)
 SketchLine_87 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OZ"))
@@ -195,7 +195,7 @@ SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_6.coordinate
 SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchLine_89.result())
 SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), SketchLine_86.result(), 24.5)
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
 RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "PartSet/OX"), 0, 360, [model.selection("SOLID", "ExtrusionCut_1_1")])
 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 0, 5, [model.selection("SOLID", "RevolutionCut_1_1")])
 model.do()
index c00585ba777ab899e24095e55e8ba488f3c820f0..9c105d2ea75a44789df6e8f49ad722a2f934b4f5 100644 (file)
@@ -131,13 +131,13 @@ SketchConstraintRadius_10 = Sketch_1.setRadius(SketchArc_16.results()[1], 6.25)
 SketchConstraintRadius_11 = Sketch_1.setRadius(SketchArc_13.results()[1], 6.25)
 SketchConstraintTangent_14 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_8.results()[1])
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_6_2r-SketchLine_3r-SketchLine_4f-SketchArc_7_2r-SketchCircle_1_2r-SketchCircle_2_2r-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2r-SketchLine_6r-SketchArc_11_2f-SketchLine_7f-SketchArc_12_2f-SketchArc_13_2r-SketchArc_14_2f-SketchArc_15_2f-SketchArc_16_2r")], model.selection(), 0, 2)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_8_2f-SketchLine_7f-SketchArc_11_2f-SketchArc_13_2r-SketchArc_12_2f-SketchArc_14_2f-SketchArc_15_2f-SketchArc_16_2r-SketchArc_9_2f-SketchArc_10_2r-SketchLine_6r-SketchCircle_1_2r-SketchArc_3_2f-SketchArc_5_2r-SketchArc_4_2r-SketchArc_2_2r-SketchLine_3r-SketchArc_7_2r-SketchLine_4f-SketchArc_6_2r-SketchCircle_2_2r")], model.selection(), 0, 2)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_7"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_7"))
 SketchArc_17 = Sketch_2.addArc(-24.92, -4.314010717669617e-016, -24.92, 7.500000000006299, -24.92, -7.500000000006299, True)
 SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_17.center())
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_8_2s-SketchLine_6s"))
-SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_6-SketchArc_8"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_8_2_StartVertex"))
+SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_6"))
 SketchArc_18 = Sketch_2.addArc(-34.92, 0, -34.91999999999937, 7.500000000006299, -34.92003434105975, -7.500000000006299, False)
 SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchArc_18.center())
 SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_18.startPoint())
@@ -151,19 +151,19 @@ SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
 SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result())
 SketchConstraintTangent_15 = Sketch_2.setTangent(SketchLine_8.result(), SketchArc_17.results()[1])
 SketchConstraintTangent_16 = Sketch_2.setTangent(SketchArc_17.results()[1], SketchLine_9.result())
-SketchPoint_4 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_2_2__cc"))
+SketchPoint_4 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_2_2__cc"))
 SketchCircle_3 = Sketch_2.addCircle(-7.5, 18.75, 8.125)
 SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchPoint_4.result(), SketchCircle_3.center())
-SketchArc_19 = Sketch_2.addArc(model.selection("EDGE", "Sketch_1/Edge-SketchArc_9_2"))
+SketchArc_19 = Sketch_2.addArc(model.selection("EDGE", "Sketch_1/SketchArc_9_2"))
 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchArc_19.results()[1])
-SketchPoint_5 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_1_2__cc"))
+SketchPoint_5 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"))
 SketchCircle_4 = Sketch_2.addCircle(0, 0, 8.75)
 SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchPoint_5.result(), SketchCircle_4.center())
 SketchConstraintRadius_12 = Sketch_2.setRadius(SketchCircle_4.results()[1], "17.5/2")
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_17_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_18_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_6_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_7_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchArc_17_2"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_18_2"), model.selection("EDGE", "Sketch_1/SketchArc_6_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchArc_7_2"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1")], model.selection(), 2, 0)
 Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3")], [])
 model.do()
index 95025acd1dc4e519f76da729a1ddf9019a66a713..ea2d58dd61bc849be10123136d4506f8ed28f3f6 100644 (file)
@@ -70,28 +70,28 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 36)
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 32)
 SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_6.result())
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_5r-SketchLine_6r-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), 76, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchLine_7 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_6r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2f-SketchLine_1r")], model.selection(), 76, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchLine_7 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
 SketchLine_7.setName("SketchLine_8")
 SketchLine_7.result().setName("SketchLine_8")
 SketchLine_8 = Sketch_2.addLine(21, 45.99999999998655, 20.99999999998684, 0)
 SketchLine_8.setName("SketchLine_9")
 SketchLine_8.result().setName("SketchLine_9")
 SketchLine_8.setAuxiliary(True)
-SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"))
 SketchLine_9.setName("SketchLine_10")
 SketchLine_9.result().setName("SketchLine_10")
 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
-SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_1"))
+SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"))
 SketchLine_10.setName("SketchLine_11")
 SketchLine_10.result().setName("SketchLine_11")
 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.result())
 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_19")
 SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_8.startPoint(), SketchLine_9.result())
 SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_8.endPoint(), SketchLine_10.result())
-SketchLine_11 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"))
+SketchLine_11 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"))
 SketchLine_11.setName("SketchLine_12")
 SketchLine_11.result().setName("SketchLine_12")
 SketchPoint_1 = Sketch_2.addPoint(20.99999999999342, 22.99999999999327)
@@ -128,8 +128,8 @@ SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchLine_12.endPoint(), Ske
 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_2.results()[1], 2.5)
 SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_12.result(), SketchCircle_4.center(), 8)
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_2_2r"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_3_2f")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/From_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r_wire_2"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_3_2f_wire")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchCircle_5 = Sketch_3.addCircle(20.99999999999342, 22.99999999999327, 19)
 SketchConstraintRadius_4 = Sketch_3.setRadius(SketchCircle_5.results()[1], 19)
@@ -137,12 +137,12 @@ SketchLine_13 = Sketch_3.addLine(41.99999999999999, 22.99999999998655, 0, 22.999
 SketchLine_13.setName("SketchLine_14")
 SketchLine_13.result().setName("SketchLine_14")
 SketchLine_13.setAuxiliary(True)
-SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&Extrusion_1_1/Generated_Face_5"))
+SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
 SketchLine_14.setName("SketchLine_15")
 SketchLine_14.result().setName("SketchLine_15")
 SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchLine_14.result())
 SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27")
-SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_2_1/Modfied_2"))
+SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]"))
 SketchLine_15.setName("SketchLine_16")
 SketchLine_15.result().setName("SketchLine_16")
 SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result())
@@ -151,12 +151,12 @@ SketchLine_16 = Sketch_3.addLine(21, 45.99999999998655, 20.99999999998684, 0)
 SketchLine_16.setName("SketchLine_17")
 SketchLine_16.result().setName("SketchLine_17")
 SketchLine_16.setAuxiliary(True)
-SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
 SketchLine_17.setName("SketchLine_18")
 SketchLine_17.result().setName("SketchLine_18")
 SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchLine_17.result())
 SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29")
-SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"))
+SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_3"))
 SketchLine_18.setName("SketchLine_19")
 SketchLine_18.result().setName("SketchLine_19")
 SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_18.result())
@@ -182,26 +182,26 @@ SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_7.results()[1], 2.5)
 SketchConstraintDistance_4 = Sketch_3.setDistance(SketchCircle_6.center(), SketchCircle_7.center(), 16)
 SketchConstraintDistance_5 = Sketch_3.setDistance(SketchCircle_6.center(), SketchLine_16.result(), 8)
 model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_6_2r-SketchCircle_7_2r")], model.selection(), 15, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2r-SketchCircle_7_2r-SketchCircle_6_2r")], model.selection(), 15, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
 ExtrusionCut_3.result().setName("ExtrusionCut_3_1")
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
-SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/Generated_Face_2"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
+SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), False)
 SketchLine_19 = SketchProjection_1.createdFeature()
 SketchLine_19.setName("SketchLine_20")
 SketchLine_19.result().setName("SketchLine_20")
-SketchProjection_2 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4"))
+SketchProjection_2 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), False)
 SketchLine_20 = SketchProjection_2.createdFeature()
 SketchLine_20.setName("SketchLine_21")
 SketchLine_20.result().setName("SketchLine_21")
 SketchLine_21 = Sketch_4.addLine(4.999999999999999, -28, 37, -28)
 SketchLine_21.setName("SketchLine_22")
 SketchLine_21.result().setName("SketchLine_22")
-SketchLine_22 = Sketch_4.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_22 = Sketch_4.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
 SketchLine_22.setName("SketchLine_23")
 SketchLine_22.result().setName("SketchLine_23")
 SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_21.startPoint(), SketchLine_22.result())
 SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_35")
-SketchLine_23 = Sketch_4.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"))
+SketchLine_23 = Sketch_4.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"))
 SketchLine_23.setName("SketchLine_24")
 SketchLine_23.result().setName("SketchLine_24")
 SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_23.result())
@@ -266,8 +266,8 @@ SketchConstraintMiddle_10 = Sketch_4.setMiddlePoint(SketchLine_27.endPoint(), Sk
 SketchConstraintMiddle_11 = Sketch_4.setMiddlePoint(SketchLine_27.startPoint(), SketchLine_19.result())
 SketchConstraintMiddle_12 = Sketch_4.setMiddlePoint(SketchLine_25.result(), SketchLine_27.startPoint())
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_22r-SketchLine_25f-SketchLine_26f-SketchLine_27r-SketchArc_5_2f-SketchArc_6_2f-SketchArc_7_2f-SketchArc_8_2f")], model.selection(), 2, 17)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_5_2f-SketchLine_26f-SketchArc_6_2f-SketchLine_25f-SketchArc_8_2f-SketchLine_27r-SketchArc_7_2f-SketchLine_22r")], model.selection(), 2, 17)
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face"))
 SketchLine_28 = Sketch_5.addLine(5.000000000000001, -46, 37.00000000000001, -46)
 SketchLine_28.setName("SketchLine_29")
 SketchLine_28.result().setName("SketchLine_29")
@@ -286,19 +286,19 @@ SketchConstraintVertical_2 = Sketch_5.setVertical(SketchLine_30.result())
 SketchConstraintVertical_3 = Sketch_5.setVertical(SketchLine_31.result())
 SketchConstraintEqual_8 = Sketch_5.setEqual(SketchLine_29.result(), SketchLine_28.result())
 SketchConstraintEqual_9 = Sketch_5.setEqual(SketchLine_31.result(), SketchLine_30.result())
-SketchLine_32 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_1"))
+SketchLine_32 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_26][Extrusion_2_1/To_Face]"))
 SketchLine_32.setName("SketchLine_33")
 SketchLine_32.result().setName("SketchLine_33")
 SketchConstraintDistance_7 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_32.result(), 2)
-SketchLine_33 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/To_Face_1"))
+SketchLine_33 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_27][Extrusion_2_1/To_Face]"))
 SketchLine_33.setName("SketchLine_34")
 SketchLine_33.result().setName("SketchLine_34")
 SketchConstraintDistance_8 = Sketch_5.setDistance(SketchLine_31.startPoint(), SketchLine_33.result(), 2)
-SketchLine_34 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_1"))
+SketchLine_34 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_22][Extrusion_2_1/To_Face]"))
 SketchLine_34.setName("SketchLine_35")
 SketchLine_34.result().setName("SketchLine_35")
 SketchConstraintDistance_9 = Sketch_5.setDistance(SketchLine_29.startPoint(), SketchLine_34.result(), 2)
-SketchLine_35 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/To_Face_1"))
+SketchLine_35 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_25][Extrusion_2_1/To_Face]"))
 SketchLine_35.setName("SketchLine_36")
 SketchLine_35.result().setName("SketchLine_36")
 SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_28.startPoint(), SketchLine_35.result(), 2)
@@ -363,7 +363,7 @@ SketchConstraintMiddle_15 = Sketch_5.setMiddlePoint(SketchLine_37.startPoint(),
 SketchConstraintMiddle_16 = Sketch_5.setMiddlePoint(SketchLine_37.endPoint(), SketchLine_35.result())
 SketchConstraintDistance_12 = Sketch_5.setDistance(SketchCircle_8.center(), SketchLine_37.result(), 8)
 model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_29f-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchArc_9_2f-SketchArc_10_2f-SketchArc_11_2f-SketchArc_12_2f")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_29r-SketchArc_12_2f-SketchLine_32r-SketchArc_11_2f-SketchLine_30r-SketchArc_9_2f-SketchLine_31r-SketchArc_10_2f-SketchCircle_9_2r-SketchCircle_8_2r_wire")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
 ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_8_2f"), model.selection("FACE", "Sketch_5/Face-SketchCircle_9_2f")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionCut_4_1"), model.selection("SOLID", "ExtrusionCut_4_2")])
 Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
 SketchLine_38 = Sketch_6.addLine(-59, 44, -59, 2)
@@ -420,33 +420,33 @@ SketchConstraintLength_3 = Sketch_6.setLength(SketchLine_38.result(), 42)
 SketchConstraintLength_4 = Sketch_6.setLength(SketchLine_43.result(), 20)
 SketchConstraintLength_5 = Sketch_6.setLength(SketchLine_44.result(), 15)
 SketchConstraintLength_6 = Sketch_6.setLength(SketchLine_39.result(), 42)
-SketchProjection_3 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"))
+SketchProjection_3 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False)
 SketchLine_46 = SketchProjection_3.createdFeature()
 SketchLine_46.setName("SketchLine_47")
 SketchLine_46.result().setName("SketchLine_47")
-SketchProjection_4 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_1_1/Modfied_1"))
+SketchProjection_4 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_1_2)]"), False)
 SketchLine_47 = SketchProjection_4.createdFeature()
 SketchLine_47.setName("SketchLine_48")
 SketchLine_47.result().setName("SketchLine_48")
-SketchProjection_5 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"))
+SketchProjection_5 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False)
 SketchLine_48 = SketchProjection_5.createdFeature()
 SketchLine_48.setName("SketchLine_49")
 SketchLine_48.result().setName("SketchLine_49")
 SketchConstraintDistance_13 = Sketch_6.setDistance(SketchLine_38.endPoint(), SketchLine_46.result(), 2)
 SketchConstraintDistance_14 = Sketch_6.setDistance(SketchLine_38.startPoint(), SketchLine_47.result(), 17)
 model.do()
-ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), -2, model.selection(), -2, [model.selection("SOLID", "ExtrusionCut_5_2")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), -2, model.selection(), -2, [model.selection("SOLID", "ExtrusionCut_5_2")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
 SketchLine_49 = Sketch_7.addLine(0, -22.99999999998656, -76, -22.99999999998655)
 SketchLine_49.setName("SketchLine_50")
 SketchLine_49.result().setName("SketchLine_50")
 SketchLine_49.setAuxiliary(True)
-SketchLine_50 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_3_1/Modfied_2"))
+SketchLine_50 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)]"))
 SketchLine_50.setName("SketchLine_51")
 SketchLine_50.result().setName("SketchLine_51")
 SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_49.startPoint(), SketchLine_50.result())
 SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_75")
-SketchPoint_3 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_13s"))
+SketchPoint_3 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_2/SketchLine_13_StartVertex"))
 SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_49.endPoint(), SketchPoint_3.result())
 SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_76")
 SketchConstraintMiddle_17 = Sketch_7.setMiddlePoint(SketchLine_49.startPoint(), SketchLine_50.result())
@@ -454,12 +454,12 @@ SketchLine_51 = Sketch_7.addLine(-38, -40.99999999998656, -38, -4.99999999998656
 SketchLine_51.setName("SketchLine_52")
 SketchLine_51.result().setName("SketchLine_52")
 SketchLine_51.setAuxiliary(True)
-SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_4_2/Modfied_3"))
+SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"))
 SketchLine_52.setName("SketchLine_53")
 SketchLine_52.result().setName("SketchLine_53")
 SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_51.startPoint(), SketchLine_52.result())
 SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_77")
-SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_1"))
+SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
 SketchLine_53.setName("SketchLine_54")
 SketchLine_53.result().setName("SketchLine_54")
 SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_53.result())
@@ -475,13 +475,13 @@ SketchConstraintCoincidence_79 = Sketch_7.setCoincident(SketchPoint_4.coordinate
 SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_80")
 SketchConstraintRadius_8 = Sketch_7.setRadius(SketchCircle_10.results()[1], 17)
 model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchCircle_10_2f")], model.selection(), 16, 0)
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
-SketchProjection_6 = Sketch_8.addProjection(model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"))
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchCircle_10_2f_wire")], model.selection(), 16, 0)
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face"))
+SketchProjection_6 = Sketch_8.addProjection(model.selection("EDGE", "Sketch_2/SketchLine_9"), False)
 SketchLine_54 = SketchProjection_6.createdFeature()
 SketchLine_54.setName("SketchLine_55")
 SketchLine_54.result().setName("SketchLine_55")
-SketchProjection_7 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_3_1/Modfied_2"))
+SketchProjection_7 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)]"), False)
 SketchLine_55 = SketchProjection_7.createdFeature()
 SketchLine_55.setName("SketchLine_56")
 SketchLine_55.result().setName("SketchLine_56")
@@ -506,11 +506,11 @@ SketchConstraintMiddle_23 = Sketch_8.setMiddlePoint(SketchLine_56.result(), Sket
 SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_57.result(), SketchPoint_5.coordinates())
 SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_84")
 SketchConstraintPerpendicular_1 = Sketch_8.setPerpendicular(SketchLine_57.result(), SketchLine_56.result())
-SketchProjection_8 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_4_2/Modfied_3"))
+SketchProjection_8 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"), False)
 SketchLine_58 = SketchProjection_8.createdFeature()
 SketchLine_58.setName("SketchLine_59")
 SketchLine_58.result().setName("SketchLine_59")
-SketchProjection_9 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_9 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False)
 SketchLine_59 = SketchProjection_9.createdFeature()
 SketchLine_59.setName("SketchLine_60")
 SketchLine_59.result().setName("SketchLine_60")
@@ -530,7 +530,7 @@ SketchConstraintDistance_15 = Sketch_8.setDistance(SketchCircle_11.center(), Ske
 SketchConstraintDistance_16 = Sketch_8.setDistance(SketchCircle_11.center(), SketchCircle_12.center(), 16)
 model.do()
 Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_8/Face-SketchCircle_12_2f")], model.selection(), 17, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), 38, True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)"), 38, True)
 Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchLine_60 = Sketch_9.addLine(-14, -36.99999999998992, 0, -36.99999999998992)
 SketchLine_60.setName("SketchLine_61")
@@ -562,19 +562,19 @@ SketchLine_64 = Sketch_9.addLine(-5.662490896925754, -22.99999999998992, -60.521
 SketchLine_64.setName("SketchLine_65")
 SketchLine_64.result().setName("SketchLine_65")
 SketchLine_64.setAuxiliary(True)
-SketchPoint_6 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_8/Vertex-SketchPoint_5"))
+SketchPoint_6 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_8/SketchPoint_5"))
 SketchConstraintCoincidence_92 = Sketch_9.setCoincident(SketchLine_64.result(), SketchPoint_6.coordinates())
 SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_93")
 SketchConstraintHorizontal_13 = Sketch_9.setHorizontal(SketchLine_64.result())
 SketchConstraintCoincidence_93 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_64.result())
 SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_94")
-SketchLine_65 = Sketch_9.addLine(model.selection("EDGE", "Sketch_7/Edge-SketchLine_52"))
+SketchLine_65 = Sketch_9.addLine(model.selection("EDGE", "Sketch_7/SketchLine_52"))
 SketchLine_65.setName("SketchLine_66")
 SketchLine_65.result().setName("SketchLine_66")
 SketchConstraintCoincidence_94 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_65.result())
 SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_95")
 model.do()
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/Edge-SketchLine_65"), 360, 0, [model.selection("SOLID", "Extrusion_3_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/SketchLine_65"), 360, 0, [model.selection("SOLID", "Extrusion_3_1")])
 model.do()
 
 from GeomAPI import  GeomAPI_Shape
index 99e22b96c4a2ac7fe205f2acc76e588c865d8b50..e576ecb001c9948da0f487b85f36565e770e89bf 100644 (file)
@@ -147,12 +147,12 @@ SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_2.center(), SketchAr
 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.result(), SketchArc_6.endPoint(), "(h4-d_diff)*coeff")
 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), "d1*coeff")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2r-SketchLine_4f-SketchArc_3_2r-SketchLine_5f-SketchArc_4_2f-SketchLine_6f-SketchLine_7r-SketchLine_8r-SketchArc_5_2r-SketchLine_9r-SketchArc_6_2f-SketchLine_10r-SketchArc_7_2f-SketchLine_11r-SketchArc_8_2r-SketchLine_12r-SketchLine_13r")], model.selection(), "epaisseur_plat*coeff", 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), "d2*coeff", True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2r-SketchLine_4f-SketchArc_3_2r-SketchLine_5f-SketchArc_4_2f-SketchLine_6f-SketchLine_13r-SketchLine_12r-SketchArc_8_2r-SketchLine_11r-SketchArc_7_2f-SketchLine_10r-SketchArc_6_2f-SketchLine_9r-SketchArc_5_2r-SketchLine_8r-SketchLine_7r_wire")], model.selection(), "epaisseur_plat*coeff", 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), "d2*coeff", True)
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), False)
 SketchLine_14 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11][Extrusion_1_1/To_Face]"), False)
 SketchLine_15 = SketchProjection_2.createdFeature()
 SketchLine_16 = Sketch_2.addLine(-24.99999999999999, -35.00000000000001, -31.24999999999999, -35.00000000000001)
 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_16.startPoint())
@@ -208,10 +208,10 @@ SketchConstraintEqual_10 = Sketch_2.setEqual(SketchArc_11.results()[1], SketchAr
 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_12.results()[1], "r3*coeff")
 SketchConstraintDistance_13 = Sketch_2.setDistance(SketchArc_10.startPoint(), SketchLine_19.result(), "d8*coeff")
 model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_16r-SketchArc_9_2f-SketchLine_17r-SketchArc_10_2f-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchArc_11_2r-SketchLine_21r-SketchArc_12_2r-SketchLine_22r-SketchLine_23f")], model.selection(), "d6*coeff", 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face_3"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_23f-SketchLine_22r-SketchArc_12_2r-SketchLine_21r-SketchArc_11_2r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_10_2f-SketchLine_17r-SketchArc_9_2f-SketchLine_16r_wire")], model.selection(), "d6*coeff", 0)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_17"))
 SketchLine_24 = Sketch_3.addLine(46.25, 22.91561885925604, 51.3, 20.00000000000001)
-SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/To_Face_1"))
+SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_17][Extrusion_2_1/To_Face]"))
 SketchLine_26 = Sketch_3.addLine(51.3, 20.00000000000001, 62.50000000000001, 20.00000000000001)
 SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_26.startPoint())
 SketchLine_27 = Sketch_3.addLine(62.50000000000001, 20.00000000000001, 62.5, -4.999999999999999)
@@ -238,9 +238,9 @@ SketchConstraintVertical_12 = Sketch_3.setVertical(SketchLine_27.result())
 SketchConstraintVertical_13 = Sketch_3.setVertical(SketchLine_33.result())
 SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_31.result())
 SketchConstraintAngle_1 = Sketch_3.setAngleComplementary(SketchLine_26.result(), SketchLine_24.result(), "angle")
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_4"))
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18][Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_10_2]"), False)
 SketchLine_34 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_1"))
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_9_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), False)
 SketchLine_35 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_34.result())
 SketchConstraintDistance_15 = Sketch_3.setDistance(SketchLine_31.result(), SketchLine_33.endPoint(), "(d6-d5)*coeff")
@@ -252,15 +252,15 @@ SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_29.endPoint()
 SketchConstraintDistance_17 = Sketch_3.setDistance(SketchLine_26.result(), SketchAPI_Line(SketchLine_35).startPoint(), "h2*coeff")
 SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_26.result(), "d7*coeff")
 model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_24r-SketchLine_26r-SketchLine_27r-SketchLine_28r-SketchLine_29r")], model.selection(), model.selection("FACE", "Extrusion_2_1/Generated_Face_6"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_2_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchLine_33r")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), "d3*coeff", True)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_29r-SketchLine_28r-SketchLine_27r-SketchLine_26r-SketchLine_24r")], model.selection(), model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_2_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_33r-SketchLine_32r-SketchLine_31r-SketchLine_30r")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), "d3*coeff", True)
 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"))
+SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]"), False)
 SketchLine_36 = SketchProjection_5.createdFeature()
-SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_8&ExtrusionCut_2_1/Modfied_9"))
+SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_2/SketchLine_23][ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_31]"), False)
 SketchLine_37 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5"))
+SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]"), False)
 SketchLine_38 = SketchProjection_7.createdFeature()
 SketchLine_39 = Sketch_4.addLine(-25, -35.00000000000001, -31.24999999999999, -35.00000000000001)
 SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_39.startPoint())
@@ -295,39 +295,39 @@ SketchConstraintRadius_6 = Sketch_4.setRadius(SketchArc_14.results()[1], "r3*coe
 SketchConstraintDistance_19 = Sketch_4.setDistance(SketchLine_41.endPoint(), SketchLine_40.result(), "epaisseur*coeff")
 SketchConstraintDistance_20 = Sketch_4.setDistance(SketchLine_41.startPoint(), SketchLine_39.result(), "h2")
 model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchLine_39r-SketchArc_13_2f-SketchLine_40r-SketchLine_41r-SketchLine_42r-SketchArc_14_2r-SketchLine_43r-SketchLine_44f")], model.selection(), 0, "e1*coeff")
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchLine_44f-SketchLine_43r-SketchArc_14_2r-SketchLine_42r-SketchLine_41r-SketchLine_40r-SketchArc_13_2f-SketchLine_39r_wire")], model.selection(), 0, "e1*coeff")
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_18"))
 SketchCircle_1 = Sketch_5.addCircle(70, 17.5, 3.125)
-SketchLine_45 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_1_1/Modfied_4"))
+SketchLine_45 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_19][ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_18]"))
 SketchConstraintDistance_21 = Sketch_5.setDistance(SketchCircle_1.center(), SketchLine_45.result(), "d9*coeff")
-SketchProjection_8 = Sketch_5.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_12&Extrusion_1_1/Generated_Face_11"))
+SketchProjection_8 = Sketch_5.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]"))
 SketchLine_46 = SketchProjection_8.createdFeature()
-SketchProjection_9 = Sketch_5.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_20&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_9 = Sketch_5.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
 SketchLine_47 = SketchProjection_9.createdFeature()
 SketchConstraintDistance_22 = Sketch_5.setDistance(SketchCircle_1.center(), SketchLine_47.result(), "d1*coeff")
 SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_1.results()[1], "r_trou")
 model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_6"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_1_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_20"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10"))
 SketchCircle_2 = Sketch_6.addCircle(70, -17.5, 5)
-SketchLine_48 = Sketch_6.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_1"))
-SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"))
+SketchLine_48 = Sketch_6.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1/To_Face]"))
+SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
 SketchLine_49 = SketchProjection_10.createdFeature()
 SketchConstraintDistance_23 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_49.result(), "d1*coeff")
 SketchConstraintDistance_23.setName("SketchConstraintDistance_24")
 SketchConstraintRadius_8 = Sketch_6.setRadius(SketchCircle_2.results()[1], "r_trou2")
-SketchLine_50 = Sketch_6.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_10"))
+SketchLine_50 = Sketch_6.addLine(model.selection("EDGE", "Sketch_1/SketchLine_10"))
 SketchConstraintDistance_24 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_50.result(), "d_trou")
 SketchConstraintDistance_24.setName("SketchConstraintDistance_25")
 model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_16"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"))
 SketchLine_51 = Sketch_7.addLine(110, 21.46600893000899, 110, 7.22841614740048)
 SketchLine_51.setAuxiliary(True)
-SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_12&Extrusion_1_1/Generated_Face_11"))
+SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]"))
 SketchConstraintCoincidence_65 = Sketch_7.setCoincident(SketchLine_51.startPoint(), SketchLine_52.result())
 SketchConstraintCoincidence_66 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_52.result())
-SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_12"))
+SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
 SketchArc_15 = Sketch_7.addArc(102.5, 7.22841614740048, 110, 7.22841614740048, 104.5, 0, True)
 SketchConstraintCoincidence_67 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchArc_15.startPoint())
 SketchConstraintTangent_29 = Sketch_7.setTangent(SketchLine_51.result(), SketchArc_15.results()[1])
@@ -344,11 +344,11 @@ SketchConstraintLength_5 = Sketch_7.setLength(SketchLine_54.result(), "5.5*coeff
 SketchLine_56 = Sketch_7.addLine(110, 12.5, 0, 12.5)
 SketchLine_56.setAuxiliary(True)
 SketchConstraintCoincidence_73 = Sketch_7.setCoincident(SketchLine_56.startPoint(), SketchLine_52.result())
-SketchLine_57 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_20&Extrusion_1_1/Generated_Face_1"))
+SketchLine_57 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"))
 SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_57.result())
 SketchConstraintMiddle_1 = Sketch_7.setMiddlePoint(SketchLine_56.endPoint(), SketchLine_57.result())
 SketchConstraintMiddle_2 = Sketch_7.setMiddlePoint(SketchLine_56.startPoint(), SketchLine_52.result())
-SketchProjection_11 = Sketch_7.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Face_1&ExtrusionCut_4_1/Modfied_2"))
+SketchProjection_11 = Sketch_7.addProjection(model.selection("EDGE", "[Extrusion_1_1/To_Face][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_4]"), False)
 SketchLine_58 = SketchProjection_11.createdFeature()
 SketchLine_59 = Sketch_7.addLine(55.00000000000002, 0, 55.00000000000002, 25)
 SketchLine_59.setAuxiliary(True)
@@ -364,7 +364,7 @@ SketchConstraintMirror_2_objects = [SketchArc_15.results()[1], SketchLine_55.res
 SketchConstraintMirror_2 = Sketch_7.addMirror(SketchLine_59.result(), SketchConstraintMirror_2_objects)
 [SketchArc_17, SketchLine_63, SketchLine_64, SketchArc_18, SketchLine_65, SketchLine_66] = SketchConstraintMirror_2.mirrored()
 model.do()
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchArc_16_2r-SketchLine_61f-SketchLine_62r"), model.selection("FACE", "Sketch_7/Face-SketchArc_18_2r-SketchLine_65f-SketchLine_66r"), model.selection("FACE", "Sketch_7/Face-SketchArc_17_2r-SketchLine_64r-SketchLine_66r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_15_2r-SketchLine_54f-SketchLine_55r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_10"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_61f-SketchLine_62r-SketchArc_16_2r_wire"), model.selection("FACE", "Sketch_7/Face-SketchLine_65f-SketchLine_66r-SketchArc_18_2r"), model.selection("FACE", "Sketch_7/Face-SketchLine_63f-SketchLine_64r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_7/Face-SketchLine_54f-SketchLine_55r-SketchArc_15_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
 Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_5_1")], [model.selection("SOLID", "Extrusion_3_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
 model.do()
 
index 05c3b5107c30ed51b01caa00932b50a4d658ed83..d1adc75e54bef83a5480868bbf7ff68080770e9f 100644 (file)
@@ -106,13 +106,13 @@ SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_3.result())
 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1])
-SketchArc_3 = Sketch_1.addArc(9.077705920073647e-31, -3.860574861749558e-31, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False)
+SketchArc_3 = Sketch_1.addArc(0, 0, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False)
 SketchArc_3.setName("SketchArc_7")
 SketchArc_3.result().setName("SketchArc_7")
 SketchArc_3.results()[1].setName("SketchArc_7_2")
 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.center())
 SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_54")
-SketchArc_4 = Sketch_1.addArc(3.497294868556922e-32, 3.186289860391258e-33, 18.89444362769119, 2, 15.46247221747308, 11.04137459394768, False)
+SketchArc_4 = Sketch_1.addArc(0, 0, 18.89444362769119, 2, 15.46247221747308, 11.04137459394768, False)
 SketchArc_4.setName("SketchArc_8")
 SketchArc_4.result().setName("SketchArc_8")
 SketchArc_4.results()[1].setName("SketchArc_8_2")
@@ -134,7 +134,7 @@ SketchArc_6.results()[1].setName("SketchArc_10_2")
 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_6.startPoint())
 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_57")
 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_6.results()[1])
-SketchLine_4 = Sketch_1.addLine(17.5, 15, 37.99999999999999, 15)
+SketchLine_4 = Sketch_1.addLine(17.5, 15, 38, 15)
 SketchLine_4.setName("SketchLine_42")
 SketchLine_4.result().setName("SketchLine_42")
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_4.startPoint())
@@ -149,7 +149,7 @@ SketchLine_6.setName("SketchLine_45")
 SketchLine_6.result().setName("SketchLine_45")
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_6.startPoint())
 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_61")
-SketchLine_7 = Sketch_1.addLine(37.99999999999999, 15, 38.00000000000001, 5.505556372308819)
+SketchLine_7 = Sketch_1.addLine(38, 15, 38, 5.505556372308819)
 SketchLine_7.setName("SketchLine_46")
 SketchLine_7.result().setName("SketchLine_46")
 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.startPoint())
@@ -166,7 +166,7 @@ SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_5.result())
 SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_14")
 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_7.result())
 SketchConstraintVertical_1.setName("SketchConstraintVertical_7")
-SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17.00000000000001)
+SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17)
 SketchLine_8.setName("SketchLine_47")
 SketchLine_8.result().setName("SketchLine_47")
 SketchLine_8.setAuxiliary(True)
@@ -193,7 +193,7 @@ SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_4.results()[1], "(r4+4)*
 SketchConstraintRadius_6.setName("SketchConstraintRadius_13")
 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff")
 SketchConstraintDistance_6.setName("SketchConstraintDistance_19")
-SketchArc_7 = Sketch_1.addArc(40, 2.220450266386716e-15, 34.49444362769118, 2, 38.00000000000001, 5.505556372308819, True)
+SketchArc_7 = Sketch_1.addArc(40, 0, 34.49444362769118, 2, 38, 5.505556372308819, True)
 SketchArc_7.setName("SketchArc_11")
 SketchArc_7.result().setName("SketchArc_11")
 SketchArc_7.results()[1].setName("SketchArc_11_2")
@@ -201,7 +201,7 @@ SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchPoint_2.coordinate
 SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_66")
 SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_7.startPoint())
 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_67")
-SketchArc_8 = Sketch_1.addArc(40.00000000000001, -2.652239435709897e-15, 34.49444362769118, -2, 37.95784774655168, -5.490060577298436, False)
+SketchArc_8 = Sketch_1.addArc(40, 0, 34.49444362769118, -2, 37.95784774655168, -5.490060577298436, False)
 SketchArc_8.setName("SketchArc_12")
 SketchArc_8.result().setName("SketchArc_12")
 SketchArc_8.results()[1].setName("SketchArc_12_2")
@@ -241,12 +241,12 @@ SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_9.results()[1], "(2.5+2)
 SketchConstraintRadius_8.setName("SketchConstraintRadius_15")
 SketchConstraintDistance_8 = Sketch_1.setDistance(SketchCircle_5.center(), SketchLine_2.result(), "4*coeff")
 SketchConstraintDistance_8.setName("SketchConstraintDistance_22")
-SketchLine_10 = Sketch_1.addLine(17.5, -15, 34.00000000000001, -15)
+SketchLine_10 = Sketch_1.addLine(17.5, -15, 34, -15)
 SketchLine_10.setName("SketchLine_43")
 SketchLine_10.result().setName("SketchLine_43")
 SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_10.startPoint())
 SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_73")
-SketchArc_10 = Sketch_1.addArc(34.00000000000001, -13.48076923076937, 34.00000000000001, -15, 35.51437699680511, -13.35942492012782, False)
+SketchArc_10 = Sketch_1.addArc(34, -13.48076923076937, 34, -15, 35.51437699680511, -13.35942492012782, False)
 SketchArc_10.setName("SketchArc_14")
 SketchArc_10.result().setName("SketchArc_14")
 SketchArc_10.results()[1].setName("SketchArc_14_2")
@@ -320,14 +320,14 @@ SketchArc_11.results()[1].setName("SketchArc_15_2")
 SketchLine_12.setName("SketchLine_50")
 SketchLine_12.result().setName("SketchLine_50")
 model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_4_2f-SketchLine_6r-SketchLine_10f-SketchArc_2_2f")], model.selection(), "h_p*coeff", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire")], model.selection(), "h_p*coeff", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_2_2"))
 SketchCircle_6 = SketchProjection_1.createdFeature()
 SketchCircle_6.setName("SketchCircle_5")
 SketchCircle_6.result().setName("SketchCircle_5")
 SketchCircle_6.results()[1].setName("SketchCircle_5_2")
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_4_2"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_4_2"))
 SketchCircle_7 = SketchProjection_2.createdFeature()
 SketchCircle_7.setName("SketchCircle_6")
 SketchCircle_7.result().setName("SketchCircle_6")
@@ -342,18 +342,18 @@ SketchConstraintRadius_9 = Sketch_2.setRadius(SketchCircle_8.results()[1], "r2*c
 SketchConstraintRadius_9.setName("SketchConstraintRadius_6")
 model.do()
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), "10*coeff", 0)
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_3_2f")], model.selection(), "p_trou1*coeff", 0, [model.selection("SOLID", "Extrusion_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2r")], model.selection(), "p2_trou1*coeff", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_3_2f_wire")], model.selection(), "p_trou1*coeff", 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire_7")], model.selection(), "p2_trou1*coeff", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
 ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_4_2f")], model.selection(), "p_trou2*coeff", 0, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2r")], model.selection(), "p2_trou*coeff", 0, [model.selection("SOLID", "ExtrusionCut_3_2")])
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire_8")], model.selection(), "p2_trou*coeff", 0, [model.selection("SOLID", "ExtrusionCut_3_2")])
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "22.5*coeff", False)
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "45*coeff", True)
 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False)
 SketchLine_18 = SketchProjection_3.createdFeature()
 SketchLine_18.setName("SketchLine_4")
 SketchLine_18.result().setName("SketchLine_4")
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"))
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"))
 SketchLine_19 = SketchProjection_4.createdFeature()
 SketchLine_19.setName("SketchLine_5")
 SketchLine_19.result().setName("SketchLine_5")
@@ -430,9 +430,9 @@ SketchConstraintDistance_13.setName("SketchConstraintDistance_11")
 SketchConstraintDistance_14 = Sketch_3.setDistance(SketchLine_23.result(), SketchLine_25.startPoint(), "2.5*coeff")
 SketchConstraintDistance_14.setName("SketchConstraintDistance_12")
 model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_9r-SketchLine_12r-SketchLine_14r-SketchLine_26r-SketchLine_27r-SketchLine_28r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), 0, model.selection(), 0)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_27r-SketchLine_26r-SketchLine_28r-SketchLine_12r-SketchLine_9r-SketchCircle_8_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10"), 0, model.selection(), 0)
 Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], [model.selection("SOLID", "ExtrusionCut_4_1")])
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchCircle_8_2f")], model.selection(), 10, 0, [model.selection("SOLID", "Smash_1_1_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_8_2f_wire")], model.selection(), 10, 0, [model.selection("SOLID", "Smash_1_1_1")])
 ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_8_2f")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_5_1_1")])
 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
 SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"))
@@ -516,11 +516,11 @@ SketchConstraintDistance_16.setName("SketchConstraintDistance_10")
 SketchConstraintLength_10 = Sketch_4.setLength(SketchLine_36.result(), 12.975642079145)
 SketchConstraintLength_10.setName("SketchConstraintLength_7")
 model.do()
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchLine_19f-SketchLine_20f-SketchLine_24f-SketchLine_21f-SketchLine_22f-SketchLine_23f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), 0, model.selection(), 0)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchCircle_9_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), 0, model.selection(), 0)
 Smash_2 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], [model.selection("COMPSOLID", "ExtrusionCut_6_1")])
 ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_9_2f")], model.selection(), 0, 10, [model.selection("SOLID", "Smash_2_1_3")])
 ExtrusionCut_8 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_9_2f")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_7_1_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Smash_2_1_3/Modified_Face_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Smash_2_1_3/Modified_Face&Extrusion_1_1/From_Face"))
 SketchPoint_3 = Sketch_5.addPoint(model.selection("VERTEX", "PartSet/Origin"))
 SketchPoint_3.setName("SketchPoint_2")
 SketchPoint_3.result().setName("SketchPoint_2")
@@ -539,7 +539,7 @@ SketchLine_39.setName("SketchLine_31")
 SketchLine_39.result().setName("SketchLine_31")
 SketchConstraintDistance_17 = Sketch_5.setDistance(SketchLine_37.result(), SketchLine_38.startPoint(), "epaisseur*coeff")
 SketchConstraintDistance_17.setName("SketchConstraintDistance_13")
-SketchArc_19 = Sketch_5.addArc(2.175718373563154e-31, -6.039735315912772e-31, -13.96424004376904, 17, -13.964240043769, -17, False)
+SketchArc_19 = Sketch_5.addArc(0, 0, -13.964240043769, 17, -13.964240043769, -17, False)
 SketchArc_19.setName("SketchArc_5")
 SketchArc_19.result().setName("SketchArc_5")
 SketchArc_19.results()[1].setName("SketchArc_5_2")
@@ -567,7 +567,7 @@ SketchConstraintDistance_19.setName("SketchConstraintDistance_15")
 SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_19.endPoint(), SketchLine_37.startPoint())
 SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_40")
 model.do()
-Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchLine_29r-SketchLine_30r-SketchArc_5_2r-SketchLine_32r")], model.selection(), 0, "22*coeff")
+Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_5_2r-SketchLine_30r-SketchLine_32r-SketchLine_29r")], model.selection(), 0, "22*coeff")
 Sketch_6_origin = GeomAPI_Pnt(0, 0, 0)
 Sketch_6_norm = GeomAPI_Dir(0, 1, 0)
 Sketch_6_dirx = GeomAPI_Dir(1, 0, 0)
@@ -575,23 +575,23 @@ Sketch_6 = model.addSketch(Part_1_doc, GeomAPI_Ax3(Sketch_6_origin, Sketch_6_dir
 SketchLine_41 = Sketch_6.addLine(-32, -17, -32, 17)
 SketchLine_41.setName("SketchLine_33")
 SketchLine_41.result().setName("SketchLine_33")
-SketchPoint_4 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_32s-SketchLine_29e"))
+SketchPoint_4 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_29_EndVertex"))
 SketchPoint_4.setName("SketchPoint_3")
 SketchPoint_4.result().setName("SketchPoint_3")
 SketchConstraintCoincidence_60 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result())
 SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_41")
-SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_30s-SketchLine_32e"))
+SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex"))
 SketchPoint_5.setName("SketchPoint_4")
 SketchPoint_5.result().setName("SketchPoint_4")
 SketchConstraintCoincidence_61 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchPoint_5.result())
 SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_42")
-SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchPoint_2-SketchArc_5-SketchLine_31s"))
+SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchPoint_2"))
 SketchPoint_6.setName("SketchPoint_5")
 SketchPoint_6.result().setName("SketchPoint_5")
-SketchLine_42 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_30"))
+SketchLine_42 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_30"))
 SketchLine_42.setName("SketchLine_34")
 SketchLine_42.result().setName("SketchLine_34")
-SketchLine_43 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_29"))
+SketchLine_43 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_29"))
 SketchLine_43.setName("SketchLine_35")
 SketchLine_43.result().setName("SketchLine_35")
 SketchArc_20 = Sketch_6.addArc(0, 0, -20.32855135026245, 17, -20.32855135026245, -17, False)
@@ -621,18 +621,18 @@ SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_49")
 SketchConstraintRadius_13 = Sketch_6.setRadius(SketchArc_20.results()[1], "r1*coeff")
 SketchConstraintRadius_13.setName("SketchConstraintRadius_10")
 model.do()
-Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_33r-SketchArc_6_2r-SketchLine_36r-SketchLine_37f")], model.selection(), "77*coeff-h_p*coeff", 0)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_6_1/Generated_Face_1"))
+Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_36r-SketchArc_6_2r-SketchLine_37f-SketchLine_33r")], model.selection(), "77*coeff-h_p*coeff", 0)
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_33"))
 SketchLine_46 = Sketch_7.addLine(37, -8.881784197001252e-16, -22, 1.665334536937735e-15)
 SketchLine_46.setName("SketchLine_38")
 SketchLine_46.result().setName("SketchLine_38")
 SketchLine_46.setAuxiliary(True)
-SketchLine_47 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_6_1/Generated_Face_1&Extrusion_6_1/To_Face_1"))
+SketchLine_47 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]"))
 SketchLine_47.setName("SketchLine_39")
 SketchLine_47.result().setName("SketchLine_39")
 SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchLine_46.startPoint(), SketchLine_47.result())
 SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_50")
-SketchLine_48 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_2&Extrusion_5_1/From_Face_1"))
+SketchLine_48 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_32][Extrusion_5_1/From_Face]"))
 SketchLine_48.setName("SketchLine_40")
 SketchLine_48.result().setName("SketchLine_40")
 SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_48.result())
@@ -661,24 +661,25 @@ SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_53")
 SketchConstraintRadius_14 = Sketch_7.setRadius(SketchCircle_11.results()[1], "r3")
 SketchConstraintRadius_14.setName("SketchConstraintRadius_12")
 model.do()
-ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchCircle_10_2f")], model.selection(), 0, "10*coeff", [model.selection("SOLID", "Extrusion_6_1")])
-ExtrusionCut_10 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_7_2r-SketchArc_10_2f-SketchLine_44r-SketchArc_12_2r-SketchArc_13_2r-SketchLine_48r-SketchLine_43f-SketchArc_14_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_50f-SketchArc_15_2f-SketchArc_16_2r-SketchLine_51r-SketchArc_17_2r-SketchLine_52f"), model.selection("FACE", "Sketch_1/Face-SketchLine_53f-SketchArc_18_2r-SketchLine_54f-SketchArc_19_2r-SketchArc_20_2f-SketchLine_55r-SketchArc_21_2f-SketchArc_22_2r"), model.selection("FACE", "Sketch_1/Face-SketchArc_8_2r-SketchArc_9_2f-SketchLine_42r-SketchLine_45f-SketchLine_46r-SketchArc_11_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_3_2/Modfied_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_8_1_2")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_9_1/Modfied_1"))
+ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchCircle_10_2f_wire")], model.selection(), 0, "10*coeff", [model.selection("SOLID", "Extrusion_6_1")])
+ExtrusionCut_10_objects_1 = [model.selection("WIRE", "Sketch_1/Face-SketchArc_10_2f-SketchLine_43f-SketchArc_14_2f-SketchArc_13_2r-SketchLine_48r-SketchArc_12_2r-SketchLine_44r-SketchArc_7_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_1/Face-SketchLine_50f-SketchLine_52f-SketchArc_17_2r-SketchLine_51r-SketchArc_16_2r-SketchArc_15_2f_wire"), model.selection("FACE", "Sketch_1/Face-SketchLine_53f-SketchArc_18_2r-SketchLine_54f-SketchArc_19_2r-SketchArc_20_2f-SketchLine_55r-SketchArc_21_2f-SketchArc_22_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_45f-SketchArc_11_2r-SketchLine_46r-SketchLine_42r-SketchArc_9_2f-SketchArc_8_2r")]
+ExtrusionCut_10 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_10_objects_1, model.selection(), model.selection("FACE", "ExtrusionCut_3_2/Modified_Face&Extrusion_1_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_8_1_2")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33"))
 SketchLine_50 = Sketch_8.addLine(37, 14.80042035331162, 37, -14)
 SketchLine_50.setName("SketchLine_56")
 SketchLine_50.result().setName("SketchLine_56")
 SketchLine_50.setAuxiliary(True)
-SketchLine_51 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_9_1/Modfied_1&Extrusion_6_1/To_Face_1"))
+SketchLine_51 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]"))
 SketchLine_51.setName("SketchLine_57")
 SketchLine_51.result().setName("SketchLine_57")
 SketchConstraintCoincidence_73 = Sketch_8.setCoincident(SketchLine_50.startPoint(), SketchLine_51.result())
 SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_81")
 SketchConstraintCoincidence_74 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_51.result())
 SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_82")
-SketchLine_52 = Sketch_8.addLine(model.selection("EDGE", "Extrusion_6_1/Generated_Face_4&ExtrusionCut_9_1/Modfied_1"))
+SketchLine_52 = Sketch_8.addLine(model.selection("EDGE", "[Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_36][ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33]"))
 SketchLine_52.setName("SketchLine_58")
 SketchLine_52.result().setName("SketchLine_58")
-SketchArc_21 = Sketch_8.addArc(34, -14, 37, -14, 34.00000001126211, -17, True)
+SketchArc_21 = Sketch_8.addArc(34, -14, 37, -14, 33.9999999583228, -17, True)
 SketchArc_21.setName("SketchArc_23")
 SketchArc_21.result().setName("SketchArc_23")
 SketchArc_21.results()[1].setName("SketchArc_23_2")
@@ -688,7 +689,7 @@ SketchConstraintTangent_6 = Sketch_8.setTangent(SketchLine_50.result(), SketchAr
 SketchConstraintCoincidence_76 = Sketch_8.setCoincident(SketchLine_52.result(), SketchArc_21.endPoint())
 SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_84")
 SketchConstraintTangent_7 = Sketch_8.setTangent(SketchArc_21.results()[1], SketchLine_52.result())
-SketchLine_53 = Sketch_8.addLine(34.00000002238511, -17, 37, -17)
+SketchLine_53 = Sketch_8.addLine(34, -17, 37, -17)
 SketchLine_53.setName("SketchLine_59")
 SketchLine_53.result().setName("SketchLine_59")
 SketchConstraintCoincidence_77 = Sketch_8.setCoincident(SketchArc_21.endPoint(), SketchLine_53.startPoint())
@@ -704,7 +705,7 @@ SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_51.startPoint
 SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_88")
 SketchConstraintRadius_15 = Sketch_8.setRadius(SketchArc_21.results()[1], "3*coeff")
 SketchConstraintRadius_15.setName("SketchConstraintRadius_16")
-SketchLine_55 = Sketch_8.addLine(model.selection("EDGE", "Sketch_7/Edge-SketchLine_38"))
+SketchLine_55 = Sketch_8.addLine(model.selection("EDGE", "Sketch_7/SketchLine_38"))
 SketchLine_55.setName("SketchLine_61")
 SketchLine_55.result().setName("SketchLine_61")
 SketchConstraintMirror_2_objects = [SketchArc_21.results()[1], SketchLine_54.result(), SketchLine_53.result()]
@@ -718,20 +719,20 @@ SketchArc_22.setName("SketchArc_24")
 SketchArc_22.result().setName("SketchArc_24")
 SketchArc_22.results()[1].setName("SketchArc_24_2")
 model.do()
-ExtrusionCut_11 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchArc_23_2r-SketchLine_59f-SketchLine_60r"), model.selection("WIRE", "Sketch_8/Wire-SketchArc_24_2r-SketchLine_62f-SketchLine_63r")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "ExtrusionCut_9_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_5_1/Generated_Face_1"))
+ExtrusionCut_11 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_59f-SketchLine_60r-SketchArc_23_2r"), model.selection("WIRE", "Sketch_8/Face-SketchLine_62f-SketchLine_63r-SketchArc_24_2r_wire")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "ExtrusionCut_9_1")])
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29"))
 SketchLine_58 = Sketch_9.addLine(-32, -19, -32, -3.575047476349699)
 SketchLine_58.setName("SketchLine_64")
 SketchLine_58.result().setName("SketchLine_64")
 SketchLine_58.setAuxiliary(True)
-SketchLine_59 = Sketch_9.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_1&Extrusion_5_1/Generated_Face_2"))
+SketchLine_59 = Sketch_9.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_32][Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29]"))
 SketchLine_59.setName("SketchLine_65")
 SketchLine_59.result().setName("SketchLine_65")
 SketchConstraintCoincidence_81 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchLine_59.result())
 SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_89")
 SketchConstraintCoincidence_82 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchLine_59.result())
 SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_90")
-SketchLine_60 = Sketch_9.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_1&Extrusion_5_1/From_Face_1"))
+SketchLine_60 = Sketch_9.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29][Extrusion_5_1/From_Face]"))
 SketchLine_60.setName("SketchLine_66")
 SketchLine_60.result().setName("SketchLine_66")
 SketchArc_23 = Sketch_9.addArc(-29, -19, -32, -19, -29.00002201340376, -22, False)
@@ -761,7 +762,7 @@ SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_96")
 SketchConstraintRadius_16 = Sketch_9.setRadius(SketchArc_23.results()[1], "3*coeff")
 SketchConstraintRadius_16.setName("SketchConstraintRadius_17")
 model.do()
-ExtrusionCut_12 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchArc_25_2r-SketchLine_67f-SketchLine_68f")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "Extrusion_5_1")])
+ExtrusionCut_12 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_67f-SketchLine_68f-SketchArc_25_2r")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "Extrusion_5_1")])
 model.do()
 
 from GeomAPI import  GeomAPI_Shape
@@ -777,7 +778,7 @@ model.testResultsVolumes(Part_1, [118190.673218984])
 # checking for parametric update
 Parameter_Epaisseur.setValue(33.9)
 model.do()
-model.testResultsVolumes(Part_1, [118105.9369682])
+model.testResultsVolumes(Part_1, [122133.938213185])
 Parameter_Epaisseur.setValue(34)
 model.do()
 model.testResultsVolumes(Part_1, [118190.673218984])
index 37ce6db8bd1490caff41cccf08aed498ae88b9c3..a0de918f041ba93c3727501cb94db6bd2b6e74ee 100644 (file)
@@ -191,12 +191,12 @@ model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [114])
 model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [228])
 model.testResultsVolumes(Revolution_1, [29055.346994571114919381216168404])
 
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), True)
 
 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_2"), False)
 SketchPoint_3 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_28"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])"), False)
 SketchLine_36 = SketchProjection_4.createdFeature()
 SketchCircle_1 = Sketch_2.addCircle(14.5, 0, 2.25)
 SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchCircle_1.center())
@@ -215,7 +215,7 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [132])
 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [264])
 model.testResultsVolumes(ExtrusionCut_1, [28943.115000463178148493170738220])
 
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_14&Revolution_1_1/Generated_Face_15")], "Fillet1")
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "Fillet1")
 # check Fillet_1
 model.testNbResults(Fillet_1, 1)
 model.testNbSubResults(Fillet_1, [0])
@@ -225,7 +225,7 @@ model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [136])
 model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [272])
 model.testResultsVolumes(Fillet_1, [28340.280766451105591841042041779])
 
-Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "Revolution_1_1/Generated_Face_6"), model.selection("FACE", "Revolution_1_1/Generated_Face_8"), model.selection("FACE", "Revolution_1_1/Generated_Face_10")], "Fillet2")
+Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_31"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_29"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_27"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25")], "Fillet2")
 # check Fillet_2
 model.testNbResults(Fillet_2, 1)
 model.testNbSubResults(Fillet_2, [0])
@@ -235,7 +235,7 @@ model.testNbSubShapes(Fillet_2, GeomAPI_Shape.EDGE, [168])
 model.testNbSubShapes(Fillet_2, GeomAPI_Shape.VERTEX, [336])
 model.testResultsVolumes(Fillet_2, [28339.715350479829794494435191154])
 
-Fillet_3 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_16")], "Fillet3")
+Fillet_3 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19")], "Fillet3")
 # check Fillet_3
 model.testNbResults(Fillet_3, 1)
 model.testNbSubResults(Fillet_3, [0])
@@ -245,7 +245,7 @@ model.testNbSubShapes(Fillet_3, GeomAPI_Shape.EDGE, [176])
 model.testNbSubShapes(Fillet_3, GeomAPI_Shape.VERTEX, [352])
 model.testResultsVolumes(Fillet_3, [28338.609830057110229972749948502])
 
-Fillet_4 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_24")], "Fillet3")
+Fillet_4 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_11")], "Fillet3")
 # check Fillet_4
 model.testNbResults(Fillet_4, 1)
 model.testNbSubResults(Fillet_4, [0])
@@ -255,7 +255,7 @@ model.testNbSubShapes(Fillet_4, GeomAPI_Shape.EDGE, [184])
 model.testNbSubShapes(Fillet_4, GeomAPI_Shape.VERTEX, [368])
 model.testResultsVolumes(Fillet_4, [28347.280717884430487174540758133])
 
-Fillet_5 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_26")], "Fillet2")
+Fillet_5 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9")], "Fillet2")
 # check Fillet_5
 model.testNbResults(Fillet_5, 1)
 model.testNbSubResults(Fillet_5, [0])
@@ -281,17 +281,17 @@ SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_41.endPoint()
 SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_42.endPoint(), SketchLine_37.startPoint())
 SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
 SketchLine_43 = SketchProjection_5.createdFeature()
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
 SketchLine_44 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
 SketchLine_45 = SketchProjection_7.createdFeature()
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
 SketchLine_46 = SketchProjection_8.createdFeature()
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
 SketchLine_47 = SketchProjection_9.createdFeature()
-SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
 SketchLine_48 = SketchProjection_10.createdFeature()
-SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
 SketchLine_49 = SketchProjection_11.createdFeature()
 SketchConstraintVertical_13 = Sketch_3.setVertical(SketchLine_37.result())
 SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_39.result())
@@ -347,11 +347,11 @@ SketchConstraintVertical_15 = Sketch_4.setVertical(SketchLine_52.result())
 SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_55.result())
 SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_58.result())
 SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result())
-SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_24s-SketchLine_23e"), False)
+SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_23_EndVertex"), False)
 SketchPoint_4 = SketchProjection_13.createdFeature()
 SketchConstraintDistanceHorizontal_17 = Sketch_4.setHorizontalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_52.endPoint(), "Drill2_Loc")
 SketchConstraintDistanceHorizontal_18 = Sketch_4.setHorizontalDistance(SketchLine_54.startPoint(), SketchLine_54.endPoint(), "Drill2_InnerRadius")
-SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_20"), False)
+SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_20"), False)
 SketchLine_59 = SketchProjection_14.createdFeature()
 SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45)
 SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_53.result(), [SketchLine_59.result()])
@@ -370,7 +370,7 @@ model.do()
 # check Sketch_4
 model.checkSketch(Sketch_4, 0)
 
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_52r-SketchLine_54r-SketchLine_55r-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchArc_2_2f")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_52"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchArc_2_2f-SketchLine_55r-SketchLine_54r-SketchLine_52r")], model.selection("EDGE", "Sketch_4/SketchLine_52"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
 # check RevolutionCut_1
 model.testNbResults(RevolutionCut_1, 1)
 model.testNbSubResults(RevolutionCut_1, [0])
@@ -384,7 +384,7 @@ RevolutionCut_2 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE",
 Sketch_5 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
 SketchLine_61 = Sketch_5.addLine(63.5, 10.5, 64, 10.5)
 SketchLine_61.setAuxiliary(True)
-SketchProjection_15 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), False)
+SketchProjection_15 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_7"), False)
 SketchLine_62 = SketchProjection_15.createdFeature()
 SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_61.startPoint(), SketchLine_62.result())
 SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_62).endPoint(), SketchLine_61.endPoint())
@@ -437,11 +437,6 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [366])
 model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [732])
 model.testResultsVolumes(Result, [14144.443128843522572424262762070])
 
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_27_1"), model.selection("FACE", "Plug/Modified_Face_26_1"), model.selection("FACE", "Plug/Modified_Face_28_1"), model.selection("FACE", "Plug/Modified_Face_32_1")])
-Group_1.result().setColor(68, 68, 68)
-# check Group_1
-model.checkGroup(Group_1, GeomAPI_Shape.FACE)
-
 model.do()
 
 # change parameters of the model
@@ -519,8 +514,6 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [364])
 model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [728])
 model.testResultsVolumes(Result, [23373.503259112552768783643841743])
 
-model.checkGroup(Group_1, GeomAPI_Shape.FACE)
-
 model.end()
 
 assert(model.checkPythonDump())
index 30c174ab240fe6f0dd557fa18ee16024ef5036bd..a5a013a7ddbecb1db5cef615a11932b7ad092a8c 100644 (file)
@@ -114,7 +114,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [1080])
 model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [2160])
 model.testResultsVolumes(Extrusion_1, [10398.453966298400700907222926617])
 
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
 SketchCircle_3 = Sketch_2.addCircle(0, 0, 4.5)
 SketchLine_125 = Sketch_2.addLine(0, 0, -24.375, 0)
 SketchLine_125.setAuxiliary(True)
index a55623b166210e1a2318b96a8e7f7625b3fb2230..6c5f4782ab5935107d6fd69fa1fbf312547ffc07 100644 (file)
@@ -187,7 +187,7 @@ SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_10.startPoint(), Sk
 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_22.result(), 1, True)
 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_6.results()[1], 15)
 model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchArc_1_2r-SketchLine_3r-SketchArc_2_2r-SketchArc_3_2f-SketchLine_8f-SketchLine_10f-SketchArc_5_2f-SketchLine_12f-SketchArc_6_2r-SketchLine_14r-SketchLine_16r-SketchArc_7_2r-SketchLine_17r-SketchLine_18r-SketchLine_20f-SketchArc_8_2f-SketchLine_23r-SketchArc_10_2f-SketchLine_24r")], model.selection("EDGE", "PartSet/OX"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_10f-SketchLine_24r-SketchLine_23r-SketchArc_8_2f-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchArc_7_2r-SketchLine_16r-SketchArc_10_2f-SketchLine_12f-SketchArc_5_2f-SketchArc_6_2r-SketchLine_14r-SketchArc_3_2f-SketchArc_2_2r-SketchLine_3r-SketchArc_1_2r-SketchLine_2r")], model.selection("EDGE", "PartSet/OX"), 360, 0)
 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
 SketchCircle_1 = Sketch_2.addCircle(0, 120, 7.5)
 SketchLine_24 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ"))